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"
]
}
} ,
2022-04-28 23:31:09 +07:00
"/v1/admin/users/{body.email}" : {
"patch" : {
"operationId" : "UserService_AdminUpdateUser" ,
2021-12-19 15:30:21 +07:00
"responses" : {
"200" : {
"description" : "A successful response." ,
"schema" : {
"$ref" : "#/definitions/v1User"
}
} ,
"default" : {
"description" : "An unexpected error response." ,
"schema" : {
"$ref" : "#/definitions/rpcStatus"
}
}
} ,
"parameters" : [
{
2022-04-28 23:31:09 +07:00
"name" : "body.email" ,
2021-12-19 15:30:21 +07:00
"in" : "path" ,
"required" : true ,
"type" : "string"
2022-04-28 23:31:09 +07:00
} ,
{
"name" : "body" ,
"in" : "body" ,
"required" : true ,
"schema" : {
"$ref" : "#/definitions/v1AdminUpdateFields"
}
2021-12-19 15:30:21 +07:00
}
] ,
"tags" : [
"UserService"
]
2022-04-28 23:31:09 +07:00
}
} ,
"/v1/admin/users/{email}" : {
"get" : {
"operationId" : "UserService_UserByEmail" ,
2021-12-19 15:30:21 +07:00
"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"
]
} ,
2022-04-28 23:31:09 +07:00
"delete" : {
"operationId" : "UserService_DeleteUser" ,
2021-12-19 15:30:21 +07:00
"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" : {
2022-04-28 23:31:09 +07:00
"$ref" : "#/definitions/v1DeleteTokenResponse"
2021-12-19 15:30:21 +07:00
}
} ,
"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 ,
2022-04-28 23:31:09 +07:00
"type" : "string"
2021-12-19 15:30:21 +07:00
}
] ,
"tags" : [
"AuthService"
]
}
} ,
2021-12-21 10:18:12 +07:00
"/v1/questions" : {
"get" : {
2022-04-28 23:31:09 +07:00
"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." ,
2021-12-21 10:18:12 +07:00
"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"
]
}
} ,
2022-04-28 23:31:09 +07:00
"/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"
]
}
} ,
2021-12-21 10:18:12 +07:00
"/v1/questions/{id}" : {
"get" : {
2022-04-28 23:31:09 +07:00
"summary" : "QuestionByID returns the question with the given ID." ,
2021-12-21 10:18:12 +07:00
"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"
]
2022-04-28 23:31:09 +07:00
}
} ,
"/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" ,
2021-12-21 10:18:12 +07:00
"responses" : {
"200" : {
"description" : "A successful response." ,
"schema" : {
2022-04-28 23:31:09 +07:00
"$ref" : "#/definitions/v1QuestionInput"
2021-12-21 10:18:12 +07:00
}
} ,
"default" : {
"description" : "An unexpected error response." ,
"schema" : {
"$ref" : "#/definitions/rpcStatus"
}
}
} ,
"parameters" : [
{
"name" : "id" ,
"in" : "path" ,
"required" : true ,
"type" : "string"
}
] ,
"tags" : [
"QuestService"
]
}
} ,
2022-04-28 23:31:09 +07:00
"/v1/questions/{id}/{part}" : {
"post" : {
"summary" : "Submit submits the answer to the given question and part." ,
"operationId" : "QuestService_Submit" ,
2021-12-21 10:18:12 +07:00
"responses" : {
"200" : {
"description" : "A successful response." ,
"schema" : {
2022-04-28 23:31:09 +07:00
"$ref" : "#/definitions/v1SubmitResponse"
2021-12-21 10:18:12 +07:00
}
} ,
"default" : {
"description" : "An unexpected error response." ,
"schema" : {
"$ref" : "#/definitions/rpcStatus"
}
}
} ,
"parameters" : [
{
"name" : "id" ,
"in" : "path" ,
"required" : true ,
"type" : "string"
2022-04-28 23:31:09 +07:00
} ,
{
"name" : "part" ,
"in" : "path" ,
"required" : true ,
"type" : "integer" ,
"format" : "int32"
} ,
{
"name" : "body" ,
"in" : "body" ,
"required" : true ,
"schema" : {
"$ref" : "#/definitions/v1SubmitRequestData"
}
2021-12-21 10:18:12 +07:00
}
] ,
"tags" : [
"QuestService"
]
}
} ,
2021-12-19 15:30:21 +07:00
"/v1/users/me" : {
"get" : {
2022-04-28 23:31:09 +07:00
"operationId" : "UserService_Info" ,
2021-12-19 15:30:21 +07:00
"responses" : {
"200" : {
"description" : "A successful response." ,
"schema" : {
2022-04-28 23:31:09 +07:00
"$ref" : "#/definitions/v1Info"
2021-12-19 15:30:21 +07:00
}
} ,
"default" : {
"description" : "An unexpected error response." ,
"schema" : {
"$ref" : "#/definitions/rpcStatus"
}
}
} ,
"tags" : [
"UserService"
]
} ,
2022-04-28 23:31:09 +07:00
"patch" : {
2021-12-19 15:30:21 +07:00
"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"
}
}
}
} ,
2022-04-28 23:31:09 +07:00
"v1AdminUpdateFields" : {
"type" : "object" ,
"properties" : {
"email" : {
"type" : "string"
} ,
"name" : {
"type" : "string"
} ,
"gradeLevel" : {
"type" : "integer" ,
"format" : "int32"
} ,
"admin" : {
"type" : "boolean"
}
}
} ,
2021-12-19 15:30:21 +07:00
"v1AllUsersResponse" : {
"type" : "object" ,
"properties" : {
"users" : {
"type" : "array" ,
"items" : {
"$ref" : "#/definitions/v1User"
}
}
}
} ,
2022-04-28 23:31:09 +07:00
"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"
}
}
}
} ,
2021-12-19 15:30:21 +07:00
"v1OAuthCodeResponse" : {
"type" : "object" ,
"properties" : {
2022-04-28 23:31:09 +07:00
"redirectURI" : {
2021-12-19 15:30:21 +07:00
"type" : "string"
}
}
} ,
2021-12-21 10:18:12 +07:00
"v1PartData" : {
"type" : "object" ,
"properties" : {
"completed" : {
"type" : "boolean"
} ,
2022-04-28 23:31:09 +07:00
"pointsWorth" : {
2021-12-21 10:18:12 +07:00
"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"
} ,
2022-04-28 23:31:09 +07:00
"difficulty" : {
"$ref" : "#/definitions/v1Difficulty"
} ,
2021-12-21 10:18:12 +07:00
"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"
} ,
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" : {
2022-04-28 23:31:09 +07:00
"type" : "string"
2021-12-19 15:30:21 +07:00
}
}
} ,
"v1UpdateFields" : {
"type" : "object" ,
"properties" : {
"name" : {
"type" : "string"
} ,
2022-04-28 23:31:09 +07:00
"gradeLevel" : {
2021-12-19 15:30:21 +07:00
"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."
} ,
2022-04-28 23:31:09 +07:00
"createdAt" : {
2021-12-19 15:30:21 +07:00
"type" : "string" ,
"description" : "CreatedAt is the time the user was created."
}
} ,
"description" : "User is a contestant in the competition."
}
}
}