export type GetApiV21AccountsAccountIdEnvelopesEnvelopeIdArgs = {accountId: string, envelopeId: string, advanced_update?: string | undefined, include?: string | undefined, include_anchor_tab_locations?: string | undefined, user_id?: string | undefined}; export type GetApiV21AccountsAccountIdEnvelopesEnvelopeIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Gets the status of a single envelope. * * GET /v2.1/accounts/{accountId}/envelopes/{envelopeId} */ export const getApiV21AccountsAccountIdEnvelopesEnvelopeId = async (args: GetApiV21AccountsAccountIdEnvelopesEnvelopeIdArgs, options?: GetApiV21AccountsAccountIdEnvelopesEnvelopeIdOptions) => { const {baseUrl = "https://www.docusign.net/restapi", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.advanced_update != null) query.append("advanced_update", String(args.advanced_update)) if (args.include != null) query.append("include", String(args.include)) if (args.include_anchor_tab_locations != null) query.append("include_anchor_tab_locations", String(args.include_anchor_tab_locations)) if (args.user_id != null) query.append("user_id", String(args.user_id)) const url = `${baseUrl.replace(/\/+$/, '')}/v2.1/accounts/${encodeURIComponent(String(args.accountId))}/envelopes/${encodeURIComponent(String(args.envelopeId))}${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() };