export type GetApiDocumentsContractorTaxDocumentsDocumentDownloadArgs = {document: string, Accept?: string | undefined}; export type GetApiDocumentsContractorTaxDocumentsDocumentDownloadOptions = {baseUrl?: string | undefined, sec0?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download a contractor tax document * * GET /documents/contractor_tax_documents/{document}/download */ export const getApiDocumentsContractorTaxDocumentsDocumentDownload = async (args: GetApiDocumentsContractorTaxDocumentsDocumentDownloadArgs, options?: GetApiDocumentsContractorTaxDocumentsDocumentDownloadOptions) => { const {baseUrl = "https://sandbox.checkhq.com", fetch: fetchFn = fetch, sec0} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/pdf") if (args.Accept != null) headers.set("Accept", String(args.Accept)) if (sec0 !== undefined) headers.set("Authorization", sec0) const url = `${baseUrl.replace(/\/+$/, '')}/documents/contractor_tax_documents/${encodeURIComponent(String(args.document))}/download${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() };