Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Categories ¶
type OpenTDB ¶
type OpenTDB struct {
// contains filtered or unexported fields
}
func (*OpenTDB) GetCategories ¶
func (o *OpenTDB) GetCategories() ([]Categories, error)
Get List of Categories from OpenTDB
func (*OpenTDB) GetCategoryCount ¶
Gets Question Count for a given category Id
func (*OpenTDB) GetQuestions ¶
func (o *OpenTDB) GetQuestions(params QuestionParams) ([]Question, error)
Get Questions based on Amount, Category, Difficulty and Type
func (*OpenTDB) GetSessionToken ¶
Retrieve a Session Token
type Question ¶
type Question struct {
CategoryName string `json:"category"`
QuestionType QuestionType `json:"type"`
QuestionDifficulty QuestionDifficulty `json:"difficulty"`
Question string `json:"question"`
CorrectAnswer string `json:"correct_answer"`
IncorrectAnswers []string `json:"incorrect_answers"`
}
type QuestionDifficulty ¶
type QuestionDifficulty string
const ( Easy QuestionDifficulty = "easy" Medium QuestionDifficulty = "medium" Hard QuestionDifficulty = "hard" )
type QuestionParams ¶
type QuestionParams struct {
Amount int64 `default:"10"`
Category int64 `default:"-1"`
QuestionDifficulty QuestionDifficulty `default:""`
QuestionType QuestionType `default:""`
Encoding `default:""`
Token string `default:""`
}
type QuestionType ¶
type QuestionType string
const ( Multiple QuestionType = "multiple" Boolean QuestionType = "boolean" )
type ResponseCode ¶
type ResponseCode int
const ( Success ResponseCode = 0 NoResults ResponseCode = 1 InvalidParameter ResponseCode = 2 TokenNotFound ResponseCode = 3 TokenEmpty ResponseCode = 4 )
Click to show internal directories.
Click to hide internal directories.