export type GetApiApiV2ProvidersProviderIdBillingContractArgs = {provider_id: string}; export type GetApiApiV2ProvidersProviderIdBillingContractOptions = {baseUrl?: string | undefined, xApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Retrieve contract for a Provider * * GET /api/v2/providers/{provider_id}/billing/contract */ export const getApiApiV2ProvidersProviderIdBillingContract = async (args: GetApiApiV2ProvidersProviderIdBillingContractArgs, options?: GetApiApiV2ProvidersProviderIdBillingContractOptions) => { 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))}/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() };