{ "swagger": "2.0", "info": { "title": "LINUX DO CDK", "contact": {}, "version": "0.1.0" }, "paths": { "/api/v1/admin/projects": { "get": { "produces": [ "application/json" ], "tags": [ "admin" ], "parameters": [ { "minimum": 1, "type": "integer", "name": "current", "in": "query" }, { "maximum": 100, "minimum": 1, "type": "integer", "name": "size", "in": "query" }, { "enum": [ 0, 1, 2 ], "type": "integer", "format": "int32", "x-enum-varnames": [ "ProjectStatusNormal", "ProjectStatusHidden", "ProjectStatusViolation" ], "name": "status", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/admin.ListProjectsResponse" } } } } }, "/api/v1/admin/projects/{id}/review": { "put": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "admin" ], "parameters": [ { "type": "string", "description": "项目ID", "name": "id", "in": "path", "required": true }, { "description": "项目信息", "name": "project", "in": "body", "required": true, "schema": { "$ref": "#/definitions/admin.ReviewProjectRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/admin.ReviewProjectResponse" } } } } }, "/api/v1/admin/users": { "get": { "produces": [ "application/json" ], "tags": [ "admin" ], "parameters": [ { "minimum": 1, "type": "integer", "name": "current", "in": "query" }, { "type": "boolean", "name": "is_active", "in": "query" }, { "type": "boolean", "name": "is_admin", "in": "query" }, { "type": "integer", "name": "min_violations", "in": "query" }, { "maximum": 100, "minimum": 1, "type": "integer", "name": "size", "in": "query" }, { "enum": [ 0, 1, 2, 3, 4 ], "type": "integer", "format": "int32", "x-enum-varnames": [ "TrustLevelNewUser", "TrustLevelBasicUser", "TrustLevelUser", "TrustLevelActiveUser", "TrustLevelLeader" ], "name": "trust_level", "in": "query" }, { "type": "string", "name": "username", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/admin.listUsersResponse" } } } } }, "/api/v1/dashboard/stats/all": { "get": { "produces": [ "application/json" ], "tags": [ "Dashboard" ], "parameters": [ { "type": "integer", "description": "request query", "name": "days", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/dashboard.DashboardDataResponse" } } } } }, "/api/v1/health": { "get": { "produces": [ "application/json" ], "tags": [ "health" ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/health.HealthResponse" } } } } }, "/api/v1/oauth/callback": { "post": { "produces": [ "application/json" ], "tags": [ "oauth" ], "parameters": [ { "description": "request body", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/oauth.CallbackRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/oauth.CallbackResponse" } } } } }, "/api/v1/oauth/login": { "get": { "produces": [ "application/json" ], "tags": [ "oauth" ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/oauth.GetLoginURLResponse" } } } } }, "/api/v1/oauth/logout": { "get": { "produces": [ "application/json" ], "tags": [ "oauth" ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/oauth.LogoutResponse" } } } } }, "/api/v1/oauth/user-info": { "get": { "produces": [ "application/json" ], "tags": [ "oauth" ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/oauth.UserInfoResponse" } } } } }, "/api/v1/projects": { "get": { "produces": [ "application/json" ], "tags": [ "project" ], "parameters": [ { "minimum": 1, "type": "integer", "name": "current", "in": "query" }, { "maximum": 100, "minimum": 1, "type": "integer", "name": "size", "in": "query" }, { "type": "array", "items": { "type": "string" }, "collectionFormat": "csv", "name": "tags", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/project.ListProjectsResponse" } } } }, "post": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "project" ], "parameters": [ { "description": "项目信息", "name": "project", "in": "body", "required": true, "schema": { "$ref": "#/definitions/project.CreateProjectRequestBody" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/project.ProjectResponse" } } } } }, "/api/v1/projects/mine": { "get": { "produces": [ "application/json" ], "tags": [ "project" ], "parameters": [ { "minimum": 1, "type": "integer", "name": "current", "in": "query" }, { "maximum": 100, "minimum": 1, "type": "integer", "name": "size", "in": "query" }, { "type": "array", "items": { "type": "string" }, "collectionFormat": "csv", "name": "tags", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/project.ListProjectsResponse" } } } } }, "/api/v1/projects/received": { "get": { "produces": [ "application/json" ], "tags": [ "project" ], "parameters": [ { "minimum": 1, "type": "integer", "name": "current", "in": "query" }, { "maxLength": 255, "type": "string", "name": "search", "in": "query" }, { "maximum": 100, "minimum": 1, "type": "integer", "name": "size", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/project.ListReceiveHistoryResponse" } } } } }, "/api/v1/projects/received/chart": { "get": { "produces": [ "application/json" ], "tags": [ "project" ], "parameters": [ { "maximum": 180, "minimum": 1, "type": "integer", "name": "day", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/project.ListReceiveHistoryChartResponse" } } } } }, "/api/v1/projects/{id}": { "get": { "description": "获取指定项目所有信息以及领取情况 (Get all information and claim status for a specific project)", "produces": [ "application/json" ], "tags": [ "project" ], "summary": "获取指定项目信息 (Get specific project information)", "parameters": [ { "type": "string", "description": "项目ID (Project ID)", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "allOf": [ { "$ref": "#/definitions/project.ProjectResponse" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/project.GetProjectResponseData" } } } ] } } } }, "put": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "project" ], "parameters": [ { "type": "string", "description": "项目ID", "name": "id", "in": "path", "required": true }, { "description": "项目信息", "name": "project", "in": "body", "required": true, "schema": { "$ref": "#/definitions/project.UpdateProjectRequestBody" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/project.ProjectResponse" } } } }, "delete": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "project" ], "parameters": [ { "type": "string", "description": "项目ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/project.ProjectResponse" } } } } }, "/api/v1/projects/{id}/pending-payment": { "get": { "description": "只返回指定项目下当前用户已有且未过期的待支付订单,不重新占用库存或刷新有效期", "produces": [ "application/json" ], "tags": [ "payment" ], "summary": "获取当前用户的待支付订单", "parameters": [ { "type": "string", "description": "项目ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "allOf": [ { "$ref": "#/definitions/payment.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/payment.PendingPaymentResponseData" } } } ] } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/payment.Response" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/project.ProjectResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/payment.Response" } } } } }, "/api/v1/projects/{id}/receivers": { "get": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "project" ], "parameters": [ { "type": "string", "description": "项目ID (Project ID)", "name": "id", "in": "path", "required": true }, { "minimum": 1, "type": "integer", "name": "current", "in": "query" }, { "maxLength": 1024, "type": "string", "name": "search", "in": "query" }, { "maximum": 100, "minimum": 1, "type": "integer", "name": "size", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/project.ProjectResponse" } } } } }, "/api/v1/projects/{id}/report": { "post": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "project" ], "parameters": [ { "type": "string", "description": "项目ID", "name": "id", "in": "path", "required": true }, { "description": "举报信息", "name": "project", "in": "body", "required": true, "schema": { "$ref": "#/definitions/project.ReportProjectRequestBody" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/project.ProjectResponse" } } } } }, "/api/v1/ready": { "get": { "produces": [ "application/json" ], "tags": [ "health" ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/health.ReadyResponse" } } } } }, "/api/v1/tags": { "get": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "project" ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/project.ListTagsResponse" } } } } } }, "definitions": { "admin.ListProjectsResponse": { "type": "object", "properties": { "data": { "$ref": "#/definitions/admin.ListProjectsResponseData" }, "error_msg": { "type": "string" } } }, "admin.ListProjectsResponseData": { "type": "object", "properties": { "results": { "type": "array", "items": { "$ref": "#/definitions/admin.ListProjectsResponseDataResult" } }, "total": { "type": "integer" } } }, "admin.ListProjectsResponseDataResult": { "type": "object", "properties": { "description": { "type": "string" }, "id": { "type": "string" }, "nickname": { "type": "string" }, "status": { "$ref": "#/definitions/project.ProjectStatus" }, "tags": { "type": "array", "items": { "type": "string" } }, "username": { "type": "string" } } }, "admin.ReviewProjectRequest": { "type": "object", "properties": { "status": { "enum": [ 0, 1, 2 ], "allOf": [ { "$ref": "#/definitions/project.ProjectStatus" } ] } } }, "admin.ReviewProjectResponse": { "type": "object", "properties": { "data": {}, "error_msg": { "type": "string" } } }, "admin.listUsersResponse": { "type": "object", "properties": { "data": { "type": "object", "properties": { "total": { "type": "integer" }, "users": { "type": "array", "items": { "$ref": "#/definitions/oauth.User" } } } }, "error_msg": { "type": "string" } } }, "dashboard.DashboardDataResponse": { "type": "object", "properties": { "data": {}, "error_msg": { "type": "string" } } }, "health.HealthResponse": { "type": "object", "properties": { "data": {}, "error_msg": { "type": "string" } } }, "health.ReadyResponse": { "type": "object", "properties": { "data": {}, "error_msg": { "type": "string" } } }, "oauth.BasicUserInfo": { "type": "object", "properties": { "avatar_url": { "type": "string" }, "id": { "type": "integer" }, "nickname": { "type": "string" }, "score": { "type": "integer" }, "trust_level": { "$ref": "#/definitions/oauth.TrustLevel" }, "username": { "type": "string" } } }, "oauth.CallbackRequest": { "type": "object", "properties": { "code": { "type": "string" }, "state": { "type": "string" } } }, "oauth.CallbackResponse": { "type": "object", "properties": { "data": {}, "error_msg": { "type": "string" } } }, "oauth.GetLoginURLResponse": { "type": "object", "properties": { "data": { "type": "string" }, "error_msg": { "type": "string" } } }, "oauth.LogoutResponse": { "type": "object", "properties": { "data": {}, "error_msg": { "type": "string" } } }, "oauth.TrustLevel": { "type": "integer", "format": "int32", "enum": [ 0, 1, 2, 3, 4 ], "x-enum-varnames": [ "TrustLevelNewUser", "TrustLevelBasicUser", "TrustLevelUser", "TrustLevelActiveUser", "TrustLevelLeader" ] }, "oauth.User": { "type": "object", "properties": { "avatar_url": { "type": "string" }, "created_at": { "type": "string" }, "id": { "type": "integer" }, "is_active": { "type": "boolean" }, "is_admin": { "type": "boolean" }, "last_login_at": { "type": "string" }, "nickname": { "type": "string" }, "score": { "type": "integer" }, "trust_level": { "$ref": "#/definitions/oauth.TrustLevel" }, "updated_at": { "type": "string" }, "username": { "type": "string" }, "violation_count": { "type": "integer" } } }, "oauth.UserInfoResponse": { "type": "object", "properties": { "data": { "$ref": "#/definitions/oauth.BasicUserInfo" }, "error_msg": { "type": "string" } } }, "payment.PendingPaymentResponseData": { "type": "object", "properties": { "amount": { "type": "string" }, "has_pending": { "type": "boolean" }, "pay_url": { "type": "string" } } }, "payment.Response": { "type": "object", "properties": { "data": {}, "error_msg": { "type": "string" } } }, "project.CreateProjectRequestBody": { "type": "object", "required": [ "end_time", "name", "project_items", "start_time" ], "properties": { "allow_same_ip": { "type": "boolean" }, "description": { "type": "string", "maxLength": 1024 }, "distribution_type": { "enum": [ 0, 1 ], "allOf": [ { "$ref": "#/definitions/project.DistributionType" } ] }, "end_time": { "type": "string" }, "hide_from_explore": { "type": "boolean" }, "minimum_trust_level": { "enum": [ 0, 1, 2, 3, 4 ], "allOf": [ { "$ref": "#/definitions/oauth.TrustLevel" } ] }, "name": { "type": "string", "maxLength": 32, "minLength": 1 }, "price": { "type": "number" }, "project_items": { "type": "array", "minItems": 1, "items": { "type": "string" } }, "project_tags": { "type": "array", "items": { "type": "string" } }, "risk_level": { "type": "integer", "maximum": 100, "minimum": 0 }, "start_time": { "type": "string" }, "topic_id": { "type": "integer" } } }, "project.DistributionType": { "type": "integer", "format": "int32", "enum": [ 0, 1, 2 ], "x-enum-varnames": [ "DistributionTypeOneForEach", "DistributionTypeLottery", "DistributionTypeInvite" ] }, "project.GetProjectResponseData": { "type": "object", "properties": { "allow_same_ip": { "type": "boolean" }, "available_items_count": { "type": "integer" }, "created_at": { "type": "string" }, "creator_id": { "type": "integer" }, "creator_nickname": { "type": "string" }, "creator_username": { "type": "string" }, "description": { "type": "string" }, "distribution_type": { "$ref": "#/definitions/project.DistributionType" }, "end_time": { "type": "string" }, "hide_from_explore": { "type": "boolean" }, "id": { "type": "string" }, "is_completed": { "type": "boolean" }, "is_received": { "type": "boolean" }, "minimum_trust_level": { "$ref": "#/definitions/oauth.TrustLevel" }, "name": { "type": "string" }, "price": { "type": "number" }, "received_content": { "type": "string" }, "report_count": { "type": "integer" }, "risk_level": { "type": "integer" }, "start_time": { "type": "string" }, "status": { "$ref": "#/definitions/project.ProjectStatus" }, "tags": { "type": "array", "items": { "type": "string" } }, "total_items": { "type": "integer" }, "updated_at": { "type": "string" } } }, "project.ListProjectsResponse": { "type": "object", "properties": { "data": { "$ref": "#/definitions/project.ListProjectsResponseData" }, "error_msg": { "type": "string" } } }, "project.ListProjectsResponseData": { "type": "object", "properties": { "results": { "type": "array", "items": { "$ref": "#/definitions/project.ListProjectsResponseDataResult" } }, "total": { "type": "integer" } } }, "project.ListProjectsResponseDataResult": { "type": "object", "properties": { "allow_same_ip": { "type": "boolean" }, "created_at": { "type": "string" }, "description": { "type": "string" }, "distribution_type": { "$ref": "#/definitions/project.DistributionType" }, "end_time": { "type": "string" }, "hide_from_explore": { "type": "boolean" }, "id": { "type": "string" }, "minimum_trust_level": { "$ref": "#/definitions/oauth.TrustLevel" }, "name": { "type": "string" }, "price": { "type": "number" }, "risk_level": { "type": "integer" }, "start_time": { "type": "string" }, "tags": { "type": "array", "items": { "type": "string" } }, "total_items": { "type": "integer" } } }, "project.ListReceiveHistoryChartResponse": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/project.ReceiveHistoryChartPoint" } }, "error_msg": { "type": "string" } } }, "project.ListReceiveHistoryResponse": { "type": "object", "properties": { "data": { "$ref": "#/definitions/project.ListReceiveHistoryResponseData" }, "error_msg": { "type": "string" } } }, "project.ListReceiveHistoryResponseData": { "type": "object", "properties": { "results": { "type": "array", "items": { "$ref": "#/definitions/project.ListReceiveHistoryResponseDataResult" } }, "total": { "type": "integer" } } }, "project.ListReceiveHistoryResponseDataResult": { "type": "object", "properties": { "content": { "type": "string" }, "project_creator": { "type": "string" }, "project_creator_nickname": { "type": "string" }, "project_id": { "type": "string" }, "project_name": { "type": "string" }, "received_at": { "type": "string" } } }, "project.ListTagsResponse": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "string" } }, "error_msg": { "type": "string" } } }, "project.ProjectResponse": { "type": "object", "properties": { "data": {}, "error_msg": { "type": "string" } } }, "project.ProjectStatus": { "type": "integer", "format": "int32", "enum": [ 0, 1, 2 ], "x-enum-varnames": [ "ProjectStatusNormal", "ProjectStatusHidden", "ProjectStatusViolation" ] }, "project.ReceiveHistoryChartPoint": { "type": "object", "properties": { "count": { "type": "integer" }, "date": { "type": "string" }, "label": { "type": "string" } } }, "project.ReportProjectRequestBody": { "type": "object", "required": [ "reason" ], "properties": { "reason": { "type": "string", "maxLength": 255, "minLength": 1 } } }, "project.UpdateProjectRequestBody": { "type": "object", "required": [ "end_time", "name", "start_time" ], "properties": { "allow_same_ip": { "type": "boolean" }, "description": { "type": "string", "maxLength": 1024 }, "enable_filter": { "type": "boolean" }, "end_time": { "type": "string" }, "hide_from_explore": { "type": "boolean" }, "minimum_trust_level": { "enum": [ 0, 1, 2, 3, 4 ], "allOf": [ { "$ref": "#/definitions/oauth.TrustLevel" } ] }, "name": { "type": "string", "maxLength": 32, "minLength": 1 }, "price": { "type": "number" }, "project_items": { "type": "array", "items": { "type": "string" } }, "project_tags": { "type": "array", "items": { "type": "string" } }, "risk_level": { "type": "integer", "maximum": 100, "minimum": 0 }, "start_time": { "type": "string" } } } } }