client

package
v0.0.0-...-2ce4fac Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NumOfHTTPCalls = 3
)

Variables

This section is empty.

Functions

func ExpiresInToExpiry

func ExpiresInToExpiry(expiresIn int) time.Time

Types

type JWTTransport

type JWTTransport struct {
	AccessToken string
	Expiry      time.Time

	Transport http.RoundTripper
	Config    *config.Config
	// contains filtered or unexported fields
}

func NewJWTTransport

func NewJWTTransport(accessToken string, expiry time.Time, config *config.Config) *JWTTransport

func (*JWTTransport) RoundTrip

func (t *JWTTransport) RoundTrip(r *http.Request) (*http.Response, error)

type PostData

type PostData struct {
	Subreddit  string  `json:"subreddit"`
	Author     string  `json:"author"`
	Title      string  `json:"title"`
	Ups        int     `json:"ups"`
	Created    float64 `json:"created"`
	CreatedUTC float64 `json:"created_utc"`
	ID         string  `json:"id"`
}

type RedditClient

type RedditClient struct {
	Config *config.Config
	// contains filtered or unexported fields
}

func NewRedditClient

func NewRedditClient(conf *config.Config) *RedditClient

func (*RedditClient) GetSubredditUsers

func (c *RedditClient) GetSubredditUsers(conf *config.Config) ([]PostData, []UserPostCount)

type RedditData

type RedditData struct {
	After    string       `json:"after"`
	Children []RedditPost `json:"children"`
	Before   *string      `json:"before"`
}

type RedditPost

type RedditPost struct {
	Data PostData `json:"data"`
}

type RedditPostResponse

type RedditPostResponse struct {
	Data RedditData `json:"data"`
}

type RedditToken

type RedditToken struct {
	AccessToken string `json:"access_token"`
	ExpiresIn   int    `json:"expires_in"`
}

type TokenClient

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

func NewTokenClient

func NewTokenClient() *TokenClient

func (*TokenClient) GetToken

func (tc *TokenClient) GetToken(conf *config.Config) (*RedditToken, error)

type UserPostCount

type UserPostCount struct {
	Username  string
	PostCount int
}

Jump to

Keyboard shortcuts

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