poetrydb

package
v0.0.0-...-3e9bda6 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HttpClient

type HttpClient interface {
	Get(url string) (resp *http.Response, err error)
}

HttpClient is an interface that makes it easier to mock http.Client in unit tests.

type PoetriesResponse

type PoetriesResponse struct {
	List []PoetryResponse `json:"list"`
}

PoetriesResponse contains a list of poetries.

type PoetryDb

type PoetryDb interface {
	// Random returns a given number of random poetries.
	Random(number int) (PoetriesResponse, error)
}

PoetryDb interface defines the available endpoints for PoetryDb API.

func NewPoetryDb

func NewPoetryDb(baseUrl string, timeoutInSeconds int) PoetryDb

NewPoetryDb creates a new PoetryDb client.

type PoetryResponse

type PoetryResponse struct {
	Title     string   `json:"title"`
	Author    string   `json:"author"`
	Lines     []string `json:"lines"`
	LineCount string   `json:"linecount"`
}

PoetryResponse holds data about a poetry.

Jump to

Keyboard shortcuts

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