twitter

package
v1.10.8 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdditionalTweetMetadata added in v1.8.0

type AdditionalTweetMetadata struct {
	Author *User
}

AdditionalTweetMetadata adds additinal metadata to a tweet that isn't directly represented in the Twitter API response

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, nextToken *string) ([]*Tweet, *string, error)

GetUserTweets gets tweets for a given user

func (*Client) SearchRecentTweets added in v1.8.0

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

SearchRecentTweets searches for recent tweets within the last 7 days matching a search string.

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"`
	AuthorID *string `json:"author_id"`

	AdditionalMetadata AdditionalTweetMetadata
}

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

func (*Tweet) IsRetweet added in v1.10.1

func (t *Tweet) IsRetweet() bool

IsRetweet returns whether the tweet is a retweet

type User

type User struct {
	ID              string        `json:"id"`
	Username        string        `json:"username"`
	Name            string        `json:"name"`
	VerifiedType    string        `json:"verified_type"`
	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