export type GetApiFinalizeV2AgreementsAgreementIdAttachmentsAttachmentIdFileArgs = {agreement_id: string, attachment_id: string}; export type GetApiFinalizeV2AgreementsAgreementIdAttachmentsAttachmentIdFileOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download Attachment * * GET /finalize/v2/agreements/{agreement_id}/attachments/{attachment_id}/file */ export const getApiFinalizeV2AgreementsAgreementIdAttachmentsAttachmentIdFile = async (args: GetApiFinalizeV2AgreementsAgreementIdAttachmentsAttachmentIdFileArgs, options?: GetApiFinalizeV2AgreementsAgreementIdAttachmentsAttachmentIdFileOptions) => { const {baseUrl = "https://api.linksquares.com/api", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (ApiKeyAuth !== undefined) headers.set("x-api-key", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/finalize/v2/agreements/${encodeURIComponent(String(args.agreement_id))}/attachments/${encodeURIComponent(String(args.attachment_id))}/file${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 undefined };