export type GetApiPublicV1DocumentsIdAttachmentsAttachmentIdDownloadArgs = {id: string, attachment_id: string}; export type GetApiPublicV1DocumentsIdAttachmentsAttachmentIdDownloadOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download Document Attachment * * GET /public/v1/documents/{id}/attachments/{attachment_id}/download * * Also accepts auth: oauth2 */ export const getApiPublicV1DocumentsIdAttachmentsAttachmentIdDownload = async (args: GetApiPublicV1DocumentsIdAttachmentsAttachmentIdDownloadArgs, options?: GetApiPublicV1DocumentsIdAttachmentsAttachmentIdDownloadOptions) => { const {baseUrl = "https://api.pandadoc.com", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/*") if (apiKey !== undefined) headers.set("Authorization", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/public/v1/documents/${encodeURIComponent(String(args.id))}/attachments/${encodeURIComponent(String(args.attachment_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.blob() };