export type DeleteApiV1PortfoliosIdLotsLotIdArgs = {id: string, lotId: string}; export type DeleteApiV1PortfoliosIdLotsLotIdOptions = {baseUrl?: string | undefined, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Removes a lot as though it had never been recorded. Use this for something entered by * mistake — a sale is recorded by closing the lot, which keeps its realized profit and loss. * This cannot be undone. * * DELETE /v1/portfolios/{id}/lots/{lotId} */ export const deleteApiV1PortfoliosIdLotsLotId = async (args: DeleteApiV1PortfoliosIdLotsLotIdArgs, options?: DeleteApiV1PortfoliosIdLotsLotIdOptions) => { 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))}/lots/${encodeURIComponent(String(args.lotId))}${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 };