export type GetApiApiCertificateRequestsProtocolProtocoloDocumentsIdDownloadArgs = {Authorization?: string | undefined, protocolo: string, id: string}; export type GetApiApiCertificateRequestsProtocolProtocoloDocumentsIdDownloadOptions = {baseUrl?: string | undefined, bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Baixar Documento * * GET /api/certificate-requests/protocol/{protocolo}/documents/{id}/download */ export const getApiApiCertificateRequestsProtocolProtocoloDocumentsIdDownload = async (args: GetApiApiCertificateRequestsProtocolProtocoloDocumentsIdDownloadArgs, options?: GetApiApiCertificateRequestsProtocolProtocoloDocumentsIdDownloadOptions) => { const {baseUrl = "https://cloud-hom.bry.com.br", fetch: fetchFn = fetch, bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/plain") if (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) if (bearer !== undefined) headers.set('authorization', `Bearer ${bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/certificate-requests/protocol/${encodeURIComponent(String(args.protocolo))}/documents/${encodeURIComponent(String(args.id))}/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.text() };