Documentation ¶
Index ¶
- func WithAccessCredentials(parent context.Context, creds AccessCredentials) context.Context
- type AccessCredentials
- type Backoff
- type BoundingBox
- type Client
- func (c *Client) CreateFavorite(ctx context.Context, params CreateFavoriteParameters) (*TweetResponse, error)
- func (c *Client) DestroyDirectMessage(ctx context.Context, params DestroyDirectMessageParams) (*DirectMessageResponse, error)
- func (c *Client) DestroyFavorite(ctx context.Context, params DestroyFavoriteParameters) (*TweetResponse, error)
- func (c *Client) DestroyTweet(ctx context.Context, params DestroyTweetParams) (*TweetResponse, error)
- func (c *Client) GetConfiguration(ctx context.Context) (*ConfigurationResponse, error)
- func (c *Client) GetDirectMessages(ctx context.Context, params GetDirectMessagesParams) (*DirectMessagesResponse, error)
- func (c *Client) GetLanguages(ctx context.Context) (*LanguagesResponse, error)
- func (c *Client) GetPrivacy(ctx context.Context) (*PrivacyResponse, error)
- func (c *Client) GetTOS(ctx context.Context) (*TOSResponse, error)
- func (c *Client) GetTotalPostInsights(ctx context.Context, params PostInsightsParams) (*PostInsightsResponse, error)
- func (c *Client) HomeTimeline(ctx context.Context, params HomeTimelineParams) (*TweetsResponse, error)
- func (c *Client) ListFavorites(ctx context.Context, params ListFavoritesParams) (*TweetsResponse, error)
- func (c *Client) Lookup(ctx context.Context, params LookupParams) (*TweetsResponse, error)
- func (c *Client) LookupFriendships(ctx context.Context, params LookupFriendshipsParams) (*FriendshipLookupResponse, error)
- func (c *Client) LookupUsers(ctx context.Context, params LookupUsersParams) (*UsersResponse, error)
- func (c *Client) MediaUpload(ctx context.Context, params MediaUploadParameters) (*MediaUploadResponse, error)
- func (c *Client) MentionsTimeline(ctx context.Context, params MentionsTimelineParams) (*TweetsResponse, error)
- func (c *Client) NewDirectMessage(ctx context.Context, params NewDirectMessageParams) (*DirectMessageResponse, error)
- func (c *Client) OEmbed(ctx context.Context, params OEmbedParams) (*OEmbedResponse, error)
- func (c *Client) RateLimitStatus(ctx context.Context, resources []string) (*RateLimitStatusResponse, error)
- func (c *Client) Retweet(ctx context.Context, params RetweetParams) (*TweetResponse, error)
- func (c *Client) RetweeterIDs(ctx context.Context, params RetweeterIDsParams) (*IDsResponse, error)
- func (c *Client) RetweetsOfMe(ctx context.Context, params RetweetsOfMeParams) (*TweetsResponse, error)
- func (c *Client) RetweetsOfTweet(ctx context.Context, params RetweetsOfTweetParams) (*TweetsResponse, error)
- func (c *Client) SearchTweets(ctx context.Context, params SearchTweetsParams) (*TweetsResponse, error)
- func (c *Client) SearchUsers(ctx context.Context, params SearchUsersParams) (*UsersResponse, error)
- func (c *Client) SentDirectMessages(ctx context.Context, params SentDirectMessagesParams) (*DirectMessagesResponse, error)
- func (c *Client) ShowDirectMessage(ctx context.Context, id string) (*DirectMessageResponse, error)
- func (c *Client) ShowFriendships(ctx context.Context, params ShowFriendshipsParameters) (*FriendshipResponse, error)
- func (c *Client) ShowTweet(ctx context.Context, params ShowTweetParams) (*TweetResponse, error)
- func (c *Client) ShowUser(ctx context.Context, params ShowUserParams) (*UserResponse, error)
- func (c *Client) StartFilterStream(ctx context.Context, params StreamFilterParams, errFn StreamErrFn) *Stream
- func (c *Client) Unretweet(ctx context.Context, params UnretweetParams) (*TweetResponse, error)
- func (c *Client) UpdateTweet(ctx context.Context, params UpdateTweetParams) (*TweetResponse, error)
- func (c *Client) UserTimeline(ctx context.Context, params UserTimelineParams) (*TweetsResponse, error)
- func (c *Client) WithGzipDisabled() *Client
- type Configuration
- type ConfigurationResponse
- type ConsumerCredentials
- type Contributor
- type Coordinates
- type CreateFavoriteParameters
- type DeleteMessage
- type DestroyDirectMessageParams
- type DestroyFavoriteParameters
- type DestroyTweetParams
- type DirectMessage
- type DirectMessageResponse
- type DirectMessagesResponse
- type DisconnectMessage
- type Entities
- type Error
- type Errors
- type ExtendedEntities
- type ExtendedTweet
- type Friendship
- type FriendshipLookup
- type FriendshipLookupResponse
- type FriendshipResponse
- type GetDirectMessagesParams
- type HTTPClient
- type HTTPMock
- type HashtagEntity
- type HomeTimelineParams
- type IDs
- type IDsResponse
- type Image
- type InsightsData
- type Language
- type LanguagesResponse
- type LimitMessage
- type ListFavoritesParams
- type Location
- type LookupFriendshipsParams
- type LookupParams
- type LookupUsersParams
- type MediaEntity
- type MediaInsights
- type MediaSize
- type MediaSizes
- type MediaUpload
- type MediaUploadParameters
- type MediaUploadResponse
- type MentionsTimelineParams
- type NewDirectMessageParams
- type OEmbed
- type OEmbedParams
- type OEmbedResponse
- type PhotoSize
- type Place
- type PostInsightsParams
- type PostInsightsResponse
- type PrivacyResponse
- type RateLimit
- type RateLimitStatusResponse
- type RateLimitsRes
- type Relationship
- type RelationshipTarget
- type RetweetParams
- type RetweeterIDsParams
- type RetweetsOfMeParams
- type RetweetsOfTweetParams
- type ScrubGeoMessage
- type SearchTweetsParams
- type SearchUsersParams
- type SentDirectMessagesParams
- type ShowFriendshipsParameters
- type ShowTweetParams
- type ShowUserParams
- type StatusWithheldMessage
- type Stream
- type StreamErrFn
- type StreamFilterParams
- type StreamMessage
- type TOSResponse
- type Tweet
- type TweetIDs
- type TweetResponse
- type TweetsResponse
- type URLEntities
- type URLEntity
- type UnretweetParams
- type UpdateTweetParams
- type User
- type UserMentionEntity
- type UserResponse
- type UserTimelineParams
- type UserWithheldMessage
- type UsersResponse
- type Video
- type VideoInfo
- type VideoVariant
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithAccessCredentials ¶
func WithAccessCredentials(parent context.Context, creds AccessCredentials) context.Context
WithAccessCredentials returns a new context with the provided parent context and AccessCredentials.
Types ¶
type AccessCredentials ¶
AccessCredentials represents an OAuth token and secret pair.
type Backoff ¶
type Backoff interface { // NextWait returns the duration that the stream will wait before // attempting to reconnect. NextWait() time.Duration // Waited returns the total duration that has been waited (not including // the NextWait duration) since a successful stream was established. Waited() time.Duration // Retries returns the total number of retries since a successful stream // was established. Retries() int }
Backoff is the interface for stream retries. When an error is encountered, the stream's StreamErrFn will be called (if it exists) with the current Backoff and the sepcific error.
type BoundingBox ¶
type BoundingBox struct { Coordinates [][][2]float64 `json:"coordinates"` Type string `json:"type"` }
BoundingBox represents a bounding box of coordinates which encloses a Place.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents the client used to make requests to the Twitter API 1.1.
func NewClient ¶
func NewClient(consumerCreds ConsumerCredentials, accessCreds AccessCredentials, httpClient HTTPClient) *Client
NewClient returns a new Client instance using the provided application credentials, optional default consumer credentials, and optional HTTPClient.
func (*Client) CreateFavorite ¶
func (c *Client) CreateFavorite(ctx context.Context, params CreateFavoriteParameters) (*TweetResponse, error)
CreateFavorite calls the Twitter /favorites/create.json endpoint
func (*Client) DestroyDirectMessage ¶
func (c *Client) DestroyDirectMessage(ctx context.Context, params DestroyDirectMessageParams) (*DirectMessageResponse, error)
DestroyDirectMessage calls the Twitter /direct_messages/destroy.json endpoint.
func (*Client) DestroyFavorite ¶
func (c *Client) DestroyFavorite(ctx context.Context, params DestroyFavoriteParameters) (*TweetResponse, error)
DestroyFavorite calls the Twitter /favorites/create.json endpoint
func (*Client) DestroyTweet ¶
func (c *Client) DestroyTweet(ctx context.Context, params DestroyTweetParams) (*TweetResponse, error)
DestroyTweet calls the Twitter /statuses/destroy/:id.json endpoint.
func (*Client) GetConfiguration ¶
func (c *Client) GetConfiguration(ctx context.Context) (*ConfigurationResponse, error)
GetConfiguration calls the Twitter /help/configuration.json endpoint.
func (*Client) GetDirectMessages ¶
func (c *Client) GetDirectMessages(ctx context.Context, params GetDirectMessagesParams) (*DirectMessagesResponse, error)
GetDirectMessages calls the Twitter /direct_messages.json endpoint.
func (*Client) GetLanguages ¶
func (c *Client) GetLanguages(ctx context.Context) (*LanguagesResponse, error)
GetLanguages calls Twitter help/langauges.json endpoint.
func (*Client) GetPrivacy ¶
func (c *Client) GetPrivacy(ctx context.Context) (*PrivacyResponse, error)
GetPrivacy calls Twitter help/privacy.json endpoint.
func (*Client) GetTOS ¶
func (c *Client) GetTOS(ctx context.Context) (*TOSResponse, error)
GetTOS calls Twitter help/tos.json endpoint.
func (*Client) GetTotalPostInsights ¶
func (c *Client) GetTotalPostInsights(ctx context.Context, params PostInsightsParams) (*PostInsightsResponse, error)
GetTotalPostInsights calls the twitter data api and retrieves insight totals (lifetime metrics) for up to 250 post ids Posts older than 90 days cannot be queried using this endpoint
func (*Client) HomeTimeline ¶
func (c *Client) HomeTimeline(ctx context.Context, params HomeTimelineParams) (*TweetsResponse, error)
HomeTimeline calls the Twitter /statuses/home_timeline.json endpoint.
func (*Client) ListFavorites ¶
func (c *Client) ListFavorites(ctx context.Context, params ListFavoritesParams) (*TweetsResponse, error)
ListFavorites calls the Twitter /favorites/list.json endpoint
func (*Client) Lookup ¶
func (c *Client) Lookup(ctx context.Context, params LookupParams) (*TweetsResponse, error)
Lookup calls the Twitter /statuses/lookup.json endpoint.
func (*Client) LookupFriendships ¶
func (c *Client) LookupFriendships(ctx context.Context, params LookupFriendshipsParams) (*FriendshipLookupResponse, error)
LookupFriendships calls Twitter endpoint /friendships/lookup.json
func (*Client) LookupUsers ¶
func (c *Client) LookupUsers(ctx context.Context, params LookupUsersParams) (*UsersResponse, error)
LookupUsers calls Twitter endpoint /users/lookup.json
func (*Client) MediaUpload ¶
func (c *Client) MediaUpload(ctx context.Context, params MediaUploadParameters) (*MediaUploadResponse, error)
MediaUpload calls the Twitter endpoint /media/upload.json
func (*Client) MentionsTimeline ¶
func (c *Client) MentionsTimeline(ctx context.Context, params MentionsTimelineParams) (*TweetsResponse, error)
MentionsTimeline calls the Twitter /statuses/mentions_timeline.json endpoint.
func (*Client) NewDirectMessage ¶
func (c *Client) NewDirectMessage(ctx context.Context, params NewDirectMessageParams) (*DirectMessageResponse, error)
NewDirectMessage calls the Twitter /direct_messages/sent.json endpoint.
func (*Client) OEmbed ¶
func (c *Client) OEmbed(ctx context.Context, params OEmbedParams) (*OEmbedResponse, error)
OEmbed calls the Twitter oembed endpoint.
func (*Client) RateLimitStatus ¶
func (c *Client) RateLimitStatus(ctx context.Context, resources []string) (*RateLimitStatusResponse, error)
RateLimitStatus calls the Twitter /application/rate_limit_status.json endpoint.
func (*Client) Retweet ¶
func (c *Client) Retweet(ctx context.Context, params RetweetParams) (*TweetResponse, error)
Retweet calls the Twitter /statuses/retweet/:id.json endpoint.
func (*Client) RetweeterIDs ¶
func (c *Client) RetweeterIDs(ctx context.Context, params RetweeterIDsParams) (*IDsResponse, error)
RetweeterIDs calls the Twitter /statuses/retweeters/ids.json endpoint.
func (*Client) RetweetsOfMe ¶
func (c *Client) RetweetsOfMe(ctx context.Context, params RetweetsOfMeParams) (*TweetsResponse, error)
RetweetsOfMe calls the Twitter /statuses/retweets_of_me.json endpoint.
func (*Client) RetweetsOfTweet ¶
func (c *Client) RetweetsOfTweet(ctx context.Context, params RetweetsOfTweetParams) (*TweetsResponse, error)
RetweetsOfTweet calls the Twitter /statuses/retweets/:id.json endpoint.
func (*Client) SearchTweets ¶
func (c *Client) SearchTweets(ctx context.Context, params SearchTweetsParams) (*TweetsResponse, error)
SearchTweets calls the Twitter /search/tweets.json endpoint.
func (*Client) SearchUsers ¶
func (c *Client) SearchUsers(ctx context.Context, params SearchUsersParams) (*UsersResponse, error)
SearchUsers calls Twitter endpoint /users/search.json
func (*Client) SentDirectMessages ¶
func (c *Client) SentDirectMessages(ctx context.Context, params SentDirectMessagesParams) (*DirectMessagesResponse, error)
SentDirectMessages calls the Twitter /direct_messages/sent.json endpoint.
func (*Client) ShowDirectMessage ¶
ShowDirectMessage calls the Twitter /direct_messages/show.json endpoint.
func (*Client) ShowFriendships ¶
func (c *Client) ShowFriendships(ctx context.Context, params ShowFriendshipsParameters) (*FriendshipResponse, error)
ShowFriendships calls the Twitter endpoint /friendships/show.json
func (*Client) ShowTweet ¶
func (c *Client) ShowTweet(ctx context.Context, params ShowTweetParams) (*TweetResponse, error)
ShowTweet calls the Twitter /statuses/show/:id.json endpoint.
func (*Client) ShowUser ¶
func (c *Client) ShowUser(ctx context.Context, params ShowUserParams) (*UserResponse, error)
ShowUser calls Twitter endpoint /users/show.json
func (*Client) StartFilterStream ¶
func (c *Client) StartFilterStream(ctx context.Context, params StreamFilterParams, errFn StreamErrFn) *Stream
StartFilterStream starts and returns a new Stream using the provided context, stream filter parameters, and optional stream error callback.
func (*Client) Unretweet ¶
func (c *Client) Unretweet(ctx context.Context, params UnretweetParams) (*TweetResponse, error)
Unretweet calls the Twitter /statuses/retweet/:id.json endpoint.
func (*Client) UpdateTweet ¶
func (c *Client) UpdateTweet(ctx context.Context, params UpdateTweetParams) (*TweetResponse, error)
UpdateTweet calls the Twitter /statuses/update.json endpoint.
func (*Client) UserTimeline ¶
func (c *Client) UserTimeline(ctx context.Context, params UserTimelineParams) (*TweetsResponse, error)
UserTimeline calls the Twitter /statuses/user_timeline.json endpoint.
func (*Client) WithGzipDisabled ¶
WithGzipDisabled returns a new shallow copy of the Client with Gzip disabled.
type Configuration ¶
type Configuration struct { CharactersReservedPerMedia int `json:"characters_reserved_per_media"` DMTextCharacterLimit int `json:"dm_text_character_limit"` MaxMediaPerUpload int `json:"max_media_per_upload"` PhotoSizeLimit int `json:"photo_size_limit"` PhotoSizes map[string]PhotoSize `json:"photo_sizes"` ShortURLLength int `json:"short_url_length"` ShortURLLengthHTTPS int `json:"short_url_length_https"` NonUsernamePaths []string `json:"non_username_paths"` }
Configuration represents the configuration object received from Twitter help/configuration endpoint
type ConfigurationResponse ¶
type ConfigurationResponse struct { Configuration Configuration RateLimit RateLimit }
ConfigurationResponse represents a response from Twitter containing configuration.
type ConsumerCredentials ¶
ConsumerCredentials represents a token/secret pair of auth credentials.
type Contributor ¶
type Contributor struct { ID int64 `json:"id"` IDStr string `json:"id_str"` ScreenName string `json:"screen_name"` }
Contributor represents a user who contributed to the authorship of a tweet.
type Coordinates ¶
Coordinates represents the geographic location of a Tweet as reported by the user or client application. The coordinates array is formatted as geoJSON (longitude first, then latitude).
type CreateFavoriteParameters ¶
CreateFavoriteParameters represents query parameters for a /favorites/create.json request
type DeleteMessage ¶
type DeleteMessage struct { Status struct { ID int64 `json:"id"` IDStr string `json:"id_str"` UserID int64 `json:"user_id"` UserIDStr string `json:"user_id_str"` } `json:"status"` }
DeleteMessage represents a stream message that a given Tweet has been deleted.
type DestroyDirectMessageParams ¶
DestroyDirectMessageParams ...
type DestroyFavoriteParameters ¶
DestroyFavoriteParameters represents query parameters for a /favorites/create.json request
type DestroyTweetParams ¶
DestroyTweetParams represents the query parameters for a /statuses/destroy/:id.json request.
type DirectMessage ¶
type DirectMessage struct { CreatedAt string `json:"created_at"` Entities Entities `json:"entities"` ID int64 `json:"id"` IDStr string `json:"id_str"` Recipient User `json:"recipient"` RecipientID int64 `json:"recipient_id"` RecipientScreenName string `json:"recipient_screen_name"` Sender User `json:"sender"` SenderID int64 `json:"sender_id"` SenderScreenName string `json:"sender_screen_name"` Text string `json:"text"` }
DirectMessage ...
type DirectMessageResponse ¶
type DirectMessageResponse struct { DirectMessage DirectMessage RateLimit RateLimit }
DirectMessageResponse represents a response from Twitter containing a single DirectMessage.
type DirectMessagesResponse ¶
type DirectMessagesResponse struct { DirectMessages []DirectMessage RateLimit RateLimit }
DirectMessagesResponse represents a response from Twitter containing multiple DirectMessages.
type DisconnectMessage ¶
type DisconnectMessage struct { Code int `json:"code"` StreamName string `json:"stream_name"` Reason string `json:"reason"` }
DisconnectMessage represents a stream message that the stream will disconnect with the provided code and reason. https://dev.twitter.com/streaming/overview/messages-types#disconnect_messages
type Entities ¶
type Entities struct { Media []MediaEntity `json:"media"` URL URLEntities `json:"url"` URLs []URLEntity `json:"urls"` UserMentions []UserMentionEntity `json:"user_mentions"` }
Entities provides metadata and additonal contextual information about twitter content.
type Errors ¶
Errors represents an error response from the Twitter API, possibly containing multiple individual errors.
type ExtendedEntities ¶
type ExtendedEntities struct {
Media []MediaEntity `json:"media"`
}
ExtendedEntities provides metadata about the media entities present.
type ExtendedTweet ¶
type ExtendedTweet struct { FullText string `json:"full_text"` DisplayTextRange []int `json:"display_text_range"` Entities Entities `json:"entities"` ExtendedEntities ExtendedEntities `json:"extended_entities"` }
ExtendedTweet represents the full information for an extended tweet.
type Friendship ¶
type Friendship struct {
Relationship Relationship `json:"relationship"`
}
Friendship represents a relationship between two Twitter users
type FriendshipLookup ¶
type FriendshipLookup struct { Name string `json:"name"` ScreenName string `json:"screen_name"` ID int64 `json:"id"` IDStr string `json:"id_str"` Connections []string `json:"connections"` }
FriendshipLookup represents a Twitter user's relationship to currently authorized user
type FriendshipLookupResponse ¶
type FriendshipLookupResponse struct { RateLimit RateLimit FriendshipLookup []FriendshipLookup }
FriendshipLookupResponse represents a response from Twitter with a list of user relationship details relative to currently authorized user
type FriendshipResponse ¶
type FriendshipResponse struct { RateLimit RateLimit Friendship Friendship }
FriendshipResponse represents a response from Twitter with two objects describing the relationship between two users
type GetDirectMessagesParams ¶
type GetDirectMessagesParams struct { SinceID string MaxID string Count int ExcludeEntities bool SkipStatus bool }
GetDirectMessagesParams ...
type HTTPClient ¶
HTTPClient is the interface for making HTTP requests. It accepts an HTTP request and returns the corresponding HTTP response or error.
type HashtagEntity ¶
HashtagEntity represents hashtags which have been parsed out of the Tweet text.
type HomeTimelineParams ¶
type HomeTimelineParams struct { Count int `json:"count"` SinceID string `json:"since_id"` MaxID string `json:"max_id"` TrimUser bool `json:"trim_user"` ExcludeReplies bool `json:"exclude_replies"` ContributorDetails bool `json:"contributor_details"` ExcludeEntities bool `json:"exclude_entities"` }
HomeTimelineParams represents the query parameters for a /statuses/home_timeline.json request.
type IDs ¶
type IDs struct { IDs []string `json:"ids"` PreviousCursor int64 `json:"previous_cursor"` PreviousCursotStr string `json:"previous_cursor_str"` NextCursor int64 `json:"next_cursor"` NextCursorStr string `json:"next_cursor_str"` }
IDs represents a paginated list of string IDs.
type IDsResponse ¶
IDsResponse represents a response from Twitter with paginated string IDs.
type InsightsData ¶
InsightsData represents the object that wraps the response from Twitter's Insights API.
type Language ¶
type Language struct { Code string `json:"code"` Status string `json:"status"` Name string `json:"name"` }
Language represents the language obejct received from Twitter help/langauges
type LanguagesResponse ¶
LanguagesResponse represents a response from Twitter containing languages.
type LimitMessage ¶
type LimitMessage struct {
Track int `json:"track"`
}
LimitMessage represents a stream message that a filtered stream has matched more tweets than its current rate limit allows to be delivered.
type ListFavoritesParams ¶
type ListFavoritesParams struct { UserID string ScreenName string Count int SinceID string MaxID string ExcludeEntities bool }
ListFavoritesParams represents the query parameters for a /favorites/list.json request
type LookupFriendshipsParams ¶
LookupFriendshipsParams represents parameters for /friendships/lookup.json Twitter endpoint
type LookupParams ¶
LookupParams represents the query parameters for a /statuses/lookup.json request.
type LookupUsersParams ¶
LookupUsersParams represents parameters to send to /users/lookup.json Twitter endpoint
type MediaEntity ¶
type MediaEntity struct { DisplayURL string `json:"display_url"` ExpandedURL string `json:"expanded_url"` ID int64 `json:"id"` IDStr string `json:"id_str"` Indices []int `json:"indices"` MediaURL string `json:"media_url"` MediaURLHTTPS string `json:"media_url_https"` Sizes MediaSizes `json:"sizes"` SourceStatusID int64 `json:"source_status_id"` SourceStatusIDStr string `json:"source_status_id_str"` Type string `json:"type"` URL string `json:"url"` VideoInfo VideoInfo `json:"video_info"` }
MediaEntity represents media elements uploaded with a Tweet.
type MediaInsights ¶
type MediaInsights struct { Favourites string `json:"favorites"` Replies string `json:"replies"` Retweets string `json:"retweets"` VideoViews string `json:"video_views"` Impressions string `json:"impressions"` Engagements string `json:"engagements"` }
MediaInsights represents the smallest piece of Twitter's response object for a call to their insights API.
type MediaSizes ¶
type MediaSizes struct { Large MediaSize `json:"large"` Medium MediaSize `json:"medium"` Small MediaSize `json:"small"` Thumb MediaSize `json:"thumb"` }
MediaSizes represents a range of media sizes.
type MediaUpload ¶
type MediaUpload struct { MediaID int64 `json:"media_id"` MediaIDString string `json:"media_id_string"` Size int `json:"size"` ExpiresAfterSecs int `json:"expires_after_secs"` Image Image `json:"image"` Video Video `json:"video"` }
MediaUpload represents a Twitter's response object for media upload
type MediaUploadParameters ¶
type MediaUploadParameters struct { Command string MediaType string TotalBytes int Media []byte MediaID string MediaData string MediaCategory string SegmentIndex int AdditionalOwners []string }
MediaUploadParameters represents the query parameters for /media/upload.json request
INIT requires: Command=INIT, MediaType, TotalBytes APPEND requires: Command=APPEND, MediaID, Media OR MediaData, SegmentIndex FINALIZE requires: Command=FINALIZE, MediaID
type MediaUploadResponse ¶
type MediaUploadResponse struct { RateLimit RateLimit Media MediaUpload }
MediaUploadResponse represents a response from Twitter after media is uploaded
type MentionsTimelineParams ¶
type MentionsTimelineParams struct { Count int `json:"count"` SinceID string `json:"since_id"` MaxID string `json:"max_id"` TrimUser bool `json:"trim_user"` ContributorDetails bool `json:"contributor_details"` ExcludeEntities bool `json:"exclude_entities"` }
MentionsTimelineParams represents the query parameters for a /statuses/mentions_timeline.json request.
type NewDirectMessageParams ¶
NewDirectMessageParams ...
type OEmbed ¶
type OEmbed struct { CacheAge string `json:"cache_age"` URL string `json:"url"` ProviderURL string `json:"provider_url"` ProviderName string `json:"provider_name"` AuthorName string `json:"author_name"` Version string `json:"version"` AuthorURL string `json:"author_url"` Type string `json:"type"` HTML string `json:"html"` Height *int `json:"height"` Width *int `json:"width"` }
OEmbed represents the response body for an oembed request.
type OEmbedParams ¶
type OEmbedParams struct { URL string MaxWidth int HideMedia bool HideThread bool OmitScript bool Align string Related []string Lang string WidgetType string HideTweet bool }
OEmbedParams represents the query parameters for an oembed request.
type OEmbedResponse ¶
OEmbedResponse represents a response from Twitter oembed request.
type Place ¶
type Place struct { Attributes map[string]string `json:"attributes"` BoundingBox BoundingBox `json:"bounding_box"` Country string `json:"country"` CountryCode string `json:"country_code"` FullName string `json:"full_name"` ID string `json:"id"` Name string `json:"name"` PlaceType string `json:"place_type"` URL string `json:"url"` }
Place represents a specific named location with corresponding geo coordinates.
type PostInsightsParams ¶
type PostInsightsParams struct {
PostIDs []string
}
PostInsightsParams represents the body parameters for the /insights/engagement/total request
type PostInsightsResponse ¶
type PostInsightsResponse struct { RateLimit RateLimit Insights InsightsData }
PostInsightsResponse represents a response from Twitter to retrieve insights for a given tween
type PrivacyResponse ¶
PrivacyResponse represents a response from Twitter containing privacy.
type RateLimit ¶
RateLimit represents the Twitter rate limit for the credentials used in the associated request.
type RateLimitStatusResponse ¶
type RateLimitStatusResponse struct { RateLimitsRes RateLimitsRes RateLimit RateLimit }
RateLimitStatusResponse represents a response from Twitter containing multiple RateLimitStatuses.
type RateLimitsRes ¶
type RateLimitsRes struct { RateLimitContext struct { AccessToken string `json:"access_token"` } `json:"rate_limit_context"` Resources struct { Help struct { Configuration RateLimit `json:"/help/configuration"` Languages RateLimit `json:"/help/languages"` Privacy RateLimit `json:"/help/privacy"` TOS RateLimit `json:"/help/tos"` } `json:"help"` Users struct { Contributees RateLimit `json:"/users/contributees"` Contributors RateLimit `json:"/users/contributors"` Lookup RateLimit `json:"/users/lookup"` ProfileBanner RateLimit `json:"/users/profile_banner"` Search RateLimit `json:"/users/search"` ShowID RateLimit `json:"/users/show/:id"` Suggestions RateLimit `json:"/users/suggestions"` SuggestionsSlug RateLimit `json:"/users/suggestions/:slug"` SuggestionsSlugMembers RateLimit `json:"/users/suggestions/:slug/members"` } `json:"users"` Search struct { Tweets RateLimit `json:"/search/tweets"` } `json:"search"` Statuses struct { HomeTimeline RateLimit `json:"/statuses/home_timeline"` Lookup RateLimit `json:"/statuses/lookup"` MentionsTimeline RateLimit `json:"/statuses/mentions_timeline"` OEmbed RateLimit `json:"/statuses/oembed"` Retweeters RateLimit `json:"/statuses/retweeters/ids"` Retweets RateLimit `json:"/statuses/retweets/:id"` RetweetsOfMe RateLimit `json:"/statuses/retweets_of_me"` Show RateLimit `json:"/statuses/show/:id"` UserTimeline RateLimit `json:"/statuses/user_timeline"` } `json:"statuses"` } `json:"resources"` }
RateLimitsRes ...
type Relationship ¶
type Relationship struct { Target RelationshipTarget `json:"target"` Source RelationshipTarget `json:"source"` }
Relationship represents a pair of Twitter users' relationship with each other
type RelationshipTarget ¶
type RelationshipTarget struct { IDStr string `json:"id_str"` ID int64 `json:"id"` ScreenName string `json:"screen_name"` Following bool `json:"following"` FollowedBy bool `json:"followed_by"` }
RelationshipTarget represents a Twitter user's relationship with a source
type RetweetParams ¶
RetweetParams represents the query parameters for a /statuses/retweet/:id.json request.
type RetweeterIDsParams ¶
RetweeterIDsParams represents the query parameters for a /statuses/retweeters/ids.json request.
type RetweetsOfMeParams ¶
type RetweetsOfMeParams struct { Count int `json:"count"` SinceID string `json:"since_id"` MaxID string `json:"max_id"` TrimUser bool `json:"trim_user"` ExcludeEntities bool `json:"exclude_entities"` ExcludeUserEntities bool `json:"exclude_user_entities"` }
RetweetsOfMeParams represents the query parameters for a /statuses/retweets_of_me.json request.
type RetweetsOfTweetParams ¶
type RetweetsOfTweetParams struct { ID string `json:"id"` Count int `json:"count"` TrimUser bool `json:"trim_user"` }
RetweetsOfTweetParams represents the query parameters for a /statuses/retweets/:id.json request.
type ScrubGeoMessage ¶
type ScrubGeoMessage struct { UserID int64 `json:"user_id"` UserIDStr string `json:"user_id_str"` UpToStatusID int64 `json:"up_to_status_id"` UpToStatusIDStr string `json:"up_to_status_id_str"` }
ScrubGeoMessage represents a stream message that geolocated data must be stripped from a range of Tweets.
type SearchTweetsParams ¶
type SearchTweetsParams struct { Query string Geocode string Lang string Locale string ResultType string Count int Until string SinceID string MaxID string ExcludeEntities bool ExtendedEntities bool Callback string }
SearchTweetsParams represents the query parameters for a /search/tweets.json request.
type SearchUsersParams ¶
SearchUsersParams represents parameters to send to /users/search.json Twitter endpoint
type SentDirectMessagesParams ¶
type SentDirectMessagesParams struct { SinceID string MaxID string Count int Page int ExcludeEntities bool }
SentDirectMessagesParams ...
type ShowFriendshipsParameters ¶
type ShowFriendshipsParameters struct { SourceID string SourceScreenName string TargetID string TargetScreenName string }
ShowFriendshipsParameters represents parameters for /friendships/show.json Twitter endpoint
type ShowTweetParams ¶
type ShowTweetParams struct { ID string `json:"id"` TrimUser bool `json:"trim_user"` IncludeMyRetweet bool `json:"include_my_retweet"` ExcludeEntities bool `json:"exclude_entities"` ExtendedTweet bool `json:"extended_tweet"` }
ShowTweetParams represents the query parameters for a /statuses/show/:id.json request.
type ShowUserParams ¶
ShowUserParams reperesents parameters to send to /users/show.json Twitter endpoint
type StatusWithheldMessage ¶
type StatusWithheldMessage struct { ID int64 `json:"id"` UserID int64 `json:"user_id"` WithheldInCountries []string `json:"withheld_in_countries"` }
StatusWithheldMessage represents a stream message that the indicated tweet has been withheld.
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
Stream represents a Twitter stream connection. Messages from the stream can be read off the channel returned by Messages. At any point, the stream can be manually closed by calling the Close method. When the stream exits, the channel returned from the Done method will be closed.
func (*Stream) Close ¶
Close immediately closes the stream and waits for the stream to completely close before returning the stream's shutdown error.
func (*Stream) Done ¶
func (s *Stream) Done() <-chan struct{}
Done returns a channel that is closed when the stream has completely shutdown.
func (*Stream) Err ¶
Err returns the stream's shutdown error after it has been closed. This should only be called after the the channel returned from Done has been closed.
func (*Stream) Messages ¶
func (s *Stream) Messages() <-chan StreamMessage
Messages returns a read-only channel that messages are sent to as they are read off of the stream. Messages should be regualrly waiting on this channel, otherwise the stream's queue (on Twitter's end) will fill up and cause the stream to close.
type StreamErrFn ¶
StreamErrFn represents a function that is called when an error is encountered in a stream and the connection will be retried. If the StreamErrFn returns a non-nil error, the stream will be immediately closed with the error.
type StreamFilterParams ¶
type StreamFilterParams struct { FilterLevel string Follow []string Language []string Locations []string StallWarnings bool Track []string }
StreamFilterParams represents the filter parameters used in a stream. https://dev.twitter.com/streaming/overview/request-parameters
type StreamMessage ¶
type StreamMessage struct { *Tweet Delete *DeleteMessage `json:"delete"` ScrubGeo *ScrubGeoMessage `json:"scrub_geo"` Limit *LimitMessage `json:"limit"` StatusWithheld *StatusWithheldMessage `json:"status_withheld"` UserWithheld *UserWithheldMessage `json:"user_withheld"` Disconnect *DisconnectMessage `json:"disconnect_message"` }
StreamMessage represents a message received from a Twitter stream. Fields should be checked for existence before being used.
type TOSResponse ¶
TOSResponse represents a response from Twitter containing terms of service.
type Tweet ¶
type Tweet struct { Contributor []Contributor `json:"contributors"` Coordinates *Coordinates `json:"coordinates"` CreatedAt string `json:"created_at"` Entities Entities `json:"entities"` ExtendedEntities ExtendedEntities `json:"extended_entities"` ExtendedTweet *ExtendedTweet `json:"extended_tweet"` FavoriteCount int `json:"favorite_count"` Favorited bool `json:"favorited"` FilterLevel string `json:"filter_level"` FullText string `json:"full_text"` ID int64 `json:"id"` IDStr string `json:"id_str"` InReplyToScreenName string `json:"in_reply_to_screen_name"` InReplyToStatusID int64 `json:"in_reply_to_status_id"` InReplyToStatusIDStr string `json:"in_reply_to_status_id_str"` InReplyToUserID int64 `json:"in_reply_to_user_id"` InReplyToUserIDStr string `json:"in_reply_to_user_id_str"` Lang string `json:"lang"` Place *Place `json:"place"` PossiblySensitive bool `json:"possibly_sensitive"` QuotedStatusID int64 `json:"quoted_status_id"` QuotedStatusIDStr string `json:"quoted_status_id_str"` QuotedStatus *Tweet `json:"quoted_status"` RetweetCount int `json:"retweet_count"` Retweeted bool `json:"retweeted"` RetweetedStatus *Tweet `json:"retweeted_status"` Scopes map[string]interface{} `json:"scopes"` Source string `json:"source"` Text string `json:"text"` Truncated bool `json:"truncated"` User User `json:"user"` WithheldCopyright bool `json:"withheld_copyright"` WithheldInCountries []string `json:"withheld_in_countries"` WithheldScope string `json:"withheld_scope"` }
Tweet represents a Twitter tweet object.
type TweetIDs ¶
type TweetIDs map[string]MediaInsights
TweetIDs represents a subset of the return object for the Twitter Insights API.
type TweetResponse ¶
TweetResponse represents a response from Twitter containing a single Tweet.
type TweetsResponse ¶
TweetsResponse represents a response from Twitter containing multiple Tweets.
type URLEntities ¶
type URLEntities struct {
URLs []URLEntity `json:"urls"`
}
URLEntities represents a list of url entities.
type URLEntity ¶
type URLEntity struct { DisplayURL string `json:"display_url"` ExpandedURL string `json:"expanded_url"` Indices []int `json:"indices"` URL string `json:"url"` }
URLEntity represents URLs included in the text of a Tweet or within textual fields of a user object.
type UnretweetParams ¶
UnretweetParams represents the query parameters for a /statuses/retweet/:id.json request.
type UpdateTweetParams ¶
type UpdateTweetParams struct { Status string InReplyToStatusID string PossiblySensitive bool Location *Location PlaceID string DisplayCoordinates bool TrimUser bool MediaIDs []string }
UpdateTweetParams represents the query parameters for a /statuses/update.json request.
type User ¶
type User struct { ContributorsEnabled bool `json:"contributors_enabled"` CreatedAt string `json:"created_at"` DefaultProfile bool `json:"default_profile"` DefaultProfileImage bool `json:"default_profile_image"` Description string `json:"description"` Entities Entities `json:"entities"` FavouritesCount int `json:"favourites_count"` FollowRequestSent bool `json:"follow_request_sent"` Following bool `json:"following"` FollowersCount int `json:"followers_count"` FriendsCount int `json:"friends_count"` GeoEnabled bool `json:"geo_enabled"` ID int64 `json:"id"` IDStr string `json:"id_str"` IsTranslator bool `json:"is_translator"` Lang string `json:"lang"` ListedCount int `json:"listed_count"` Location string `json:"location"` Name string `json:"name"` Notifications bool `json:"notifications"` ProfileBackgroundColor string `json:"profile_background_color"` ProfileBackgroundImageURL string `json:"profile_background_image_url"` ProfileBackgroundImageURLHTTPS string `json:"profile_background_image_url_https"` ProfileBackgroundTile bool `json:"profile_background_tile"` ProfileBannerURL string `json:"profile_banner_url"` ProfileImageURL string `json:"profile_image_url"` ProfileImageURLHTTPS string `json:"profile_image_url_https"` ProfileLinkColor string `json:"profile_link_color"` ProfileSidebarBorderColor string `json:"profile_sidebar_border_color"` ProfileSidebarFillColor string `json:"profile_sidebar_fill_color"` ProfileTextColor string `json:"profile_text_color"` ProfileUseBackgroundImage bool `json:"profile_use_background_image"` Protected bool `json:"protected"` ScreenName string `json:"screen_name"` ShowAllInlineMedia bool `json:"show_all_inline_media"` Status *Tweet `json:"status"` // can be null StatusesCount int `json:"statuses_count"` TimeZone string `json:"time_zone"` URL string `json:"url"` UTCOffset int `json:"utc_offset"` Verified bool `json:"verified"` WithheldInCountries []string `json:"withheld_in_countries"` WithheldScope string `json:"withheld_scope"` }
User represents a twitter user object, as received using the twitter REST API.
type UserMentionEntity ¶
type UserMentionEntity struct { ID int64 `json:"id"` IDStr string `json:"id_str"` Indices []int `json:"indices"` Name string `json:"name"` ScreenName string `json:"screen_name"` }
UserMentionEntity represents other Twitter users mentioned in the text of a tweet.
type UserResponse ¶
UserResponse represents a response from Twitter with a user object
type UserTimelineParams ¶
type UserTimelineParams struct { UserID string `json:"user_id"` ScreenName string `json:"screen_name"` SinceID string `json:"since_id"` Count int `json:"count"` MaxID string `json:"max_id"` TrimUser bool `json:"trim_user"` ExcludeReplies bool `json:"exclude_replies"` ContributorDetails bool `json:"contributor_details"` ExcludeRTS bool `json:"exclude_rts"` }
UserTimelineParams represents the query parameters for a /statuses/user_timeline.json request.
type UserWithheldMessage ¶
type UserWithheldMessage struct { ID int64 `json:"id"` WithheldInCountries []string `json:"withheld_in_countries"` }
UserWithheldMessage represents a steram message that tweets from the indicated user have been withheld.
type UsersResponse ¶
UsersResponse represents a response from Twitter with a list of user objects
type Video ¶
type Video struct {
VideoType string `json:"video_type"`
}
Video represents info on a Twitter video
type VideoInfo ¶
type VideoInfo struct { AspectRatio []int `json:"aspect_ratio"` DurationMillis int `json:"duration_millis"` Variants []VideoVariant `json:"variants"` }
VideoInfo represents information specific to videos.
type VideoVariant ¶
type VideoVariant struct { Bitrate int `json:"bitrate"` ContentType string `json:"content_type"` URL string `json:"url"` }
VideoVariant represents video info for a single bitrate.