twitter

package
v1.7.3 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: MIT Imports: 7 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(apiToken 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

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 are public metrics for a Twitter user

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