client

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package client provides an http client used extensively by Takeout for syncing media. There's support for local file-based caching and cache-only usage.

Index

Constants

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

Variables

View Source
var (
	ErrCacheMiss = errors.New("cache miss")
)

Functions

func RateLimit

func RateLimit(host string)

Types

type Config

type Config struct {
	UserAgent string
	CacheDir  string
	MaxAge    time.Duration
}

func (*Config) Merge

func (c *Config) Merge(o Config)

type Getter

type Getter interface {
	Get(url string) (http.Header, []byte, error)
	GetJson(url string, result interface{}) error
	GetJsonWith(headers map[string]string, url string, result interface{}) error
	GetXML(url string, result interface{}) error
	GetPLS(url string) (pls.Playlist, error)
}

func NewCacheOnlyGetter

func NewCacheOnlyGetter(config Config) Getter

func NewGetter

func NewGetter(config Config) Getter

Jump to

Keyboard shortcuts

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