export type ProjectAssignment = {user: string, type: 'project_admin'} | {role: string, type: 'project_admin'} | {user: string, type: 'security_admin'} | {role: string, type: 'security_admin'} | {user: string, type: 'data_admin'} | {role: string, type: 'data_admin'} | {user: string, type: 'role_creator'} | {role: string, type: 'role_creator'} | {user: string, type: 'describe'} | {role: string, type: 'describe'} | {user: string, type: 'select'} | {role: string, type: 'select'} | {user: string, type: 'create'} | {role: string, type: 'create'} | {user: string, type: 'modify'} | {role: string, type: 'modify'}; export type UpdateProjectAssignmentsRequest = {deletes?: Array | undefined, writes?: Array | undefined}; export type CreateApiManagementV1PermissionsProjectAssignmentsArgs = {body: UpdateProjectAssignmentsRequest}; export type CreateApiManagementV1PermissionsProjectAssignmentsOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update permissions for the default project * * POST /management/v1/permissions/project/assignments */ export const createApiManagementV1PermissionsProjectAssignments = async (args: CreateApiManagementV1PermissionsProjectAssignmentsArgs, options?: CreateApiManagementV1PermissionsProjectAssignmentsOptions) => { const {baseUrl = "https://localhost", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/management/v1/permissions/project/assignments${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 };