// Package docs Code generated by swaggo/swag. DO NOT EDIT package docs import "github.com/swaggo/swag" const docTemplate = `{ "schemes": {{ marshal .Schemes }}, "swagger": "2.0", "info": { "description": "{{escape .Description}}", "title": "{{.Title}}", "termsOfService": "http://swagger.io/terms/", "contact": { "name": "API Support", "url": "http://www.swagger.io/support", "email": "support@swagger.io" }, "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.html" }, "version": "{{.Version}}" }, "host": "{{.Host}}", "basePath": "{{.BasePath}}", "paths": { "/auth/exchange": { "post": { "description": "Exchanges client credentials and user session for a specific redirect authorization code.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Authentication" ], "summary": "Exchange Auth Code", "parameters": [ { "description": "Exchange Request Credentials", "name": "payload", "in": "body", "required": true, "schema": { "$ref": "#/definitions/service_auth.ExchangeData" } } ], "responses": { "200": { "description": "Successful exchange", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/service_auth.ExchangeResponse" } } } ] } }, "400": { "description": "Invalid Input", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "401": { "description": "Unauthorized", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "500": { "description": "Internal Server Error", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } } } } }, "/auth/magic": { "post": { "description": "Verifies Turnstile token and sends an authentication link via email. Returns the URI directly if debug mode is enabled.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Authentication" ], "summary": "Request Magic Link", "parameters": [ { "description": "Magic Link Request Data", "name": "payload", "in": "body", "required": true, "schema": { "$ref": "#/definitions/service_auth.MagicData" } } ], "responses": { "200": { "description": "Successful request", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/service_auth.MagicResponse" } } } ] } }, "400": { "description": "Invalid Input", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "403": { "description": "Turnstile Verification Failed", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "500": { "description": "Internal Server Error", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } } } } }, "/auth/redirect": { "get": { "description": "Verifies the temporary email code, ensures the user exists (or creates one), validates the client's redirect URI, and finally performs a 302 redirect with a new authorization code.", "consumes": [ "application/x-www-form-urlencoded" ], "produces": [ "application/json", "text/html" ], "tags": [ "Authentication" ], "summary": "Handle Auth Callback and Redirect", "parameters": [ { "type": "string", "description": "Client Identifier", "name": "client_id", "in": "query", "required": true }, { "type": "string", "description": "Target Redirect URI", "name": "redirect_uri", "in": "query", "required": true }, { "type": "string", "description": "Temporary Verification Code", "name": "code", "in": "query", "required": true }, { "type": "string", "description": "Opaque state used to maintain state between the request and callback", "name": "state", "in": "query" } ], "responses": { "302": { "description": "Redirect to the provided RedirectUri with a new code", "schema": { "type": "string" } }, "400": { "description": "Invalid Input / Client Not Found / URI Mismatch", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "403": { "description": "Invalid or Expired Verification Code", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "500": { "description": "Internal Server Error", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } } } } }, "/auth/refresh": { "post": { "description": "Accepts a valid refresh token to issue a new access token and a rotated refresh token.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Authentication" ], "summary": "Refresh Access Token", "parameters": [ { "description": "Refresh Token Body", "name": "payload", "in": "body", "required": true, "schema": { "$ref": "#/definitions/service_auth.RefreshData" } } ], "responses": { "200": { "description": "Successful rotation", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/service_auth.TokenResponse" } } } ] } }, "400": { "description": "Invalid Input", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "401": { "description": "Invalid Refresh Token", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "500": { "description": "Internal Server Error", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } } } } }, "/auth/token": { "post": { "description": "Verifies the provided authorization code and issues a pair of JWT tokens (Access and Refresh).", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Authentication" ], "summary": "Exchange Code for Token", "parameters": [ { "description": "Token Request Body", "name": "payload", "in": "body", "required": true, "schema": { "$ref": "#/definitions/service_auth.TokenData" } } ], "responses": { "200": { "description": "Successful token issuance", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/service_auth.TokenResponse" } } } ] } }, "400": { "description": "Invalid Input", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "403": { "description": "Invalid or Expired Code", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "500": { "description": "Internal Server Error", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } } } } }, "/event/checkin": { "get": { "security": [ { "ApiKeyAuth": [] } ], "description": "Creates a temporary check-in code for the authenticated user and event.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Event" ], "summary": "Generate Check-in Code", "parameters": [ { "type": "string", "description": "Event UUID", "name": "event_id", "in": "query", "required": true } ], "responses": { "200": { "description": "Successfully generated code", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/service_event.CheckinResponse" } } } ] } }, "400": { "description": "Invalid Input", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "401": { "description": "Missing User ID / Unauthorized", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "500": { "description": "Internal Server Error", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } } } } }, "/event/checkin/query": { "get": { "security": [ { "ApiKeyAuth": [] } ], "description": "Returns the timestamp of when the user checked in, or null if not yet checked in.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Event" ], "summary": "Query Check-in Status", "parameters": [ { "type": "string", "description": "Event UUID", "name": "event_id", "in": "query", "required": true } ], "responses": { "200": { "description": "Current attendance status", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/service_event.CheckinQueryResponse" } } } ] } }, "400": { "description": "Invalid Input", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "404": { "description": "Record Not Found", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } } } } }, "/event/checkin/submit": { "post": { "security": [ { "ApiKeyAuth": [] } ], "description": "Submits the generated code to mark the user as attended.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Event" ], "summary": "Submit Check-in Code", "parameters": [ { "description": "Checkin Code Data", "name": "payload", "in": "body", "required": true, "schema": { "$ref": "#/definitions/service_event.CheckinSubmitData" } } ], "responses": { "200": { "description": "Attendance marked successfully", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "400": { "description": "Invalid Code or Input", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } } } } }, "/event/info": { "get": { "security": [ { "ApiKeyAuth": [] } ], "description": "Fetches the name, start time, and end time of an event using its UUID.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Event" ], "summary": "Get Event Information", "parameters": [ { "type": "string", "description": "Event UUID", "name": "event_id", "in": "query", "required": true } ], "responses": { "200": { "description": "Successful retrieval", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/data.EventIndexDoc" } } } ] } }, "400": { "description": "Invalid Input", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "401": { "description": "Missing User ID / Unauthorized", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "404": { "description": "Event Not Found", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "500": { "description": "Internal Server Error", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } } } } }, "/event/list": { "get": { "security": [ { "ApiKeyAuth": [] } ], "description": "Fetches a list of events with support for pagination via limit and offset. Data is retrieved directly from the database for consistency.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Event" ], "summary": "List Events", "parameters": [ { "type": "string", "description": "Maximum number of events to return (default 20)", "name": "limit", "in": "query" }, { "type": "string", "description": "Number of events to skip", "name": "offset", "in": "query", "required": true } ], "responses": { "200": { "description": "Successful paginated list retrieval", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/data.EventIndexDoc" } } } } ] } }, "400": { "description": "Invalid Input (Missing offset or malformed parameters)", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "401": { "description": "Missing User ID / Unauthorized", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "500": { "description": "Internal Server Error (Database query failed)", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } } } } }, "/user/info": { "get": { "security": [ { "ApiKeyAuth": [] } ], "description": "Fetches the complete profile data for the user associated with the provided session/token.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "User" ], "summary": "Get My User Information", "responses": { "200": { "description": "Successful profile retrieval", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/service_user.UserInfoData" } } } ] } }, "401": { "description": "Missing User ID / Unauthorized", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "404": { "description": "User Not Found", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "500": { "description": "Internal Server Error (UUID Parse Failed)", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } } } } }, "/user/info/{user_id}": { "get": { "security": [ { "ApiKeyAuth": [] } ], "description": "Fetches the complete profile data for the user associated with the provided session/token.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "User" ], "summary": "Get Other User Information", "parameters": [ { "type": "string", "description": "Other user id", "name": "user_id", "in": "path", "required": true } ], "responses": { "200": { "description": "Successful profile retrieval", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/service_user.UserInfoData" } } } ] } }, "401": { "description": "Missing User ID / Unauthorized", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "403": { "description": "User Not Public", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/service_user.UserInfoData" } } } ] } }, "404": { "description": "User Not Found", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "500": { "description": "Internal Server Error (UUID Parse Failed)", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } } } } }, "/user/list": { "get": { "security": [ { "ApiKeyAuth": [] } ], "description": "Fetches a list of users with support for pagination via limit and offset. Data is sourced from the search engine for high performance.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "User" ], "summary": "List Users", "parameters": [ { "type": "string", "description": "Maximum number of users to return (default 0)", "name": "limit", "in": "query" }, { "type": "string", "description": "Number of users to skip", "name": "offset", "in": "query", "required": true } ], "responses": { "200": { "description": "Successful paginated list retrieval", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/data.UserIndexDoc" } } } } ] } }, "400": { "description": "Invalid Input (Format Error)", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "401": { "description": "Missing User ID / Unauthorized", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "500": { "description": "Internal Server Error (Search Engine or Missing Offset)", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } } } } }, "/user/update": { "patch": { "security": [ { "ApiKeyAuth": [] } ], "description": "Updates specific profile fields such as username, nickname, subtitle, avatar (URL), and bio (Base64).\nValidation: Username (5-255 chars), Nickname (max 24 chars), Subtitle (max 32 chars).", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "User" ], "summary": "Update User Information", "parameters": [ { "description": "Updated User Profile Data", "name": "payload", "in": "body", "required": true, "schema": { "$ref": "#/definitions/service_user.UserInfoData" } } ], "responses": { "200": { "description": "Successful profile update", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "400": { "description": "Invalid Input (Validation Failed)", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "401": { "description": "Missing User ID / Unauthorized", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "500": { "description": "Internal Server Error (Database Error / UUID Parse Failed)", "schema": { "allOf": [ { "$ref": "#/definitions/utils.RespStatus" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } } } } } }, "definitions": { "data.EventIndexDoc": { "type": "object", "properties": { "description": { "type": "string" }, "end_time": { "type": "string" }, "event_id": { "type": "string" }, "name": { "type": "string" }, "start_time": { "type": "string" }, "thumbnail": { "type": "string" }, "type": { "type": "string" } } }, "data.UserIndexDoc": { "type": "object", "properties": { "avatar": { "type": "string" }, "email": { "type": "string" }, "nickname": { "type": "string" }, "subtitle": { "type": "string" }, "type": { "type": "string" }, "user_id": { "type": "string" }, "username": { "type": "string" } } }, "service_auth.ExchangeData": { "type": "object", "properties": { "client_id": { "type": "string" }, "redirect_uri": { "type": "string" }, "state": { "type": "string" } } }, "service_auth.ExchangeResponse": { "type": "object", "properties": { "redirect_uri": { "type": "string" } } }, "service_auth.MagicData": { "type": "object", "properties": { "client_id": { "type": "string" }, "client_ip": { "type": "string" }, "email": { "type": "string" }, "redirect_uri": { "type": "string" }, "state": { "type": "string" }, "turnstile_token": { "type": "string" } } }, "service_auth.MagicResponse": { "type": "object", "properties": { "uri": { "type": "string" } } }, "service_auth.RefreshData": { "type": "object", "properties": { "refresh_token": { "type": "string" } } }, "service_auth.TokenData": { "type": "object", "properties": { "code": { "type": "string" } } }, "service_auth.TokenResponse": { "type": "object", "properties": { "access_token": { "type": "string" }, "refresh_token": { "type": "string" } } }, "service_event.CheckinQueryResponse": { "type": "object", "properties": { "checkin_at": { "type": "string" } } }, "service_event.CheckinResponse": { "type": "object", "properties": { "checkin_code": { "type": "string" } } }, "service_event.CheckinSubmitData": { "type": "object", "properties": { "checkin_code": { "type": "string" } } }, "service_user.UserInfoData": { "type": "object", "properties": { "allow_public": { "type": "boolean" }, "avatar": { "type": "string" }, "bio": { "type": "string" }, "email": { "type": "string" }, "nickname": { "type": "string" }, "permission_level": { "type": "integer" }, "subtitle": { "type": "string" }, "user_id": { "type": "string" }, "username": { "type": "string" } } }, "utils.RespStatus": { "type": "object", "properties": { "code": { "type": "integer" }, "data": {}, "error_id": { "type": "string" }, "status": { "type": "string" } } } } }` // SwaggerInfo holds exported Swagger Info so clients can modify it var SwaggerInfo = &swag.Spec{ Version: "1.0", Host: "localhost:8000", BasePath: "/api/v1", Schemes: []string{"http", "https"}, Title: "NixCN CMS API", Description: "API Docs based on Gin framework", InfoInstanceName: "swagger", SwaggerTemplate: docTemplate, LeftDelim: "{{", RightDelim: "}}", } func init() { swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo) }