https://github.com/pinheirolucas/opentrivia
API client for Open Trivia DB: https://opentdb.com/
https://github.com/pinheirolucas/opentrivia
api-client client golang http trivia
Last synced: 6 months ago
JSON representation
API client for Open Trivia DB: https://opentdb.com/
- Host: GitHub
- URL: https://github.com/pinheirolucas/opentrivia
- Owner: pinheirolucas
- License: mit
- Created: 2017-06-16T20:28:35.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-06-19T00:18:27.000Z (about 9 years ago)
- Last Synced: 2025-12-16T03:19:49.232Z (8 months ago)
- Topics: api-client, client, golang, http, trivia
- Language: Go
- Size: 43 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# opentrivia
This repository contains an API client for [Open Trivia DB](https://opentdb.com/).
opentrivia was developed under golang version 1.8 and not tested on previous versions of the
language.
## Usage
### opentrivia ([godoc](https://godoc.org/github.com/pinheirolucas/opentrivia))
go get github.com/pinheirolucas/opentrivia
Construct a new Open Trivia API client, then use the services on the client to access
different parts of the API. For example:
```go
client := opentrivia.DefaultClient
// list 10 random questions
questions, err := client.Question.List(nil)
```
Some API methods have optional parameters that can be passed. For example:
```go
client := opentrivia.DefaultClient
// list 20 questions with difficulty easy
options := &opentrivia.QuestionListOptions{
Difficulty: opentrivia.QuestionDifficultyEasy,
Limit: 20,
}
questions, err := client.Question.List(options)
```
## License
This library is distributed under the MIT license found in the
[LICENSE](https://github.com/pinheirolucas/opentrivia/blob/master/LICENSE) file.