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") ErrSchemeNotSupported = errors.New("scheme not supported") )
Functions ¶
Types ¶
type Getter ¶
type Getter interface { Get(url string) (http.Header, []byte, error) GetBody(url string) ([]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 NewDefaultGetter ¶ added in v0.14.0
func NewDefaultGetter() Getter
func NewTransportGetter ¶ added in v0.14.0
func NewTransportGetter(config Config, transport http.RoundTripper) Getter
type RateLimiter ¶ added in v0.14.0
type RateLimiter interface {
RateLimit(host string)
}
var DefaultLimiter RateLimiter = &timeLimiter{}
var UnlimitedLimiter RateLimiter = unlimitedLimiter(0)
Click to show internal directories.
Click to hide internal directories.