Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrConnClosed = errors.New("connection closed")
var ErrNotSubscribed = errors.New("not subscribed to channel")
Functions ¶
func AccessToken ¶
AccessToken returns an access token from the kahoot rest api.
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
func NewConn ¶
NewConn connects to the kahoot server and performs a handshake using a given game pin.
func (*Conn) Close ¶
func (c *Conn) Close()
Close terminates the connection, waiting synchronously for the incoming channels to close.
func (*Conn) GracefulClose ¶
func (c *Conn) GracefulClose()
GracefulClose closes the connection gracefully, telling the other end that we are disconnecting.
func (*Conn) Receive ¶
Receive returns the next message on a given channel. You must Subscribe() to the channel before Receiving on it.
type Quiz ¶
type Quiz struct {
// contains filtered or unexported fields
}
func (*Quiz) Receive ¶
func (q *Quiz) Receive() (*QuizAction, error)
Receive receives the next QuizAction. This may be a QuestionIntro, indicating a new question is starting, or QuestionAnswers, indicating that the user may now submit an answer.
type QuizAction ¶
type QuizAction struct {
Type QuizActionType
NumAnswers int
Index int
AnswerMap map[int]int
}
type QuizActionType ¶
type QuizActionType int
const ( QuestionIntro QuizActionType = iota QuestionAnswers )
type QuizChoice ¶
QuizChoice represents a possible answer for a QuizQuestion.
type QuizInfo ¶
type QuizInfo struct {
Uuid string `json:"uuid"`
QuizType string `json:"quizType"`
Cover string `json:"cover"`
Modified int64 `json:"modified"`
Creator string `json:"creator"`
Audience string `json:"audience"`
Title string `json:"title"`
Description string `json:"description"`
Type string `json:"type"`
Created int64 `json:"created"`
Language string `json:"language"`
CreatorPrimaryUsage string `json:"creator_primary_usage"`
Questions []QuizQuestion `json:"questions"`
Image string `json:"image"`
Video QuizVideo `json:"video"`
Metadata QuizMetadata `json:"metadata"`
Resources string `json:"resources"`
CreatorUsername string `json:"creator_username"`
Visibility int64 `json:"visibility"`
}
QuizInfo stores information about a quiz, including the correct answers.
func QuizInformation ¶
QuizInformation returns all quiz information for a specific kahoot id.
type QuizMetadata ¶
type QuizMetadata struct {
Resolution string `json:"resolution"`
Moderation QuizModeration `json:"moderation"`
}
QuizMetadata stores metadata about a quiz.
type QuizModeration ¶
type QuizModeration struct {
FlaggedTimestamp float64 `json:"flaggedTimestamp"`
TimestampResolution float64 `json:"timestampResolution"`
Resolution string `json:"resolution"`
}
QuizModeration stores moderator information for a quiz.
type QuizQuestion ¶
type QuizQuestion struct {
NumberOfAnswers int `json:"numberOfAnswers"`
Image string `json:"image"`
Video QuizVideo `json:"video"`
Question string `json:"question"`
QuestionFormat int `json:"questionFormat"`
Time int `json:"time"`
Points bool `json:"points"`
Choices []QuizChoice `json:"choices"`
Resources string `json:"resources"`
Type string `json:"type"`
}
QuizQuestion is a question in a quiz.