export type GetApiV21AccountsAccountIdEnvelopesEnvelopeIdDocumentsArgs = {accountId: string, envelopeId: string, documents_by_userid?: string | undefined, include_agreement_type?: string | undefined, include_docgen_formfields?: string | undefined, include_is_edited?: string | undefined, include_metadata?: string | undefined, include_tabs?: string | undefined, recipient_id?: string | undefined, shared_user_id?: string | undefined}; export type GetApiV21AccountsAccountIdEnvelopesEnvelopeIdDocumentsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Gets a list of documents in an envelope. * * GET /v2.1/accounts/{accountId}/envelopes/{envelopeId}/documents */ export const getApiV21AccountsAccountIdEnvelopesEnvelopeIdDocuments = async (args: GetApiV21AccountsAccountIdEnvelopesEnvelopeIdDocumentsArgs, options?: GetApiV21AccountsAccountIdEnvelopesEnvelopeIdDocumentsOptions) => { const {baseUrl = "https://www.docusign.net/restapi", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.documents_by_userid != null) query.append("documents_by_userid", String(args.documents_by_userid)) if (args.include_agreement_type != null) query.append("include_agreement_type", String(args.include_agreement_type)) if (args.include_docgen_formfields != null) query.append("include_docgen_formfields", String(args.include_docgen_formfields)) if (args.include_is_edited != null) query.append("include_is_edited", String(args.include_is_edited)) if (args.include_metadata != null) query.append("include_metadata", String(args.include_metadata)) if (args.include_tabs != null) query.append("include_tabs", String(args.include_tabs)) if (args.recipient_id != null) query.append("recipient_id", String(args.recipient_id)) if (args.shared_user_id != null) query.append("shared_user_id", String(args.shared_user_id)) const url = `${baseUrl.replace(/\/+$/, '')}/v2.1/accounts/${encodeURIComponent(String(args.accountId))}/envelopes/${encodeURIComponent(String(args.envelopeId))}/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() };