605 lines
14 KiB
JSON
605 lines
14 KiB
JSON
{
|
|
"swagger": "2.0",
|
|
"info": {
|
|
"title": "github.com/hhhapz/codequest/api/v1/all.proto",
|
|
"version": "version not set"
|
|
},
|
|
"tags": [
|
|
{
|
|
"name": "AuthService"
|
|
},
|
|
{
|
|
"name": "QuestService"
|
|
},
|
|
{
|
|
"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"
|
|
]
|
|
}
|
|
},
|
|
"/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"
|
|
},
|
|
{
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/v1SubmitRequestData"
|
|
}
|
|
}
|
|
],
|
|
"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"
|
|
]
|
|
}
|
|
},
|
|
"/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"
|
|
}
|
|
}
|
|
},
|
|
"v1PartData": {
|
|
"type": "object",
|
|
"properties": {
|
|
"completed": {
|
|
"type": "boolean"
|
|
},
|
|
"points_worth": {
|
|
"type": "integer",
|
|
"format": "int32"
|
|
}
|
|
}
|
|
},
|
|
"v1Question": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"title": {
|
|
"type": "string"
|
|
},
|
|
"text": {
|
|
"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"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"v1SubmitRequestData": {
|
|
"type": "object",
|
|
"properties": {
|
|
"answer": {
|
|
"type": "string"
|
|
},
|
|
"part": {
|
|
"type": "integer",
|
|
"format": "int32"
|
|
},
|
|
"code": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"v1SubmitResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"correct": {
|
|
"type": "boolean"
|
|
},
|
|
"points": {
|
|
"type": "integer",
|
|
"format": "int32"
|
|
}
|
|
}
|
|
},
|
|
"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."
|
|
}
|
|
}
|
|
}
|