export type ErrorDetails = {errorCode?: string | undefined, message?: string | undefined}; export type ListCustomField = {configurationType?: string | undefined, errorDetails?: ErrorDetails | undefined, fieldId?: string | undefined, listItems?: Array | undefined, name?: string | undefined, required?: string | undefined, show?: string | undefined, value?: string | undefined}; export type TextCustomField = {configurationType?: string | undefined, errorDetails?: ErrorDetails | undefined, fieldId?: string | undefined, name?: string | undefined, required?: string | undefined, show?: string | undefined, value?: string | undefined}; export type EnvelopeCustomFields = {listCustomFields?: Array | undefined, textCustomFields?: Array | undefined}; export type UpdateApiV21AccountsAccountIdEnvelopesEnvelopeIdCustomFieldsArgs = {accountId: string, envelopeId: string, body: EnvelopeCustomFields}; export type UpdateApiV21AccountsAccountIdEnvelopesEnvelopeIdCustomFieldsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Updates envelope custom fields in an envelope. * * PUT /v2.1/accounts/{accountId}/envelopes/{envelopeId}/custom_fields */ export const updateApiV21AccountsAccountIdEnvelopesEnvelopeIdCustomFields = async (args: UpdateApiV21AccountsAccountIdEnvelopesEnvelopeIdCustomFieldsArgs, options?: UpdateApiV21AccountsAccountIdEnvelopesEnvelopeIdCustomFieldsOptions) => { 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))}/custom_fields${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() };