export type DeleteApiV2UserAccountsServerAccountIdOrdersIdArgs = {server: 'oanda' | 'oanda-demo' | 'otms' | 'v20' | 'v20-demo' | 'oj' | 'oj-demo' | 'opt' | 'ftmo-1', accountId: string, id: string, body: {instrument: string, orderType: 'MARKET' | 'STOP' | 'LIMIT' | 'TAKE_PROFIT' | 'STOP_LOSS' | 'TRAILING_STOP_LOSS' | 'GUARANTEED_STOP_LOSS' | 'MARKET_IF_TOUCHED', direction: 'LONG' | 'SHORT', trackingData?: ({instrumentCategory?: string | undefined, instrumentCategoryCountry?: string | undefined, isCFD?: boolean | undefined}) | undefined}}; export type DeleteApiV2UserAccountsServerAccountIdOrdersIdOptions = {baseUrl: string, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * DELETE /v2/user/accounts/{server}/{accountId}/orders/{id} */ export const deleteApiV2UserAccountsServerAccountIdOrdersId = async (args: DeleteApiV2UserAccountsServerAccountIdOrdersIdArgs, options: DeleteApiV2UserAccountsServerAccountIdOrdersIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v2/user/accounts/${encodeURIComponent(String(args.server))}/${encodeURIComponent(String(args.accountId))}/orders/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };