export type GetApiV21AccountsAccountIdUsersUserIdAuthorizationsArgs = {accountId: string, userId: string, active_only?: string | undefined, count?: string | undefined, email_substring?: string | undefined, include_closed_users?: string | undefined, permissions?: string | undefined, start_position?: string | undefined, task_source?: string | undefined, task_type?: string | undefined, user_name_substring?: string | undefined}; export type GetApiV21AccountsAccountIdUsersUserIdAuthorizationsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Returns the authorizations for which the specified user is the principal user. * * GET /v2.1/accounts/{accountId}/users/{userId}/authorizations */ export const getApiV21AccountsAccountIdUsersUserIdAuthorizations = async (args: GetApiV21AccountsAccountIdUsersUserIdAuthorizationsArgs, options?: GetApiV21AccountsAccountIdUsersUserIdAuthorizationsOptions) => { const {baseUrl = "https://www.docusign.net/restapi", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.active_only != null) query.append("active_only", String(args.active_only)) if (args.count != null) query.append("count", String(args.count)) if (args.email_substring != null) query.append("email_substring", String(args.email_substring)) if (args.include_closed_users != null) query.append("include_closed_users", String(args.include_closed_users)) if (args.permissions != null) query.append("permissions", String(args.permissions)) if (args.start_position != null) query.append("start_position", String(args.start_position)) if (args.task_source != null) query.append("task_source", String(args.task_source)) if (args.task_type != null) query.append("task_type", String(args.task_type)) if (args.user_name_substring != null) query.append("user_name_substring", String(args.user_name_substring)) const url = `${baseUrl.replace(/\/+$/, '')}/v2.1/accounts/${encodeURIComponent(String(args.accountId))}/users/${encodeURIComponent(String(args.userId))}/authorizations${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() };