client

package
v0.0.0-...-fc80ed1 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2018 License: GPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BadCaptchaError

type BadCaptchaError struct {
	CaptchaId string
}

func (BadCaptchaError) Error

func (e BadCaptchaError) Error() string

type Client

type Client struct {
	ClientId string

	AccessToken               string
	AccessTokenExpirationTime time.Time
	Username                  string

	UserAgent string
	// contains filtered or unexported fields
}

func New

func New(clientId string, clientSecret string) *Client

func (*Client) Get

func (c *Client) Get(resourceUrl string) (*http.Response, error)

func (*Client) GetSubreddit

func (c *Client) GetSubreddit(resourceUrl string) (*Response, error)

func (*Client) NeedsCaptcha

func (c *Client) NeedsCaptcha() (bool, error)

func (*Client) NewCaptcha

func (c *Client) NewCaptcha() (string, error)

func (*Client) Post

func (c *Client) Post(resourceUrl string, values url.Values) (*http.Response, error)

func (*Client) Signin

func (c *Client) Signin(username string, password string)

func (*Client) SubmitComment

func (c *Client) SubmitComment(parentId string, text string) error
func (c *Client) SubmitLink(parameters SubmitLinkParameters) (*linkResponseData, error)

type Listing

type Listing struct {
	Kind string
	Data struct {
		Domain    string
		Subreddit string
		Id        string
		Author    string
		Permalink string
		Title     string
		Url       string
		Score     int
		Over18    bool `json:"over_18"`
		IsSelf    bool `json:"is_self"`
	}
}

func (*Listing) Copy

func (l *Listing) Copy() *Listing

type Response

type Response struct {
	Type string
	Data struct {
		Children []Listing
	}
}

func ParseResponse

func ParseResponse(response []byte) (*Response, error)

type SubmitLinkParameters

type SubmitLinkParameters struct {
	Subreddit       string
	Title           string
	Url             string
	CaptchaId       string
	CaptchaResponse string
	Nsfw            bool
}

Jump to

Keyboard shortcuts

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