twitter

package
v0.0.0-...-476b611 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	TIDs TwitterIdentifiers
	// contains filtered or unexported fields
}

func NewAPI

func NewAPI(queries *coredb.Queries, redis *redis.Cache) *API

func (*API) GetAuthedUserFromCode

func (a *API) GetAuthedUserFromCode(ctx context.Context, authCode string) (TwitterIdentifiers, AccessTokenResponse, error)

GetAuthedUserFromCode creates a new twitter API client with an auth code

func (*API) GetFollowing

func (a *API) GetFollowing(ctx context.Context) ([]TwitterIdentifiers, error)

func (*API) WithAuth

func (a *API) WithAuth(ctx context.Context, accessToken string, refreshToken string) (*API, *AccessTokenResponse, error)

WithAuth establishes the API with an access token and refresh token, if the passed in access token is invalid, it will attempt to refresh it and optionally return the new access token and refresh token

type AccessTokenResponse

type AccessTokenResponse struct {
	TokenType    string `json:"token_type"`
	AccessToken  string `json:"access_token"`
	Scope        string `json:"scope"`
	RefreshToken string `json:"refresh_token"`
}

type ErrInvalidRefreshToken

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

func (ErrInvalidRefreshToken) Error

func (e ErrInvalidRefreshToken) Error() string

type GetUserFollowingResponse

type GetUserFollowingResponse struct {
	Data []TwitterIdentifiers `json:"data"`
	Meta struct {
		ResultCount int    `json:"result_count"`
		NextToken   string `json:"next_token"`
	}
}

type GetUserMeResponse

type GetUserMeResponse struct {
	Data TwitterIdentifiers `json:"data"`
}

type TwitterIdentifiers

type TwitterIdentifiers 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