export type GroupUpdateOperationValue = {value: string, display?: string | undefined}; export type GroupUpdateOperation = {op: string, path?: string | undefined, value?: (Array | string) | undefined}; export type GroupUpdate = {schemas: Array, Operations: Array}; export type PatchApiScimGroupsGroupIdArgs = {group_id: string, body: GroupUpdate}; export type PatchApiScimGroupsGroupIdOptions = {baseUrl: string, OAuth2AuthorizationCodeBearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update Group On Prem * * PATCH /scim/Groups/{group_id} */ export const patchApiScimGroupsGroupId = async (args: PatchApiScimGroupsGroupIdArgs, options: PatchApiScimGroupsGroupIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, OAuth2AuthorizationCodeBearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (OAuth2AuthorizationCodeBearer !== undefined) headers.set('authorization', `Bearer ${OAuth2AuthorizationCodeBearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/scim/Groups/${encodeURIComponent(String(args.group_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };