export type SubjectType = 'user' | 'team'; export type RepositoryPolicySubject = {subject_type: SubjectType, name: string}; export type DeleteApiRecipesOwnerNamePermissionsArgs = {owner: string, name: string, body: RepositoryPolicySubject}; export type DeleteApiRecipesOwnerNamePermissionsOptions = {baseUrl: string, JWTAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Remove a Repository permissions * * DELETE /recipes/{owner}/{name}/permissions * * Also accepts auth: APIKeyAuth */ export const deleteApiRecipesOwnerNamePermissions = async (args: DeleteApiRecipesOwnerNamePermissionsArgs, options: DeleteApiRecipesOwnerNamePermissionsOptions) => { 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(/\/+$/, '')}/recipes/${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 };