export type GetApiRetirementsRetirementIdPdfArgs = {'x-icr-api-version'?: string | undefined, retirementId: string}; export type GetApiRetirementsRetirementIdPdfOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get retirement pdf * * GET /retirements/{retirementId}/pdf */ export const getApiRetirementsRetirementIdPdf = async (args: GetApiRetirementsRetirementIdPdfArgs, options?: GetApiRetirementsRetirementIdPdfOptions) => { const {baseUrl = "https://api.carbonregistry.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/octet-stream") if (args['x-icr-api-version'] != null) headers.set("x-icr-api-version", String(args['x-icr-api-version'])) const url = `${baseUrl.replace(/\/+$/, '')}/retirements/${encodeURIComponent(String(args.retirementId))}/pdf${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() };