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 PatchApiScimProviderNameGroupsGroupIdArgs = {group_id: string, provider_name: string, body: GroupUpdate}; export type PatchApiScimProviderNameGroupsGroupIdOptions = {baseUrl: string, OAuth2AuthorizationCodeBearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update Group Cloud * * PATCH /scim/{provider_name}/Groups/{group_id} */ export const patchApiScimProviderNameGroupsGroupId = async (args: PatchApiScimProviderNameGroupsGroupIdArgs, options: PatchApiScimProviderNameGroupsGroupIdOptions) => { 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/${encodeURIComponent(String(args.provider_name))}/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 };