export type CreateApiV2UserAccountsServerAccountIdTrackingViewArgs = {server: 'oanda' | 'oanda-demo' | 'otms' | 'v20' | 'v20-demo' | 'oj' | 'oj-demo' | 'opt' | 'ftmo-1', accountId: string, body: {event: 'View | Instruments Group' | 'View | Orderbook Indicator' | 'View | Account Balance', agent: string, ip: string, userId: string, oandaAgent: string, engineType: string, division: string, accountFund?: ('LIVE' | 'DEMO') | undefined, accountId?: string | undefined, tradingAccountType?: ('OGM' | 'V20' | 'CRYPTO' | 'OTMS' | 'OEL' | 'OJ') | undefined, properties: {group: string, tag: string, platform: string} | {version?: string | undefined, language?: string | undefined, platform?: string | undefined, server?: string | undefined, country?: string | undefined}}}; export type CreateApiV2UserAccountsServerAccountIdTrackingViewOptions = {baseUrl: string, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * POST /v2/user/accounts/{server}/{accountId}/tracking/view */ export const createApiV2UserAccountsServerAccountIdTrackingView = async (args: CreateApiV2UserAccountsServerAccountIdTrackingViewArgs, options: CreateApiV2UserAccountsServerAccountIdTrackingViewOptions) => { 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))}/tracking/view${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 };