export type GetApiV21AccountsAccountIdTemplatesTemplateIdDocumentsArgs = {accountId: string, templateId: string, include_agreement_type?: string | undefined, include_is_edited?: string | undefined, include_tabs?: string | undefined}; export type GetApiV21AccountsAccountIdTemplatesTemplateIdDocumentsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Gets a list of documents associated with a template. * * GET /v2.1/accounts/{accountId}/templates/{templateId}/documents */ export const getApiV21AccountsAccountIdTemplatesTemplateIdDocuments = async (args: GetApiV21AccountsAccountIdTemplatesTemplateIdDocumentsArgs, options?: GetApiV21AccountsAccountIdTemplatesTemplateIdDocumentsOptions) => { const {baseUrl = "https://www.docusign.net/restapi", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.include_agreement_type != null) query.append("include_agreement_type", String(args.include_agreement_type)) if (args.include_is_edited != null) query.append("include_is_edited", String(args.include_is_edited)) if (args.include_tabs != null) query.append("include_tabs", String(args.include_tabs)) const url = `${baseUrl.replace(/\/+$/, '')}/v2.1/accounts/${encodeURIComponent(String(args.accountId))}/templates/${encodeURIComponent(String(args.templateId))}/documents${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() };