export type CreateApiFinancialDatasetsAgentCheckoutLinkArgs = {body: {amount_to_add?: number | undefined}}; export type CreateApiFinancialDatasetsAgentCheckoutLinkOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Mint a Stripe Checkout link that funds the account tied to the API key. Give the returned checkout_url to the account owner; they pay in the browser with no login. * * POST /financial-datasets/agent/checkout-link */ export const createApiFinancialDatasetsAgentCheckoutLink = async (args: CreateApiFinancialDatasetsAgentCheckoutLinkArgs, options?: CreateApiFinancialDatasetsAgentCheckoutLinkOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/financial-datasets/agent/checkout-link${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 };