hackathon/api/v1/gen/json/codequest/all.swagger.json

708 lines
16 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/{body.email}": {
"patch": {
"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": "body.email",
"in": "path",
"required": true,
"type": "string"
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/v1AdminUpdateFields"
}
}
],
"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"
]
}
},
"/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": {
"$ref": "#/definitions/v1DeleteTokenResponse"
}
},
"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"
}
],
"tags": [
"AuthService"
]
}
},
"/v1/questions": {
"get": {
"summary": "Questions returns the list of available questions.\nEach question is also listed with whether it has been answered, and\nthe points awarded for answering it correctly.",
"description": "The Text field will not be populated. To get the text, use QuestionByID.",
"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/leaderboard": {
"get": {
"summary": "Leaderboard returns the global ranking of all participatants.\nThe leaderboard is sorted by score, descending.",
"operationId": "QuestService_Leaderboard",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/v1LeaderboardResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"tags": [
"QuestService"
]
}
},
"/v1/questions/{id}": {
"get": {
"summary": "QuestionByID returns the question with the given ID.",
"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"
]
}
},
"/v1/questions/{id}/input": {
"get": {
"summary": "QuestionInput returns the question input for the given question.\nThe input is the same for part 1 and part 2.",
"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/questions/{id}/{part}": {
"post": {
"summary": "Submit submits the answer to the given question and part.",
"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": "part",
"in": "path",
"required": true,
"type": "integer",
"format": "int32"
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/v1SubmitRequestData"
}
}
],
"tags": [
"QuestService"
]
}
},
"/v1/users/me": {
"get": {
"operationId": "UserService_Info",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/v1Info"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"tags": [
"UserService"
]
},
"patch": {
"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"
}
}
],
"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"
}
}
}
},
"v1AdminUpdateFields": {
"type": "object",
"properties": {
"email": {
"type": "string"
},
"name": {
"type": "string"
},
"gradeLevel": {
"type": "integer",
"format": "int32"
},
"admin": {
"type": "boolean"
}
}
},
"v1AllUsersResponse": {
"type": "object",
"properties": {
"users": {
"type": "array",
"items": {
"$ref": "#/definitions/v1User"
}
}
}
},
"v1DeleteTokenResponse": {
"type": "object"
},
"v1Difficulty": {
"type": "string",
"enum": [
"Level1",
"Level2"
],
"default": "Level1"
},
"v1Info": {
"type": "object",
"properties": {
"currentUser": {
"$ref": "#/definitions/v1User"
},
"active": {
"type": "boolean"
},
"points": {
"type": "integer",
"format": "int32"
},
"startTime": {
"type": "string"
},
"endTime": {
"type": "string"
}
},
"description": "Info is the current information about the competition."
},
"v1LeaderboardEntry": {
"type": "object",
"properties": {
"username": {
"type": "string"
},
"points": {
"type": "integer",
"format": "int32"
}
}
},
"v1LeaderboardResponse": {
"type": "object",
"properties": {
"leaderboard": {
"type": "array",
"items": {
"$ref": "#/definitions/v1LeaderboardEntry"
}
}
}
},
"v1OAuthCodeResponse": {
"type": "object",
"properties": {
"redirectURI": {
"type": "string"
}
}
},
"v1PartData": {
"type": "object",
"properties": {
"completed": {
"type": "boolean"
},
"pointsWorth": {
"type": "integer",
"format": "int32"
}
}
},
"v1Question": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"title": {
"type": "string"
},
"text": {
"type": "string"
},
"difficulty": {
"$ref": "#/definitions/v1Difficulty"
},
"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"
},
"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"
}
}
},
"v1UpdateFields": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"gradeLevel": {
"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."
},
"createdAt": {
"type": "string",
"description": "CreatedAt is the time the user was created."
}
},
"description": "User is a contestant in the competition."
}
}
}