chuckclient

package
v0.0.0-...-c40f013 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 13, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const APIURL = "https://api.chucknorris.io/jokes/random?category="

APIURL is the URL of the Chuck Norris API

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClient

type APIClient struct{}

APIClient is a client for the Chuck Norris API

func (*APIClient) GetJoke

func (c *APIClient) GetJoke(ctx context.Context, category string) (string, error)

GetJoke returns a joke from the Chuck Norris API

type APIResponse

type APIResponse struct {
	Categories []string `json:"categories"`
	CreatedAt  string   `json:"created_at"`
	IconURL    string   `json:"icon_url"`
	ID         string   `json:"id"`
	UpdatedAt  string   `json:"updated_at"`
	URL        string   `json:"url"`
	Value      string   `json:"value"`
}

APIResponse is the response from the Chuck Norris API

type JokeGetter

type JokeGetter interface {
	GetJoke(ctx context.Context, category string) (string, error)
}

JokeGetter is an interface for getting jokes

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL