export type AddProfileUserRequest = {userId?: number | undefined}; export type CreateApiV1PermissionProfilesIdUsersArgs = {id: number, body: AddProfileUserRequest}; export type CreateApiV1PermissionProfilesIdUsersOptions = {baseUrl: string, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * POST /v1/permission-profiles/{id}/users * * Also accepts auth: API Key */ export const createApiV1PermissionProfilesIdUsers = async (args: CreateApiV1PermissionProfilesIdUsersArgs, options: CreateApiV1PermissionProfilesIdUsersOptions) => { const {baseUrl, fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (Bearer !== undefined) headers.set('authorization', `Bearer ${Bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/permission-profiles/${encodeURIComponent(String(args.id))}/users${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 };