export type CreateApiApiAccessControlV2EntryGroupArgs = {body: {data?: ({type?: 'ppms/permissions/group' | undefined, attributes?: ({entity?: 'ppms/app' | undefined, entityId?: string | undefined, group?: ('no-access' | 'view' | 'edit' | 'edit-publish' | 'manage') | undefined, targetUserId?: string | undefined}) | undefined}) | undefined}}; export type CreateApiApiAccessControlV2EntryGroupOptions = {baseUrl?: string | undefined, OAuth2ClientCredentials?: string | undefined, fetch?: typeof fetch | undefined}; /** * Permission set * * POST /api/access-control/v2/entry/group */ export const createApiApiAccessControlV2EntryGroup = async (args: CreateApiApiAccessControlV2EntryGroupArgs, options?: CreateApiApiAccessControlV2EntryGroupOptions) => { 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/access-control/v2/entry/group${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 };