export type GetApiV1BillingCreditsAddArgs = {amount_dollars: number}; export type GetApiV1BillingCreditsAddOptions = {baseUrl: string, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Redirect to Stripe for adding credits * * GET /v1/billing/credits-add */ export const getApiV1BillingCreditsAdd = async (args: GetApiV1BillingCreditsAddArgs, options: GetApiV1BillingCreditsAddOptions) => { const {baseUrl, fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.amount_dollars != null) query.append("amount_dollars", String(args.amount_dollars)) if (ApiKeyAuth !== undefined) headers.set("x-api-key", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/v1/billing/credits-add${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };