Documentation ¶
Index ¶
Constants ¶
const ( MediaNone = iota // 0: No usable media. MediaImageURL = iota // 1: An URL pointing to an image. MediaFileURL = iota // 2: An URL pointing to a file. MediaVideoURL = iota // 3: An URL pointing to a video. )
Media types
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client holds state about a Reddit client
func (*Client) RandomMediaURL ¶
RandomMediaURL returns the URL containing a random media from a given subreddit. The type specifies the type of media being returned (usually an URL pointing to an image or to a video). Returns the type empty string with type mediaNone if the random article does not contain any pictures.
type Credentials ¶
type Credentials struct {
// contains filtered or unexported fields
}
Credentials holds all state require to authenticate a reddit request.
func NewCredentials ¶
func NewCredentials(username, password, clientID, clientSecret string) *Credentials
NewCredentials returns a pointer to a new Credentials object.
func (*Credentials) RefreshToken ¶
func (c *Credentials) RefreshToken() error
RefreshToken fetches a new authorization token (if needed).
func (*Credentials) Token ¶
func (c *Credentials) Token() (*Token, error)
Token returns the latest token (or triggers a token fetch, if needed).
type CredentialsInterface ¶
CredentialsInterface defines the interface between the client and the Credentials routines.