export type DeleteApiV1PortfoliosIdArgs = {id: string}; export type DeleteApiV1PortfoliosIdOptions = {baseUrl?: string | undefined, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Deletes a portfolio and every lot in it, including the closed ones and their realized * history. This cannot be undone. * * DELETE /v1/portfolios/{id} */ export const deleteApiV1PortfoliosId = async (args: DeleteApiV1PortfoliosIdArgs, options?: DeleteApiV1PortfoliosIdOptions) => { const {baseUrl = "https://api.equibles.com", fetch: fetchFn = fetch, ApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (ApiKey !== undefined) headers.set('authorization', `Bearer ${ApiKey}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/portfolios/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };