export type AuthorizationUser = {accountId?: string | undefined, email?: string | undefined, name?: string | undefined, userId?: string | undefined}; export type UserAuthorizationCreateRequestWithId = {agentUser?: AuthorizationUser | undefined, authorizationId?: string | undefined, endDate?: string | undefined, permission?: string | undefined, startDate?: string | undefined, taskSource?: string | undefined, taskType?: string | undefined}; export type UserAuthorizationsRequest = {authorizations?: Array | undefined}; export type CreateApiV21AccountsAccountIdUsersUserIdAuthorizationsArgs = {accountId: string, userId: string, body: UserAuthorizationsRequest}; export type CreateApiV21AccountsAccountIdUsersUserIdAuthorizationsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create or update multiple user authorizations. * * POST /v2.1/accounts/{accountId}/users/{userId}/authorizations */ export const createApiV21AccountsAccountIdUsersUserIdAuthorizations = async (args: CreateApiV21AccountsAccountIdUsersUserIdAuthorizationsArgs, options?: CreateApiV21AccountsAccountIdUsersUserIdAuthorizationsOptions) => { 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', "*/*") 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: "POST", 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() };