reddit

package
v0.0.0-...-59ff9c4 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(appId, appSecret, agent string) (c Client, err error)

func (*Client) Subreddit

func (c *Client) Subreddit(name string, limit int) *SubredditService

type Comment

type Comment struct {
	Id      string    `json:"id"`
	Body    string    `json:"body"`
	Ups     int       `json:"ups"`
	Downs   int       `json:"downs"`
	Score   int       `json:"score"`
	Created time.Time `json:"created_utc"`
	Depth   int       `json:"depth"`
	Author  string    `json:"author"`

	// Parent and children needs to be filled in after struct has been unmarshalled
	//Parent   *Comment   `json:"-"`
	Replies []Comment `json:"replies"`
}

type Post

type Post struct {
	Subreddit   string    `json:"subreddit"`
	Title       string    `json:"title"`
	Body        string    `json:"selftext"`
	Ups         int       `json:"ups"`
	Downs       int       `json:"downs"`
	Score       int       `json:"score"`
	UpvoteRatio float64   `json:"upvote_ratio"`
	Created     float64   `json:"created_utc"`
	Author      string    `json:"author"`
	Permalink   string    `json:"permalink"`
	NumComments int       `json:"num_comments"`
	Comments    []Comment `json:"comments"`
	// contains filtered or unexported fields
}

func (*Post) GetComments

func (p *Post) GetComments() (c []Comment, err error)

type SubredditService

type SubredditService struct {
	Name  string
	Limit int
	// contains filtered or unexported fields
}

func (*SubredditService) GetHot

func (s *SubredditService) GetHot() ([]Post, error)

func (*SubredditService) GetNew

func (s *SubredditService) GetNew() ([]Post, error)

func (*SubredditService) GetRising

func (s *SubredditService) GetRising() ([]Post, error)

func (*SubredditService) GetTop

func (s *SubredditService) GetTop() ([]Post, error)

Jump to

Keyboard shortcuts

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