export type GetApiApiV2ProvidersProviderIdInvoicesIDOptions = {baseUrl?: string | undefined, xApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download a provider's invoice. * * GET /api/v2/providers/{provider_id}/invoices/{ID} */ export const getApiApiV2ProvidersProviderIdInvoicesID = async (options?: GetApiApiV2ProvidersProviderIdInvoicesIDOptions) => { const {baseUrl = "https://console.jumpcloud.com", fetch: fetchFn = fetch, xApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/pdf") if (xApiKey !== undefined) headers.set("x-api-key", xApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/providers/${encodeURIComponent(String(args.provider_id))}/invoices/${encodeURIComponent(String(args.ID))}${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 res.blob() };