controller

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultHost is the default host for the client
	DefaultHost       = "https://bible-api.com/"
	MaxRetryCount     = 3
	RetryWaitDuration = 5 * time.Second
)

Variables

Functions

func RespError

func RespError(resp *resty.Response) error

RespError Convert error response into error message

Types

type BiBleResult

type BiBleResult struct {
	Reference string `json:"reference"`
	Verses    []struct {
		BookID   string `json:"book_id"`
		BookName string `json:"book_name"`
		Chapter  int    `json:"chapter"`
		Verse    int    `json:"verse"`
		Text     string `json:"text"`
	} `json:"verses"`
	Text            string `json:"text"`
	TranslationID   string `json:"translation_id"`
	TranslationName string `json:"translation_name"`
	TranslationNote string `json:"translation_note"`
}

type BibleClient

type BibleClient struct {
	// contains filtered or unexported fields
}

func NewBibleClient

func NewBibleClient(wrapper middlewares.Wrapper) *BibleClient

func (*BibleClient) GetResult

func (c *BibleClient) GetResult(book, chapter, verse string) (*BiBleResult, error)

func (*BibleClient) PutResult

func (c *BibleClient) PutResult(result BiBleResult) (*BiBleResult, error)

type HttpError

type HttpError struct {
	Code    int    `json:"error_code,omitempty"`
	Message string `json:"error_message,omitempty"`
}

Jump to

Keyboard shortcuts

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