export type GetApiV21AccountsAccountIdEnvelopesArgs = {accountId: string, ac_status?: string | undefined, block?: string | undefined, cdse_mode?: string | undefined, continuation_token?: string | undefined, count?: string | undefined, custom_field?: string | undefined, email?: string | undefined, envelope_ids?: string | undefined, exclude?: string | undefined, folder_ids?: string | undefined, folder_types?: string | undefined, from_date?: string | undefined, from_to_status?: string | undefined, include?: string | undefined, include_purge_information?: string | undefined, intersecting_folder_ids?: string | undefined, last_queried_date?: string | undefined, order?: string | undefined, order_by?: string | undefined, powerformids?: string | undefined, query_budget?: string | undefined, requester_date_format?: string | undefined, search_mode?: string | undefined, search_text?: string | undefined, start_position?: string | undefined, status?: string | undefined, to_date?: string | undefined, transaction_ids?: string | undefined, user_filter?: string | undefined, user_id?: string | undefined, user_name?: string | undefined}; export type GetApiV21AccountsAccountIdEnvelopesOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Search for specific sets of envelopes by using search filters. * * GET /v2.1/accounts/{accountId}/envelopes */ export const getApiV21AccountsAccountIdEnvelopes = async (args: GetApiV21AccountsAccountIdEnvelopesArgs, options?: GetApiV21AccountsAccountIdEnvelopesOptions) => { const {baseUrl = "https://www.docusign.net/restapi", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.ac_status != null) query.append("ac_status", String(args.ac_status)) if (args.block != null) query.append("block", String(args.block)) if (args.cdse_mode != null) query.append("cdse_mode", String(args.cdse_mode)) if (args.continuation_token != null) query.append("continuation_token", String(args.continuation_token)) if (args.count != null) query.append("count", String(args.count)) if (args.custom_field != null) query.append("custom_field", String(args.custom_field)) if (args.email != null) query.append("email", String(args.email)) if (args.envelope_ids != null) query.append("envelope_ids", String(args.envelope_ids)) if (args.exclude != null) query.append("exclude", String(args.exclude)) 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.from_to_status != null) query.append("from_to_status", String(args.from_to_status)) if (args.include != null) query.append("include", String(args.include)) if (args.include_purge_information != null) query.append("include_purge_information", String(args.include_purge_information)) if (args.intersecting_folder_ids != null) query.append("intersecting_folder_ids", String(args.intersecting_folder_ids)) if (args.last_queried_date != null) query.append("last_queried_date", String(args.last_queried_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.powerformids != null) query.append("powerformids", String(args.powerformids)) if (args.query_budget != null) query.append("query_budget", String(args.query_budget)) if (args.requester_date_format != null) query.append("requester_date_format", String(args.requester_date_format)) if (args.search_mode != null) query.append("search_mode", String(args.search_mode)) if (args.search_text != null) query.append("search_text", String(args.search_text)) if (args.start_position != null) query.append("start_position", String(args.start_position)) if (args.status != null) query.append("status", String(args.status)) if (args.to_date != null) query.append("to_date", String(args.to_date)) if (args.transaction_ids != null) query.append("transaction_ids", String(args.transaction_ids)) 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)) if (args.user_name != null) query.append("user_name", String(args.user_name)) const url = `${baseUrl.replace(/\/+$/, '')}/v2.1/accounts/${encodeURIComponent(String(args.accountId))}/envelopes${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() };