Documentation ¶
Index ¶
- Constants
- func AddAuth(instance, token string)
- func AddCurrentAuth(token string)
- func AuthLink(instance ...string) string
- func Cancel()
- func CheckInstance(host string) (string, error)
- func Ctx() context.Context
- func CurrentTokenValid() bool
- func Delete(ctx context.Context, param string, token ...string) (*http.Response, error)
- func Fetch(ctx context.Context, param string, token ...string) (*http.Response, error)
- func Get(ctx context.Context, param string, token ...string) (*http.Response, error)
- func GetBestInstance(custom string) (string, error)
- func GetInstances() ([]string, error)
- func Host() string
- func Init()
- func Instance() string
- func IsAuthInstance() bool
- func IsTokenValid(token string) bool
- func Modify(param, body string, token ...string) (*http.Response, error)
- func Patch(ctx context.Context, param, body string, token ...string) (*http.Response, error)
- func Post(ctx context.Context, param, body string, token ...string) (*http.Response, error)
- func Remove(param string, token ...string) (*http.Response, error)
- func Send(param, body string, token ...string) (*http.Response, error)
- func SendCancel()
- func SendCtx() context.Context
- func SetAuthCredentials(credentials []Credential)
- func SetHost(host string) *url.URL
- func Token() string
- type Auth
- type Client
- type Credential
Constants ¶
const ( // API is the api endpoint. API = "/api/v1/" // InstanceData is the URL to retrieve available Invidious instances. InstanceData = "https://api.invidious.io/instances.json?sort_by=api,health" // UserAgent is the user agent for the client. UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36" )
const Scopes = "GET:playlists*,GET:subscriptions*,GET:feed*,GET:notifications*,GET:tokens*"
Scopes lists the user token's scopes.
Variables ¶
This section is empty.
Functions ¶
func AddAuth ¶
func AddAuth(instance, token string)
AddAuth adds and stores an instance and token credential.
func AddCurrentAuth ¶
func AddCurrentAuth(token string)
AddCurrentAuth adds and stores an instance and token credential for the selected instance.
func CheckInstance ¶
CheckInstance returns if the provided instance is valid.
func CurrentTokenValid ¶
func CurrentTokenValid() bool
CurrentTokenValid tests the validity of the stored token.
func GetBestInstance ¶
GetBestInstance determines and returns the best instance.
func IsAuthInstance ¶
func IsAuthInstance() bool
IsAuthInstance checks whether the selected instance has a stored token.
func IsTokenValid ¶
IsTokenValid tests the validity of the given token.
func SetAuthCredentials ¶ added in v0.3.3
func SetAuthCredentials(credentials []Credential)
SetAuthCredentials sets the authentication credentials.
Types ¶
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
Auth stores information about instances and the user's authentication tokens associated with it.
type Credential ¶
Credential stores an instance and the user's authentication token.
func GetAuthCredentials ¶ added in v0.3.3
func GetAuthCredentials() []Credential
GetAuthCredentials returns the authentication credentials.