export type Role = 'anonymous' | 'ADMIN' | 'CREATOR' | 'USER' | 'SUPER_ADMIN' | 'AUTOGAME' | 'DISTRIBUTION_MANAGER' | 'MICROSOFT_REWARDS_USER'; export type SetRoleDto = {role: Role}; export type CreateApiSuperadminAuthRoleUserIdArgs = {userId: string, body: SetRoleDto}; export type CreateApiSuperadminAuthRoleUserIdOptions = {baseUrl: string, accessToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * POST /superadmin/auth/role/{userId} */ export const createApiSuperadminAuthRoleUserId = async (args: CreateApiSuperadminAuthRoleUserIdArgs, options: CreateApiSuperadminAuthRoleUserIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, accessToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (accessToken !== undefined) headers.set('authorization', `Bearer ${accessToken}`) const url = `${baseUrl.replace(/\/+$/, '')}/superadmin/auth/role/${encodeURIComponent(String(args.userId))}${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 undefined };