export type GetApiManualJournalsManualJournalIDAttachmentsAttachmentIDArgs = {ManualJournalID: string, AttachmentID: string, contentType: string}; export type GetApiManualJournalsManualJournalIDAttachmentsAttachmentIDOptions = {baseUrl?: string | undefined, OAuth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Allows you to retrieve a specific attachment from a specific manual journal using a unique attachment Id * * GET /ManualJournals/{ManualJournalID}/Attachments/{AttachmentID} */ export const getApiManualJournalsManualJournalIDAttachmentsAttachmentID = async (args: GetApiManualJournalsManualJournalIDAttachmentsAttachmentIDArgs, options?: GetApiManualJournalsManualJournalIDAttachmentsAttachmentIDOptions) => { const {baseUrl = "https://api.xero.com/api.xro/2.0", fetch: fetchFn = fetch, OAuth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/octet-stream") if (args.contentType != null) headers.set("contentType", String(args.contentType)) if (OAuth2 !== undefined) headers.set('authorization', `Bearer ${OAuth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/ManualJournals/${encodeURIComponent(String(args.ManualJournalID))}/Attachments/${encodeURIComponent(String(args.AttachmentID))}${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() };