Skip to content
GoLang client for the Internet Chuck Norris Database
Go
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
.travis.yml
LICENSE
README.md
cndb.go
cndb_test.go

README.md

go-icndb

Build Status GoDoc

GoLang client for the Internet Chuck Norris Database API (http://www.icndb.com/api/).

Usage

Get a Random Joke

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)
}

Specify Custom Name for the Joke

  req := &chucknorris.CNDBRequest{
    FirstName: "John",
    LastName: "Doe",
  }
  joke, err := chucknorris.GetRandomJoke(req)
  if err != nil {
  	log.Fatal(err)
  }
  fmt.Printf("\nJoke: %s", joke)
You can’t perform that action at this time.