export type GetApiProvidersProviderIdBillingContractArgs = {provider_id: string}; export type GetApiProvidersProviderIdBillingContractOptions = {baseUrl?: string | undefined, xApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Retrieve contract for a Provider * * GET /providers/{provider_id}/billing/contract */ export const getApiProvidersProviderIdBillingContract = async (args: GetApiProvidersProviderIdBillingContractArgs, options?: GetApiProvidersProviderIdBillingContractOptions) => { const {baseUrl = "https://console.jumpcloud.com/api/v2", 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(/\/+$/, '')}/providers/${encodeURIComponent(String(args.provider_id))}/billing/contract${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() };