export type NamespaceAssignment = {user: string, type: 'ownership'} | {role: string, type: 'ownership'} | {user: string, type: 'pass_grants'} | {role: string, type: 'pass_grants'} | {user: string, type: 'manage_grants'} | {role: string, type: 'manage_grants'} | {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 UpdateNamespaceAssignmentsRequest = {deletes?: Array | undefined, writes?: Array | undefined}; export type CreateApiManagementV1PermissionsNamespaceNamespaceIdAssignmentsArgs = {namespace_id: string, body: UpdateNamespaceAssignmentsRequest}; export type CreateApiManagementV1PermissionsNamespaceNamespaceIdAssignmentsOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update permissions for a namespace * * POST /management/v1/permissions/namespace/{namespace_id}/assignments */ export const createApiManagementV1PermissionsNamespaceNamespaceIdAssignments = async (args: CreateApiManagementV1PermissionsNamespaceNamespaceIdAssignmentsArgs, options?: CreateApiManagementV1PermissionsNamespaceNamespaceIdAssignmentsOptions) => { 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/namespace/${encodeURIComponent(String(args.namespace_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 };