twitter

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2023 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const API_V1 = "https://api.twitter.com/1.1/"
View Source
const API_V2 = "https://api.twitter.com/2/"

Variables

This section is empty.

Functions

func Bool

func Bool(v bool) *bool

Bool returns a new pointer to the given bool value.

func Float

func Float(v float64) *float64

Float returns a new pointer to the given float64 value.

Types

type APIError

type APIError struct {
	Status int    `json:"status"`
	Detail string `json:"detail"`
}

APIError represents a Twitter API Error response

func (APIError) Error

func (e APIError) Error() string

type Client

type Client struct {

	// Twitter API Services
	Tweets *TweetService
	// contains filtered or unexported fields
}

Client is a Twitter client for making Twitter API requests.

func NewClient

func NewClient(httpClient *http.Client) *Client

NewClient returns a new Client.

type PostTweetParams added in v0.0.2

type PostTweetParams struct {
	DirectMessageDeepLink string `json:"direct_message_deep_link,omitempty"`
	ForSuperFollowersOnly bool   `json:"for_super_followers_only,omitempty"`
	QuoteTweetId          string `json:"quote_tweet_id,omitempty"`
	Text                  string `json:"text,omitempty"`
}

StatusUpdateParams are the parameters for StatusService.Update

type ReplySetting added in v0.0.2

type ReplySetting string
const (
	MentionedUsers ReplySetting = "mentionedUsers"
	Following      ReplySetting = "following"
)

type Tweet

type Tweet struct {
	ID              string `json:"id"`
	Text            string `json:"text"`
	AuthorID        string `json:"author_id"`
	ConversationID  string `json:"conversation_id"`
	CreatedAt       string `json:"created_at"`
	InReplyToUserID string `json:"in_reply_to_user_id"`
}

Tweet represents a Twitter Tweet, previously called a status. I added the fields in use now, more fields will be added as functionality increases https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/tweet

func (Tweet) CreatedAtTime

func (t Tweet) CreatedAtTime() (time.Time, error)

CreatedAtTime returns the time a tweet was created.

type TweetGeoObj added in v0.0.2

type TweetGeoObj struct {
	PlaceId string `json:"place_id,omitempty"`
}

type TweetMedia added in v0.0.2

type TweetMedia struct {
	MediaIds      []string `json:"media_ids,omitempty"`
	TaggedUserIds []string `json:"tagged_user_ids,omitempty"`
}

type TweetPoll added in v0.0.2

type TweetPoll struct {
	DurationMinutes int      `json:"duration_minutes,omitempty"`
	Options         []string `json:"options,omitempty"`
}

type TweetReply added in v0.0.2

type TweetReply struct {
	ExcludeReplyUserIds []string `json:"exclude_reply_user_ids,omitempty"`
	InReplyToTweetId    string   `json:"in_reply_to_tweet_id,omitempty"`
}

type TweetService added in v0.0.2

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

TweetService provides methods for accessing Twitter status API endpoints.

func (*TweetService) PostTweet added in v0.0.2

func (s *TweetService) PostTweet(text string, params *PostTweetParams) (*Tweet, *http.Response, error)

Post tweet makes a new tweet. Requires a user auth context. https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-statuses-update

Jump to

Keyboard shortcuts

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