feat: add channel admin endpoints to console OpenAPI spec

This commit is contained in:
Patrick Buckley
2026-03-11 21:08:28 -07:00
parent 8eb8722346
commit e06554d1ec
2 changed files with 52 additions and 0 deletions
+21
View File
@@ -347,4 +347,25 @@ class AuditEventInfo(BaseModel):
class ListAuditEventsResponse(BaseModel):
events: list[AuditEventInfo]
# ---------------------------------------------------------------------------
# Channels
# ---------------------------------------------------------------------------
class ChannelUserInfo(BaseModel):
channel_type: str
channel_user_id: str
user_id: str
created: str
class ListChannelUsersResponse(BaseModel):
channels: list[ChannelUserInfo]
class CreateChannelUserRequest(BaseModel):
channel_type: str = Field(..., description="Channel type (e.g. discord, slack)")
channel_user_id: str = Field(..., description="External channel user identifier")
total: int
+31
View File
@@ -10,6 +10,7 @@ if TYPE_CHECKING:
from turnstone.api.console_schemas import (
AssignRoleRequest,
AuditEventInfo,
ChannelUserInfo,
ClusterNodesResponse,
ClusterOverviewResponse,
ClusterSnapshotResponse,
@@ -17,10 +18,12 @@ from turnstone.api.console_schemas import (
ConsoleCreateWsRequest,
ConsoleCreateWsResponse,
ConsoleHealthResponse,
CreateChannelUserRequest,
CreatePromptTemplateRequest,
CreateRoleRequest,
CreateToolPolicyRequest,
ListAuditEventsResponse,
ListChannelUsersResponse,
ListOrgsResponse,
ListPromptTemplatesResponse,
ListRolesResponse,
@@ -219,6 +222,31 @@ CONSOLE_ENDPOINTS: list[EndpointSpec] = [
error_codes=[404],
tags=["Admin"],
),
# --- Channels ---
EndpointSpec(
"/v1/api/admin/users/{user_id}/channels",
"GET",
"List channel links for a user",
response_model=ListChannelUsersResponse,
tags=["Admin"],
),
EndpointSpec(
"/v1/api/admin/users/{user_id}/channels",
"POST",
"Link a channel account to a user",
request_model=CreateChannelUserRequest,
response_model=ChannelUserInfo,
error_codes=[400, 404, 409],
tags=["Admin"],
),
EndpointSpec(
"/v1/api/admin/channels/{channel_type}/{channel_user_id}",
"DELETE",
"Unlink a channel account",
response_model=StatusResponse,
error_codes=[404],
tags=["Admin"],
),
# --- Schedules ---
EndpointSpec(
"/v1/api/admin/schedules",
@@ -483,6 +511,9 @@ _ALL_MODELS: list[type[BaseModel]] = [
CreateTokenRequest,
CreateTokenResponse,
ListTokensResponse,
ChannelUserInfo,
CreateChannelUserRequest,
ListChannelUsersResponse,
ClusterOverviewResponse,
ClusterNodesResponse,
ClusterWorkstreamsResponse,