export type EnvelopeIdsRequest = {envelopeIds?: Array | undefined, transactionIds?: Array | undefined}; export type UpdateApiV21AccountsAccountIdEnvelopesStatusArgs = {accountId: string, ac_status?: string | undefined, block?: string | undefined, count?: string | undefined, email?: string | undefined, envelope_ids?: string | undefined, from_date?: string | undefined, from_to_status?: string | undefined, start_position?: string | undefined, status?: string | undefined, to_date?: string | undefined, transaction_ids?: string | undefined, user_name?: string | undefined, body: EnvelopeIdsRequest}; export type UpdateApiV21AccountsAccountIdEnvelopesStatusOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Gets envelope statuses for a set of envelopes. * * PUT /v2.1/accounts/{accountId}/envelopes/status */ export const updateApiV21AccountsAccountIdEnvelopesStatus = async (args: UpdateApiV21AccountsAccountIdEnvelopesStatusArgs, options?: UpdateApiV21AccountsAccountIdEnvelopesStatusOptions) => { 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', "*/*") 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.count != null) query.append("count", String(args.count)) 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.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.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_name != null) query.append("user_name", String(args.user_name)) const url = `${baseUrl.replace(/\/+$/, '')}/v2.1/accounts/${encodeURIComponent(String(args.accountId))}/envelopes/status${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() };