twitter

package
v0.0.0-...-ec2a438 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUserNotFound      = errors.New("user not found")
	ErrUserSuspended     = errors.New("user suspended")
	ErrRateLimitExceeded = errors.New("rate limit exceeded")
	ErrInvalidToken      = errors.New("invalid or expired token")
)

Functions

This section is empty.

Types

type API

type API interface {
	FollowerIDs(ctx context.Context, accessToken, accessSecret string) ([]int64, error)
	CurrentUser(ctx context.Context, accessToken, accessSecret string) (*User, error)
	UserByID(ctx context.Context, accessToken, accessSecret string, userID int64) (*User, error)
}

type Client

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

func NewClient

func NewClient(consumerKey, consumerSecret string) *Client

func (*Client) CurrentUser

func (c *Client) CurrentUser(ctx context.Context, accessToken, accessSecret string) (*User, error)

func (*Client) FollowerIDs

func (c *Client) FollowerIDs(ctx context.Context, accessToken, accessSecret string) ([]int64, error)

Due to Twitter's API rate limiting, this function will only return up to 75,000 followers (15 requests * 5000 items, over 15 minutes).

func (*Client) UserByID

func (c *Client) UserByID(ctx context.Context, accessToken, accessSecret string, userID int64) (*User, error)

type User

type User struct {
	ID              string `json:"id"`
	Handle          string `json:"handle,omitempty"`
	Name            string `json:"name,omitempty"`
	Location        string `json:"location,omitempty"`
	Bio             string `json:"bio,omitempty"`
	ProfileImageURL string `json:"profileImageUrl,omitempty"`
	Protected       bool   `json:"protected"`
	TotalFollowers  int    `json:"totalFollowers"`
}

Jump to

Keyboard shortcuts

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