twitter

package
v0.0.0-...-706d53e Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TwitterErrorTypeNotFound = "https://api.twitter.com/2/problems/resource-not-found"
)

Variables

This section is empty.

Functions

func NewClient

func NewClient(log logger.Logger, cache cache.Cache[twitter.UserObj], backend Backend) *twitterClient

Types

type Authorizer

type Authorizer struct {
	Token string
}

func (Authorizer) Add

func (a Authorizer) Add(req *http.Request)

type Backend

type Backend interface {
	UserNameLookup(
		ctx context.Context,
		usernames []string,
		opts twitter.UserLookupOpts,
	) (*twitter.UserLookupResponse, error)
	UserTweetTimeline(
		ctx context.Context,
		userID string,
		opts twitter.UserTweetTimelineOpts,
	) (*twitter.UserTweetTimelineResponse, error)
	TweetLookup(ctx context.Context, ids []string, opts twitter.TweetLookupOpts) (*twitter.TweetLookupResponse, error)
	UserLookup(ctx context.Context, ids []string, opts twitter.UserLookupOpts) (*twitter.UserLookupResponse, error)
}

type TwitterClient

type TwitterClient interface {
	GetUserTweets(context.Context, string, twitter.UserTweetTimelineOpts) (*twitter.UserTweetTimelineResponse, error)
	GetTweets(context.Context, []string, twitter.TweetLookupOpts) (*twitter.TweetLookupResponse, error)
	GetUser(ctx context.Context, username string) (*twitter.UserObj, error)
	GetUserByIDs(context.Context, []string) ([]*twitter.UserObj, error)
}

type UserNotFoundError

type UserNotFoundError struct {
	Username string
}

func (UserNotFoundError) Error

func (u UserNotFoundError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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