export type RefCurrency = string; export type CreateApiExchangesExchangeCodeExecutionVenuesExecutionVenueCodeActionSettleArgs = {body: {tradeIdentifier: string, sellerIdentifier: string, buyerIdentifier: string, productCode: string, quantity: number, price: number, currency: RefCurrency}}; export type CreateApiExchangesExchangeCodeExecutionVenuesExecutionVenueCodeActionSettleOptions = {baseUrl?: string | undefined, bearerToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Deposits settlement * * POST /exchanges/{ExchangeCode}/execution-venues/{ExecutionVenueCode}/action/settle */ export const createApiExchangesExchangeCodeExecutionVenuesExecutionVenueCodeActionSettle = async (args: CreateApiExchangesExchangeCodeExecutionVenuesExecutionVenueCodeActionSettleArgs, options?: CreateApiExchangesExchangeCodeExecutionVenuesExecutionVenueCodeActionSettleOptions) => { const {baseUrl = "https://sandbox.preprod.connect.xpansiv.com/app/api/v1", fetch: fetchFn = fetch, bearerToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (bearerToken !== undefined) headers.set('authorization', `Bearer ${bearerToken}`) const url = `${baseUrl.replace(/\/+$/, '')}/exchanges/${encodeURIComponent(String(args.ExchangeCode))}/execution-venues/${encodeURIComponent(String(args.ExecutionVenueCode))}/action/settle${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 };