mirror of
https://github.com/EZ-Api/ez-api.git
synced 2026-01-13 17:47:51 +00:00
docs(api): expand whoami endpoint documentation with detailed response fields
Add comprehensive API documentation for the whoami endpoint including: - Detailed response structure for each token type (Admin, Master, Child Key) - Complete field listings for master keys and child keys - All possible error responses with status codes - Usage guidance for frontend initialization
This commit is contained in:
@@ -132,13 +132,41 @@ type WhoamiResponse struct {
|
|||||||
|
|
||||||
// Whoami godoc
|
// Whoami godoc
|
||||||
// @Summary Get current identity
|
// @Summary Get current identity
|
||||||
// @Description Returns the identity of the authenticated user based on the Authorization header.
|
// @Description Returns complete identity and realtime statistics of the authenticated user.
|
||||||
// @Description Supports Admin Token, Master Key, and Child Key (API Key) authentication.
|
// @Description Supports Admin Token, Master Key, and Child Key (API Key) authentication.
|
||||||
|
// @Description This endpoint is designed for frontend initialization - call once after login
|
||||||
|
// @Description and store the response for subsequent use.
|
||||||
// @Description
|
// @Description
|
||||||
// @Description Response varies by token type:
|
// @Description **Response varies by token type:**
|
||||||
// @Description - Admin Token: {"type": "admin", "role": "admin"}
|
// @Description
|
||||||
// @Description - Master Key: {"type": "master", "id": 1, "name": "...", ...}
|
// @Description **Admin Token:**
|
||||||
// @Description - Child Key: {"type": "key", "id": 5, "master_id": 1, "issued_by": "master", ...}
|
// @Description - type: "admin"
|
||||||
|
// @Description - role: "admin"
|
||||||
|
// @Description - permissions: ["*"] (full access)
|
||||||
|
// @Description
|
||||||
|
// @Description **Master Key:**
|
||||||
|
// @Description - type: "master"
|
||||||
|
// @Description - Basic info: id, name, group, namespaces, status, epoch, max_child_keys, global_qps
|
||||||
|
// @Description - Timestamps: created_at, updated_at
|
||||||
|
// @Description - Realtime stats: requests, tokens, qps, qps_limit, rate_limited
|
||||||
|
// @Description
|
||||||
|
// @Description **Child Key (API Key):**
|
||||||
|
// @Description - type: "key"
|
||||||
|
// @Description - Basic info: id, master_id, master_name, group, scopes, namespaces, status
|
||||||
|
// @Description - Security: issued_at_epoch, issued_by, allow_ips, deny_ips, expires_at
|
||||||
|
// @Description - Model limits: model_limits, model_limits_enabled
|
||||||
|
// @Description - Quota: quota_limit, quota_used, quota_reset_at, quota_reset_type
|
||||||
|
// @Description - Usage stats: request_count, used_tokens, last_accessed_at
|
||||||
|
// @Description - Realtime stats: requests, tokens, qps, qps_limit, rate_limited
|
||||||
|
// @Description
|
||||||
|
// @Description **Error responses:**
|
||||||
|
// @Description - 401: authorization header required
|
||||||
|
// @Description - 401: invalid authorization header format
|
||||||
|
// @Description - 401: invalid token
|
||||||
|
// @Description - 401: token is not active
|
||||||
|
// @Description - 401: token has expired
|
||||||
|
// @Description - 401: token has been revoked
|
||||||
|
// @Description - 401: master is not active
|
||||||
// @Tags auth
|
// @Tags auth
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Security AdminAuth
|
// @Security AdminAuth
|
||||||
|
|||||||
Reference in New Issue
Block a user