export type UpdateGroupRequest = {name: string, description?: string | undefined, externalGroups?: Array | undefined, externalGroupRegex?: Array | undefined}; export type UpdateApiPublicV1GroupsGroupIdArgs = {groupId: string, body: UpdateGroupRequest}; export type UpdateApiPublicV1GroupsGroupIdOptions = {baseUrl: string, httpAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create or update a group in the organization * * PUT /public/v1/groups/{groupId} */ export const updateApiPublicV1GroupsGroupId = async (args: UpdateApiPublicV1GroupsGroupIdArgs, options: UpdateApiPublicV1GroupsGroupIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, httpAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (httpAuth !== undefined) headers.set('authorization', `Bearer ${httpAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/public/v1/groups/${encodeURIComponent(String(args.groupId))}${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 };