Awesome Go

jokeapi-go

CategoryThird-party APIs
SubcategoryThird-party APIs
Stars0

Go client for [JokeAPI](https://sv443.net/jokeapi/v2/)

About jokeapi-go

jokeapi-go

GoDoc Go Report Card Mentioned in Awesome Go

Official golang wrapper for Sv443's jokeapi.

Install- Add github.com/icelain/jokeapito your go.mod(recommended) or:

EXPORT GO11MODULE=off
go get -u github.com/icelain/jokeapi

Basic Usage Without Parameters-

import "github.com/icelain/jokeapi"

func main(){
  api := jokeapi.New()
  response, err := api.Fetch()
}

Response Struct-

type JokesResp struct{
	Error bool
	Category string
	JokeType string
	Joke []string
	Flags map[string] bool
	Id float64
	Lang string
}

Usage with all parameters-

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-

api.Set(jokeapi.Params{})

Config methods-

api.SetBlacklist(blacklist)
api.SetCategories(ctgs)
api.SetJokeType(joketype)
api.SetLang(language)

Frequently Asked Questions

What is jokeapi-go?

jokeapi-go is a Third-party APIs library for the Go programming language. Go client for [JokeAPI](https://sv443.net/jokeapi/v2/)

How do I install jokeapi-go?

Install jokeapi-go with the Go module system using `go get icelain/jokeapi`. Check the repository for the current installation instructions.

What category does jokeapi-go belong to?

jokeapi-go is listed under Third-party APIs, specifically Third-party APIs.

← Back to Third-party APIs