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 CreateApiManagementV1PermissionsProjectProjectIdAssignmentsArgs = {project_id: string | null, body: UpdateProjectAssignmentsRequest}; export type CreateApiManagementV1PermissionsProjectProjectIdAssignmentsOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update permissions for a project * * POST /management/v1/permissions/project/{project_id}/assignments */ export const createApiManagementV1PermissionsProjectProjectIdAssignments = async (args: CreateApiManagementV1PermissionsProjectProjectIdAssignmentsArgs, options?: CreateApiManagementV1PermissionsProjectProjectIdAssignmentsOptions) => { 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/${encodeURIComponent(String(args.project_id))}/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 };