export type CreateApiOrdersOrderUuidCancelArgs = {order_uuid: string}; export type CreateApiOrdersOrderUuidCancelOptions = {baseUrl?: string | undefined, bityAccountOauth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Cancel an order * * POST /orders/{order_uuid}/cancel * * Also accepts auth: bity_account_client_oauth, client_oauth */ export const createApiOrdersOrderUuidCancel = async (args: CreateApiOrdersOrderUuidCancelArgs, options?: CreateApiOrdersOrderUuidCancelOptions) => { const {baseUrl = "https://exchange.api.bity.com/v2", fetch: fetchFn = fetch, bityAccountOauth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (bityAccountOauth !== undefined) headers.set('authorization', `Bearer ${bityAccountOauth}`) const url = `${baseUrl.replace(/\/+$/, '')}/orders/${encodeURIComponent(String(args.order_uuid))}/cancel${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };