client

package
v0.0.0-...-5edc56a Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DirectiveMaxAge       = "max-age"
	DirectiveOnlyIfCached = "only-if-cached"
)

Variables

View Source
var (
	HeaderUserAgent    = http.CanonicalHeaderKey("User-Agent")
	HeaderCacheControl = http.CanonicalHeaderKey("Cache-Control")
	ErrCacheMiss       = errors.New("cache miss")
)

Functions

func RateLimit

func RateLimit(host string)

Types

type Client

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

func NewClient

func NewClient(config *config.ClientConfig) *Client

func (*Client) Get

func (c *Client) Get(url string) (http.Header, []byte, error)

func (*Client) GetJson

func (c *Client) GetJson(url string, result interface{}) error

func (*Client) GetJsonWith

func (c *Client) GetJsonWith(headers map[string]string, url string, result interface{}) error

func (*Client) GetPLS

func (c *Client) GetPLS(urlString string) (pls.Playlist, error)

func (*Client) GetWith

func (c *Client) GetWith(headers map[string]string, url string) (http.Header, []byte, error)

func (*Client) GetXML

func (c *Client) GetXML(urlString string, result interface{}) error

func (*Client) UseOnlyIfCached

func (c *Client) UseOnlyIfCached(enabled bool)

Jump to

Keyboard shortcuts

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