export type GetApiV21AccountsAccountIdTemplatesArgs = {accountId: string, count?: string | undefined, created_from_date?: string | undefined, created_to_date?: string | undefined, folder_ids?: string | undefined, folder_types?: string | undefined, from_date?: string | undefined, include?: string | undefined, is_deleted_template_only?: string | undefined, is_download?: string | undefined, link_configuration_id?: string | undefined, modified_from_date?: string | undefined, modified_to_date?: string | undefined, order?: string | undefined, order_by?: string | undefined, search_fields?: string | undefined, search_text?: string | undefined, shared_by_me?: string | undefined, start_position?: string | undefined, template_ids?: string | undefined, to_date?: string | undefined, used_from_date?: string | undefined, used_to_date?: string | undefined, user_filter?: string | undefined, user_id?: string | undefined}; export type GetApiV21AccountsAccountIdTemplatesOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Gets the list of templates. * * GET /v2.1/accounts/{accountId}/templates */ export const getApiV21AccountsAccountIdTemplates = async (args: GetApiV21AccountsAccountIdTemplatesArgs, options?: GetApiV21AccountsAccountIdTemplatesOptions) => { const {baseUrl = "https://www.docusign.net/restapi", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.count != null) query.append("count", String(args.count)) if (args.created_from_date != null) query.append("created_from_date", String(args.created_from_date)) if (args.created_to_date != null) query.append("created_to_date", String(args.created_to_date)) if (args.folder_ids != null) query.append("folder_ids", String(args.folder_ids)) if (args.folder_types != null) query.append("folder_types", String(args.folder_types)) if (args.from_date != null) query.append("from_date", String(args.from_date)) if (args.include != null) query.append("include", String(args.include)) if (args.is_deleted_template_only != null) query.append("is_deleted_template_only", String(args.is_deleted_template_only)) if (args.is_download != null) query.append("is_download", String(args.is_download)) if (args.link_configuration_id != null) query.append("link_configuration_id", String(args.link_configuration_id)) if (args.modified_from_date != null) query.append("modified_from_date", String(args.modified_from_date)) if (args.modified_to_date != null) query.append("modified_to_date", String(args.modified_to_date)) if (args.order != null) query.append("order", String(args.order)) if (args.order_by != null) query.append("order_by", String(args.order_by)) if (args.search_fields != null) query.append("search_fields", String(args.search_fields)) if (args.search_text != null) query.append("search_text", String(args.search_text)) if (args.shared_by_me != null) query.append("shared_by_me", String(args.shared_by_me)) if (args.start_position != null) query.append("start_position", String(args.start_position)) if (args.template_ids != null) query.append("template_ids", String(args.template_ids)) if (args.to_date != null) query.append("to_date", String(args.to_date)) if (args.used_from_date != null) query.append("used_from_date", String(args.used_from_date)) if (args.used_to_date != null) query.append("used_to_date", String(args.used_to_date)) if (args.user_filter != null) query.append("user_filter", String(args.user_filter)) if (args.user_id != null) query.append("user_id", String(args.user_id)) const url = `${baseUrl.replace(/\/+$/, '')}/v2.1/accounts/${encodeURIComponent(String(args.accountId))}/templates${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() };