Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/dotnet/APIView/APIViewWeb/typespec/main.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import "./autoreview.tsp";
import "./apirevisions.tsp";
import "./comments.tsp";
import "./reviews.tsp";
import "./permissions.tsp";

using TypeSpec.Http;

Expand Down
15 changes: 15 additions & 0 deletions src/dotnet/APIView/APIViewWeb/typespec/models.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,21 @@ model ApiViewAgentComment {
ThreadId?: string;
}

/** A user returned by a reviewer/admin endpoint */
model ReviewerInfo {
/** GitHub username */
name: string;
/** The user's role (e.g. "Architect", "DeputyArchitect", "admin") */
role: string;
}

/** Response envelope for the get-approvers-for-language endpoint */
model ApproversForLanguageResponse {
/** The language these approvers are scoped to */
language: string;
/** List of approvers with their language-scoped role */
approvers: ReviewerInfo[];
}

/**
* Bad request error response
Expand Down
39 changes: 39 additions & 0 deletions src/dotnet/APIView/APIViewWeb/typespec/permissions.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import "@typespec/http";
import "./models.tsp";

using TypeSpec.Http;

namespace APIView;

/**
* Permissions endpoints accessible via Azure AD token.
* These endpoints are intended for use by agents and MCP clients via Bearer token.
*/
@route("/api/permissions")
@useAuth(BearerAuth)
namespace Permissions {
Comment thread
AlitzelMendez marked this conversation as resolved.
/**
* Get the approvers for a given language with their roles.
* @param language The language to get approvers for (e.g. "Python", "Java").
* @returns List of approvers with their language-scoped role
*/
@get
@route("/approvers/{language}")
op GetApproversForLanguage(
@path language: string
): {
@statusCode statusCode: 200;
@body body: ApproversForLanguageResponse;
} | UnauthorizedErrorResponse | InternalServerErrorResponse;

/**
* Get the list of GitHub usernames who have APIView admin permissions.
* @returns Admins with role "admin"
*/
@get
@route("/admins")
op GetAdminUsernames(): {
@statusCode statusCode: 200;
@body admins: ReviewerInfo[];
} | UnauthorizedErrorResponse | InternalServerErrorResponse;
Comment thread
AlitzelMendez marked this conversation as resolved.
}