export type GetApiV1DefaultBanksBankIdAttachmentsAttachmentIdArgs = {bank_id: string, attachment_id: string, authorization?: (string | null) | undefined}; export type GetApiV1DefaultBanksBankIdAttachmentsAttachmentIdOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Fetch an attachment retained inline with a document * * GET /v1/default/banks/{bank_id}/attachments/{attachment_id} */ export const getApiV1DefaultBanksBankIdAttachmentsAttachmentId = async (args: GetApiV1DefaultBanksBankIdAttachmentsAttachmentIdArgs, options: GetApiV1DefaultBanksBankIdAttachmentsAttachmentIdOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/octet-stream") if (args.authorization != null) headers.set("authorization", String(args.authorization)) const url = `${baseUrl.replace(/\/+$/, '')}/v1/default/banks/${encodeURIComponent(String(args.bank_id))}/attachments/${encodeURIComponent(String(args.attachment_id))}${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() };