package codequest import ( "github.com/gunk/opt/http" "github.com/gunk/opt/openapiv2" "github.com/gunk/opt/proto" "time" ) type QuestService interface { // +gunk http.Match{ // Method: "GET", // Path: "/v1/questions", // } Questions() QuestionsResponse // +gunk http.Match{ // Method: "GET", // Path: "/v1/questions/{ID}", // } QuestionByID(QuestionByIDRequest) Question // +gunk http.Match{ // Method: "GET", // Path: "/v1/questions/{ID}/input", // } QuestionInput(QuestionInputRequest) QuestionInput // +gunk http.Match{ // Method: "POST", // Path: "/v1/questions/{ID}", // } Submit(SubmitRequest) SubmitResponse } type PartData struct { Part int `pb:"1" json:"part"` Completed bool `pb:"2" json:"completed"` PointsWorth int `pb:"3" json:"points_worth"` } type Question struct { ID string `pb:"1" json:"id"` Title string `pb:"2" json:"title"` Content string `pb:"3" json:"content"` Part1 PartData `pb:"4" json:"part1"` Part2 PartData `pb:"5" json:"part2"` } type QuestionsResponse struct { Questions []Question `pb:"1" json:"questions"` } type QuestionByIDRequest struct { ID string `pb:"1" json:"id"` } type QuestionInputRequest struct { ID string `pb:"1" json:"id"` } type QuestionInput struct { ID string `pb:"1" json:"id"` Input string `pb:"2" json:"input"` } type SubmitRequest struct { ID string `pb:"1" json:"id"` Answer string `pb:"2" json:"content"` Part bool `pb:"3" json:"part"` Code string `pb:"4" json:"code"` } type SubmitResponse struct { ID string `pb:"1" json:"id"` Part int `pb:"2" json:"part"` Correct bool `pb:"3" json:"correct"` Ranking int `pb:"4" json:"ranking"` Points int `pb:"5" json:"points"` }