https://github.com/icelain/jokeapi
Official golang wrapper for Sv443's jokeapi.
https://github.com/icelain/jokeapi
api-client api-wrapper go golang jokeapi
Last synced: 8 months ago
JSON representation
Official golang wrapper for Sv443's jokeapi.
- Host: GitHub
- URL: https://github.com/icelain/jokeapi
- Owner: Icelain
- License: mit
- Created: 2020-11-22T10:43:16.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-12-25T19:12:20.000Z (11 months ago)
- Last Synced: 2025-04-14T23:09:56.512Z (8 months ago)
- Topics: api-client, api-wrapper, go, golang, jokeapi
- Language: Go
- Homepage:
- Size: 85.9 KB
- Stars: 25
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-go-cn - jokeapi-go
- awesome-go - jokeapi-go - Go client for [JokeAPI](https://sv443.net/jokeapi/v2/). (Third-party APIs / Utility/Miscellaneous)
- awesome-go - jokeapi-go - Go client for [JokeAPI](https://sv443.net/jokeapi/v2/). (Third-party APIs / Utility/Miscellaneous)
- awesome-go-plus - jokeapi-go - Go client for [JokeAPI](https://sv443.net/jokeapi/v2/).  (Third-party APIs / Utility/Miscellaneous)
- awesome-go - jokeapi-go - Go client for [JokeAPI](https://sv443.net/jokeapi/v2/). (Third-party APIs / Utility/Miscellaneous)
- awesome-go-with-stars - jokeapi-go - Go client for [JokeAPI](https://sv443.net/jokeapi/v2/). (Third-party APIs / Utility/Miscellaneous)
- awesome-go - jokeapi-go - Go client for [JokeAPI](https://sv443.net/jokeapi/v2/). (Third-party APIs / Utility/Miscellaneous)
- awesome-go - jokeapi-go - Go client for [JokeAPI](https://sv443.net/jokeapi/v2/). (Third-party APIs / Utility/Miscellaneous)
- fucking-awesome-go - jokeapi-go - Go client for 🌎 [JokeAPI](sv443.net/jokeapi/v2/). (Third-party APIs / Utility/Miscellaneous)
- awesome-go-cn - jokeapi-go
README
# jokeapi-go
[](https://godoc.org/github.com/icelain/jokeapi)
[](https://goreportcard.com/report/github.com/icelain/jokeapi)
[](https://github.com/avelino/awesome-go)
Official golang wrapper for Sv443's jokeapi.
Install-
Add ```github.com/icelain/jokeapi```to your go.mod(recommended) or:
```
EXPORT GO11MODULE=off
go get -u github.com/icelain/jokeapi
```
Basic Usage Without Parameters-
```go
import "github.com/icelain/jokeapi"
func main(){
api := jokeapi.New()
response, err := api.Fetch()
}
```
Response Struct-
```go
type JokesResp struct{
Error bool
Category string
JokeType string
Joke []string
Flags map[string] bool
Id float64
Lang string
}
```
Usage with all parameters-
```go
import "github.com/icelain/jokeapi"
func main(){
jt := "single"
blacklist := []string{"nsfw"}
ctgs := []string{"Programming","Dark"}
api:= jokeapi.New()
api.Set(jokeapi.Params{Blacklist: blacklist, JokeType: jt, Categories: ctgs})
response, err := api.Fetch()
}
```
Config struct-
```go
api.Set(jokeapi.Params{})
```
Config methods-
```go
api.SetBlacklist(blacklist)
api.SetCategories(ctgs)
api.SetJokeType(joketype)
api.SetLang(language)
```