export type PatchApiApiUserGroupsV1UserGroupIdArgs = {user_group_id: string, body: {data: {type: 'ppms/user-group', id: string, attributes: {name: string, created_at: string, updated_at: string, external_id?: (string | null) | undefined}}}}; export type PatchApiApiUserGroupsV1UserGroupIdOptions = {baseUrl?: string | undefined, OAuth2ClientCredentials?: string | undefined, fetch?: typeof fetch | undefined}; /** * Edit user group * * PATCH /api/user-groups/v1/{user_group_id} */ export const patchApiApiUserGroupsV1UserGroupId = async (args: PatchApiApiUserGroupsV1UserGroupIdArgs, options?: PatchApiApiUserGroupsV1UserGroupIdOptions) => { const {baseUrl = "https://example.piwik.pro", fetch: fetchFn = fetch, OAuth2ClientCredentials} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/vnd.api+json") if (OAuth2ClientCredentials !== undefined) headers.set('authorization', `Bearer ${OAuth2ClientCredentials}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/user-groups/v1/${encodeURIComponent(String(args.user_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 };