export type Attachment = {accessControl?: string | undefined, attachmentId?: string | undefined, attachmentType?: string | undefined, data?: string | undefined, label?: string | undefined, name?: string | undefined, remoteUrl?: string | undefined}; export type EnvelopeAttachmentsRequest = {attachments?: Array | undefined}; export type UpdateApiV21AccountsAccountIdEnvelopesEnvelopeIdAttachmentsArgs = {accountId: string, envelopeId: string, body: EnvelopeAttachmentsRequest}; export type UpdateApiV21AccountsAccountIdEnvelopesEnvelopeIdAttachmentsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Adds one or more envelope attachments to a draft or in-process envelope. * * PUT /v2.1/accounts/{accountId}/envelopes/{envelopeId}/attachments */ export const updateApiV21AccountsAccountIdEnvelopesEnvelopeIdAttachments = async (args: UpdateApiV21AccountsAccountIdEnvelopesEnvelopeIdAttachmentsArgs, options?: UpdateApiV21AccountsAccountIdEnvelopesEnvelopeIdAttachmentsOptions) => { const {baseUrl = "https://www.docusign.net/restapi", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") const url = `${baseUrl.replace(/\/+$/, '')}/v2.1/accounts/${encodeURIComponent(String(args.accountId))}/envelopes/${encodeURIComponent(String(args.envelopeId))}/attachments${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };