Skip to content

saadullahsaeed/go-icndb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

GoLang client for the Internet Chuck Norris Database

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages