trivia

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 2, 2025 License: BSD-2-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TriviaUrl = "https://opentdb.com/api.php?amount=50&difficulty=easy&type=multiple"
)

Functions

This section is empty.

Types

type Difficulty

type Difficulty string
const (
	Medium Difficulty = "medium"
)

type Result

type Result struct {
	Type             Type       `json:"type"`
	Difficulty       Difficulty `json:"difficulty"`
	Category         string     `json:"category"`
	Question         string     `json:"question"`
	CorrectAnswer    string     `json:"correct_answer"`
	IncorrectAnswers []string   `json:"incorrect_answers"`
}

func GetNextTriviaQuestions

func GetNextTriviaQuestions(ctx context.Context) ([]Result, error)

func GetTriviaQuestions

func GetTriviaQuestions(ctx context.Context, url string) ([]Result, error)

type TriviaResponse

type TriviaResponse struct {
	ResponseCode int64    `json:"response_code"`
	Results      []Result `json:"results"`
}

type Type

type Type string
const (
	Multiple Type = "multiple"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL