export type SubjectType = 'user' | 'team'; export type ProjectPolicySubject = {subject_type: SubjectType, name: string}; export type DeleteApiProjectsOwnerNamePermissionsArgs = {owner: string, name: string, body: ProjectPolicySubject}; export type DeleteApiProjectsOwnerNamePermissionsOptions = {baseUrl: string, JWTAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Remove a Project permissions * * DELETE /projects/{owner}/{name}/permissions * * Also accepts auth: APIKeyAuth */ export const deleteApiProjectsOwnerNamePermissions = async (args: DeleteApiProjectsOwnerNamePermissionsArgs, options: DeleteApiProjectsOwnerNamePermissionsOptions) => { const {baseUrl, fetch: fetchFn = fetch, JWTAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (JWTAuth !== undefined) headers.set('authorization', `Bearer ${JWTAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/projects/${encodeURIComponent(String(args.owner))}/${encodeURIComponent(String(args.name))}/permissions${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", 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 };