2021-12-19 15:30:21 +07:00
|
|
|
{
|
|
|
|
"swagger": "2.0",
|
|
|
|
"info": {
|
|
|
|
"title": "github.com/hhhapz/codequest/api/v1/all.proto",
|
|
|
|
"version": "version not set"
|
|
|
|
},
|
|
|
|
"tags": [
|
|
|
|
{
|
|
|
|
"name": "AuthService"
|
|
|
|
},
|
2021-12-21 10:18:12 +07:00
|
|
|
{
|
|
|
|
"name": "QuestService"
|
|
|
|
},
|
2021-12-19 15:30:21 +07:00
|
|
|
{
|
|
|
|
"name": "UserService"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"consumes": [
|
|
|
|
"application/json"
|
|
|
|
],
|
|
|
|
"produces": [
|
|
|
|
"application/json"
|
|
|
|
],
|
|
|
|
"paths": {
|
|
|
|
"/v1/admin/users": {
|
|
|
|
"get": {
|
|
|
|
"operationId": "UserService_AllUsers",
|
|
|
|
"responses": {
|
|
|
|
"200": {
|
|
|
|
"description": "A successful response.",
|
|
|
|
"schema": {
|
|
|
|
"$ref": "#/definitions/v1AllUsersResponse"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"default": {
|
|
|
|
"description": "An unexpected error response.",
|
|
|
|
"schema": {
|
|
|
|
"$ref": "#/definitions/rpcStatus"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"tags": [
|
|
|
|
"UserService"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"/v1/admin/users/{email}": {
|
|
|
|
"get": {
|
|
|
|
"operationId": "UserService_UserByEmail",
|
|
|
|
"responses": {
|
|
|
|
"200": {
|
|
|
|
"description": "A successful response.",
|
|
|
|
"schema": {
|
|
|
|
"$ref": "#/definitions/v1User"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"default": {
|
|
|
|
"description": "An unexpected error response.",
|
|
|
|
"schema": {
|
|
|
|
"$ref": "#/definitions/rpcStatus"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"parameters": [
|
|
|
|
{
|
|
|
|
"name": "email",
|
|
|
|
"in": "path",
|
|
|
|
"required": true,
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"tags": [
|
|
|
|
"UserService"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"delete": {
|
|
|
|
"operationId": "UserService_DeleteUser",
|
|
|
|
"responses": {
|
|
|
|
"200": {
|
|
|
|
"description": "A successful response.",
|
|
|
|
"schema": {
|
|
|
|
"$ref": "#/definitions/v1User"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"default": {
|
|
|
|
"description": "An unexpected error response.",
|
|
|
|
"schema": {
|
|
|
|
"$ref": "#/definitions/rpcStatus"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"parameters": [
|
|
|
|
{
|
|
|
|
"name": "email",
|
|
|
|
"in": "path",
|
|
|
|
"required": true,
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"tags": [
|
|
|
|
"UserService"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"put": {
|
|
|
|
"operationId": "UserService_AdminUpdateUser",
|
|
|
|
"responses": {
|
|
|
|
"200": {
|
|
|
|
"description": "A successful response.",
|
|
|
|
"schema": {
|
|
|
|
"$ref": "#/definitions/v1User"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"default": {
|
|
|
|
"description": "An unexpected error response.",
|
|
|
|
"schema": {
|
|
|
|
"$ref": "#/definitions/rpcStatus"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"parameters": [
|
|
|
|
{
|
|
|
|
"name": "email",
|
|
|
|
"in": "path",
|
|
|
|
"required": true,
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "body",
|
|
|
|
"in": "body",
|
|
|
|
"required": true,
|
|
|
|
"schema": {
|
|
|
|
"$ref": "#/definitions/v1UpdateFields"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"tags": [
|
|
|
|
"UserService"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"/v1/auth/code": {
|
|
|
|
"get": {
|
|
|
|
"operationId": "AuthService_OAuthCode",
|
|
|
|
"responses": {
|
|
|
|
"200": {
|
|
|
|
"description": "A successful response.",
|
|
|
|
"schema": {
|
|
|
|
"$ref": "#/definitions/v1OAuthCodeResponse"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"default": {
|
|
|
|
"description": "An unexpected error response.",
|
|
|
|
"schema": {
|
|
|
|
"$ref": "#/definitions/rpcStatus"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"tags": [
|
|
|
|
"AuthService"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"/v1/auth/token": {
|
|
|
|
"get": {
|
|
|
|
"operationId": "AuthService_Token",
|
|
|
|
"responses": {
|
|
|
|
"200": {
|
|
|
|
"description": "A successful response.",
|
|
|
|
"schema": {
|
|
|
|
"$ref": "#/definitions/v1Token"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"default": {
|
|
|
|
"description": "An unexpected error response.",
|
|
|
|
"schema": {
|
|
|
|
"$ref": "#/definitions/rpcStatus"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"parameters": [
|
|
|
|
{
|
|
|
|
"name": "code",
|
|
|
|
"in": "query",
|
|
|
|
"required": false,
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "state",
|
|
|
|
"in": "query",
|
|
|
|
"required": false,
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"tags": [
|
|
|
|
"AuthService"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"delete": {
|
|
|
|
"operationId": "AuthService_DeleteToken",
|
|
|
|
"responses": {
|
|
|
|
"200": {
|
|
|
|
"description": "A successful response.",
|
|
|
|
"schema": {
|
|
|
|
"properties": {}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"default": {
|
|
|
|
"description": "An unexpected error response.",
|
|
|
|
"schema": {
|
|
|
|
"$ref": "#/definitions/rpcStatus"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"parameters": [
|
|
|
|
{
|
|
|
|
"name": "all",
|
|
|
|
"in": "query",
|
|
|
|
"required": false,
|
|
|
|
"type": "boolean"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "token.token",
|
|
|
|
"in": "query",
|
|
|
|
"required": false,
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "token.expires",
|
|
|
|
"in": "query",
|
|
|
|
"required": false,
|
|
|
|
"type": "string",
|
|
|
|
"format": "date-time"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"tags": [
|
|
|
|
"AuthService"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
2021-12-21 10:18:12 +07:00
|
|
|
"/v1/questions": {
|
|
|
|
"get": {
|
|
|
|
"operationId": "QuestService_Questions",
|
|
|
|
"responses": {
|
|
|
|
"200": {
|
|
|
|
"description": "A successful response.",
|
|
|
|
"schema": {
|
|
|
|
"$ref": "#/definitions/v1QuestionsResponse"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"default": {
|
|
|
|
"description": "An unexpected error response.",
|
|
|
|
"schema": {
|
|
|
|
"$ref": "#/definitions/rpcStatus"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"tags": [
|
|
|
|
"QuestService"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"/v1/questions/{id}": {
|
|
|
|
"get": {
|
|
|
|
"operationId": "QuestService_QuestionByID",
|
|
|
|
"responses": {
|
|
|
|
"200": {
|
|
|
|
"description": "A successful response.",
|
|
|
|
"schema": {
|
|
|
|
"$ref": "#/definitions/v1Question"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"default": {
|
|
|
|
"description": "An unexpected error response.",
|
|
|
|
"schema": {
|
|
|
|
"$ref": "#/definitions/rpcStatus"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"parameters": [
|
|
|
|
{
|
|
|
|
"name": "id",
|
|
|
|
"in": "path",
|
|
|
|
"required": true,
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"tags": [
|
|
|
|
"QuestService"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"post": {
|
|
|
|
"operationId": "QuestService_Submit",
|
|
|
|
"responses": {
|
|
|
|
"200": {
|
|
|
|
"description": "A successful response.",
|
|
|
|
"schema": {
|
|
|
|
"$ref": "#/definitions/v1SubmitResponse"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"default": {
|
|
|
|
"description": "An unexpected error response.",
|
|
|
|
"schema": {
|
|
|
|
"$ref": "#/definitions/rpcStatus"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"parameters": [
|
|
|
|
{
|
|
|
|
"name": "id",
|
|
|
|
"in": "path",
|
|
|
|
"required": true,
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
{
|
2021-12-23 03:09:24 +07:00
|
|
|
"name": "body",
|
|
|
|
"in": "body",
|
|
|
|
"required": true,
|
|
|
|
"schema": {
|
|
|
|
"$ref": "#/definitions/v1SubmitRequestData"
|
|
|
|
}
|
2021-12-21 10:18:12 +07:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"tags": [
|
|
|
|
"QuestService"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"/v1/questions/{id}/input": {
|
|
|
|
"get": {
|
|
|
|
"operationId": "QuestService_QuestionInput",
|
|
|
|
"responses": {
|
|
|
|
"200": {
|
|
|
|
"description": "A successful response.",
|
|
|
|
"schema": {
|
|
|
|
"$ref": "#/definitions/v1QuestionInput"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"default": {
|
|
|
|
"description": "An unexpected error response.",
|
|
|
|
"schema": {
|
|
|
|
"$ref": "#/definitions/rpcStatus"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"parameters": [
|
|
|
|
{
|
|
|
|
"name": "id",
|
|
|
|
"in": "path",
|
|
|
|
"required": true,
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"tags": [
|
|
|
|
"QuestService"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
2021-12-19 15:30:21 +07:00
|
|
|
"/v1/users/me": {
|
|
|
|
"get": {
|
|
|
|
"operationId": "UserService_User",
|
|
|
|
"responses": {
|
|
|
|
"200": {
|
|
|
|
"description": "A successful response.",
|
|
|
|
"schema": {
|
|
|
|
"$ref": "#/definitions/v1User"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"default": {
|
|
|
|
"description": "An unexpected error response.",
|
|
|
|
"schema": {
|
|
|
|
"$ref": "#/definitions/rpcStatus"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"tags": [
|
|
|
|
"UserService"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"put": {
|
|
|
|
"operationId": "UserService_UpdateUser",
|
|
|
|
"responses": {
|
|
|
|
"200": {
|
|
|
|
"description": "A successful response.",
|
|
|
|
"schema": {
|
|
|
|
"$ref": "#/definitions/v1User"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"default": {
|
|
|
|
"description": "An unexpected error response.",
|
|
|
|
"schema": {
|
|
|
|
"$ref": "#/definitions/rpcStatus"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"parameters": [
|
|
|
|
{
|
|
|
|
"name": "body",
|
|
|
|
"in": "body",
|
|
|
|
"required": true,
|
|
|
|
"schema": {
|
|
|
|
"$ref": "#/definitions/v1UpdateFields"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "email",
|
|
|
|
"in": "query",
|
|
|
|
"required": false,
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"tags": [
|
|
|
|
"UserService"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"definitions": {
|
|
|
|
"protobufAny": {
|
|
|
|
"type": "object",
|
|
|
|
"properties": {
|
|
|
|
"@type": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"additionalProperties": {}
|
|
|
|
},
|
|
|
|
"rpcStatus": {
|
|
|
|
"type": "object",
|
|
|
|
"properties": {
|
|
|
|
"code": {
|
|
|
|
"type": "integer",
|
|
|
|
"format": "int32"
|
|
|
|
},
|
|
|
|
"message": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"details": {
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"$ref": "#/definitions/protobufAny"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"v1AllUsersResponse": {
|
|
|
|
"type": "object",
|
|
|
|
"properties": {
|
|
|
|
"users": {
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"$ref": "#/definitions/v1User"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"v1OAuthCodeResponse": {
|
|
|
|
"type": "object",
|
|
|
|
"properties": {
|
|
|
|
"redirect_uri": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2021-12-21 10:18:12 +07:00
|
|
|
"v1PartData": {
|
|
|
|
"type": "object",
|
|
|
|
"properties": {
|
|
|
|
"completed": {
|
|
|
|
"type": "boolean"
|
|
|
|
},
|
|
|
|
"points_worth": {
|
|
|
|
"type": "integer",
|
|
|
|
"format": "int32"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"v1Question": {
|
|
|
|
"type": "object",
|
|
|
|
"properties": {
|
|
|
|
"id": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"title": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
2021-12-22 14:38:22 +07:00
|
|
|
"text": {
|
2021-12-21 10:18:12 +07:00
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"part1": {
|
|
|
|
"$ref": "#/definitions/v1PartData"
|
|
|
|
},
|
|
|
|
"part2": {
|
|
|
|
"$ref": "#/definitions/v1PartData"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"v1QuestionInput": {
|
|
|
|
"type": "object",
|
|
|
|
"properties": {
|
|
|
|
"id": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"input": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"v1QuestionsResponse": {
|
|
|
|
"type": "object",
|
|
|
|
"properties": {
|
|
|
|
"questions": {
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"$ref": "#/definitions/v1Question"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2021-12-23 03:09:24 +07:00
|
|
|
"v1SubmitRequestData": {
|
2021-12-21 10:18:12 +07:00
|
|
|
"type": "object",
|
|
|
|
"properties": {
|
2021-12-23 03:09:24 +07:00
|
|
|
"answer": {
|
2021-12-21 10:18:12 +07:00
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"part": {
|
|
|
|
"type": "integer",
|
|
|
|
"format": "int32"
|
|
|
|
},
|
2021-12-23 03:09:24 +07:00
|
|
|
"code": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"v1SubmitResponse": {
|
|
|
|
"type": "object",
|
|
|
|
"properties": {
|
2021-12-21 10:18:12 +07:00
|
|
|
"correct": {
|
|
|
|
"type": "boolean"
|
|
|
|
},
|
|
|
|
"points": {
|
|
|
|
"type": "integer",
|
|
|
|
"format": "int32"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2021-12-19 15:30:21 +07:00
|
|
|
"v1Token": {
|
|
|
|
"type": "object",
|
|
|
|
"properties": {
|
|
|
|
"token": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"expires": {
|
|
|
|
"type": "string",
|
|
|
|
"format": "date-time"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"v1UpdateFields": {
|
|
|
|
"type": "object",
|
|
|
|
"properties": {
|
|
|
|
"name": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"grade_level": {
|
|
|
|
"type": "integer",
|
|
|
|
"format": "int32"
|
|
|
|
},
|
|
|
|
"admin": {
|
|
|
|
"type": "boolean"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"v1User": {
|
|
|
|
"type": "object",
|
|
|
|
"properties": {
|
|
|
|
"id": {
|
|
|
|
"type": "string",
|
|
|
|
"description": "ID of the user. Received via Google's OAuth2 API."
|
|
|
|
},
|
|
|
|
"name": {
|
|
|
|
"type": "string",
|
|
|
|
"description": "Name of the user."
|
|
|
|
},
|
|
|
|
"email": {
|
|
|
|
"type": "string",
|
|
|
|
"description": "Email of the user."
|
|
|
|
},
|
|
|
|
"picture": {
|
|
|
|
"type": "string",
|
|
|
|
"description": "Picture is the URL of the user's profile picture."
|
|
|
|
},
|
|
|
|
"admin": {
|
|
|
|
"type": "boolean",
|
|
|
|
"description": "Admin is true if the user is an administrator."
|
|
|
|
},
|
|
|
|
"created_at": {
|
|
|
|
"type": "string",
|
|
|
|
"format": "date-time",
|
|
|
|
"description": "CreatedAt is the time the user was created."
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"description": "User is a contestant in the competition."
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|