export type CreateApiOrdersOrderUuidDuplicateArgs = {order_uuid: string}; export type CreateApiOrdersOrderUuidDuplicateOptions = {baseUrl?: string | undefined, bityAccountOauth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Duplicate an order * * POST /orders/{order_uuid}/duplicate * * Also accepts auth: bity_account_client_oauth, client_oauth */ export const createApiOrdersOrderUuidDuplicate = async (args: CreateApiOrdersOrderUuidDuplicateArgs, options?: CreateApiOrdersOrderUuidDuplicateOptions) => { 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))}/duplicate${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 };