twitter

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2024 License: MPL-2.0 Imports: 13 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 New

func New(cfg Config, rdb *redis.Client) *Client

func (*Client) ExchangeTokensWithCode

func (c *Client) ExchangeTokensWithCode(ctx context.Context, code, state string) (*oauth2.Token, error)

func (*Client) GetAuthURL

func (c *Client) GetAuthURL(ctx context.Context, state string) string

func (*Client) GetUserInfo

func (c *Client) GetUserInfo(ctx context.Context, token *oauth2.Token) (*UserResponse, error)

func (*Client) PostTweet

func (c *Client) PostTweet(ctx context.Context, token *oauth2.Token, tweet string) (string, error)

func (*Client) RefreshAccessToken

func (c *Client) RefreshAccessToken(ctx context.Context, token *oauth2.Token) (*oauth2.Token, error)

type Config

type Config struct {
	ClientID     string
	ClientSecret string
	CallbackURL  string
}

type OAuthResponse

type OAuthResponse struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	TokenType    string `json:"token_type"`
	Expiry       string `json:"expiry"`
}

type UserResponse

type UserResponse struct {
	ID              string `json:"id"`
	Username        string `json:"username"`
	Name            string `json:"name"`
	ProfileImageURL string `json:"profile_image_url"`
}

Jump to

Keyboard shortcuts

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