reddit

package
v0.0.0-...-abaf530 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 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 Children

type Children[T any] struct {
	Kind string `json:"kind"`
	Data T      `json:"data"`
}

type Client

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

func NewRedditClient

func NewRedditClient(clientId, clientSecret, username, password, accessToken string, expireTimeMilli int64, overrideOldBot bool) (*Client, error)

func (*Client) GetCommentsBySubmissionId

func (rc *Client) GetCommentsBySubmissionId(submissionId string, limit int) ([]SubmissionComment, error)

func (*Client) GetNewSubmissions

func (rc *Client) GetNewSubmissions(subreddit string, limit int) ([]Submission, error)

func (*Client) GetUserNewestComments

func (rc *Client) GetUserNewestComments(limit int) ([]UserComment, error)

func (*Client) IsCommentedByUser

func (rc *Client) IsCommentedByUser(submissionId string, author string) bool

func (*Client) RefreshToken

func (rc *Client) RefreshToken() error

func (*Client) SubmitComment

func (rc *Client) SubmitComment(postId, text string) error

type Listing

type Listing[T any] struct {
	Kind string         `json:"kind"`
	Data ListingData[T] `json:"data"`
}

type ListingData

type ListingData[T any] struct {
	After     string        `json:"after"`
	Dist      int           `json:"dist"`
	Modhash   string        `json:"modhash"`
	GeoFilter string        `json:"geo_filter"`
	Children  []Children[T] `json:"children"`
	Before    string        `json:"before"`
}

type Submission

type Submission struct {
	ID            string `json:"id"`
	Subreddit     string `json:"subreddit"`
	Title         string `json:"title"`
	Name          string `json:"name"`
	LinkFlairText string `json:"link_flair_text"`
}

type SubmissionComment

type SubmissionComment struct {
	SubredditID    string `json:"subreddit_id"`
	Subreddit      string `json:"subreddit"`
	ID             string `json:"id"`
	Author         string `json:"author"`
	ParentID       string `json:"parent_id"`
	AuthorFullname string `json:"author_fullname"`
	Body           string `json:"body"`
	Name           string `json:"name"`
	IsSubmitter    bool   `json:"is_submitter"`
}

type UserComment

type UserComment struct {
	SubredditID    string `json:"subreddit_id"`
	Subreddit      string `json:"subreddit"`
	ID             string `json:"id"`
	Author         string `json:"author"`
	ParentID       string `json:"parent_id"`
	AuthorFullname string `json:"author_fullname"`
	Body           string `json:"body"`
	LinkID         string `json:"link_id"`
	Name           string `json:"name"`
}

Jump to

Keyboard shortcuts

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