export type GetApiV21AccountsAccountIdTemplatesTemplateIdDocumentsDocumentIdFieldsArgs = {accountId: string, documentId: string, templateId: string}; export type GetApiV21AccountsAccountIdTemplatesTemplateIdDocumentsDocumentIdFieldsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Gets the custom document fields for a an existing template document. * * GET /v2.1/accounts/{accountId}/templates/{templateId}/documents/{documentId}/fields */ export const getApiV21AccountsAccountIdTemplatesTemplateIdDocumentsDocumentIdFields = async (args: GetApiV21AccountsAccountIdTemplatesTemplateIdDocumentsDocumentIdFieldsArgs, options?: GetApiV21AccountsAccountIdTemplatesTemplateIdDocumentsDocumentIdFieldsOptions) => { const {baseUrl = "https://www.docusign.net/restapi", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") const url = `${baseUrl.replace(/\/+$/, '')}/v2.1/accounts/${encodeURIComponent(String(args.accountId))}/templates/${encodeURIComponent(String(args.templateId))}/documents/${encodeURIComponent(String(args.documentId))}/fields${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() };