GoLang client for the Internet Chuck Norris Database API (http://www.icndb.com/api/).
package main
import (
"fmt"
"log"
"github.com/saadullahsaeed/go-icndb"
)
func main() {
joke, err := chucknorris.GetRandomJoke(nil)
if err != nil {
log.Fatal(err)
}
fmt.Printf("\nID: %d ", joke.ID)
fmt.Printf("\nText: %s", joke)
}
req := &chucknorris.CNDBRequest{
FirstName: "John",
LastName: "Doe",
}
joke, err := chucknorris.GetRandomJoke(req)
if err != nil {
log.Fatal(err)
}
fmt.Printf("\nJoke: %s", joke)