Documentation ¶
Index ¶
- type Authorizer
- type EntitiesObj
- type EntityAnnotationObj
- type EntityMentionObj
- type EntityObj
- type EntityTagObj
- type EntityURLObj
- type Expansion
- type MediaField
- type MediaMetricsObj
- type MediaObj
- type PlaceField
- type PlaceGeoObj
- type PlaceObj
- type PollField
- type PollObj
- type PollOptionObj
- type Tweet
- func (t *Tweet) Lookup(ctx context.Context, ids []string, parameters TweetLookupParameters) (TweetLookups, error)
- func (t *Tweet) RecentSearch(ctx context.Context, query string, parameters TweetRecentSearchParameters) (*TweetRecentSearch, error)
- func (t *Tweet) SearchStream(ctx context.Context, parameters TweetStreamSearchParameters) (TweetLookups, error)
- func (t *Tweet) SearchStreamRules(ctx context.Context, ids []string) (*TweetSearchStreamRules, error)
- func (t *Tweet) UpdateSearchStreamRules(ctx context.Context, rules TweetSearchStreamRule, validate bool) (*TweetSearchStreamRules, error)
- type TweetAttachmentsObj
- type TweetContextAnnotationObj
- type TweetContextObj
- type TweetError
- type TweetErrorResponse
- type TweetField
- type TweetGeoCoordinatesObj
- type TweetGeoObj
- type TweetLookup
- type TweetLookupParameters
- type TweetLookups
- type TweetMetricsObj
- type TweetObj
- type TweetRecentSearch
- type TweetRecentSearchMeta
- type TweetRecentSearchParameters
- type TweetReferencedTweetObj
- type TweetSearchStreamAddRule
- type TweetSearchStreamDeleteRule
- type TweetSearchStreamRule
- type TweetSearchStreamRuleData
- type TweetSearchStreamRuleMeta
- type TweetSearchStreamRuleSummary
- type TweetSearchStreamRules
- type TweetStreamSearchParameters
- type UserField
- type UserMetricsObj
- type UserObj
- type WithHeldObj
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authorizer ¶
Authorizer will add the authorization to the HTTP request
type EntitiesObj ¶
type EntitiesObj struct { Annotations []EntityAnnotationObj `json:"annotations"` URLs []EntityURLObj `json:"urls"` HashTags []EntityTagObj `json:"hashtags"` Mentions []EntityMentionObj `json:"mentions"` CashTags []EntityTagObj `json:"cashtags"` }
EntitiesObj contains details about text that has a special meaning.
type EntityAnnotationObj ¶
type EntityAnnotationObj struct { EntityObj Probability float64 `json:"probability"` Type string `json:"type"` NormalizedText string `json:"normalized_text"` }
EntityAnnotationObj contains details about annotations relative to the text.
type EntityMentionObj ¶
EntityMentionObj contains details about text recognized as a user mention.
type EntityTagObj ¶
EntityTagObj contains details about text recognized as a tag
type EntityURLObj ¶
type EntityURLObj struct { EntityObj URL string `json:"url"` ExpandedURL string `json:"expanded_url"` DisplayURL string `json:"display_url"` Status string `json:"status"` Title string `json:"title"` Desription string `json:"description"` UnwoundURL string `json:"unwound_url"` }
EntityURLObj contains details about text recognized as a URL.
type Expansion ¶
type Expansion string
Expansion can expand objects referenced in the payload
const ( // ExpansionAttachmentsPollIDs returns a poll object containing metadata for the poll included in the Tweet ExpansionAttachmentsPollIDs Expansion = "attachments.poll_ids" // ExpansionAttachmentsMediaKeys returns a media object representing the images, videos, GIFs included in the Tweet ExpansionAttachmentsMediaKeys Expansion = "attachments.media_keys" // ExpansionAuthorID returns a user object representing the Tweet’s author ExpansionAuthorID Expansion = "author_id" // ExpansionEntitiesMentionsUserName returns a user object for the user mentioned in the Tweet ExpansionEntitiesMentionsUserName Expansion = "entities.mentions.username" // ExpansionGeoPlaceID returns a place object containing metadata for the location tagged in the Tweet ExpansionGeoPlaceID Expansion = "geo.place_id" // ExpansionInReplyToUserID returns a user object representing the Tweet author this requested Tweet is a reply of ExpansionInReplyToUserID Expansion = "in_reply_to_user_id" // ExpansionReferencedTweetsID returns a Tweet object that this Tweet is referencing (either as a Retweet, Quoted Tweet, or reply) ExpansionReferencedTweetsID Expansion = "referenced_tweets.id" // ExpansionReferencedTweetsIDAuthorID returns a user object for the author of the referenced Tweet ExpansionReferencedTweetsIDAuthorID Expansion = "referenced_tweets.id.author_id" // ExpansionPinnedTweetID returns a Tweet object representing the Tweet pinned to the top of the user’s profile ExpansionPinnedTweetID Expansion = "pinned_tweet_id" )
type MediaField ¶
type MediaField string
MediaField can expand the fields that are returned in the media object
const ( // MediaFieldDurationMS available when type is video. Duration in milliseconds of the video. MediaFieldDurationMS MediaField = "duration_ms" // MediaFieldHeight of this content in pixels. MediaFieldHeight MediaField = "height" // MediaFieldMediaKey unique identifier of the expanded media content. MediaFieldMediaKey MediaField = "media_key" // MediaFieldPreviewImageURL is the URL to the static placeholder preview of this content. MediaFieldPreviewImageURL MediaField = "preview_image_url" // MediaFieldType is the type of content (animated_gif, photo, video) MediaFieldType MediaField = "type" // MediaFieldURL is the URL of the content MediaFieldURL MediaField = "url" // MediaFieldWidth is the width of this content in pixels MediaFieldWidth MediaField = "width" // MediaFieldPublicMetrics is the public engagement metrics for the media content at the time of the request. MediaFieldPublicMetrics MediaField = "public_metrics" // MediaFieldNonPublicMetrics is the non-public engagement metrics for the media content at the time of the request. MediaFieldNonPublicMetrics MediaField = "non_public_metrics" // MediaFieldOrganicMetrics is the engagement metrics for the media content, tracked in an organic context, at the time of the request. MediaFieldOrganicMetrics MediaField = "organic_metrics" // MediaFieldPromotedMetrics is the URL to the static placeholder preview of this content. MediaFieldPromotedMetrics MediaField = "promoted_metrics" )
type MediaMetricsObj ¶
type MediaMetricsObj struct { Playback0 int `json:"playback_0_count"` Playback100 int `json:"playback_100_count"` Playback25 int `json:"playback_25_count"` Playback50 int `json:"playback_50_count"` Playback75 int `json:"playback_75_count"` Views int `json:"view_count"` }
MediaMetricsObj engagement metrics for the media content at the time of the request
type MediaObj ¶
type MediaObj struct { Key string `json:"media_key"` Type string `json:"type"` URL string `json:"url"` DurationMS int `json:"duration_ms"` Height int `json:"height"` NonPublicMetrics MediaMetricsObj `json:"non_public_metrics"` OrganicMetrics MediaMetricsObj `json:"organic_metrics"` PreviewImageURL string `json:"preview_image_url"` PromotedMetrics MediaMetricsObj `json:"promoted_metrics"` PublicMetrics MediaMetricsObj `json:"public_metrics"` Width int `json:"width"` }
MediaObj refers to any image, GIF, or video attached to a Tweet
type PlaceField ¶
type PlaceField string
PlaceField can expand the tweet primary object
const ( // PlaceFieldContainedWithin returns the identifiers of known places that contain the referenced place. PlaceFieldContainedWithin PlaceField = "contained_within" // PlaceFieldCountry is the full-length name of the country this place belongs to. PlaceFieldCountry PlaceField = "country" // PlaceFieldCountryCode is the ISO Alpha-2 country code this place belongs to. PlaceFieldCountryCode PlaceField = "country_code" // PlaceFieldFullName is a longer-form detailed place name. PlaceFieldFullName PlaceField = "full_name" // PlaceFieldGeo contains place details in GeoJSON format. PlaceFieldGeo PlaceField = "geo" // PlaceFieldID is the unique identifier of the expanded place, if this is a point of interest tagged in the Tweet. PlaceFieldID PlaceField = "id" // PlaceFieldName is the short name of this place PlaceFieldName PlaceField = "name" // PlaceFieldPlaceType is specified the particular type of information represented by this place information, such as a city name, or a point of interest. PlaceFieldPlaceType PlaceField = "place_type" )
type PlaceGeoObj ¶
type PlaceGeoObj struct { Type string `json:"type"` BBox []float64 `json:"bbox"` Properties map[string]interface{} `json:"properties"` }
PlaceGeoObj contains place details
type PlaceObj ¶
type PlaceObj struct { FullName string `json:"full_name"` ID string `json:"id"` ContainedWithin []string `json:"contained_within"` Country string `json:"country"` CountryCode string `json:"country_code"` Geo PlaceGeoObj `json:"geo"` Name string `json:"name"` PlaceType string `json:"place_type"` }
PlaceObj tagged in a Tweet is not a primary object on any endpoint
type PollField ¶
type PollField string
PollField defines the fields of the expanded tweet
const ( // PollFieldDurationMinutes specifies the total duration of this poll. PollFieldDurationMinutes PollField = "duration_minutes" // PollFieldEndDateTime specifies the end date and time for this poll. PollFieldEndDateTime PollField = "end_datetime" // PollFieldID is unique identifier of the expanded poll. PollFieldID PollField = "id" // PollFieldOptions contains objects describing each choice in the referenced poll. PollFieldOptions PollField = "options" // PollFieldVotingStatus indicates if this poll is still active and can receive votes, or if the voting is now closed. PollFieldVotingStatus PollField = "voting_status" )
type PollObj ¶
type PollObj struct { ID string `json:"id"` Options []PollOptionObj `json:"options"` DurationMinutes int `json:"duration_minutes"` EndDateTime string `json:"end_datetime"` VotingStatus string `json:"voting_status"` }
PollObj included in a Tweet is not a primary object on any endpoint
type PollOptionObj ¶
type PollOptionObj struct { Position int `json:"position"` Label string `json:"label"` Votes int `json:"votes"` }
PollOptionObj contains objects describing each choice in the referenced poll.
type Tweet ¶
type Tweet struct { Authorizer Authorizer Client *http.Client Host string }
Tweet represents the Tweet v2 APIs
func (*Tweet) Lookup ¶
func (t *Tweet) Lookup(ctx context.Context, ids []string, parameters TweetLookupParameters) (TweetLookups, error)
Lookup will return a tweet or tweets from a set of ids
func (*Tweet) RecentSearch ¶
func (t *Tweet) RecentSearch(ctx context.Context, query string, parameters TweetRecentSearchParameters) (*TweetRecentSearch, error)
RecentSearch will query the recent search
func (*Tweet) SearchStream ¶
func (t *Tweet) SearchStream(ctx context.Context, parameters TweetStreamSearchParameters) (TweetLookups, error)
SearchStream allows to stream some tweets on a specific set of filter rules
func (*Tweet) SearchStreamRules ¶
func (t *Tweet) SearchStreamRules(ctx context.Context, ids []string) (*TweetSearchStreamRules, error)
SearchStreamRules will return the rules from the ids
func (*Tweet) UpdateSearchStreamRules ¶
func (t *Tweet) UpdateSearchStreamRules(ctx context.Context, rules TweetSearchStreamRule, validate bool) (*TweetSearchStreamRules, error)
UpdateSearchStreamRules will add and/or remove rules from the seach stream
type TweetAttachmentsObj ¶
type TweetAttachmentsObj struct { MediaKeys []string `json:"media_keys"` PollIDs []string `json:"poll_ids"` }
TweetAttachmentsObj specifics the type of attachment present in the tweet
type TweetContextAnnotationObj ¶
type TweetContextAnnotationObj struct { Domain TweetContextObj `json:"domain"` Entity TweetContextObj `json:"entity"` }
TweetContextAnnotationObj contain the context annotation
type TweetContextObj ¶
type TweetContextObj struct { ID string `json:"id"` Name string `json:"name"` Description string `json:"description"` }
TweetContextObj contains the elements which identify detailed information regarding the domain classificaiton based on the Tweet text
type TweetError ¶
type TweetError struct { Parameters interface{} `json:"parameters"` Message string `json:"message"` }
TweetError is the group of errors in a response
type TweetErrorResponse ¶
type TweetErrorResponse struct { StatusCode int Errors []TweetError `json:"errors"` Title string `json:"title"` Detail string `json:"detail"` Type string `json:"type"` }
TweetErrorResponse is the error message from the callout
func (*TweetErrorResponse) Error ¶
func (t *TweetErrorResponse) Error() string
type TweetField ¶
type TweetField string
TweetField defines the fields of the basic building block of all things twitter
const ( // TweetFieldID is the unique identifier of the requested Tweet. TweetFieldID TweetField = "id" // TweetFieldText is the actual UTF-8 text of the Tweet. See twitter-text for details on what characters are currently considered valid. TweetFieldText TweetField = "text" // TweetFieldAttachments specifies the type of attachments (if any) present in this Tweet. TweetFieldAttachments TweetField = "attachments" // TweetFieldAuthorID is the unique identifier of the User who posted this Tweet TweetFieldAuthorID TweetField = "author_id" // TweetFieldContextAnnotations contains context annotations for the Tweet. TweetFieldContextAnnotations TweetField = "context_annotations" // TweetFieldConversationID is the Tweet ID of the original Tweet of the conversation (which includes direct replies, replies of replies). TweetFieldConversationID TweetField = "conversation_id" // TweetFieldCreatedAt is the creation time of the Tweet. TweetFieldCreatedAt TweetField = "created_at" // TweetFieldEntities are the entities which have been parsed out of the text of the Tweet. Additionally see entities in Twitter Objects. TweetFieldEntities TweetField = "entities" // TweetFieldGeo contains details about the location tagged by the user in this Tweet, if they specified one. TweetFieldGeo TweetField = "geo" // TweetFieldInReplyToUserID will contain the original Tweet’s author ID TweetFieldInReplyToUserID TweetField = "in_reply_to_user_id" // TweetFieldLanguage is the language of the Tweet, if detected by Twitter. Returned as a BCP47 language tag. TweetFieldLanguage TweetField = "lang" // TweetFieldNonPublicMetrics are the non-public engagement metrics for the Tweet at the time of the request. TweetFieldNonPublicMetrics TweetField = "non_public_metrics" // TweetFieldPublicMetrics are the public engagement metrics for the Tweet at the time of the request. TweetFieldPublicMetrics TweetField = "public_metrics" // TweetFieldOrganicMetrics are the engagement metrics, tracked in an organic context, for the Tweet at the time of the request. TweetFieldOrganicMetrics TweetField = "organic_metrics" // TweetFieldPromotedMetrics are the engagement metrics, tracked in a promoted context, for the Tweet at the time of the request. TweetFieldPromotedMetrics TweetField = "promoted_metrics" // TweetFieldPossiblySensitve is an indicator that the URL contained in the Tweet may contain content or media identified as sensitive content. TweetFieldPossiblySensitve TweetField = "possibly_sensitive" // TweetFieldReferencedTweets is a list of Tweets this Tweet refers to. TweetFieldReferencedTweets TweetField = "referenced_tweets" // TweetFieldSource is the name of the app the user Tweeted from. TweetFieldSource TweetField = "source" // TweetFieldWithHeld contains withholding details TweetFieldWithHeld TweetField = "withheld" )
type TweetGeoCoordinatesObj ¶
type TweetGeoCoordinatesObj struct { Type string `json:"type"` Coordinates []float64 `json:"coordinates"` }
TweetGeoCoordinatesObj contains details about the coordinates of the location tagged by the user in this Tweet, if they specified one.
type TweetGeoObj ¶
type TweetGeoObj struct { PlaceID string `json:"place_id"` Coordinates TweetGeoCoordinatesObj `json:"coordinates"` }
TweetGeoObj contains details about the location tagged by the user in this Tweet, if they specified one.
type TweetLookup ¶
type TweetLookup struct { Tweet TweetObj Media *MediaObj Place *PlaceObj Poll *PollObj User *UserObj }
TweetLookup is a complete tweet objects
type TweetLookupParameters ¶
type TweetLookupParameters struct { Expansions []Expansion MediaFields []MediaField PlaceFields []PlaceField PollFields []PollField TweetFields []TweetField UserFields []UserField // contains filtered or unexported fields }
TweetLookupParameters are the query parameters for the tweet lookup
type TweetMetricsObj ¶
type TweetMetricsObj struct { Impressions int `json:"impression_count"` URLLinkClicks int `json:"url_link_clicks"` UserProfileClicks int `json:"user_profile_clicks"` Likes int `json:"like_count"` Replies int `json:"reply_count"` Retweets int `json:"retweet_count"` Quotes int `json:"quote_count"` }
TweetMetricsObj engagement metrics for the Tweet at the time of the request
type TweetObj ¶
type TweetObj struct { ID string `json:"id"` Text string `json:"text"` Attachments TweetAttachmentsObj `json:"attachments"` AuthorID string `json:"author_id"` ContextAnnotations []TweetContextAnnotationObj `json:"context_annotations"` ConversationID string `json:"conversation_id"` CreatedAt string `json:"created_at"` Entities EntitiesObj `json:"entities"` Geo TweetGeoObj `json:"geo"` InReplyToUserID string `json:"in_reply_to_user_id"` Language string `json:"lang"` NonPublicMetrics TweetMetricsObj `json:"non_public_metrics"` OrganicMetrics TweetMetricsObj `json:"organic_metrics"` PossibySensitive bool `json:"possiby_sensitive"` PromotedMetrics TweetMetricsObj `json:"promoted_metrics"` PublicMetrics TweetMetricsObj `json:"public_metrics"` ReferencedTweets []TweetReferencedTweetObj `json:"referenced_tweets"` Source string `json:"source"` WithHeld WithHeldObj `json:"withheld"` }
TweetObj is the primary object on the tweets endpoints
type TweetRecentSearch ¶
type TweetRecentSearch struct { LookUps TweetLookups Meta TweetRecentSearchMeta }
TweetRecentSearch is what is returned from the callout
func (*TweetRecentSearch) UnmarshalJSON ¶
func (t *TweetRecentSearch) UnmarshalJSON(b []byte) error
UnmarshalJSON will unmarshal the byte array
type TweetRecentSearchMeta ¶
type TweetRecentSearchMeta struct { NewestID string `json:"newest_id"` OldestID string `json:"oldest_id"` ResultCount int `json:"result_count"` NextToken string `json:"next_token"` }
TweetRecentSearchMeta is the media data returned from the recent search
type TweetRecentSearchParameters ¶
type TweetRecentSearchParameters struct { StartTime time.Time EndTime time.Time MaxResult int NextToken string SinceID string UntilID string Expansions []Expansion MediaFields []MediaField PlaceFields []PlaceField PollFields []PollField TweetFields []TweetField UserFields []UserField // contains filtered or unexported fields }
TweetRecentSearchParameters handles all of the recent search parameters
type TweetReferencedTweetObj ¶
TweetReferencedTweetObj is a Tweet this Tweet refers to
type TweetSearchStreamAddRule ¶
type TweetSearchStreamAddRule struct { Value string `json:"value"` Tag string `json:"tag,omitempty"` }
TweetSearchStreamAddRule are the rules to add the search stream
type TweetSearchStreamDeleteRule ¶
type TweetSearchStreamDeleteRule struct {
IDs []string `json:"ids"`
}
TweetSearchStreamDeleteRule lists the search rule ids to remove
type TweetSearchStreamRule ¶
type TweetSearchStreamRule struct { Add []*TweetSearchStreamAddRule `json:"add,omitempty"` Delete *TweetSearchStreamDeleteRule `json:"delete,omitempty"` }
TweetSearchStreamRule are the rules to add and/or delete
type TweetSearchStreamRuleData ¶
type TweetSearchStreamRuleData struct { ID string `json:"id"` Value string `json:"value"` Tag string `json:"tag"` }
TweetSearchStreamRuleData are the rules that where added
type TweetSearchStreamRuleMeta ¶
type TweetSearchStreamRuleMeta struct { Sent string `json:"sent"` Summary TweetSearchStreamRuleSummary `json:"summary"` }
TweetSearchStreamRuleMeta is the meta data for the search rules
type TweetSearchStreamRuleSummary ¶
type TweetSearchStreamRuleSummary struct { Created int `json:"created"` NotCreated int `json:"not_created"` Deleted int `json:"deleted"` NotDeleted int `json:"not_deleted"` }
TweetSearchStreamRuleSummary is the summary of the rules
type TweetSearchStreamRules ¶
type TweetSearchStreamRules struct { Data []TweetSearchStreamRuleData `json:"data"` Meta TweetSearchStreamRuleMeta `json:"meta"` }
TweetSearchStreamRules is the returned set of rules
type TweetStreamSearchParameters ¶
type TweetStreamSearchParameters struct { Expansions []Expansion MediaFields []MediaField PlaceFields []PlaceField PollFields []PollField TweetFields []TweetField UserFields []UserField }
TweetStreamSearchParameters are the search tweet get parameters
type UserField ¶
type UserField string
UserField defines the twitter user account metadata fields
const ( // UserFieldCreatedAt is the UTC datetime that the user account was created on Twitter. UserFieldCreatedAt UserField = "created_at" // UserFieldDescription is the text of this user's profile description (also known as bio), if the user provided one. UserFieldDescription UserField = "description" // UserFieldEntities contains details about text that has a special meaning in the user's description. UserFieldEntities UserField = "entities" // UserFieldID is the unique identifier of this user. UserFieldID UserField = "id" // UserFieldLocation is the location specified in the user's profile, if the user provided one. UserFieldLocation UserField = "location" // UserFieldName is the name of the user, as they’ve defined it on their profile UserFieldName UserField = "name" // UserFieldPinnedTweetID is the unique identifier of this user's pinned Tweet. UserFieldPinnedTweetID UserField = "pinned_tweet_id" // UserFieldProfileImageURL is the URL to the profile image for this user, as shown on the user's profile. UserFieldProfileImageURL UserField = "profile_image_url" // UserFieldProtected indicates if this user has chosen to protect their Tweets (in other words, if this user's Tweets are private). UserFieldProtected UserField = "protected" // UserFieldPublicMetrics contains details about activity for this user. UserFieldPublicMetrics UserField = "public_metrics" // UserFieldURL is the URL specified in the user's profile, if present. UserFieldURL UserField = "url" // UserFieldUserName is the Twitter screen name, handle, or alias that this user identifies themselves with UserFieldUserName UserField = "username" // UserFieldVerified indicates if this user is a verified Twitter User. UserFieldVerified UserField = "verified" // UserFieldWithHeld contains withholding details UserFieldWithHeld UserField = "withheld" )
type UserMetricsObj ¶
type UserMetricsObj struct { Followers int `json:"followers_count"` Following int `json:"following_count"` Tweets int `json:"tweet_count"` Listed int `json:"listed_count"` }
UserMetricsObj contains details about activity for this user
type UserObj ¶
type UserObj struct { ID string `json:"id"` Name string `json:"name"` UserName string `json:"username"` CreatedAt string `json:"created_at"` Description string `json:"description"` Entities EntitiesObj `json:"entities"` Location string `json:"location"` PinnedTweetID string `json:"pinned_tweet_id"` ProfileImageURL string `json:"profile_image_url"` Protected bool `json:"protected"` PublicMetrics UserMetricsObj `json:"public_metrics"` URL string `json:"url"` Verified bool `json:"verified"` WithHeld WithHeldObj `json:"withheld"` }
UserObj contains Twitter user account metadata describing the referenced user
type WithHeldObj ¶
type WithHeldObj struct { Copyright bool `json:"copyright"` CountryCodes []string `json:"country_codes"` }
WithHeldObj contains withholding details