export type CreateApiV1DomainsDomainIdAccountsAccountIdBalancesRefreshArgs = {domainId: string, accountId: string, ledgerId?: string | undefined, tickerId?: string | undefined}; export type CreateApiV1DomainsDomainIdAccountsAccountIdBalancesRefreshOptions = {baseUrl: string, httpAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update account balances forcefully * * POST /v1/domains/{domainId}/accounts/{accountId}/balances/refresh */ export const createApiV1DomainsDomainIdAccountsAccountIdBalancesRefresh = async (args: CreateApiV1DomainsDomainIdAccountsAccountIdBalancesRefreshArgs, options: CreateApiV1DomainsDomainIdAccountsAccountIdBalancesRefreshOptions) => { const {baseUrl, fetch: fetchFn = fetch, httpAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.ledgerId != null) query.append("ledgerId", String(args.ledgerId)) if (args.tickerId != null) query.append("tickerId", String(args.tickerId)) if (httpAuth !== undefined) headers.set('authorization', `Bearer ${httpAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/domains/${encodeURIComponent(String(args.domainId))}/accounts/${encodeURIComponent(String(args.accountId))}/balances/refresh${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 };