Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultClientOpts = ClientOptions{ BaseURL: "https://api.real-debrid.com", Timeout: 5 * time.Second, CacheAge: 24 * time.Hour, }
Functions ¶
This section is empty.
Types ¶
type Cache ¶ added in v0.7.0
Cache is the interface that the RealDebrid client uses for caching a user's API token validity and the "instant availability" of a torrent (via info_hash). A package user must pass an implementation of this interface. Usually you create a simple wrapper around an existing cache package. An example implementation is the InMemoryCache in this package.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CheckInstantAvailability ¶ added in v0.2.0
func (*Client) GetStreamURL ¶
type ClientOptions ¶ added in v0.7.0
type ClientOptions struct { BaseURL string Timeout time.Duration CacheAge time.Duration ExtraHeaders []string }
func NewClientOpts ¶ added in v0.7.0
func NewClientOpts(baseURL string, timeout, cacheAge time.Duration, extraHeaders []string) ClientOptions
type InMemoryCache ¶ added in v0.7.0
type InMemoryCache struct {
// contains filtered or unexported fields
}
InMemoryCache is an example implementation of the Cache interface. It doesn't persist its data, so it's not suited for production use of the realdebrid package.
func NewInMemoryCache ¶ added in v0.8.0
func NewInMemoryCache() *InMemoryCache
NewInMemoryCache creates a new InMemoryCache.
func (*InMemoryCache) Get ¶ added in v0.7.0
Get returns the time the API token / "instant availability" was cached. The boolean return value signals if the value was found in the cache.
func (*InMemoryCache) Set ¶ added in v0.7.0
func (c *InMemoryCache) Set(key string) error
Set caches the validity of a user's API token or the "instant availability" for a torrent (via info_hash). There's no need to pass a boolean or so - if a value gets cached it means the token is valid / the torrent is "instantly available".