twitter

package
v1.7.5 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 11 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 NewClient

func NewClient(clientId, clientSecret string) *Client

NewClient returns a new Twitter client

func (*Client) GetUserById

func (c *Client) GetUserById(ctx context.Context, id string) (*User, error)

GetUserById makes a request to the Twitter API and returns the user's information by ID

func (*Client) GetUserByUsername

func (c *Client) GetUserByUsername(ctx context.Context, username string) (*User, error)

GetUserByUsername makes a request to the Twitter API and returns the user's information by username

func (*Client) GetUserTweets added in v1.7.5

func (c *Client) GetUserTweets(ctx context.Context, userId string, maxResults int) ([]*Tweet, error)

GetUserTweets gets tweets for a given user

todo: Doesn't support paging, so only the most recent ones are returned

func (*Client) SearchRecentUserTweets added in v1.7.5

func (c *Client) SearchRecentUserTweets(ctx context.Context, userId, searchString string, maxResults int) ([]*Tweet, error)

SearchRecentUserTweets searches for tweets made by a user within the last 7 days

todo: Doesn't support paging, so only the most recent ones are returned

type PublicMetrics

type PublicMetrics struct {
	FollowersCount int `json:"followers_count"`
	FollowingCount int `json:"following_count"`
	TweetCount     int `json:"tweet_count"`
	LikeCount      int `json:"like_count"`
}

PublicMetrics represents the structure for public metrics in the Twitter API response

type Tweet added in v1.7.5

type Tweet struct {
	ID   string `json:"id"`
	Text string `json:"text"`
}

Tweet represents the structure for a tweet in the Twitter API response

type User

type User struct {
	ID              string        `json:"id"`
	Username        string        `json:"username"`
	Name            string        `json:"name"`
	ProfileImageUrl string        `json:"profile_image_url"`
	PublicMetrics   PublicMetrics `json:"public_metrics"`
}

User represents the structure for a user in the Twitter API response

Jump to

Keyboard shortcuts

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