export type UserGroupRequest = {partitionId?: string | undefined, accountId?: string | undefined, groupId?: string | undefined, groupName?: string | undefined, groupDescription?: string | undefined, userIds?: (Array<{userId?: string | undefined, endUserType?: string | undefined}>) | undefined}; export type UpdateApiV2UserGroupsSettingsArgs = {partitionId: string, accountId: string, groupId: string, body: UserGroupRequest}; export type UpdateApiV2UserGroupsSettingsOptions = {baseUrl?: string | undefined, XAuthToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update user group * * PUT /v2/user-groups/settings */ export const updateApiV2UserGroupsSettings = async (args: UpdateApiV2UserGroupsSettingsArgs, options?: UpdateApiV2UserGroupsSettingsOptions) => { const {baseUrl = "https://api.alianza.com", fetch: fetchFn = fetch, XAuthToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.partitionId != null) query.append("partitionId", String(args.partitionId)) if (args.accountId != null) query.append("accountId", String(args.accountId)) if (args.groupId != null) query.append("groupId", String(args.groupId)) if (XAuthToken !== undefined) headers.set("X-AUTH-TOKEN", XAuthToken) const url = `${baseUrl.replace(/\/+$/, '')}/v2/user-groups/settings${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };