2076 lines
71 KiB
JSON
2076 lines
71 KiB
JSON
{
|
||
"swagger": "2.0",
|
||
"info": {
|
||
"description": "API для Telegram Mini App с викторинами, QR-сканированием и внутренней валютой",
|
||
"title": "Telegram Quiz Mini App API",
|
||
"contact": {},
|
||
"version": "1.0"
|
||
},
|
||
"host": "localhost:8080",
|
||
"basePath": "/",
|
||
"paths": {
|
||
"/api/admin/analytics": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"description": "Returns analytics data including user statistics, rewards, and quiz performance (admin/operator only)",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"admin"
|
||
],
|
||
"summary": "Get analytics data",
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "object"
|
||
},
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Internal Server Error",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/admin/operators": {
|
||
"post": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"description": "Creates a new operator account (admin only)",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"admin"
|
||
],
|
||
"summary": "Create operator",
|
||
"parameters": [
|
||
{
|
||
"description": "Create operator request",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/models.CreateOperatorRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"201": {
|
||
"description": "Created",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Internal Server Error",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/admin/operators/{id}": {
|
||
"delete": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"description": "Deletes an operator account (admin only)",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"admin"
|
||
],
|
||
"summary": "Delete operator",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "Operator Telegram ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Internal Server Error",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/admin/qrcodes": {
|
||
"post": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"description": "Generates unique QR codes for rewards, quizzes, or shop items (admin/operator only)",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"qr"
|
||
],
|
||
"summary": "Generate QR codes",
|
||
"parameters": [
|
||
{
|
||
"description": "QR codes generation request",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/models.GenerateQRCodesRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/models.GenerateQRCodesResponse"
|
||
},
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Internal Server Error",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/admin/quizzes": {
|
||
"post": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"description": "Creates a new quiz (admin/operator only)",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"quizzes"
|
||
],
|
||
"summary": "Create a new quiz",
|
||
"parameters": [
|
||
{
|
||
"description": "Quiz object",
|
||
"name": "quiz",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/models.Quiz"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"201": {
|
||
"description": "Created",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/models.Quiz"
|
||
},
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Internal Server Error",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/admin/quizzes/{id}": {
|
||
"put": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"description": "Updates an existing quiz (admin only)",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"quizzes"
|
||
],
|
||
"summary": "Update a quiz",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "Quiz ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
},
|
||
{
|
||
"description": "Updated quiz object",
|
||
"name": "quiz",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/models.Quiz"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/models.Quiz"
|
||
},
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Internal Server Error",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"delete": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"description": "Deletes a quiz (admin only)",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"quizzes"
|
||
],
|
||
"summary": "Delete a quiz",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "Quiz ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Internal Server Error",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/admin/quizzes/{quiz_id}/questions": {
|
||
"post": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"description": "Adds a new question to a quiz (admin/operator only)",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"questions"
|
||
],
|
||
"summary": "Create question",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "Quiz ID",
|
||
"name": "quiz_id",
|
||
"in": "path",
|
||
"required": true
|
||
},
|
||
{
|
||
"description": "Question object",
|
||
"name": "question",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/models.Question"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"201": {
|
||
"description": "Created",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/models.Question"
|
||
},
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Internal Server Error",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/admin/rewards": {
|
||
"post": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"description": "Creates a new reward that users can purchase with stars (admin/operator only)",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"rewards"
|
||
],
|
||
"summary": "Create a new reward",
|
||
"parameters": [
|
||
{
|
||
"description": "Reward object",
|
||
"name": "reward",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/models.Reward"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"201": {
|
||
"description": "Created",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/models.Reward"
|
||
},
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Internal Server Error",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/admin/rewards/{id}": {
|
||
"put": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"description": "Updates an existing reward (admin only)",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"rewards"
|
||
],
|
||
"summary": "Update a reward",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "Reward ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
},
|
||
{
|
||
"description": "Updated reward object",
|
||
"name": "reward",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/models.Reward"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/models.Reward"
|
||
},
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Internal Server Error",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"delete": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"description": "Deletes a reward (admin only)",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"rewards"
|
||
],
|
||
"summary": "Delete a reward",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "Reward ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Internal Server Error",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/admin/users/grant-stars": {
|
||
"post": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"description": "Manually grants stars to a user (admin only)",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"admin"
|
||
],
|
||
"summary": "Grant stars to user",
|
||
"parameters": [
|
||
{
|
||
"description": "Grant stars request",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/models.GrantStarsRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Internal Server Error",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/auth/me": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"description": "Returns information about the currently authenticated Telegram user",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"auth"
|
||
],
|
||
"summary": "Get current authenticated user",
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "object"
|
||
},
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"401": {
|
||
"description": "Unauthorized",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/auth/validate": {
|
||
"post": {
|
||
"description": "Validates Telegram WebApp init data and returns user information",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"auth"
|
||
],
|
||
"summary": "Validate Telegram WebApp init data",
|
||
"parameters": [
|
||
{
|
||
"description": "Init data validation request",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"initData": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "object"
|
||
},
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"401": {
|
||
"description": "Unauthorized",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/me": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"description": "Returns the current user's profile information including balance",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"user"
|
||
],
|
||
"summary": "Get current user profile",
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/models.User"
|
||
},
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "Not Found",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/qr/validate": {
|
||
"post": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"description": "Validates a QR code payload and processes the associated action",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"qr"
|
||
],
|
||
"summary": "Validate QR code payload",
|
||
"parameters": [
|
||
{
|
||
"description": "QR validation request",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/models.QRValidateRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "object"
|
||
},
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"401": {
|
||
"description": "Unauthorized",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/quizzes": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"description": "Returns a list of all active quizzes",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"quizzes"
|
||
],
|
||
"summary": "Get all active quizzes",
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/models.Quiz"
|
||
}
|
||
},
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Internal Server Error",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/quizzes/{id}": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"description": "Returns a single quiz with all its questions",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"quizzes"
|
||
],
|
||
"summary": "Get quiz by ID",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "Quiz ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/models.Quiz"
|
||
},
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "Not Found",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Internal Server Error",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/quizzes/{id}/can-repeat": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"description": "Checks if user can repeat a quiz and when it will be available",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"quizzes"
|
||
],
|
||
"summary": "Check if quiz can be repeated",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "Quiz ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/models.CanRepeatResponse"
|
||
},
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Internal Server Error",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/quizzes/{id}/submit": {
|
||
"post": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"description": "Submits quiz answers and calculates score/stars earned",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"quizzes"
|
||
],
|
||
"summary": "Submit quiz answers",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "Quiz ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
},
|
||
{
|
||
"description": "Quiz submission",
|
||
"name": "submission",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/models.SubmissionRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "object"
|
||
},
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Internal Server Error",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/rewards": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"description": "Returns a list of all active rewards available for purchase",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"rewards"
|
||
],
|
||
"summary": "Get all active rewards",
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/models.Reward"
|
||
}
|
||
},
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Internal Server Error",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/rewards/{id}/purchase": {
|
||
"post": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"description": "Allows a user to purchase a reward using their stars",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"rewards"
|
||
],
|
||
"summary": "Purchase a reward",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "Reward ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/models.Purchase"
|
||
},
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Internal Server Error",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/user/purchases": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"description": "Returns the current user's purchase history",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"user"
|
||
],
|
||
"summary": "Get user purchase history",
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/models.Purchase"
|
||
}
|
||
},
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Internal Server Error",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/user/transactions": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"description": "Returns the current user's transaction history (earned/spent stars)",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"user"
|
||
],
|
||
"summary": "Get user transaction history",
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/models.Transaction"
|
||
}
|
||
},
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Internal Server Error",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"success": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"definitions": {
|
||
"models.CanRepeatResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"can_repeat": {
|
||
"type": "boolean"
|
||
},
|
||
"next_available_at": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"models.CreateOperatorRequest": {
|
||
"type": "object",
|
||
"properties": {
|
||
"name": {
|
||
"type": "string"
|
||
},
|
||
"telegram_id": {
|
||
"type": "integer"
|
||
}
|
||
}
|
||
},
|
||
"models.DeliveryType": {
|
||
"type": "string",
|
||
"enum": [
|
||
"physical",
|
||
"digital"
|
||
],
|
||
"x-enum-varnames": [
|
||
"Physical",
|
||
"Digital"
|
||
]
|
||
},
|
||
"models.GenerateQRCodesRequest": {
|
||
"type": "object",
|
||
"properties": {
|
||
"count": {
|
||
"description": "Number of codes to generate",
|
||
"type": "integer"
|
||
},
|
||
"type": {
|
||
"description": "e.g., \"reward\", \"quiz\"",
|
||
"type": "string"
|
||
},
|
||
"value": {
|
||
"description": "e.g., \"50\" for reward, \"1\" for quiz",
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"models.GenerateQRCodesResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"tokens": {
|
||
"description": "List of generated unique tokens",
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"models.GrantStarsRequest": {
|
||
"type": "object",
|
||
"properties": {
|
||
"amount": {
|
||
"type": "integer"
|
||
},
|
||
"user_id": {
|
||
"type": "integer"
|
||
}
|
||
}
|
||
},
|
||
"models.Option": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "integer"
|
||
},
|
||
"is_correct": {
|
||
"type": "boolean"
|
||
},
|
||
"text": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"models.Purchase": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "integer"
|
||
},
|
||
"purchased_at": {
|
||
"type": "string"
|
||
},
|
||
"reward_id": {
|
||
"type": "integer"
|
||
},
|
||
"stars_spent": {
|
||
"type": "integer"
|
||
},
|
||
"status": {
|
||
"$ref": "#/definitions/models.PurchaseStatus"
|
||
},
|
||
"user_id": {
|
||
"type": "integer"
|
||
}
|
||
}
|
||
},
|
||
"models.PurchaseStatus": {
|
||
"type": "string",
|
||
"enum": [
|
||
"pending",
|
||
"delivered",
|
||
"cancelled"
|
||
],
|
||
"x-enum-varnames": [
|
||
"Pending",
|
||
"Delivered",
|
||
"Cancelled"
|
||
]
|
||
},
|
||
"models.QRValidateRequest": {
|
||
"type": "object",
|
||
"properties": {
|
||
"payload": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"models.Question": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "integer"
|
||
},
|
||
"options": {
|
||
"description": "Stored as JSONB",
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/models.Option"
|
||
}
|
||
},
|
||
"order_index": {
|
||
"type": "integer"
|
||
},
|
||
"quiz_id": {
|
||
"type": "integer"
|
||
},
|
||
"text": {
|
||
"type": "string"
|
||
},
|
||
"type": {
|
||
"$ref": "#/definitions/models.QuestionType"
|
||
}
|
||
}
|
||
},
|
||
"models.QuestionType": {
|
||
"type": "string",
|
||
"enum": [
|
||
"single",
|
||
"multiple"
|
||
],
|
||
"x-enum-varnames": [
|
||
"Single",
|
||
"Multiple"
|
||
]
|
||
},
|
||
"models.Quiz": {
|
||
"type": "object",
|
||
"properties": {
|
||
"can_repeat": {
|
||
"type": "boolean"
|
||
},
|
||
"created_at": {
|
||
"type": "string"
|
||
},
|
||
"created_by": {
|
||
"type": "integer"
|
||
},
|
||
"description": {
|
||
"type": "string"
|
||
},
|
||
"has_timer": {
|
||
"type": "boolean"
|
||
},
|
||
"id": {
|
||
"type": "integer"
|
||
},
|
||
"image_url": {
|
||
"type": "string"
|
||
},
|
||
"is_active": {
|
||
"type": "boolean"
|
||
},
|
||
"questions": {
|
||
"description": "This field is for API responses, not DB storage",
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/models.Question"
|
||
}
|
||
},
|
||
"repeat_cooldown_hours": {
|
||
"type": "integer"
|
||
},
|
||
"reward_stars": {
|
||
"type": "integer"
|
||
},
|
||
"timer_per_question": {
|
||
"type": "integer"
|
||
},
|
||
"title": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"models.Reward": {
|
||
"type": "object",
|
||
"properties": {
|
||
"created_at": {
|
||
"type": "string"
|
||
},
|
||
"created_by": {
|
||
"type": "integer"
|
||
},
|
||
"delivery_type": {
|
||
"$ref": "#/definitions/models.DeliveryType"
|
||
},
|
||
"description": {
|
||
"type": "string"
|
||
},
|
||
"id": {
|
||
"type": "integer"
|
||
},
|
||
"image_url": {
|
||
"type": "string"
|
||
},
|
||
"instructions": {
|
||
"type": "string"
|
||
},
|
||
"is_active": {
|
||
"type": "boolean"
|
||
},
|
||
"price_stars": {
|
||
"type": "integer"
|
||
},
|
||
"stock": {
|
||
"type": "integer"
|
||
},
|
||
"title": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"models.SubmissionRequest": {
|
||
"type": "object",
|
||
"properties": {
|
||
"answers": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/models.UserAnswer"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"models.Transaction": {
|
||
"type": "object",
|
||
"properties": {
|
||
"amount": {
|
||
"type": "integer"
|
||
},
|
||
"created_at": {
|
||
"type": "string"
|
||
},
|
||
"description": {
|
||
"type": "string"
|
||
},
|
||
"type": {
|
||
"$ref": "#/definitions/models.TransactionType"
|
||
}
|
||
}
|
||
},
|
||
"models.TransactionType": {
|
||
"type": "string",
|
||
"enum": [
|
||
"earned",
|
||
"spent"
|
||
],
|
||
"x-enum-varnames": [
|
||
"TransactionEarned",
|
||
"TransactionSpent"
|
||
]
|
||
},
|
||
"models.User": {
|
||
"type": "object",
|
||
"properties": {
|
||
"created_at": {
|
||
"type": "string"
|
||
},
|
||
"first_name": {
|
||
"type": "string"
|
||
},
|
||
"last_name": {
|
||
"type": "string"
|
||
},
|
||
"stars_balance": {
|
||
"type": "integer"
|
||
},
|
||
"telegram_id": {
|
||
"type": "integer"
|
||
},
|
||
"username": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"models.UserAnswer": {
|
||
"type": "object",
|
||
"properties": {
|
||
"option_ids": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "integer"
|
||
}
|
||
},
|
||
"question_id": {
|
||
"type": "integer"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"securityDefinitions": {
|
||
"ApiKeyAuth": {
|
||
"type": "apiKey",
|
||
"name": "Authorization",
|
||
"in": "header"
|
||
},
|
||
"BasicAuth": {
|
||
"type": "basic"
|
||
}
|
||
}
|
||
} |