Documentation
¶
Overview ¶
Package gotwtr provides a Client for the Twitter v2 API.
Note ¶
This library will cover all Twitter v2 API in the future, but please note that not all Twitter API are currently compatible with v2.
Because, Twitter announced Twitter v2 API is ready for prime time.
So, we covers only Twitter v2 API supported by OAuth 2.0 Bearer Token.
We will had worked on it, when new one is be handled OAuth 2.0.
Index ¶
- Constants
- func CalculateClickThroughRate(metrics *TweetMetrics) float64
- func CalculateEngagementRate(metrics *TweetMetrics) float64
- type APIResponseError
- type AddOrDeleteJSONBody
- type AddOrDeleteMetaSummary
- type AddOrDeleteRulesMeta
- type AddOrDeleteRulesOption
- type AddOrDeleteRulesResponse
- type AddRule
- type AllListsOwnedOption
- type AllListsOwnedResponse
- type AllListsUserFollowsResponse
- type Analytics
- type AnalyticsComparison
- type AnalyticsTimeframe
- type BlockOption
- type Blocking
- type BlockingBody
- type BlockingResponse
- type BlocksMeta
- type BookmarkTweetBody
- type BookmarkTweetData
- type BookmarkTweetResponse
- type Client
- func (c *Client) AddOrDeleteRules(ctx context.Context, body *AddOrDeleteJSONBody, opt ...*AddOrDeleteRulesOption) (*AddOrDeleteRulesResponse, error)
- func (c *Client) AllListsUserFollows(ctx context.Context, userID string, opt ...*ListFollowsOption) (*AllListsUserFollowsResponse, error)
- func (c *Client) AppendChunkedUpload(ctx context.Context, req *MediaUploadAppendRequest) error
- func (c *Client) Blocking(ctx context.Context, userID string, opt ...*BlockOption) (*BlockingResponse, error)
- func (c *Client) BookmarkTweet(ctx context.Context, userID string, body *BookmarkTweetBody) (*BookmarkTweetResponse, error)
- func (c *Client) CalculateEngagementMetrics(metrics *TweetMetrics) *EngagementMetrics
- func (c *Client) CalculateEngagementRate(metrics *TweetMetrics) float64
- func (c *Client) CheckUploadStatus(ctx context.Context, req *MediaUploadStatusRequest) (*MediaUploadResponse, error)
- func (c *Client) CompareMetrics(current, previous *TweetMetrics) *AnalyticsComparison
- func (c *Client) ComplianceJob(ctx context.Context, complianceJobID int) (*ComplianceJobResponse, error)
- func (c *Client) ComplianceJobs(ctx context.Context, opt *ComplianceJobsOption) (*ComplianceJobsResponse, error)
- func (c *Client) ConnectToStream(ctx context.Context, ch chan<- ConnectToStreamResponse, errCh chan<- error, ...) *ConnectToStream
- func (c *Client) CountAllTweets(ctx context.Context, tweet string, opt ...*TweetCountsAllOption) (*TweetCountsResponse, error)
- func (c *Client) CountRecentTweets(ctx context.Context, tweet string, opt ...*TweetCountsOption) (*TweetCountsResponse, error)
- func (c *Client) CreateCommunityNote(ctx context.Context, body *CreateCommunityNoteBody) (*CreateCommunityNoteResponse, error)
- func (c *Client) CreateComplianceJob(ctx context.Context, opt ...*CreateComplianceJobOption) (*CreateComplianceJobResponse, error)
- func (c *Client) CreateNewGroupDM(ctx context.Context, conversationID string, body *CreateNewGroupDMBody) (*CreateNewGroupDMResponse, error)
- func (c *Client) CreateNewList(ctx context.Context, body *CreateNewListBody) (*CreateNewListResponse, error)
- func (c *Client) CreateOneToOneDM(ctx context.Context, participantID string, body *CreateOneToOneDMBody) (*CreateOneToOneDMResponse, error)
- func (c *Client) DeleteList(ctx context.Context, listID string) (*DeleteListResponse, error)
- func (c Client) DeleteTweet(ctx context.Context, tweetID string) (*DeleteTweetResponse, error)
- func (c *Client) DiscoverSpaces(ctx context.Context, userIDs []string, opt ...*DiscoverSpacesOption) (*DiscoverSpacesResponse, error)
- func (c *Client) FinalizeChunkedUpload(ctx context.Context, req *MediaUploadFinalizeRequest) (*MediaUploadResponse, error)
- func (c *Client) Followers(ctx context.Context, userID string, opt ...*FollowOption) (*FollowersResponse, error)
- func (c *Client) Following(ctx context.Context, userID string, opt ...*FollowOption) (*FollowingResponse, error)
- func (c *Client) GenerateAppOnlyBearerToken(ctx context.Context) (bool, error)
- func (c *Client) GetTopPerformingTweets(tweets []*Tweet, limit int) []*Tweet
- func (c Client) HideReplies(ctx context.Context, tweetID string, hidden bool) (*HideRepliesResponse, error)
- func (c *Client) InitializeChunkedUpload(ctx context.Context, req *MediaUploadInitRequest) (*MediaUploadResponse, error)
- func (c *Client) InvalidateToken(ctx context.Context) (*InvalidateTokenResponse, error)
- func (c *Client) ListFollowers(ctx context.Context, listID string, opt ...*ListFollowersOption) (*ListFollowersResponse, error)
- func (c *Client) ListMembers(ctx context.Context, listID string, opt ...*ListMembersOption) (*ListMembersResponse, error)
- func (c *Client) ListsSpecifiedUser(ctx context.Context, userID string, opt ...*ListsSpecifiedUserOption) (*ListsSpecifiedUserResponse, error)
- func (c *Client) LookUpAllDM(ctx context.Context, opt ...*DirectMessageOption) (*LookUpAllDMResponse, error)
- func (c *Client) LookUpAllListsOwned(ctx context.Context, userID string, opt ...*AllListsOwnedOption) (*AllListsOwnedResponse, error)
- func (c *Client) LookUpAllOneToOneDM(ctx context.Context, participantID string, opt ...*DirectMessageOption) (*LookUpAllOneToOneDMResponse, error)
- func (c *Client) LookUpDM(ctx context.Context, dmConversationID string, opt ...*DirectMessageOption) (*LookUpDMResponse, error)
- func (c *Client) LookUpList(ctx context.Context, listID string, opt ...*LookUpListOption) (*ListResponse, error)
- func (c *Client) LookUpListTweets(ctx context.Context, listID string, opt ...*ListTweetsOption) (*ListTweetsResponse, error)
- func (c *Client) LookUpSpace(ctx context.Context, spaceID string, opt ...*SpaceOption) (*SpaceResponse, error)
- func (c *Client) LookUpSpaces(ctx context.Context, spaceIDs []string, opt ...*SpaceOption) (*SpacesResponse, error)
- func (c *Client) LookupUserBookmarks(ctx context.Context, userID string, opt ...*LookupUserBookmarksOption) (*LookupUserBookmarksResponse, error)
- func (c *Client) Me(ctx context.Context, opt ...*MeOption) (*MeResponse, error)
- func (c *Client) Muting(ctx context.Context, userID string, opt ...*MuteOption) (*MutingResponse, error)
- func (c *Client) PinnedLists(ctx context.Context, userID string, opt ...*PinnedListsOption) (*PinnedListsResponse, error)
- func (c *Client) PostBlocking(ctx context.Context, userID string, targetUserID string) (*PostBlockingResponse, error)
- func (c *Client) PostDM(ctx context.Context, body *PostDMBody) (*PostDMResponse, error)
- func (c *Client) PostDMBlocking(ctx context.Context, userID string, targetUserID string) (*PostDMBlockingResponse, error)
- func (c *Client) PostFollowing(ctx context.Context, userID string, targetUserID string) (*PostFollowingResponse, error)
- func (c *Client) PostListFollows(ctx context.Context, listID string, userID string) (*PostListFollowsResponse, error)
- func (c *Client) PostListMembers(ctx context.Context, listID string, userID string) (*PostListMembersResponse, error)
- func (c *Client) PostMuting(ctx context.Context, userID string, targetUserID string) (*PostMutingResponse, error)
- func (c *Client) PostPinnedLists(ctx context.Context, listID string, userID string) (*PostPinnedListsResponse, error)
- func (c Client) PostRetweet(ctx context.Context, userID string, tweetID string) (*PostRetweetResponse, error)
- func (c Client) PostTweet(ctx context.Context, body *PostTweetOption) (*PostTweetResponse, error)
- func (c Client) PostUsersLikingTweet(ctx context.Context, userID string, tweetID string) (*PostUsersLikingTweetResponse, error)
- func (c *Client) QuoteTweets(ctx context.Context, tweetID string, opt ...*QuoteTweetsOption) (*QuoteTweetsResponse, error)
- func (c *Client) RemoveBookmarkOfTweet(ctx context.Context, userID string, tweetID string) (*RemoveBookmarkOfTweetResponse, error)
- func (c *Client) RetrieveMultipleTweets(ctx context.Context, tweetIDs []string, opt ...*RetriveTweetOption) (*TweetsResponse, error)
- func (c *Client) RetrieveMultipleUsersWithIDs(ctx context.Context, userIDs []string, opt ...*RetrieveUserOption) (*UsersResponse, error)
- func (c *Client) RetrieveMultipleUsersWithUserNames(ctx context.Context, userNames []string, opt ...*RetrieveUserOption) (*UsersResponse, error)
- func (c *Client) RetrieveSingleTweet(ctx context.Context, tweetID string, opt ...*RetriveTweetOption) (*TweetResponse, error)
- func (c *Client) RetrieveSingleUserWithID(ctx context.Context, userID string, opt ...*RetrieveUserOption) (*UserResponse, error)
- func (c *Client) RetrieveSingleUserWithUserName(ctx context.Context, userName string, opt ...*RetrieveUserOption) (*UserResponse, error)
- func (c *Client) RetrieveStreamRules(ctx context.Context, opt ...*RetrieveStreamRulesOption) (*RetrieveStreamRulesResponse, error)
- func (c *Client) RetweetsLookup(ctx context.Context, tweetID string, opt ...*RetweetsLookupOption) (*RetweetsResponse, error)
- func (c Client) SearchAllTweets(ctx context.Context, tweet string, opt ...*SearchTweetsOption) (*SearchTweetsResponse, error)
- func (c *Client) SearchNotesWritten(ctx context.Context, opt ...*SearchNotesWrittenOption) (*SearchNotesWrittenResponse, error)
- func (c *Client) SearchPostsEligibleForNotes(ctx context.Context, opt ...*SearchPostsEligibleForNotesOption) (*SearchPostsEligibleForNotesResponse, error)
- func (c *Client) SearchRecentTweets(ctx context.Context, tweet string, opt ...*SearchTweetsOption) (*SearchTweetsResponse, error)
- func (c *Client) SearchSpaces(ctx context.Context, searchTerm string, opt ...*SearchSpacesOption) (*SearchSpacesResponse, error)
- func (c *Client) SearchUsers(ctx context.Context, query string, opt ...*SearchUsersOption) (*SearchUsersResponse, error)
- func (c *Client) SpacesTweets(ctx context.Context, spaceID string, opt ...*SpacesTweetsOption) (*SpacesTweetsResponse, error)
- func (c *Client) TrendsByWOEID(ctx context.Context, woeid string) (*TrendsByWOEIDResponse, error)
- func (c *Client) TweetsUserLiked(ctx context.Context, userID string, opt ...*TweetsUserLikedOption) (*TweetsUserLikedResponse, error)
- func (c *Client) UndoBlocking(ctx context.Context, sourceUserID string, targetUserID string) (*UndoBlockingResponse, error)
- func (c *Client) UndoDMBlocking(ctx context.Context, userID string, targetUserID string) (*UndoDMBlockingResponse, error)
- func (c *Client) UndoFollowing(ctx context.Context, sourceUserID string, targetUserID string) (*UndoFollowingResponse, error)
- func (c *Client) UndoListFollows(ctx context.Context, listID string, userID string) (*UndoListFollowsResponse, error)
- func (c *Client) UndoListMembers(ctx context.Context, listID string, userID string) (*UndoListMembersResponse, error)
- func (c *Client) UndoMuting(ctx context.Context, sourceUserID string, targetUserID string) (*UndoMutingResponse, error)
- func (c *Client) UndoPinnedLists(ctx context.Context, listID string, userID string) (*UndoPinnedListsResponse, error)
- func (c Client) UndoRetweet(ctx context.Context, userID string, sourceTweetID string) (*UndoRetweetResponse, error)
- func (c Client) UndoUsersLikingTweet(ctx context.Context, userID string, tweetID string) (*UndoUsersLikingTweetResponse, error)
- func (c *Client) UpdateMetaDataForList(ctx context.Context, listID string, body ...*UpdateMetaDataForListBody) (*UpdateMetaDataForListResponse, error)
- func (c *Client) UploadMedia(ctx context.Context, media io.Reader, mediaType string, ...) (*MediaUploadResponse, error)
- func (c *Client) UserMentionTimeline(ctx context.Context, userID string, opt ...*UserMentionTimelineOption) (*UserMentionTimelineResponse, error)
- func (c *Client) UserReverseChronologicalTimeline(ctx context.Context, userID string, ...) (*UserReverseChronologicalTimelineResponse, error)
- func (c *Client) UserTweetTimeline(ctx context.Context, userID string, opt ...*UserTweetTimelineOption) (*UserTweetTimelineResponse, error)
- func (c *Client) UsersLikingTweet(ctx context.Context, tweetID string, opt ...*UsersLikingTweetOption) (*UsersLikingTweetResponse, error)
- func (c *Client) UsersPurchasedSpaceTicket(ctx context.Context, spaceID string, opt ...*UsersPurchasedSpaceTicketOption) (*UsersPurchasedSpaceTicketResponse, error)
- func (c *Client) VolumeStreams(ctx context.Context, ch chan<- VolumeStreamsResponse, errCh chan<- error, ...) *VolumeStreams
- func (c *Client) VolumeStreams10(ctx context.Context, ch chan<- VolumeStreamsResponse, errCh chan<- error, ...) *VolumeStreams
- type ClientOption
- type CommunityNote
- type CommunityNoteField
- type CommunityNoteInfoRequest
- type CommunityNotes
- type CommunityNotesIncludes
- type ComplianceFieldStatus
- type ComplianceFieldType
- type ComplianceJobData
- type ComplianceJobResponse
- type ComplianceJobsData
- type ComplianceJobsOption
- type ComplianceJobsResponse
- type Compliances
- type ConnectToStream
- type ConnectToStreamOption
- type ConnectToStreamResponse
- type CreateCommunityNoteBody
- type CreateCommunityNoteResponse
- type CreateComplianceJobData
- type CreateComplianceJobOption
- type CreateComplianceJobResponse
- type CreateNewGroupDMBody
- type CreateNewGroupDMResponse
- type CreateNewListBody
- type CreateNewListData
- type CreateNewListResponse
- type CreateOneToOneDMBody
- type CreateOneToOneDMResponse
- type DMBlocking
- type DMBlockingBody
- type DMEventField
- type DeleteListData
- type DeleteListResponse
- type DeleteRule
- type DeleteTweetData
- type DeleteTweetResponse
- type DirectMessage
- type DirectMessageAttachment
- type DirectMessageMeta
- type DirectMessageMetrics
- type DirectMessageOption
- type DirectMessages
- type DiscoverSpacesMeta
- type DiscoverSpacesOption
- type DiscoverSpacesResponse
- type EngagementMetrics
- type EventTypes
- type Exclude
- type Expansion
- type FilteredRule
- type FollowOption
- type FollowersResponse
- type Following
- type FollowingBody
- type FollowingResponse
- type FollowsMeta
- type HTTPError
- type HideRepliesResponse
- type HideRepliesResponseData
- type InvalidateTokenResponse
- type IsMember
- type Liked
- type List
- type ListAnalytics
- type ListField
- type ListFollowersOption
- type ListFollowersResponse
- type ListFollows
- type ListFollowsBody
- type ListFollowsOption
- type ListIncludes
- type ListMembersBody
- type ListMembersOption
- type ListMembersResponse
- type ListMeta
- type ListResponse
- type ListTweetsOption
- type ListTweetsResponse
- type Lists
- type ListsSpecifiedUserOption
- type ListsSpecifiedUserResponse
- type LookUpAllDMResponse
- type LookUpAllOneToOneDMResponse
- type LookUpDMResponse
- type LookUpListOption
- type LookUpUsersWhoLiked
- type LookUpUsersWhoLikedCashTag
- type LookUpUsersWhoLikedDescription
- type LookUpUsersWhoLikedEntity
- type LookUpUsersWhoLikedHashTag
- type LookUpUsersWhoLikedIncludes
- type LookUpUsersWhoLikedMention
- type LookUpUsersWhoLikedMeta
- type LookUpUsersWhoLikedPublicMetrics
- type LookUpUsersWhoLikedURL
- type LookUpUsersWhoLikedURLContent
- type LookUpUsersWhoLikedWithheld
- type LookUpUsersWhoPurchasedSpaceTicketIncludes
- type LookupUserBookmarksMeta
- type LookupUserBookmarksOption
- type LookupUserBookmarksResponse
- type MatchingRule
- type Me
- type MeIncludes
- type MeOption
- type MeResponse
- type MeWithheld
- type Media
- type MediaAnalytics
- type MediaField
- type MediaMetrics
- type MediaProcessingError
- type MediaProcessingInfo
- type MediaUpload
- type MediaUploadAppendRequest
- type MediaUploadFinalizeRequest
- type MediaUploadInitRequest
- type MediaUploadOption
- type MediaUploadResponse
- type MediaUploadStatusRequest
- type MediaVariant
- type MuteOption
- type MutesMeta
- type Muting
- type MutingBody
- type MutingResponse
- type OAuth
- type Parameter
- type Pinned
- type PinnedListsBody
- type PinnedListsOption
- type PinnedListsResponse
- type Place
- type PlaceField
- type PlaceGeo
- type Poll
- type PollField
- type PollOption
- type Post
- type PostBlockingResponse
- type PostDMBlockingResponse
- type PostDMBody
- type PostDMResponse
- type PostFollowingResponse
- type PostListFollowsResponse
- type PostListMembersResponse
- type PostMutingResponse
- type PostPinnedListsResponse
- type PostRetweetResponse
- type PostTweetData
- type PostTweetOption
- type PostTweetResponse
- type PostUsersLikingTweetResponse
- type QuoteTweetsMeta
- type QuoteTweetsOption
- type QuoteTweetsResponse
- type RemoveBookmarkOfTweetData
- type RemoveBookmarkOfTweetResponse
- type RetrieveStreamRulesMeta
- type RetrieveStreamRulesOption
- type RetrieveStreamRulesResponse
- type RetrieveUserOption
- type RetriveTweetOption
- type Retweeted
- type RetweetsLookupMeta
- type RetweetsLookupOption
- type RetweetsResponse
- type SearchNotesMeta
- type SearchNotesWrittenOption
- type SearchNotesWrittenResponse
- type SearchPostsEligibleForNotesOption
- type SearchPostsEligibleForNotesResponse
- type SearchSpacesMeta
- type SearchSpacesOption
- type SearchSpacesResponse
- type SearchTweetsMeta
- type SearchTweetsOption
- type SearchTweetsResponse
- type SearchUsersMeta
- type SearchUsersOption
- type SearchUsersResponse
- type Space
- type SpaceAnalytics
- type SpaceField
- type SpaceIncludes
- type SpaceOption
- type SpaceResponse
- type Spaces
- type SpacesResponse
- type SpacesTweetsMeta
- type SpacesTweetsOption
- type SpacesTweetsResponse
- type StateOption
- type TimeseriesCount
- type Topic
- type TopicField
- type Trend
- type Trends
- type TrendsByWOEIDResponse
- type Tweet
- type TweetAnalyticsSummary
- type TweetAnnotation
- type TweetAttachment
- type TweetBody
- type TweetCashtag
- type TweetContextAnnotation
- type TweetContextObj
- type TweetCoordinates
- type TweetCountMeta
- type TweetCountsAllOption
- type TweetCountsOption
- type TweetCountsResponse
- type TweetEditControls
- type TweetEntity
- type TweetField
- type TweetGeo
- type TweetHashtag
- type TweetImage
- type TweetIncludes
- type TweetMention
- type TweetMetrics
- type TweetReferencedTweet
- type TweetReply
- type TweetResponse
- type TweetURL
- type TweetWithheld
- type Tweets
- type TweetsResponse
- type TweetsUserLiked
- type TweetsUserLikedAttachments
- type TweetsUserLikedContextAnnotations
- type TweetsUserLikedContextAnnotationsDomain
- type TweetsUserLikedContextAnnotationsEntity
- type TweetsUserLikedEditControls
- type TweetsUserLikedEntities
- type TweetsUserLikedEntitiesAnnotation
- type TweetsUserLikedEntitiesCashTag
- type TweetsUserLikedEntitiesHashTag
- type TweetsUserLikedEntitiesMention
- type TweetsUserLikedEntitiesURLContent
- type TweetsUserLikedGeo
- type TweetsUserLikedGeoCoordinates
- type TweetsUserLikedMeta
- type TweetsUserLikedNonPublicMetrics
- type TweetsUserLikedOption
- type TweetsUserLikedOrganicMetrics
- type TweetsUserLikedPromotedMetrics
- type TweetsUserLikedPublicMetrics
- type TweetsUserLikedReferencedTweets
- type TweetsUserLikedResponse
- type TweetsUserLikedWithheld
- type Twtr
- type UndoBlockingResponse
- type UndoDMBlockingResponse
- type UndoFollowingResponse
- type UndoListFollowsResponse
- type UndoListMembersResponse
- type UndoMutingResponse
- type UndoPinnedListsResponse
- type UndoRetweetResponse
- type UndoUsersLikingTweetResponse
- type UpdateMetaDataForListBody
- type UpdateMetaDataForListData
- type UpdateMetaDataForListResponse
- type User
- type UserAnalyticsSummary
- type UserCashtag
- type UserDescription
- type UserEntity
- type UserField
- type UserHashtag
- type UserIncludes
- type UserMention
- type UserMentionTimelineOption
- type UserMentionTimelineResponse
- type UserPublicMetrics
- type UserResponse
- type UserReverseChronologicalTimelineOption
- type UserReverseChronologicalTimelineResponse
- type UserTimelineMeta
- type UserTweetTimelineOption
- type UserTweetTimelineResponse
- type UserURL
- type UserURLs
- type UserWithheld
- type Users
- type UsersLikingBody
- type UsersLikingTweetOption
- type UsersLikingTweetResponse
- type UsersPurchasedSpaceTicketOption
- type UsersPurchasedSpaceTicketResponse
- type UsersResponse
- type VolumeStreams
- type VolumeStreamsOption
- type VolumeStreamsResponse
Examples ¶
- Client.AddOrDeleteRules (Add)
- Client.AddOrDeleteRules (Delete)
- Client.AllListsUserFollows
- Client.Blocking
- Client.BookmarkTweet
- Client.ComplianceJob
- Client.ComplianceJobs
- Client.ConnectToStream
- Client.CountAllTweets
- Client.CountRecentTweets
- Client.CreateNewGroupDM
- Client.CreateNewList
- Client.CreateOneToOneDM
- Client.DeleteList
- Client.DeleteTweet
- Client.DiscoverSpaces
- Client.Followers
- Client.Following
- Client.GenerateAppOnlyBearerToken
- Client.ListFollowers
- Client.ListMembers
- Client.ListsSpecifiedUser
- Client.LookUpAllDM
- Client.LookUpAllListsOwned
- Client.LookUpAllOneToOneDM
- Client.LookUpDM
- Client.LookUpList
- Client.LookUpListTweets
- Client.LookUpSpace
- Client.LookUpSpaces
- Client.LookupUserBookmarks
- Client.Me
- Client.Muting
- Client.PinnedLists
- Client.PostBlocking
- Client.PostDM
- Client.PostFollowing
- Client.PostListFollows
- Client.PostListMembers
- Client.PostMuting
- Client.PostPinnedLists
- Client.PostRetweet
- Client.PostTweet
- Client.PostUsersLikingTweet
- Client.RemoveBookmarkOfTweet
- Client.RetrieveMultipleTweets
- Client.RetrieveMultipleUsersWithIDs
- Client.RetrieveMultipleUsersWithUserNames
- Client.RetrieveSingleTweet
- Client.RetrieveSingleUserWithID
- Client.RetrieveSingleUserWithUserName
- Client.RetrieveStreamRules
- Client.RetweetsLookup
- Client.SearchRecentTweets
- Client.SearchSpaces
- Client.TweetsUserLiked
- Client.UndoBlocking
- Client.UndoFollowing
- Client.UndoListFollows
- Client.UndoListMembers
- Client.UndoMuting
- Client.UndoPinnedLists
- Client.UndoRetweet
- Client.UndoUsersLikingTweet
- Client.UpdateMetaDataForList
- Client.UserMentionTimeline
- Client.UserTweetTimeline
- Client.UsersLikingTweet
- Client.UsersPurchasedSpaceTicket
- Client.VolumeStreams
Constants ¶
const ( MediaCategoryTweetImage = "tweet_image" MediaCategoryTweetVideo = "tweet_video" MediaCategoryTweetGIF = "tweet_gif" MediaCategoryDMImage = "dm_image" MediaCategoryDMVideo = "dm_video" MediaCategoryDMGIF = "dm_gif" )
MediaCategory constants for different media types
const ( MediaTypeJPEG = "image/jpeg" MediaTypePNG = "image/png" MediaTypeGIF = "image/gif" MediaTypeWebP = "image/webp" MediaTypeMP4 = "video/mp4" MediaTypeMOV = "video/quicktime" MediaTypeAVI = "video/x-msvideo" MediaTypeWEBM = "video/webm" )
Common MIME types for media upload
const ChunkedUploadThreshold = 5 * 1024 * 1024
ChunkedUploadThreshold defines the file size threshold for using chunked upload (5MB)
const MaxChunkSize = 5 * 1024 * 1024
MaxChunkSize defines the maximum size of each upload chunk (5MB)
Variables ¶
This section is empty.
Functions ¶
func CalculateClickThroughRate ¶ added in v1.3.0
func CalculateClickThroughRate(metrics *TweetMetrics) float64
CalculateClickThroughRate calculates CTR from metrics
func CalculateEngagementRate ¶ added in v1.3.0
func CalculateEngagementRate(metrics *TweetMetrics) float64
CalculateEngagementRate calculates engagement rate from public metrics
Types ¶
type APIResponseError ¶
type APIResponseError struct { Title string `json:"title"` Detail string `json:"detail"` Type string `json:"type"` ResourceType string `json:"resource_type"` ResourceID string `json:"resource_id"` Parameter string `json:"parameter"` Parameters Parameter `json:"parameters"` Message string `json:"message"` Value interface{} `json:"value"` Reason string `json:"reason,omitempty"` ClientID string `json:"client_id,omitempty"` RequiredEnrollment string `json:"required_enrollment,omitempty"` RegistrationURL string `json:"registration_url,omitempty"` ConnectionIssue string `json:"connection_issue,omitempty"` Status int `json:"status,omitempty"` }
type AddOrDeleteJSONBody ¶
type AddOrDeleteJSONBody struct { Add []*AddRule `json:"add,omitempty"` Delete *DeleteRule `json:"delete,omitempty"` }
type AddOrDeleteMetaSummary ¶
type AddOrDeleteRulesMeta ¶
type AddOrDeleteRulesMeta struct { Sent string `json:"sent"` Summary *AddOrDeleteMetaSummary `json:"summary"` }
type AddOrDeleteRulesOption ¶
type AddOrDeleteRulesOption struct {
DryRun bool // If it is true, test a the syntax of your rule without submitting it
}
type AddOrDeleteRulesResponse ¶
type AddOrDeleteRulesResponse struct { Rules []*FilteredRule `json:"data"` Meta *AddOrDeleteRulesMeta `json:"meta"` Errors []*APIResponseError `json:"errors,omitempty"` }
type AllListsOwnedOption ¶
type AllListsOwnedResponse ¶
type AllListsOwnedResponse struct { Lists []*List `json:"data"` Includes *ListIncludes `json:"includes,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` Meta *ListMeta `json:"meta"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type AllListsUserFollowsResponse ¶
type AllListsUserFollowsResponse struct { Lists []*List `json:"data"` Includes *ListIncludes `json:"includes,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` Meta *ListMeta `json:"meta"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type Analytics ¶ added in v1.3.0
type Analytics interface { // Analytics Utilities CalculateEngagementRate(metrics *TweetMetrics) float64 CalculateEngagementMetrics(metrics *TweetMetrics) *EngagementMetrics GetTopPerformingTweets(tweets []*Tweet, limit int) []*Tweet CompareMetrics(current, previous *TweetMetrics) *AnalyticsComparison }
type AnalyticsComparison ¶ added in v1.3.0
type AnalyticsComparison struct { Current interface{} `json:"current"` Previous interface{} `json:"previous"` Change float64 `json:"change_percentage"` }
AnalyticsComparison represents comparative analytics data
func CompareMetrics ¶ added in v1.3.0
func CompareMetrics(current, previous *TweetMetrics) *AnalyticsComparison
CompareMetrics compares two sets of metrics and returns change percentage
type AnalyticsTimeframe ¶ added in v1.3.0
type AnalyticsTimeframe struct { StartTime time.Time `json:"start_time"` EndTime time.Time `json:"end_time"` Granularity string `json:"granularity"` // day, hour, minute }
AnalyticsTimeframe represents time-based analytics filters
type BlockOption ¶ added in v1.1.0
type BlockOption struct { Expansions []Expansion MaxResults int PaginationToken string TweetFields []TweetField UserFields []UserField }
type BlockingBody ¶ added in v1.1.0
type BlockingBody struct {
TargetUserID string `json:"target_user_id"`
}
type BlockingResponse ¶ added in v1.1.0
type BlockingResponse struct { Users []*User `json:"data"` Includes *UserIncludes `json:"includes,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` Meta *BlocksMeta `json:"meta"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type BlocksMeta ¶ added in v1.1.0
type BookmarkTweetBody ¶ added in v1.1.0
type BookmarkTweetBody struct {
TweetID string `json:"tweet_id"`
}
type BookmarkTweetData ¶ added in v1.1.0
type BookmarkTweetData struct {
Bookmarked bool `json:"bookmarked"`
}
type BookmarkTweetResponse ¶ added in v1.1.0
type BookmarkTweetResponse struct { BookmarkTweetData *BookmarkTweetData `json:"data"` Errors []*APIResponseError `json:"errors,omitempty"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an API client for Twitter v2 API.
func New ¶
func New(bearerToken string, opts ...ClientOption) *Client
func (*Client) AddOrDeleteRules ¶
func (c *Client) AddOrDeleteRules(ctx context.Context, body *AddOrDeleteJSONBody, opt ...*AddOrDeleteRulesOption) (*AddOrDeleteRulesResponse, error)
AddOrDeleteRules To create one or more rules, submit an add JSON body with an array of rules and operators. Similarly, to delete one or more rules, submit a delete JSON body with an array of list of existing rule IDs.
Example (Add) ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") _, err := client.AddOrDeleteRules(context.Background(), &gotwtr.AddOrDeleteJSONBody{ Add: []*gotwtr.AddRule{ { Value: "puppy has:media", Tag: "puppies with media", }, { Value: "meme has:images", }, }, }) if err != nil { log.Fatal(err) } }
Example (Delete) ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") // retrieve Stream rules ts, err := client.RetrieveStreamRules(context.Background()) if err != nil { panic(err) } var ids []string for _, t := range ts.Rules { log.Println(t) ids = append(ids, t.ID) } // delete Stream rules _, err = client.AddOrDeleteRules(context.Background(), &gotwtr.AddOrDeleteJSONBody{ Delete: &gotwtr.DeleteRule{ IDs: ids, }, }) if err != nil { panic(err) } }
func (*Client) AllListsUserFollows ¶ added in v1.1.0
func (c *Client) AllListsUserFollows(ctx context.Context, userID string, opt ...*ListFollowsOption) (*AllListsUserFollowsResponse, error)
AllListsUserFollows returns all Lists a specified user follows.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") lists, err := client.AllListsUserFollows(context.Background(), "user_id") if err != nil { log.Fatal(err) } for _, list := range lists.Lists { log.Println(list) } }
func (*Client) AppendChunkedUpload ¶ added in v1.3.0
func (c *Client) AppendChunkedUpload(ctx context.Context, req *MediaUploadAppendRequest) error
AppendChunkedUpload uploads a chunk of data to an existing upload session.
func (*Client) Blocking ¶ added in v1.1.0
func (c *Client) Blocking(ctx context.Context, userID string, opt ...*BlockOption) (*BlockingResponse, error)
Blocking returns a list of users who are blocked by the specified user ID.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") b, err := client.Blocking(context.Background(), "user_id") if err != nil { log.Fatal(err) } for _, user := range b.Users { log.Println(user) } }
func (*Client) BookmarkTweet ¶ added in v1.1.0
func (c *Client) BookmarkTweet(ctx context.Context, userID string, body *BookmarkTweetBody) (*BookmarkTweetResponse, error)
BookmarkTweet returns the count of Tweets from the last seven days that match a query.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") l, err := client.BookmarkTweet(context.Background(), "user_id", &gotwtr.BookmarkTweetBody{ TweetID: "2022", }) if err != nil { log.Fatal(err) } log.Println(l) }
func (*Client) CalculateEngagementMetrics ¶ added in v1.3.0
func (c *Client) CalculateEngagementMetrics(metrics *TweetMetrics) *EngagementMetrics
CalculateEngagementMetrics calculates detailed engagement metrics.
func (*Client) CalculateEngagementRate ¶ added in v1.3.0
func (c *Client) CalculateEngagementRate(metrics *TweetMetrics) float64
CalculateEngagementRate calculates engagement rate from public metrics.
func (*Client) CheckUploadStatus ¶ added in v1.3.0
func (c *Client) CheckUploadStatus(ctx context.Context, req *MediaUploadStatusRequest) (*MediaUploadResponse, error)
CheckUploadStatus checks the processing status of an uploaded media file.
func (*Client) CompareMetrics ¶ added in v1.3.0
func (c *Client) CompareMetrics(current, previous *TweetMetrics) *AnalyticsComparison
CompareMetrics compares two sets of metrics and returns change percentage.
func (*Client) ComplianceJob ¶ added in v1.1.0
func (c *Client) ComplianceJob(ctx context.Context, complianceJobID int) (*ComplianceJobResponse, error)
ComplianceJob returns a single compliance job with the specified ID.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") cj, err := client.ComplianceJob(context.Background(), 1382081613278814209) if err != nil { log.Fatal(err) } log.Println(cj) for _, e := range cj.Errors { log.Println(e) } }
func (*Client) ComplianceJobs ¶ added in v1.1.0
func (c *Client) ComplianceJobs(ctx context.Context, opt *ComplianceJobsOption) (*ComplianceJobsResponse, error)
ComplianceJobs returns a list of recent compliance jobs.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") cj, err := client.ComplianceJobs(context.Background(), &gotwtr.ComplianceJobsOption{ Type: gotwtr.ComplianceFieldTypeTweets, }) if err != nil { log.Fatal(err) } log.Println(cj) }
func (*Client) ConnectToStream ¶
func (c *Client) ConnectToStream(ctx context.Context, ch chan<- ConnectToStreamResponse, errCh chan<- error, opt ...*ConnectToStreamOption) *ConnectToStream
ConnectToStream streams Tweets in real-time based on a specific set of filter rules.
Example ¶
package main import ( "context" "log" "time" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") ch := make(chan gotwtr.ConnectToStreamResponse, 5) errCh := make(chan error) stream := client.ConnectToStream(context.Background(), ch, errCh) log.Println("streaming...") ctx, cancel := context.WithCancel(context.Background()) go func(ctx context.Context) { for { select { case data := <-ch: log.Println(data.Tweet) case err := <-errCh: log.Println(err) case <-ctx.Done(): return } } }(ctx) time.Sleep(time.Second * 10) cancel() stream.Stop() log.Println("done") }
func (*Client) CountAllTweets ¶ added in v1.1.0
func (c *Client) CountAllTweets(ctx context.Context, tweet string, opt ...*TweetCountsAllOption) (*TweetCountsResponse, error)
CountAllTweets returns the count of Tweets that match your query from the complete history of public Tweets; since the first Tweet was created March 26, 2006.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") ts, err := client.CountAllTweets(context.Background(), "lakers") if err != nil { log.Fatal(err) } log.Println(ts.Meta.TotalTweetCount) for _, t := range ts.Counts { log.Println(t) } }
func (*Client) CountRecentTweets ¶ added in v1.1.0
func (c *Client) CountRecentTweets(ctx context.Context, tweet string, opt ...*TweetCountsOption) (*TweetCountsResponse, error)
CountRecentTweets returns the count of Tweets from the last seven days that match a query.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") ts, err := client.CountRecentTweets(context.Background(), "lakers") if err != nil { log.Fatal(err) } log.Println(ts.Meta.TotalTweetCount) for _, t := range ts.Counts { log.Println(t) } }
func (*Client) CreateCommunityNote ¶ added in v1.3.0
func (c *Client) CreateCommunityNote(ctx context.Context, body *CreateCommunityNoteBody) (*CreateCommunityNoteResponse, error)
CreateCommunityNote creates a Community Note on a post.
func (*Client) CreateComplianceJob ¶ added in v1.1.0
func (c *Client) CreateComplianceJob(ctx context.Context, opt ...*CreateComplianceJobOption) (*CreateComplianceJobResponse, error)
CreateComplianceJob create a compliance job.
func (*Client) CreateNewGroupDM ¶ added in v1.2.0
func (c *Client) CreateNewGroupDM(ctx context.Context, conversationID string, body *CreateNewGroupDMBody) (*CreateNewGroupDMResponse, error)
CreateNewGroupDM enables create a Direct Message on behalf of an authenticated user, and adds it to the specified conversation.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") d, err := client.CreateNewGroupDM(context.Background(), "conversation_id", &gotwtr.CreateNewGroupDMBody{ Text: "Hello World", }) if err != nil { log.Fatal(err) } log.Println(d) }
func (*Client) CreateNewList ¶ added in v1.1.0
func (c *Client) CreateNewList(ctx context.Context, body *CreateNewListBody) (*CreateNewListResponse, error)
CreateNewList enables the authenticated user to create a List.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") l, err := client.CreateNewList(context.Background(), &gotwtr.CreateNewListBody{ Name: "test v2 create list", }) if err != nil { log.Fatal(err) } log.Println(l) }
func (*Client) CreateOneToOneDM ¶ added in v1.2.0
func (c *Client) CreateOneToOneDM(ctx context.Context, participantID string, body *CreateOneToOneDMBody) (*CreateOneToOneDMResponse, error)
CreateOneToOneDM enables create a new one-to-one conversation or retrieves the current conversation and adds the Direct Message to it.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") d, err := client.CreateOneToOneDM(context.Background(), "participant_id", &gotwtr.CreateOneToOneDMBody{ Text: "Hello World", }) if err != nil { log.Fatal(err) } log.Println(d) }
func (*Client) DeleteList ¶ added in v1.1.0
DeleteList enables the authenticated user to delete a List that they own.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") l, err := client.DeleteList(context.Background(), "list_id") if err != nil { log.Fatal(err) } log.Println(l) }
func (Client) DeleteTweet ¶ added in v1.1.0
func (c Client) DeleteTweet(ctx context.Context, tweetID string) (*DeleteTweetResponse, error)
DeleteTweet allows a user or authenticated user ID to delete a Tweet.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") _, err := client.DeleteTweet(context.Background(), "tweet_id") if err != nil { log.Fatal(err) } }
func (*Client) DiscoverSpaces ¶
func (c *Client) DiscoverSpaces(ctx context.Context, userIDs []string, opt ...*DiscoverSpacesOption) (*DiscoverSpacesResponse, error)
DiscoverSpaces returns live or scheduled Spaces created by the specified userIDs. Up to 100 comma-separated IDs can be looked up using this endpoint.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") discover, err := client.DiscoverSpaces(context.Background(), []string{"user_id", "user_id2"}) if err != nil { log.Fatal(err) } for _, space := range discover.Spaces { log.Println(space) } }
func (*Client) FinalizeChunkedUpload ¶ added in v1.3.0
func (c *Client) FinalizeChunkedUpload(ctx context.Context, req *MediaUploadFinalizeRequest) (*MediaUploadResponse, error)
FinalizeChunkedUpload completes a chunked upload session.
func (*Client) Followers ¶
func (c *Client) Followers(ctx context.Context, userID string, opt ...*FollowOption) (*FollowersResponse, error)
Followers returns a list of users who are followers of the specified userID.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") f, err := client.Followers(context.Background(), "user_id") if err != nil { log.Fatal(err) } for _, user := range f.Users { log.Println(user) } }
func (*Client) Following ¶
func (c *Client) Following(ctx context.Context, userID string, opt ...*FollowOption) (*FollowingResponse, error)
Following returns a list of users the specified userID is following.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") f, err := client.Following(context.Background(), "user_id") if err != nil { log.Fatal(err) } for _, user := range f.Users { log.Println(user) } }
func (*Client) GenerateAppOnlyBearerToken ¶ added in v1.1.0
GenerateAppOnlyBearerToken generates a bearer token for app-only auth.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { c := gotwtr.New( "key", gotwtr.WithConsumerSecret("sec"), ) b, err := c.GenerateAppOnlyBearerToken(context.Background()) if err != nil { log.Fatal(err) } if !b { log.Fatal("failed to generate bearer token") } }
func (*Client) GetTopPerformingTweets ¶ added in v1.3.0
GetTopPerformingTweets sorts tweets by engagement rate and returns top performers.
func (Client) HideReplies ¶ added in v1.1.0
func (c Client) HideReplies(ctx context.Context, tweetID string, hidden bool) (*HideRepliesResponse, error)
HideReplies hides or unhides a reply to a Tweet.
func (*Client) InitializeChunkedUpload ¶ added in v1.3.0
func (c *Client) InitializeChunkedUpload(ctx context.Context, req *MediaUploadInitRequest) (*MediaUploadResponse, error)
InitializeChunkedUpload initializes a chunked upload session for large files.
func (*Client) InvalidateToken ¶ added in v1.3.0
func (c *Client) InvalidateToken(ctx context.Context) (*InvalidateTokenResponse, error)
InvalidateToken invalidates the current bearer token.
func (*Client) ListFollowers ¶ added in v1.1.0
func (c *Client) ListFollowers(ctx context.Context, listID string, opt ...*ListFollowersOption) (*ListFollowersResponse, error)
ListFollowers returns a list of users who are followers of the specified List.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") followers, err := client.ListFollowers(context.Background(), "list_id") if err != nil { log.Fatal(err) } for _, user := range followers.Users { log.Println(user) } }
func (*Client) ListMembers ¶
func (c *Client) ListMembers(ctx context.Context, listID string, opt ...*ListMembersOption) (*ListMembersResponse, error)
ListMembers returns a list of users who are members of the specified List.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") members, err := client.ListMembers(context.Background(), "list_id") if err != nil { log.Fatal(err) } for _, member := range members.Users { log.Println(member) } }
func (*Client) ListsSpecifiedUser ¶
func (c *Client) ListsSpecifiedUser(ctx context.Context, userID string, opt ...*ListsSpecifiedUserOption) (*ListsSpecifiedUserResponse, error)
ListsSpecifiedUser returns all Lists a specified user is a member of that.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") lists, err := client.ListsSpecifiedUser(context.Background(), "user_id") if err != nil { log.Fatal(err) } for _, list := range lists.Lists { log.Println(list) } }
func (*Client) LookUpAllDM ¶ added in v1.2.0
func (c *Client) LookUpAllDM(ctx context.Context, opt ...*DirectMessageOption) (*LookUpAllDMResponse, error)
LookUpAllDM returns a list of Direct Messages for the authenticated user, both sent and received. Direct Message events are returned in reverse chronological order. Supports retrieving events from the previous 30 days.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") dm, err := client.LookUpAllDM(context.Background(), &gotwtr.DirectMessageOption{ EventTypes: "MessageCreate", }) if err != nil { log.Fatal(err) } log.Println(dm) }
func (*Client) LookUpAllListsOwned ¶
func (c *Client) LookUpAllListsOwned(ctx context.Context, userID string, opt ...*AllListsOwnedOption) (*AllListsOwnedResponse, error)
LookUpAllListsOwned returns all Lists owned by the specified user.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") lists, err := client.LookUpAllListsOwned(context.Background(), "user_id") if err != nil { log.Fatal(err) } for _, list := range lists.Lists { log.Println(list) } }
func (*Client) LookUpAllOneToOneDM ¶ added in v1.2.0
func (c *Client) LookUpAllOneToOneDM(ctx context.Context, participantID string, opt ...*DirectMessageOption) (*LookUpAllOneToOneDMResponse, error)
LookUpAllOneToOneDM returns a list of Direct Messages (DM) events within a 1-1 conversation with the user specified in the participant_id path parameter. Messages are returned in reverse chronological order.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") dm, err := client.LookUpAllOneToOneDM(context.Background(), "participant_id", &gotwtr.DirectMessageOption{ EventTypes: "MessageCreate", }) if err != nil { log.Fatal(err) } log.Println(dm) }
func (*Client) LookUpDM ¶ added in v1.2.0
func (c *Client) LookUpDM(ctx context.Context, dmConversationID string, opt ...*DirectMessageOption) (*LookUpDMResponse, error)
LookUpDM returns a list of Direct Messages within a conversation specified in the dm_conversation_id path parameter. Messages are returned in reverse chronological order.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") dm, err := client.LookUpDM(context.Background(), "participant_id", &gotwtr.DirectMessageOption{ EventTypes: "MessageCreate", }) if err != nil { log.Fatal(err) } log.Println(dm) }
func (*Client) LookUpList ¶
func (c *Client) LookUpList(ctx context.Context, listID string, opt ...*LookUpListOption) (*ListResponse, error)
LookUpList returns the details of a specified List.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") l, err := client.LookUpList(context.Background(), "list_id") if err != nil { log.Fatal(err) } log.Println(l) }
func (*Client) LookUpListTweets ¶
func (c *Client) LookUpListTweets(ctx context.Context, listID string, opt ...*ListTweetsOption) (*ListTweetsResponse, error)
LookUpListTweets returns a list of Tweets from the specified List.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") lt, err := client.LookUpListTweets(context.Background(), "list_id") if err != nil { log.Fatal(err) } for _, tweet := range lt.Tweets { log.Println(tweet) } }
func (*Client) LookUpSpace ¶
func (c *Client) LookUpSpace(ctx context.Context, spaceID string, opt ...*SpaceOption) (*SpaceResponse, error)
LookUpSpace returns a variety of information about a single Space specified by the requested ID.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") s, err := client.LookUpSpace(context.Background(), "space_id") if err != nil { log.Fatal(err) } log.Println(s) }
func (*Client) LookUpSpaces ¶
func (c *Client) LookUpSpaces(ctx context.Context, spaceIDs []string, opt ...*SpaceOption) (*SpacesResponse, error)
LookUpSpaces returns details about multiple Spaces. Up to 100 comma-separated SpacesIDs can be looked up using this endpoint.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") ss, err := client.LookUpSpaces(context.Background(), []string{"space_id", "space_id2"}) if err != nil { log.Fatal(err) } for _, s := range ss.Spaces { log.Println(s) } }
func (*Client) LookupUserBookmarks ¶ added in v1.1.0
func (c *Client) LookupUserBookmarks(ctx context.Context, userID string, opt ...*LookupUserBookmarksOption) (*LookupUserBookmarksResponse, error)
LookupUserBookmarks returns the count of Tweets from the last seven days that match a query.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") l, err := client.LookupUserBookmarks(context.Background(), "userID") if err != nil { log.Fatal(err) } log.Println(l) }
func (*Client) Me ¶ added in v1.1.2
Me returns information about an authorized user.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") me, err := client.Me(context.Background()) if err != nil { log.Fatal(err) } log.Printf("me is %+v", me) }
func (*Client) Muting ¶ added in v1.1.0
func (c *Client) Muting(ctx context.Context, userID string, opt ...*MuteOption) (*MutingResponse, error)
Muting returns a list of users who are muted by the specified user ID.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") m, err := client.Muting(context.Background(), "user_id") if err != nil { log.Fatal(err) } for _, user := range m.Users { log.Println(user) } }
func (*Client) PinnedLists ¶ added in v1.1.0
func (c *Client) PinnedLists(ctx context.Context, userID string, opt ...*PinnedListsOption) (*PinnedListsResponse, error)
PinnedLists returns the Lists pinned by a specified user.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") pl, err := client.PinnedLists(context.Background(), "user_id") if err != nil { log.Fatal(err) } for _, l := range pl.Lists { log.Println(l) } }
func (*Client) PostBlocking ¶ added in v1.1.0
func (c *Client) PostBlocking(ctx context.Context, userID string, targetUserID string) (*PostBlockingResponse, error)
PostBlocking causes the user (in the path) to block the target user. The user (in the path) must match the user Access Tokens being used to authorize the request.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") pb, err := client.PostBlocking(context.Background(), "user_id", "target_user_id") if err != nil { log.Println(err) } log.Println(pb) }
func (*Client) PostDM ¶ added in v1.2.0
func (c *Client) PostDM(ctx context.Context, body *PostDMBody) (*PostDMResponse, error)
PostDM enables create a new group conversation and adds a Direct Message to it on behalf of an authenticated user.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") d, err := client.PostDM(context.Background(), &gotwtr.PostDMBody{ ConversationType: "Group", ParticipantIDs: []string{ "944480690", "906948460078698496", }, Message: &gotwtr.DirectMessage{ Text: "Hello to you two, this is a new group conversation", }, }) if err != nil { log.Fatal(err) } log.Println(d) }
func (*Client) PostDMBlocking ¶ added in v1.3.0
func (c *Client) PostDMBlocking(ctx context.Context, userID string, targetUserID string) (*PostDMBlockingResponse, error)
PostDMBlocking blocks DMs from a specific user.
func (*Client) PostFollowing ¶ added in v1.1.0
func (c *Client) PostFollowing(ctx context.Context, userID string, targetUserID string) (*PostFollowingResponse, error)
PostFollowing allows a user ID to follow another user. If the target user does not have public Tweets, this method will send a follow request.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") pf, err := client.PostFollowing(context.Background(), "user_id", "target_user_id") if err != nil { panic(err) } log.Println(pf) }
func (*Client) PostListFollows ¶ added in v1.1.0
func (c *Client) PostListFollows(ctx context.Context, listID string, userID string) (*PostListFollowsResponse, error)
PostListFollows enables the authenticated user to follow a List.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") plf, err := client.PostListFollows(context.Background(), "list_id", "user_id") if err != nil { log.Println(err) } log.Println(plf) }
func (*Client) PostListMembers ¶ added in v1.1.0
func (c *Client) PostListMembers(ctx context.Context, listID string, userID string) (*PostListMembersResponse, error)
PostListMembers enables the authenticated user to add a member to a List they own.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") plm, err := client.PostListMembers(context.Background(), "list_id", "user_id") if err != nil { log.Println(err) } log.Println(plm) }
func (*Client) PostMuting ¶ added in v1.1.0
func (c *Client) PostMuting(ctx context.Context, userID string, targetUserID string) (*PostMutingResponse, error)
PostMuting allows an authenticated user ID to mute the target user.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") pm, err := client.PostMuting(context.Background(), "user_id", "target_user_id") if err != nil { panic(err) } log.Println(pm) }
func (*Client) PostPinnedLists ¶ added in v1.1.0
func (c *Client) PostPinnedLists(ctx context.Context, listID string, userID string) (*PostPinnedListsResponse, error)
PostPinnedLists enables the authenticated user to pin a List.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") ppl, err := client.PostPinnedLists(context.Background(), "list_id", "user_id") if err != nil { log.Println(err) } log.Println(ppl) }
func (Client) PostRetweet ¶ added in v1.1.0
func (c Client) PostRetweet(ctx context.Context, userID string, tweetID string) (*PostRetweetResponse, error)
PostRetweet causes the user ID identified in the path parameter to Retweet the target Tweet.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") pr, err := client.PostRetweet(context.Background(), "user_id", "tweet_id") if err != nil { log.Println(err) } log.Println(pr) }
func (Client) PostTweet ¶ added in v1.1.0
func (c Client) PostTweet(ctx context.Context, body *PostTweetOption) (*PostTweetResponse, error)
PostTweet creates a Tweet on behalf of an authenticated user.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") t, err := client.PostTweet(context.Background(), &gotwtr.PostTweetOption{ Text: "Hello World", }) if err != nil { log.Fatal(err) } log.Println(t) }
func (Client) PostUsersLikingTweet ¶ added in v1.1.0
func (c Client) PostUsersLikingTweet(ctx context.Context, userID string, tweetID string) (*PostUsersLikingTweetResponse, error)
PostUsersLikingTweet causes the user ID identified in the path parameter to Like the target Tweet.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") pult, err := client.PostUsersLikingTweet(context.Background(), "user_id", "tweet_id") if err != nil { log.Println(err) } log.Println(pult) }
func (*Client) QuoteTweets ¶ added in v1.3.0
func (c *Client) QuoteTweets(ctx context.Context, tweetID string, opt ...*QuoteTweetsOption) (*QuoteTweetsResponse, error)
QuoteTweets returns a list of Tweets that quote the specified Tweet ID.
func (*Client) RemoveBookmarkOfTweet ¶ added in v1.1.0
func (c *Client) RemoveBookmarkOfTweet(ctx context.Context, userID string, tweetID string) (*RemoveBookmarkOfTweetResponse, error)
RemoveBookmarkOfTweet returns the count of Tweets from the last seven days that match a query.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") l, err := client.RemoveBookmarkOfTweet(context.Background(), "user_id", "tweet_id") if err != nil { log.Fatal(err) } log.Println(l) }
func (*Client) RetrieveMultipleTweets ¶
func (c *Client) RetrieveMultipleTweets(ctx context.Context, tweetIDs []string, opt ...*RetriveTweetOption) (*TweetsResponse, error)
RetrieveMultipleTweets returns a variety of information about the Tweet specified by the requested ID or list of IDs.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") ts, err := client.RetrieveMultipleTweets(context.Background(), []string{"tweet_id", "tweet_id2"}) if err != nil { log.Fatal(err) } for _, t := range ts.Tweets { log.Println(t) } }
func (*Client) RetrieveMultipleUsersWithIDs ¶
func (c *Client) RetrieveMultipleUsersWithIDs(ctx context.Context, userIDs []string, opt ...*RetrieveUserOption) (*UsersResponse, error)
RetrieveMultipleUsersWithIDs returns a variety of information about one or more users specified by the requested userIDs.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") // look up users us, err := client.RetrieveMultipleUsersWithIDs(context.Background(), []string{"user_id", "user_id2"}) if err != nil { log.Fatal(err) } for _, u := range us.Users { log.Println(u) } }
func (*Client) RetrieveMultipleUsersWithUserNames ¶
func (c *Client) RetrieveMultipleUsersWithUserNames(ctx context.Context, userNames []string, opt ...*RetrieveUserOption) (*UsersResponse, error)
RetrieveMultipleUsersWithUserNames returns a variety of information about one or more users specified by their usernames.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") uns, err := client.RetrieveMultipleUsersWithUserNames(context.Background(), []string{"username", "username2"}) if err != nil { log.Fatal(err) } for _, un := range uns.Users { log.Println(un) } }
func (*Client) RetrieveSingleTweet ¶
func (c *Client) RetrieveSingleTweet(ctx context.Context, tweetID string, opt ...*RetriveTweetOption) (*TweetResponse, error)
RetrieveSingleTweet returns a variety of information about a single Tweet specified by the requested ID.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") t, err := client.RetrieveSingleTweet(context.Background(), "tweet_id") if err != nil { log.Fatal(err) } log.Println(*t.Tweet) }
func (*Client) RetrieveSingleUserWithID ¶
func (c *Client) RetrieveSingleUserWithID(ctx context.Context, userID string, opt ...*RetrieveUserOption) (*UserResponse, error)
RetrieveSingleUserWithID returns a variety of information about a single user specified by the requested userID.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") u, err := client.RetrieveSingleUserWithID(context.Background(), "user_id") if err != nil { log.Fatal(err) } log.Println(u) }
func (*Client) RetrieveSingleUserWithUserName ¶
func (c *Client) RetrieveSingleUserWithUserName(ctx context.Context, userName string, opt ...*RetrieveUserOption) (*UserResponse, error)
RetrieveSingleUserWithUserName returns a variety of information about one or more users specified by their username.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") un, err := client.RetrieveSingleUserWithUserName(context.Background(), "username") if err != nil { log.Fatal(err) } log.Println(un) }
func (*Client) RetrieveStreamRules ¶
func (c *Client) RetrieveStreamRules(ctx context.Context, opt ...*RetrieveStreamRulesOption) (*RetrieveStreamRulesResponse, error)
RetrieveStreamRules return a list of rules currently active on the streaming endpoint, either as a list or individually.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") ts, err := client.RetrieveStreamRules(context.Background()) if err != nil { log.Fatal(err) } for _, t := range ts.Rules { log.Println(t) } }
func (*Client) RetweetsLookup ¶
func (c *Client) RetweetsLookup(ctx context.Context, tweetID string, opt ...*RetweetsLookupOption) (*RetweetsResponse, error)
RetweetsLookup allows you to get information about who has Retweeted a Tweet.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") t, err := client.RetweetsLookup(context.Background(), "tweet_id") if err != nil { log.Println(err) } log.Println(t) }
func (Client) SearchAllTweets ¶ added in v1.1.0
func (c Client) SearchAllTweets(ctx context.Context, tweet string, opt ...*SearchTweetsOption) (*SearchTweetsResponse, error)
SearchAllTweets returns Tweets since the first Tweet was created on March 26, 2006. This endpoint is only available to those users who have been approved for Academic Research access.
func (*Client) SearchNotesWritten ¶ added in v1.3.0
func (c *Client) SearchNotesWritten(ctx context.Context, opt ...*SearchNotesWrittenOption) (*SearchNotesWrittenResponse, error)
SearchNotesWritten returns a list of Community Notes written by the authenticating user.
func (*Client) SearchPostsEligibleForNotes ¶ added in v1.3.0
func (c *Client) SearchPostsEligibleForNotes(ctx context.Context, opt ...*SearchPostsEligibleForNotesOption) (*SearchPostsEligibleForNotesResponse, error)
SearchPostsEligibleForNotes returns a list of posts that are eligible to receive a Community Note.
func (*Client) SearchRecentTweets ¶
func (c *Client) SearchRecentTweets(ctx context.Context, tweet string, opt ...*SearchTweetsOption) (*SearchTweetsResponse, error)
SearchRecentTweets returns Tweets from the last seven days that match a search query.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") tsr, err := client.SearchRecentTweets(context.Background(), "go", &gotwtr.SearchTweetsOption{ TweetFields: []gotwtr.TweetField{ gotwtr.TweetFieldAuthorID, gotwtr.TweetFieldAttachments, }, MaxResults: 10, }) if err != nil { log.Fatal(err) } for _, t := range tsr.Tweets { log.Println("---") log.Println(t.Text) } log.Println("---meta---") log.Println(tsr.Meta) }
func (*Client) SearchSpaces ¶
func (c *Client) SearchSpaces(ctx context.Context, searchTerm string, opt ...*SearchSpacesOption) (*SearchSpacesResponse, error)
SearchSpaces return live or scheduled Spaces matching your specified search terms. This endpoint performs a keyword search, meaning that it will return Spaces that are an exact case-insensitive match of the specified search term. The search term will match the original title of the Space.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") spaces, err := client.SearchSpaces(context.Background(), "query") if err != nil { log.Fatal(err) } for _, space := range spaces.Spaces { log.Println(space) } }
func (*Client) SearchUsers ¶ added in v1.3.0
func (c *Client) SearchUsers(ctx context.Context, query string, opt ...*SearchUsersOption) (*SearchUsersResponse, error)
SearchUsers searches for users matching the specified query.
func (*Client) SpacesTweets ¶ added in v1.3.0
func (c *Client) SpacesTweets(ctx context.Context, spaceID string, opt ...*SpacesTweetsOption) (*SpacesTweetsResponse, error)
SpacesTweets returns Tweets shared in the specified Space.
func (*Client) TrendsByWOEID ¶ added in v1.3.0
TrendsByWOEID returns trending topics for a specific location using Where On Earth ID (WOEID).
func (*Client) TweetsUserLiked ¶
func (c *Client) TweetsUserLiked(ctx context.Context, userID string, opt ...*TweetsUserLikedOption) (*TweetsUserLikedResponse, error)
TweetsUserLiked allows you to get information about a Tweet’s liking users. You will receive the most recent 100 users who liked the specified Tweet.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") tulr, err := client.TweetsUserLiked(context.Background(), "user_id") if err != nil { log.Println(err) } for _, tweet := range tulr.Tweets { log.Printf("id: %s, text: %s\n", tweet.ID, tweet.Text) } }
func (*Client) UndoBlocking ¶ added in v1.1.0
func (c *Client) UndoBlocking(ctx context.Context, sourceUserID string, targetUserID string) (*UndoBlockingResponse, error)
UndoBlocking allows a user or authenticated user ID to unblock another user.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") ub, err := client.UndoBlocking(context.Background(), "source_user_id", "target_user_id") if err != nil { log.Println(err) } log.Println(ub) }
func (*Client) UndoDMBlocking ¶ added in v1.3.0
func (c *Client) UndoDMBlocking(ctx context.Context, userID string, targetUserID string) (*UndoDMBlockingResponse, error)
UndoDMBlocking unblocks DMs from a specific user.
func (*Client) UndoFollowing ¶ added in v1.1.0
func (c *Client) UndoFollowing(ctx context.Context, sourceUserID string, targetUserID string) (*UndoFollowingResponse, error)
UndoFollowing allows a user ID to unfollow another user.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") uf, err := client.UndoFollowing(context.Background(), "source_user_id", "target_user_id") if err != nil { panic(err) } log.Println(uf) }
func (*Client) UndoListFollows ¶ added in v1.1.0
func (c *Client) UndoListFollows(ctx context.Context, listID string, userID string) (*UndoListFollowsResponse, error)
UndoListFollows enables the authenticated user to unfollow a List.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") ulf, err := client.UndoListFollows(context.Background(), "list_id", "user_id") if err != nil { log.Println(err) } log.Println(ulf) }
func (*Client) UndoListMembers ¶ added in v1.1.0
func (c *Client) UndoListMembers(ctx context.Context, listID string, userID string) (*UndoListMembersResponse, error)
UndoListMembers enables the authenticated user to remove a member from a List they own.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") ulm, err := client.UndoListMembers(context.Background(), "list_id", "user_id") if err != nil { log.Println(err) } log.Println(ulm) }
func (*Client) UndoMuting ¶ added in v1.1.0
func (c *Client) UndoMuting(ctx context.Context, sourceUserID string, targetUserID string) (*UndoMutingResponse, error)
UndoMuting allows an authenticated user ID to unmute the target user.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") um, err := client.UndoMuting(context.Background(), "source_user_id", "target_user_id") if err != nil { panic(err) } log.Println(um) }
func (*Client) UndoPinnedLists ¶ added in v1.1.0
func (c *Client) UndoPinnedLists(ctx context.Context, listID string, userID string) (*UndoPinnedListsResponse, error)
UndoPinnedLists enables the authenticated user to unpin a List.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") upl, err := client.UndoPinnedLists(context.Background(), "list_id", "user_id") if err != nil { log.Println(err) } log.Println(upl) }
func (Client) UndoRetweet ¶ added in v1.1.0
func (c Client) UndoRetweet(ctx context.Context, userID string, sourceTweetID string) (*UndoRetweetResponse, error)
UndoRetweet allows a user or authenticated user ID to remove the Retweet of a Tweet.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") ur, err := client.UndoRetweet(context.Background(), "user_id", "source_tweet_id") if err != nil { log.Println(err) } log.Println(ur) }
func (Client) UndoUsersLikingTweet ¶ added in v1.1.0
func (c Client) UndoUsersLikingTweet(ctx context.Context, userID string, tweetID string) (*UndoUsersLikingTweetResponse, error)
UndoUsersLikingTweet allows a user or authenticated user ID to unlike a Tweet. The request succeeds with no action when the user sends a request to a user they're not liking the Tweet or have already unliked the Tweet.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") uult, err := client.UndoUsersLikingTweet(context.Background(), "user_id", "tweet_id") if err != nil { log.Println(err) } log.Println(uult) }
func (*Client) UpdateMetaDataForList ¶ added in v1.1.0
func (c *Client) UpdateMetaDataForList(ctx context.Context, listID string, body ...*UpdateMetaDataForListBody) (*UpdateMetaDataForListResponse, error)
UpdateMetaDataForList enables the authenticated user to update the meta data of a specified List that they own.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") l, err := client.UpdateMetaDataForList(context.Background(), "list_id") if err != nil { log.Fatal(err) } log.Println(l) }
func (*Client) UploadMedia ¶ added in v1.3.0
func (c *Client) UploadMedia(ctx context.Context, media io.Reader, mediaType string, opt ...*MediaUploadOption) (*MediaUploadResponse, error)
UploadMedia uploads media files for use in tweets and direct messages.
func (*Client) UserMentionTimeline ¶
func (c *Client) UserMentionTimeline(ctx context.Context, userID string, opt ...*UserMentionTimelineOption) (*UserMentionTimelineResponse, error)
UserMentionTimeline returns Tweets mentioning a single user specified by the requested userID. By default, the most recent ten Tweets are returned per request. Using pagination, up to the most recent 800 Tweets can be retrieved.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") tws, err := client.UserMentionTimeline(context.Background(), "user_id") if err != nil { log.Fatal(err) } for _, tw := range tws.Tweets { log.Println(tw) } }
func (*Client) UserReverseChronologicalTimeline ¶ added in v1.3.0
func (c *Client) UserReverseChronologicalTimeline(ctx context.Context, userID string, opt ...*UserReverseChronologicalTimelineOption) (*UserReverseChronologicalTimelineResponse, error)
UserReverseChronologicalTimeline returns Tweets from the user's timeline in reverse chronological order.
func (*Client) UserTweetTimeline ¶
func (c *Client) UserTweetTimeline(ctx context.Context, userID string, opt ...*UserTweetTimelineOption) (*UserTweetTimelineResponse, error)
UserTweetTimeline returns Tweets composed by a single user, specified by the requested userID. By default, the most recent ten Tweets are returned per request. Using pagination, the most recent 3,200 Tweets can be retrieved.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") ts, err := client.UserTweetTimeline(context.Background(), "user_id") if err != nil { log.Fatal(err) } for _, t := range ts.Tweets { log.Println(t) } }
func (*Client) UsersLikingTweet ¶
func (c *Client) UsersLikingTweet(ctx context.Context, tweetID string, opt ...*UsersLikingTweetOption) (*UsersLikingTweetResponse, error)
UsersLikingTweet allows you to get information about a user’s liked Tweets.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") ultr, err := client.UsersLikingTweet(context.Background(), "tweet_id") if err != nil { log.Fatal(err) } for _, user := range ultr.Users { log.Printf("id: %s, name: %s\n", user.ID, user.UserName) } }
func (*Client) UsersPurchasedSpaceTicket ¶
func (c *Client) UsersPurchasedSpaceTicket(ctx context.Context, spaceID string, opt ...*UsersPurchasedSpaceTicketOption) (*UsersPurchasedSpaceTicketResponse, error)
UsersPurchasedSpaceTicket returns a list of user who purchased a ticket to the requested Space. You must authenticate the request using the access token of the creator of the requested Space.
Example ¶
package main import ( "context" "log" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") tickets, err := client.UsersPurchasedSpaceTicket(context.Background(), "space_id") if err != nil { log.Fatal(err) } for _, user := range tickets.Users { log.Println(user) } }
func (*Client) VolumeStreams ¶
func (c *Client) VolumeStreams(ctx context.Context, ch chan<- VolumeStreamsResponse, errCh chan<- error, opt ...*VolumeStreamsOption) *VolumeStreams
VolumeStreams streams about 1% of all Tweets in real-time.
Example ¶
package main import ( "context" "log" "time" "github.com/sivchari/gotwtr" ) func main() { client := gotwtr.New("key") ch := make(chan gotwtr.VolumeStreamsResponse, 5) errCh := make(chan error) stream := client.VolumeStreams(context.Background(), ch, errCh) log.Println("streaming...") done := make(chan struct{}) go func(done chan struct{}) { for { select { case data := <-ch: log.Println(data.Tweet) case err := <-errCh: log.Println(err) case <-done: return } } }(done) time.Sleep(time.Second * 10) close(done) stream.Stop() log.Println("done") }
func (*Client) VolumeStreams10 ¶ added in v1.3.0
func (c *Client) VolumeStreams10(ctx context.Context, ch chan<- VolumeStreamsResponse, errCh chan<- error, opt ...*VolumeStreamsOption) *VolumeStreams
VolumeStreams10 streams about 10% of all Tweets in real-time.
type ClientOption ¶
type ClientOption func(*client)
func WithConsumerKey ¶ added in v1.1.0
func WithConsumerKey(consumerKey string) ClientOption
func WithConsumerSecret ¶ added in v1.1.0
func WithConsumerSecret(consumerSecret string) ClientOption
func WithHTTPClient ¶
func WithHTTPClient(httpClient *http.Client) ClientOption
type CommunityNote ¶ added in v1.3.0
type CommunityNote struct { ID string `json:"id"` Text string `json:"text"` CreatedAt string `json:"created_at,omitempty"` AuthorID string `json:"author_id,omitempty"` PostID string `json:"post_id,omitempty"` Classification string `json:"classification,omitempty"` Believable *bool `json:"believable,omitempty"` Harmful *bool `json:"harmful,omitempty"` ValidationDifficult *bool `json:"validation_difficult,omitempty"` MisleadingOther *bool `json:"misleading_other,omitempty"` NotMisleading *bool `json:"not_misleading,omitempty"` TrustworthySources []string `json:"trustworthy_sources,omitempty"` }
CommunityNote represents a Community Note structure
type CommunityNoteField ¶ added in v1.3.0
type CommunityNoteField string
Community Notes field enum for request parameters
const ( CommunityNoteFieldID CommunityNoteField = "id" CommunityNoteFieldText CommunityNoteField = "text" CommunityNoteFieldCreatedAt CommunityNoteField = "created_at" CommunityNoteFieldAuthorID CommunityNoteField = "author_id" CommunityNoteFieldPostID CommunityNoteField = "post_id" CommunityNoteFieldClassification CommunityNoteField = "classification" CommunityNoteFieldBelievable CommunityNoteField = "believable" CommunityNoteFieldHarmful CommunityNoteField = "harmful" CommunityNoteFieldValidationDifficult CommunityNoteField = "validation_difficult" CommunityNoteFieldMisleadingOther CommunityNoteField = "misleading_other" CommunityNoteFieldNotMisleading CommunityNoteField = "not_misleading" )
type CommunityNoteInfoRequest ¶ added in v1.3.0
type CommunityNoteInfoRequest struct { Text string `json:"text"` Classification string `json:"classification"` MisleadingTags []string `json:"misleading_tags,omitempty"` TrustworthySources []string `json:"trustworthy_sources,omitempty"` }
CommunityNoteInfoRequest represents the info section of a create note request
type CommunityNotes ¶ added in v1.3.0
type CommunityNotes interface { // Community Notes SearchPostsEligibleForNotes(ctx context.Context, opt ...*SearchPostsEligibleForNotesOption) (*SearchPostsEligibleForNotesResponse, error) SearchNotesWritten(ctx context.Context, opt ...*SearchNotesWrittenOption) (*SearchNotesWrittenResponse, error) CreateCommunityNote(ctx context.Context, body *CreateCommunityNoteBody) (*CreateCommunityNoteResponse, error) }
type CommunityNotesIncludes ¶ added in v1.3.0
type CommunityNotesIncludes struct { Users []*User `json:"users,omitempty"` Posts []*Post `json:"posts,omitempty"` Notes []*CommunityNote `json:"notes,omitempty"` }
CommunityNotesIncludes represents included data in Community Notes responses
type ComplianceFieldStatus ¶ added in v1.1.0
type ComplianceFieldStatus string
const ( ComplianseFieldStatusCreated ComplianceFieldStatus = "created" ComplianseFieldStatusInProgress ComplianceFieldStatus = "in_progress" ComplianseFieldStatusFailed ComplianceFieldStatus = "failed" ComplianseFieldStatusCompletae ComplianceFieldStatus = "complete" )
type ComplianceFieldType ¶ added in v1.1.0
type ComplianceFieldType string
const ( ComplianceFieldTypeTweets ComplianceFieldType = "tweets" ComplianceFieldTypeUsers ComplianceFieldType = "users" )
type ComplianceJobData ¶ added in v1.1.0
type ComplianceJobData struct { ID string `json:"id"` CreatedAt string `json:"created_at"` Type string `json:"type"` Name string `json:"name"` UploadURL string `json:"upload_url"` UploadExpiresAt string `json:"upload_expires_at"` DownloadURL string `json:"download_url"` DownloadExpiresAt string `json:"download_expires_at"` Status string `json:"status"` Resumable bool `json:"resumable"` Error string `json:"error,omitempty"` }
type ComplianceJobResponse ¶ added in v1.1.0
type ComplianceJobResponse struct { ComplianceJobData *ComplianceJobData `json:"data"` Errors []*APIResponseError `json:"errors"` }
type ComplianceJobsData ¶ added in v1.1.0
type ComplianceJobsData struct { ID string `json:"id"` CreatedAt string `json:"created_at"` Type string `json:"type"` Name string `json:"name"` UploadURL string `json:"upload_url"` UploadExpiresAt string `json:"upload_expires_at"` DownloadURL string `json:"download_url"` DownloadExpiresAt string `json:"download_expires_at"` Status string `json:"status"` Resumable bool `json:"resumable"` Error string `json:"error,omitempty"` }
type ComplianceJobsOption ¶ added in v1.1.0
type ComplianceJobsOption struct { Type ComplianceFieldType Status ComplianceFieldStatus }
type ComplianceJobsResponse ¶ added in v1.1.0
type ComplianceJobsResponse struct { ComplianceJobsData []*ComplianceJobsData `json:"data"` Errors []*APIResponseError `json:"errors"` }
type Compliances ¶ added in v1.1.0
type Compliances interface { // Batch compliance ComplianceJobs(ctx context.Context, opt *ComplianceJobsOption) (*ComplianceJobsResponse, error) ComplianceJob(ctx context.Context, complianceJobID int) (*ComplianceJobResponse, error) CreateComplianceJob(ctx context.Context, opt ...*CreateComplianceJobOption) (*CreateComplianceJobResponse, error) }
type ConnectToStream ¶
type ConnectToStream struct {
// contains filtered or unexported fields
}
func (*ConnectToStream) Stop ¶
func (s *ConnectToStream) Stop()
type ConnectToStreamOption ¶
type ConnectToStreamOption struct { // BackfillMinutes int // This feature is currently only available to the Academic Research product track. Expansions []Expansion MediaFields []MediaField PlaceFields []PlaceField PollFields []PollField TweetFields []TweetField UserFields []UserField }
type ConnectToStreamResponse ¶
type ConnectToStreamResponse struct { Tweet *Tweet `json:"data"` Includes *TweetIncludes `json:"includes,omitempty"` MatchingRules []*MatchingRule `json:"matching_rules"` }
type CreateCommunityNoteBody ¶ added in v1.3.0
type CreateCommunityNoteBody struct { TestMode bool `json:"test_mode"` PostID string `json:"post_id"` Info *CommunityNoteInfoRequest `json:"info"` }
CreateCommunityNoteBody represents the request body for creating a community note
type CreateCommunityNoteResponse ¶ added in v1.3.0
type CreateCommunityNoteResponse struct { Data *CommunityNote `json:"data,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
CreateCommunityNoteResponse represents the response for creating a community note
type CreateComplianceJobData ¶ added in v1.1.0
type CreateComplianceJobData struct { ID string `json:"id"` CreatedAt string `json:"created_at"` Type string `json:"type"` Name string `json:"name"` UploadURL string `json:"upload_url"` UploadExpiresAt string `json:"upload_expires_at"` DownloadURL string `json:"download_url"` DownloadExpiresAt string `json:"download_expires_at"` Status string `json:"status"` Resumable bool `json:"resumable"` Error string `json:"error,omitempty"` }
type CreateComplianceJobOption ¶ added in v1.1.0
type CreateComplianceJobOption struct { Type ComplianceFieldType `json:"type"` Name string `json:"name,omitempty"` Resumable bool `json:"resumable,omitempty"` }
type CreateComplianceJobResponse ¶ added in v1.1.0
type CreateComplianceJobResponse struct { CreateComplianceJobData *CreateComplianceJobData `json:"data"` Errors []*APIResponseError `json:"errors"` }
type CreateNewGroupDMBody ¶ added in v1.2.0
type CreateNewGroupDMBody struct { Text string `json:"text,omitempty"` Attachments []DirectMessageAttachment `json:"attachments,omitempty"` }
type CreateNewGroupDMResponse ¶ added in v1.2.0
type CreateNewGroupDMResponse struct { DMConversationID string `json:"dm_conversation_id,omitempty"` DMEventFieldID string `json:"dm_event_id,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type CreateNewListBody ¶ added in v1.1.0
type CreateNewListData ¶ added in v1.1.0
type CreateNewListResponse ¶ added in v1.1.0
type CreateNewListResponse struct { CreateNewListData *CreateNewListData `json:"data"` Errors []*APIResponseError `json:"errors,omitempty"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type CreateOneToOneDMBody ¶ added in v1.2.0
type CreateOneToOneDMBody struct { Text string `json:"text,omitempty"` Attachments []DirectMessageAttachment `json:"attachments,omitempty"` }
type CreateOneToOneDMResponse ¶ added in v1.2.0
type CreateOneToOneDMResponse struct { DMConversationID string `json:"dm_conversation_id,omitempty"` DMEventFieldID string `json:"dm_event_id,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type DMBlocking ¶ added in v1.3.0
type DMBlocking struct {
DMBlocking bool `json:"dm_blocking"`
}
DMBlocking represents the DM blocking data
type DMBlockingBody ¶ added in v1.3.0
type DMBlockingBody struct {
TargetUserID string `json:"target_user_id"`
}
DMBlockingBody represents the request body for DM blocking operations
type DMEventField ¶ added in v1.2.0
type DMEventField string
const ( DirectMessageFieldID DMEventField = "id" DirectMessageFieldText DMEventField = "text" DirectMessageFieldEventType DMEventField = "event_type" DirectMessageFieldCreatedAt DMEventField = "created_at" DirectMessageFieldDMConversationID DMEventField = "dm_conversation_id" DirectMessageFieldSenderID DMEventField = "sender_id" DirectMessageFieldParticipantIDs DMEventField = "participant_ids" DirectMessageFieldReferencedTweets DMEventField = "referenced_tweets" DirectMessageFieldAttachments DMEventField = "attachments" DirectMessageFieldMediaKeys DMEventField = "media_keys" DirectMessageFieldPublicMetrics DMEventField = "public_metrics" )
type DeleteListData ¶ added in v1.1.0
type DeleteListData struct {
Deleted bool `json:"deleted"`
}
type DeleteListResponse ¶ added in v1.1.0
type DeleteListResponse struct { DeleteListData *DeleteListData `json:"data"` Errors []*APIResponseError `json:"errors,omitempty"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type DeleteRule ¶
type DeleteRule struct {
IDs []string `json:"ids"`
}
type DeleteTweetData ¶ added in v1.1.0
type DeleteTweetData struct {
Deleted bool `json:"deleted"`
}
type DeleteTweetResponse ¶ added in v1.1.0
type DeleteTweetResponse struct {
Data DeleteTweetData `json:"data"`
}
type DirectMessage ¶ added in v1.2.0
type DirectMessage struct { Attachments []DirectMessageAttachment `json:"attachments,omitempty"` CreatedAt string `json:"created_at"` DMConversationID string `json:"dm_conversation_id"` EventType string `json:"event_type"` ID string `json:"id"` SenderID string `json:"sender_id"` Text string `json:"text,omitempty"` MediaKeys []string `json:"media_keys,omitempty"` PublicMetrics *DirectMessageMetrics `json:"public_metrics,omitempty"` }
type DirectMessageAttachment ¶ added in v1.2.0
type DirectMessageAttachment struct {
MediaID string `json:"media_id"`
}
type DirectMessageMeta ¶ added in v1.2.0
type DirectMessageMetrics ¶ added in v1.3.0
type DirectMessageMetrics struct {
ReadCount int `json:"read_count"`
}
type DirectMessageOption ¶ added in v1.2.0
type DirectMessageOption struct { DMEventFields []DMEventField EventTypes EventTypes Expansions []Expansion MaxResults int MediaFields []MediaField PaginationToken string TweetFields []TweetField UserFields []UserField }
type DirectMessages ¶ added in v1.2.0
type DirectMessages interface { // Direct Message CreateOneToOneDM(ctx context.Context, participantID string, body *CreateOneToOneDMBody) (*CreateOneToOneDMResponse, error) CreateNewGroupDM(ctx context.Context, conversationID string, body *CreateNewGroupDMBody) (*CreateNewGroupDMResponse, error) PostDM(ctx context.Context, body *PostDMBody) (*PostDMResponse, error) LookUpAllOneToOneDM(ctx context.Context, participantID string, opt ...*DirectMessageOption) (*LookUpAllOneToOneDMResponse, error) LookUpDM(ctx context.Context, dmConversationID string, opt ...*DirectMessageOption) (*LookUpDMResponse, error) LookUpAllDM(ctx context.Context, opt ...*DirectMessageOption) (*LookUpAllDMResponse, error) // DM Blocks PostDMBlocking(ctx context.Context, userID string, targetUserID string) (*PostDMBlockingResponse, error) UndoDMBlocking(ctx context.Context, userID string, targetUserID string) (*UndoDMBlockingResponse, error) }
type DiscoverSpacesMeta ¶
type DiscoverSpacesMeta struct {
ResultCount int `json:"result_count"`
}
type DiscoverSpacesOption ¶
type DiscoverSpacesOption struct { Expansions []Expansion SpaceFields []SpaceField TopicFields []TopicField UserFields []UserField }
type DiscoverSpacesResponse ¶
type DiscoverSpacesResponse struct { Spaces []*Space `json:"data"` Includes *SpaceIncludes `json:"includes,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` Meta *DiscoverSpacesMeta `json:"meta"` }
type EngagementMetrics ¶ added in v1.3.0
type EngagementMetrics struct { EngagementRate float64 `json:"engagement_rate"` LikeRate float64 `json:"like_rate"` RetweetRate float64 `json:"retweet_rate"` ReplyRate float64 `json:"reply_rate"` QuoteRate float64 `json:"quote_rate"` BookmarkRate float64 `json:"bookmark_rate"` ClickThroughRate float64 `json:"click_through_rate"` }
EngagementMetrics provides calculated engagement metrics
func CalculateEngagementMetrics ¶ added in v1.3.0
func CalculateEngagementMetrics(metrics *TweetMetrics) *EngagementMetrics
CalculateEngagementMetrics calculates detailed engagement metrics
type EventTypes ¶ added in v1.2.0
type EventTypes string
const ( EventTypesFieldMessageCreate EventTypes = "MessageCreate" EventTypesFieldParticipantsJoin EventTypes = "ParticipantsJoin" EventTypesFieldParticipantsLeave EventTypes = "ParticipantsLeave" )
type Expansion ¶
type Expansion string
const ( // Tweet payloads ExpansionAuthorID Expansion = "author_id" ExpansionReferencedTweetsID Expansion = "referenced_tweets.id" ExpansionEditHistoryTweetIDs Expansion = "edit_history_tweet_ids" ExpansionInReplyToUserID Expansion = "in_reply_to_user_id" ExpansionAttachmentsMediaKeys Expansion = "attachments.media_keys" ExpansionAttachmentsPollIDs Expansion = "attachments.poll_ids" ExpansionGeoPlaceID Expansion = "geo.place_id" ExpansionEntitiesMentionsUserName Expansion = "entities.mentions.username" ExpansionReferencedTweetsIDAuthorID Expansion = "referenced_tweets.id.author_id" ExpansionContextAnnotations Expansion = "context_annotations" // USer payloads ExpansionPinnedTweetID Expansion = "pinned_tweet_id" // Direct Message event payloads with attachments.media_keys + referenced_tweets.id ExpansionSenderID Expansion = "sender_id" ExpansionParticipantIDs Expansion = "participant_ids" // Space payloads ExpansionInvitedUserIDs Expansion = "invited_user_ids" ExpansionSpeakerIDs Expansion = "speaker_ids" ExpansionCreatorID Expansion = "creator_id" ExpansionHostIDs Expansion = "host_ids" ExpansionTopicIDs Expansion = "topic_ids" // List payloads ExpansionOwnerID Expansion = "owner_id" )
type FilteredRule ¶
type FollowOption ¶
type FollowOption struct { Expansions []Expansion MaxResults int PaginationToken string TweetFields []TweetField UserFields []UserField }
type FollowersResponse ¶
type FollowersResponse struct { Users []*User `json:"data"` Includes *UserIncludes `json:"includes,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` Meta *FollowsMeta `json:"meta"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type FollowingBody ¶
type FollowingBody struct {
TargetUserID string `json:"target_user_id"`
}
type FollowingResponse ¶
type FollowingResponse struct { Users []*User `json:"data"` Includes *UserIncludes `json:"includes,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` Meta *FollowsMeta `json:"meta"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type FollowsMeta ¶
type HideRepliesResponse ¶ added in v1.1.0
type HideRepliesResponse struct { HideRepliesResponseData *HideRepliesResponseData `json:"data"` Errors []*APIResponseError `json:"errors,omitempty"` }
type HideRepliesResponseData ¶ added in v1.1.0
type HideRepliesResponseData struct {
Hidden bool `json:"hidden"`
}
type InvalidateTokenResponse ¶ added in v1.3.0
type InvalidateTokenResponse struct { AccessToken string `json:"access_token,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` }
type List ¶
type List struct { ID string `json:"id"` Name string `json:"name"` CreatedAt string `json:"created_at,omitempty"` Private bool `json:"private,omitempty"` FollowerCount int `json:"follower_count,omitempty"` MemberCount int `json:"member_count,omitempty"` OwnerID string `json:"owner_id,omitempty"` Description string `json:"description,omitempty"` }
type ListAnalytics ¶ added in v1.3.0
type ListAnalytics struct { ViewCount int `json:"view_count,omitempty"` MemberGrowthRate float64 `json:"member_growth_rate,omitempty"` TweetCount int `json:"tweet_count,omitempty"` EngagementRate float64 `json:"engagement_rate,omitempty"` }
ListAnalytics represents analytics for Lists
type ListFollowersOption ¶
type ListFollowersOption struct { Expansions []Expansion MaxResults int PaginationToken string TweetFields []TweetField UserFields []UserField }
type ListFollowersResponse ¶
type ListFollowersResponse struct { Users []*User `json:"data"` Includes *ListIncludes `json:"includes,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` Meta *ListMeta `json:"meta"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type ListFollows ¶ added in v1.1.0
type ListFollows struct {
Following bool `json:"following"`
}
type ListFollowsBody ¶ added in v1.1.0
type ListFollowsBody struct {
ListID string `json:"list_id"`
}
type ListFollowsOption ¶
type ListIncludes ¶
type ListMembersBody ¶ added in v1.1.0
type ListMembersBody struct {
UserID string `json:"user_id"`
}
type ListMembersOption ¶
type ListMembersOption struct { Expansions []Expansion MaxResults int PaginationToken string TweetFields []TweetField UserFields []UserField }
type ListMembersResponse ¶
type ListMembersResponse struct { Users []*User `json:"data"` Includes *ListIncludes `json:"includes,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` Meta *ListMeta `json:"meta"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type ListResponse ¶
type ListResponse struct { List *List `json:"data"` Includes *ListIncludes `json:"includes,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type ListTweetsOption ¶
type ListTweetsOption struct { Expansions []Expansion MaxResults int PaginationToken string TweetFields []TweetField UserFields []UserField }
type ListTweetsResponse ¶
type ListTweetsResponse struct { Tweets []*Tweet `json:"data"` Includes *ListIncludes `json:"includes,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` Meta *ListMeta `json:"meta"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type Lists ¶
type Lists interface { // List Tweets lookup LookUpListTweets(ctx context.Context, listID string, opt ...*ListTweetsOption) (*ListTweetsResponse, error) // List follows UndoListFollows(ctx context.Context, listID string, userID string) (*UndoListFollowsResponse, error) ListFollowers(ctx context.Context, listID string, opt ...*ListFollowersOption) (*ListFollowersResponse, error) AllListsUserFollows(ctx context.Context, userID string, opt ...*ListFollowsOption) (*AllListsUserFollowsResponse, error) PostListFollows(ctx context.Context, listID string, userID string) (*PostListFollowsResponse, error) // List lookup LookUpList(ctx context.Context, listID string, opt ...*LookUpListOption) (*ListResponse, error) LookUpAllListsOwned(ctx context.Context, userID string, opt ...*AllListsOwnedOption) (*AllListsOwnedResponse, error) // List members UndoListMembers(ctx context.Context, listID string, userID string) (*UndoListMembersResponse, error) ListMembers(ctx context.Context, listID string, opt ...*ListMembersOption) (*ListMembersResponse, error) ListsSpecifiedUser(ctx context.Context, userID string, opt ...*ListsSpecifiedUserOption) (*ListsSpecifiedUserResponse, error) PostListMembers(ctx context.Context, listID string, userID string) (*PostListMembersResponse, error) // Manage Lists DeleteList(ctx context.Context, listID string) (*DeleteListResponse, error) UpdateMetaDataForList(ctx context.Context, listID string, body ...*UpdateMetaDataForListBody) (*UpdateMetaDataForListResponse, error) CreateNewList(ctx context.Context, body *CreateNewListBody) (*CreateNewListResponse, error) // Pinned Lists UndoPinnedLists(ctx context.Context, listID string, userID string) (*UndoPinnedListsResponse, error) PinnedLists(ctx context.Context, userID string, opt ...*PinnedListsOption) (*PinnedListsResponse, error) PostPinnedLists(ctx context.Context, listID string, userID string) (*PostPinnedListsResponse, error) }
type ListsSpecifiedUserResponse ¶
type ListsSpecifiedUserResponse struct { Lists []*List `json:"data"` Includes *ListIncludes `json:"includes,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` Meta *ListMeta `json:"meta"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type LookUpAllDMResponse ¶ added in v1.2.0
type LookUpAllDMResponse struct { Message []*DirectMessage `json:"data"` Errors []*APIResponseError `json:"errors,omitempty"` Meta *DirectMessageMeta `json:"meta,omitempty"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type LookUpAllOneToOneDMResponse ¶ added in v1.2.0
type LookUpAllOneToOneDMResponse struct { Message []*DirectMessage `json:"data"` Errors []*APIResponseError `json:"errors,omitempty"` Meta *DirectMessageMeta `json:"meta,omitempty"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type LookUpDMResponse ¶ added in v1.2.0
type LookUpDMResponse struct { Message []*DirectMessage `json:"data"` Errors []*APIResponseError `json:"errors,omitempty"` Meta *DirectMessageMeta `json:"meta,omitempty"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type LookUpListOption ¶
type LookUpUsersWhoLiked ¶
type LookUpUsersWhoLiked struct { ID string `json:"id"` Name string `json:"name"` UserName string `json:"username"` CreatedAt string `json:"created_at,omitempty"` Protected bool `json:"protected,omitempty"` Withheld *LookUpUsersWhoLikedWithheld `json:"withheld,omitempty"` Location string `json:"location,omitempty"` URL string `json:"url,omitempty"` Description string `json:"description,omitempty"` Verified bool `json:"verified,omitempty"` Entities *LookUpUsersWhoLikedEntity `json:"entities,omitempty"` ProfileImageURL string `json:"profile_image_url,omitempty"` PublicMetrics *LookUpUsersWhoLikedPublicMetrics `json:"public_metrics,omitempty"` PinnedTweetID string `json:"pinned_tweet_id,omitempty"` }
type LookUpUsersWhoLikedDescription ¶
type LookUpUsersWhoLikedDescription struct { URLs []*LookUpUsersWhoLikedURLContent `json:"urls"` HashTags []*LookUpUsersWhoLikedHashTag `json:"hashtags"` Mentions []*LookUpUsersWhoLikedMention `json:"mentions"` }
type LookUpUsersWhoLikedEntity ¶
type LookUpUsersWhoLikedEntity struct { URL *LookUpUsersWhoLikedURL `json:"url"` Description *LookUpUsersWhoLikedDescription `json:"description"` }
type LookUpUsersWhoLikedIncludes ¶
type LookUpUsersWhoLikedIncludes struct {
Tweets []*Tweet `json:"tweets"`
}
type LookUpUsersWhoLikedMention ¶
type LookUpUsersWhoLikedMention struct { Start int `json:"start"` End int `json:"end"` UserName string `json:"username"` CashTags []*LookUpUsersWhoLikedCashTag `json:"cashtags"` }
type LookUpUsersWhoLikedMeta ¶
type LookUpUsersWhoLikedMeta struct {
ResultCount int `json:"result_count"`
}
type LookUpUsersWhoLikedURL ¶
type LookUpUsersWhoLikedURL struct {
URLs []*LookUpUsersWhoLikedURLContent `json:"urls"`
}
type LookUpUsersWhoPurchasedSpaceTicketIncludes ¶
type LookUpUsersWhoPurchasedSpaceTicketIncludes struct {
Tweets []*Tweet
}
type LookupUserBookmarksMeta ¶ added in v1.1.0
type LookupUserBookmarksOption ¶ added in v1.1.0
type LookupUserBookmarksOption struct { Expansions []Expansion MaxResults int MediaFields []MediaField PaginationToken string PlaceFields []PlaceField PollFields []PollField TweetFields []TweetField UserFields []UserField }
type LookupUserBookmarksResponse ¶ added in v1.1.0
type LookupUserBookmarksResponse struct { Tweets []*Tweet `json:"data"` Includes *TweetIncludes `json:"includes,omitempty"` Meta *LookupUserBookmarksMeta `json:"meta"` Errors []*APIResponseError `json:"errors,omitempty"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type MatchingRule ¶
type Me ¶ added in v1.1.2
type Me struct { ID string `json:"id"` Name string `json:"name"` UserName string `json:"username"` CreatedAt string `json:"created_at,omitempty"` Protected bool `json:"protected,omitempty"` Withheld *MeWithheld `json:"withheld,omitempty"` Location string `json:"location,omitempty"` URL string `json:"url,omitempty"` Description string `json:"description,omitempty"` Verified bool `json:"verified,omitempty"` Entities *UserEntity `json:"entities,omitempty"` ProfileImageURL string `json:"profile_image_url,omitempty"` PublicMetrics *UserPublicMetrics `json:"public_metrics,omitempty"` PinnedTweetID string `json:"pinned_tweet_id,omitempty"` Includes *MeIncludes `json:"includes,omitempty"` }
type MeIncludes ¶ added in v1.1.2
type MeIncludes struct {
Tweets []*Tweet
}
type MeOption ¶ added in v1.1.2
type MeOption struct { Expansions []Expansion TweetFields []TweetField UserFields []UserField }
type MeResponse ¶ added in v1.1.2
type MeResponse struct { Me *Me `json:"data"` Errors []*APIResponseError `json:"errors,omitempty"` }
type MeWithheld ¶ added in v1.1.2
type Media ¶
type Media struct { MediaKey string `json:"media_key"` Type string `json:"type"` URL string `json:"url,omitempty"` DurationMs int `json:"duration_ms,omitempty"` Height int `json:"height,omitempty"` NonPublicMetrics *MediaMetrics `json:"non_public_metrics,omitempty"` OrganicMetrics *MediaMetrics `json:"organic_metrics,omitempty"` PreviewImageURL string `json:"preview_image_url,omitempty"` PromotedMetrics *MediaMetrics `json:"promoted_metrics,omitempty"` PublicMetrics *MediaMetrics `json:"public_metrics,omitempty"` Width int `json:"width,omitempty"` AltText string `json:"alt_text,omitempty"` MediaIDs []string `json:"media_ids,omitempty"` TaggedUserIDs []string `json:"tagged_user_ids,omitempty"` Variants []MediaVariant `json:"variants,omitempty"` }
type MediaAnalytics ¶ added in v1.3.0
type MediaAnalytics struct { ViewCount int `json:"view_count,omitempty"` PlayCount int `json:"play_count,omitempty"` DownloadCount int `json:"download_count,omitempty"` CompletionRate int `json:"completion_rate,omitempty"` // Percentage for videos }
MediaAnalytics represents analytics for Media objects
type MediaField ¶
type MediaField string
const ( MediaFieldMediaKey MediaField = "media_key" MediaFieldType MediaField = "type" MediaFieldURL MediaField = "url" MediaFieldDurationMS MediaField = "duration_ms" MediaFieldHeight MediaField = "height" MediaFieldNonPublicMetrics MediaField = "non_public_metrics" MediaFieldOrganicMetrics MediaField = "organic_metrics" MediaFieldPreviewImageURL MediaField = "preview_image_url" MediaFieldPromotedMetrics MediaField = "promoted_metrics" MediaFieldPublicMetrics MediaField = "public_metrics" MediaFieldWidth MediaField = "width" MediaFieldAltText MediaField = "alt_text" MediaFieldVariants MediaField = "variants" )
type MediaMetrics ¶
type MediaMetrics struct { Playback0Count int `json:"playback_0_count,omitempty"` Playback25Count int `json:"playback_25_count,omitempty"` Playback50Count int `json:"playback_50_count,omitempty"` Playback75Count int `json:"playback_75_count,omitempty"` Playback100Count int `json:"playback_100_count,omitempty"` ViewCount int `json:"view_count,omitempty"` }
type MediaProcessingError ¶ added in v1.3.0
type MediaProcessingError struct { Code int `json:"code"` Name string `json:"name"` Message string `json:"message"` }
MediaProcessingError represents errors during media processing
type MediaProcessingInfo ¶ added in v1.3.0
type MediaProcessingInfo struct { State string `json:"state"` // pending, in_progress, failed, succeeded CheckAfterSecs int `json:"check_after_secs,omitempty"` ProgressPercent int `json:"progress_percent,omitempty"` Error *MediaProcessingError `json:"error,omitempty"` }
MediaProcessingInfo represents media processing status
type MediaUpload ¶ added in v1.3.0
type MediaUpload interface { // Media Upload UploadMedia(ctx context.Context, media io.Reader, mediaType string, opt ...*MediaUploadOption) (*MediaUploadResponse, error) InitializeChunkedUpload(ctx context.Context, req *MediaUploadInitRequest) (*MediaUploadResponse, error) AppendChunkedUpload(ctx context.Context, req *MediaUploadAppendRequest) error FinalizeChunkedUpload(ctx context.Context, req *MediaUploadFinalizeRequest) (*MediaUploadResponse, error) CheckUploadStatus(ctx context.Context, req *MediaUploadStatusRequest) (*MediaUploadResponse, error) }
type MediaUploadAppendRequest ¶ added in v1.3.0
type MediaUploadAppendRequest struct { Command string `json:"command"` // "APPEND" MediaID string `json:"media_id"` SegmentIndex int `json:"segment_index"` Media []byte `json:"media"` // File chunk data }
MediaUploadAppendRequest represents the APPEND command for chunked upload
type MediaUploadFinalizeRequest ¶ added in v1.3.0
type MediaUploadFinalizeRequest struct { Command string `json:"command"` // "FINALIZE" MediaID string `json:"media_id"` }
MediaUploadFinalizeRequest represents the FINALIZE command for chunked upload
type MediaUploadInitRequest ¶ added in v1.3.0
type MediaUploadInitRequest struct { Command string `json:"command"` // "INIT" MediaType string `json:"media_type"` // MIME type (e.g., "image/jpeg", "video/mp4") TotalBytes int64 `json:"total_bytes"` MediaCategory string `json:"media_category,omitempty"` // e.g., "tweet_image", "tweet_video", "dm_image" AdditionalOwners []string `json:"additional_owners,omitempty"` }
MediaUploadInitRequest represents the INIT command for chunked upload
type MediaUploadOption ¶ added in v1.3.0
type MediaUploadOption struct { MediaCategory string `json:"media_category,omitempty"` // e.g., "tweet_image", "tweet_video", "dm_image", "dm_video" AdditionalOwners []string `json:"additional_owners,omitempty"` // Additional user IDs with upload permissions AltText string `json:"alt_text,omitempty"` // Alt text for accessibility }
MediaUploadOption represents options for simple media upload
type MediaUploadResponse ¶ added in v1.3.0
type MediaUploadResponse struct { MediaID string `json:"media_id"` MediaKey string `json:"media_key,omitempty"` ExpiresAfterSecs int `json:"expires_after_secs,omitempty"` ProcessingInfo *MediaProcessingInfo `json:"processing_info,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
MediaUploadResponse represents the response from media upload operations
type MediaUploadStatusRequest ¶ added in v1.3.0
type MediaUploadStatusRequest struct { Command string `json:"command"` // "STATUS" MediaID string `json:"media_id"` }
MediaUploadStatusRequest represents the STATUS command to check upload progress
type MediaVariant ¶ added in v1.2.0
type MuteOption ¶ added in v1.1.0
type MuteOption struct { Expansions []Expansion MaxResults int PaginationToken string TweetFields []TweetField UserFields []UserField }
type MutingBody ¶ added in v1.1.0
type MutingBody struct {
TargetUserID string `json:"target_user_id"`
}
type MutingResponse ¶ added in v1.1.0
type MutingResponse struct { Users []*User `json:"data"` Includes *UserIncludes `json:"includes,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` Meta *MutesMeta `json:"meta"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type PinnedListsBody ¶ added in v1.1.0
type PinnedListsBody struct {
ListID string `json:"list_id"`
}
type PinnedListsOption ¶ added in v1.1.0
type PinnedListsResponse ¶ added in v1.1.0
type PinnedListsResponse struct { Lists []*List `json:"data"` Includes *ListIncludes `json:"includes,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` Meta *ListMeta `json:"meta"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type Place ¶
type Place struct { FullName string `json:"full_name"` ID string `json:"id"` ContainedWithin []string `json:"contained_within,omitempty"` Country string `json:"country,omitempty"` CountryCode string `json:"country_code,omitempty"` Geo *PlaceGeo `json:"geo,omitempty"` Name string `json:"name,omitempty"` PlaceType string `json:"place_type,omitempty"` }
type PlaceField ¶
type PlaceField string
const ( PlaceFieldFullName PlaceField = "full_name" PlaceFieldID PlaceField = "id" PlaceFieldContainedWithin PlaceField = "contained_within" PlaceFieldCountry PlaceField = "country" PlaceFieldCountryCode PlaceField = "country_code" PlaceFieldGeo PlaceField = "geo" PlaceFieldName PlaceField = "name" PlaceFieldPlaceType PlaceField = "place_type" )
type Poll ¶
type Poll struct { ID string `json:"id"` Options []*PollOption `json:"options"` DurationMinutes int `json:"duration_minutes,omitempty"` EndDatetime string `json:"end_datetime,omitempty"` VotingStatus string `json:"voting_status,omitempty"` }
type PollOption ¶
type Post ¶ added in v1.3.0
type Post struct { ID string `json:"id"` Text string `json:"text"` AuthorID string `json:"author_id,omitempty"` CreatedAt string `json:"created_at,omitempty"` }
Post represents a post/tweet eligible for Community Notes
type PostBlockingResponse ¶ added in v1.1.0
type PostBlockingResponse struct { Blocking *Blocking `json:"data"` Errors []*APIResponseError `json:"errors,omitempty"` }
type PostDMBlockingResponse ¶ added in v1.3.0
type PostDMBlockingResponse struct { DMBlocking *DMBlocking `json:"data,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
PostDMBlockingResponse represents the response for blocking DMs from a user
type PostDMBody ¶ added in v1.2.0
type PostDMBody struct { ConversationType string `json:"conversation_type"` Message *DirectMessage `json:"message"` ParticipantIDs []string `json:"participant_id"` }
type PostDMResponse ¶ added in v1.2.0
type PostDMResponse struct { DMConversationID string `json:"dm_conversation_id,omitempty"` DMEventFieldID string `json:"dm_event_id,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type PostFollowingResponse ¶
type PostFollowingResponse struct { Following *Following `json:"data"` Errors []*APIResponseError `json:"errors,omitempty"` }
type PostListFollowsResponse ¶ added in v1.1.0
type PostListFollowsResponse struct { Following *ListFollows `json:"data"` Errors []*APIResponseError `json:"errors,omitempty"` }
type PostListMembersResponse ¶ added in v1.1.0
type PostListMembersResponse struct { IsMember *IsMember `json:"data"` Errors []*APIResponseError `json:"errors,omitempty"` }
type PostMutingResponse ¶ added in v1.1.0
type PostMutingResponse struct { Muting *Muting `json:"data"` Errors []*APIResponseError `json:"errors,omitempty"` }
type PostPinnedListsResponse ¶ added in v1.1.0
type PostPinnedListsResponse struct { Pinned *Pinned `json:"data"` Errors []*APIResponseError `json:"errors,omitempty"` }
type PostRetweetResponse ¶
type PostRetweetResponse struct { Retweeted *Retweeted `json:"data"` Errors []*APIResponseError `json:"errors,omitempty"` }
type PostTweetData ¶ added in v1.1.0
type PostTweetOption ¶ added in v1.1.0
type PostTweetOption struct { DirectMessageDeepLink string `json:"direct_message_deep_link,omitempty"` ForSuperFollowersOnly bool `json:"for_super_followers_only,omitempty"` Geo *TweetGeo `json:"geo,omitempty"` Media *Media `json:"media,omitempty"` Poll *Poll `json:"poll,omitempty"` QuoteTweetID string `json:"quote_tweet_id,omitempty"` Reply *TweetReply `json:"reply,omitempty"` ReplySettings string `json:"reply_settings,omitempty"` Text string `json:"text,omitempty"` }
type PostTweetResponse ¶ added in v1.1.0
type PostTweetResponse struct {
PostTweetData PostTweetData `json:"data"`
}
type PostUsersLikingTweetResponse ¶ added in v1.1.0
type PostUsersLikingTweetResponse struct { Liked *Liked `json:"data"` Errors []*APIResponseError `json:"errors,omitempty"` }
type QuoteTweetsMeta ¶ added in v1.3.0
type QuoteTweetsOption ¶ added in v1.3.0
type QuoteTweetsOption struct { Expansions []Expansion MaxResults int MediaFields []MediaField PaginationToken string PlaceFields []PlaceField PollFields []PollField TweetFields []TweetField UserFields []UserField }
type QuoteTweetsResponse ¶ added in v1.3.0
type QuoteTweetsResponse struct { Tweets []*Tweet `json:"data"` Includes *TweetIncludes `json:"includes,omitempty"` Meta *QuoteTweetsMeta `json:"meta,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type RemoveBookmarkOfTweetData ¶ added in v1.1.0
type RemoveBookmarkOfTweetData struct {
Bookmarks bool `json:"bookmarks"`
}
type RemoveBookmarkOfTweetResponse ¶ added in v1.1.0
type RemoveBookmarkOfTweetResponse struct { RemoveBookmarkOfTweetData *RemoveBookmarkOfTweetData `json:"data"` Errors []*APIResponseError `json:"errors,omitempty"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type RetrieveStreamRulesMeta ¶
type RetrieveStreamRulesMeta struct {
Sent string
}
type RetrieveStreamRulesOption ¶
type RetrieveStreamRulesOption struct {
IDs []string
}
type RetrieveStreamRulesResponse ¶
type RetrieveStreamRulesResponse struct { Rules []*FilteredRule `json:"data"` Meta *RetrieveStreamRulesMeta `json:"meta"` Errors []*APIResponseError `json:"errors,omitempty"` }
type RetrieveUserOption ¶
type RetrieveUserOption struct { Expansions []Expansion TweetFields []TweetField UserFields []UserField }
type RetriveTweetOption ¶
type RetriveTweetOption struct { Expansions []Expansion MediaFields []MediaField PlaceFields []PlaceField PollFields []PollField TweetFields []TweetField UserFields []UserField }
type RetweetsLookupMeta ¶
type RetweetsLookupMeta struct {
ResultCount int `json:"result_count"`
}
type RetweetsLookupOption ¶
type RetweetsLookupOption struct { Expansions []Expansion MediaFields []MediaField PlaceFields []PlaceField PollFields []PollField TweetFields []TweetField UserFields []UserField }
type RetweetsResponse ¶
type RetweetsResponse struct { Users []*User `json:"data"` Includes *TweetIncludes `json:"includes,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` Meta *RetweetsLookupMeta `json:"meta"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type SearchNotesMeta ¶ added in v1.3.0
type SearchNotesMeta struct { ResultCount int `json:"result_count,omitempty"` NextToken string `json:"next_token,omitempty"` PreviousToken string `json:"previous_token,omitempty"` }
SearchNotesMeta represents metadata for search responses
type SearchNotesWrittenOption ¶ added in v1.3.0
type SearchNotesWrittenOption struct { TestMode bool `json:"test_mode"` MaxResults int `json:"max_results,omitempty"` PaginationToken string `json:"pagination_token,omitempty"` Expansions []Expansion `json:"expansions,omitempty"` NoteFields []CommunityNoteField `json:"note.fields,omitempty"` PostFields []TweetField `json:"post.fields,omitempty"` UserFields []UserField `json:"user.fields,omitempty"` }
SearchNotesWrittenOption represents options for searching notes written by user
type SearchNotesWrittenResponse ¶ added in v1.3.0
type SearchNotesWrittenResponse struct { Data []*CommunityNote `json:"data,omitempty"` Includes *CommunityNotesIncludes `json:"includes,omitempty"` Meta *SearchNotesMeta `json:"meta,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
SearchNotesWrittenResponse represents the response for searching notes written by user
type SearchPostsEligibleForNotesOption ¶ added in v1.3.0
type SearchPostsEligibleForNotesOption struct { TestMode bool `json:"test_mode"` MaxResults int `json:"max_results,omitempty"` PaginationToken string `json:"pagination_token,omitempty"` Expansions []Expansion `json:"expansions,omitempty"` NoteFields []CommunityNoteField `json:"note.fields,omitempty"` PostFields []TweetField `json:"post.fields,omitempty"` UserFields []UserField `json:"user.fields,omitempty"` }
SearchPostsEligibleForNotesOption represents options for searching posts eligible for notes
type SearchPostsEligibleForNotesResponse ¶ added in v1.3.0
type SearchPostsEligibleForNotesResponse struct { Data []*Post `json:"data,omitempty"` Includes *CommunityNotesIncludes `json:"includes,omitempty"` Meta *SearchNotesMeta `json:"meta,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
SearchPostsEligibleForNotesResponse represents the response for searching posts eligible for notes
type SearchSpacesMeta ¶
type SearchSpacesMeta struct {
ResultCount int `json:"result_count"`
}
type SearchSpacesOption ¶
type SearchSpacesOption struct { Expansions []Expansion SpaceFields []SpaceField State []StateOption TopicFields []TopicField UserFields []UserField }
type SearchSpacesResponse ¶
type SearchSpacesResponse struct { Spaces []*Space `json:"data,omitempty"` Includes *SpaceIncludes `json:"includes,omitempty"` Meta *SearchSpacesMeta `json:"meta"` Errors []*APIResponseError `json:"errors,omitempty"` }
type SearchTweetsMeta ¶
type SearchTweetsOption ¶
type SearchTweetsOption struct { EndTime time.Time Expansions []Expansion MaxResults int MediaFields []MediaField NextToken string PlaceFields []PlaceField PollFields []PollField SinceID string StartTime time.Time TweetFields []TweetField UntilID string UserFields []UserField }
type SearchTweetsResponse ¶
type SearchTweetsResponse struct { Tweets []*Tweet `json:"data"` Includes *TweetIncludes `json:"includes,omitempty"` Meta *SearchTweetsMeta `json:"meta"` Errors []*APIResponseError `json:"errors,omitempty"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type SearchUsersMeta ¶ added in v1.3.0
type SearchUsersOption ¶ added in v1.3.0
type SearchUsersOption struct { Expansions []Expansion MaxResults int PaginationToken string TweetFields []TweetField UserFields []UserField }
type SearchUsersResponse ¶ added in v1.3.0
type SearchUsersResponse struct { Users []*User `json:"data"` Includes *UserIncludes `json:"includes,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` Meta *SearchUsersMeta `json:"meta,omitempty"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type Space ¶
type Space struct { ID string `json:"id"` State string `json:"state"` CreatedAt string `json:"created_at,omitempty"` EndedAt string `json:"ended_at,omitempty"` HostIDs []string `json:"host_ids,omitempty"` Lang string `json:"lang,omitempty"` IsTicketed bool `json:"is_ticketed,omitempty"` InvitedUserIDs []string `json:"invited_user_ids,omitempty"` ParticipantCount int `json:"participant_count,omitempty"` ScheduledStart string `json:"scheduled_start,omitempty"` SpeakerIDs []string `json:"speaker_ids,omitempty"` StartedAt string `json:"started_at,omitempty"` TopicIDs []string `json:"topic_ids,omitempty"` Title string `json:"title,omitempty"` UpdatedAt string `json:"updated_at,omitempty"` CreatorID string `json:"creator_id,omitempty"` SubscriberCount int `json:"subscriber_count,omitempty"` }
type SpaceAnalytics ¶ added in v1.3.0
type SpaceAnalytics struct { LiveListenerCount int `json:"live_listener_count,omitempty"` TotalListenerCount int `json:"total_listener_count,omitempty"` SpeakerRequestCount int `json:"speaker_request_count,omitempty"` RecordingDownloads int `json:"recording_downloads,omitempty"` Duration string `json:"duration,omitempty"` }
SpaceAnalytics represents extended analytics for Spaces
type SpaceField ¶
type SpaceField string
const ( SpaceFieldHostIDs SpaceField = "host_ids" SpaceFieldCreatedAt SpaceField = "created_at" SpaceFieldCreatorID SpaceField = "creator_id" SpaceFieldID SpaceField = "id" SpaceFieldLanguage SpaceField = "lang" SpaceFieldInvittedUserIDs SpaceField = "invited_user_ids" SpaceFieldParticipantCount SpaceField = "participant_count" SpaceFieldSpeakerIDs SpaceField = "speaker_ids" SpaceFieldStartedAt SpaceField = "started_at" SpaceFieldEndedAt SpaceField = "ended_at" SpaceFieldTopicIDs SpaceField = "topic_ids" SpaceFieldState SpaceField = "state" SpaceFieldTitle SpaceField = "title" SpaceFieldUpdatedAt SpaceField = "updated_at" SpaceFieldScheduledStart SpaceField = "scheduled_start" SpaceFieldIsTicketed SpaceField = "is_ticketed" SpaceFieldSubscriberCount SpaceField = "subscriber_count" )
type SpaceIncludes ¶
type SpaceOption ¶
type SpaceOption struct { Expansions []Expansion SpaceFields []SpaceField TopicFields []TopicField UserFields []UserField }
type SpaceResponse ¶
type SpaceResponse struct { Space *Space `json:"data,omitempty"` Includes *SpaceIncludes `json:"includes,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type Spaces ¶
type Spaces interface { // Search Spaces SearchSpaces(ctx context.Context, searchTerm string, opt ...*SearchSpacesOption) (*SearchSpacesResponse, error) // Spaces lookup LookUpSpaces(ctx context.Context, spaceIDs []string, opt ...*SpaceOption) (*SpacesResponse, error) LookUpSpace(ctx context.Context, spaceID string, opt ...*SpaceOption) (*SpaceResponse, error) UsersPurchasedSpaceTicket(ctx context.Context, spaceID string, opt ...*UsersPurchasedSpaceTicketOption) (*UsersPurchasedSpaceTicketResponse, error) // Spaces tweets SpacesTweets(ctx context.Context, spaceID string, opt ...*SpacesTweetsOption) (*SpacesTweetsResponse, error) DiscoverSpaces(ctx context.Context, userIDs []string, opt ...*DiscoverSpacesOption) (*DiscoverSpacesResponse, error) }
type SpacesResponse ¶
type SpacesResponse struct { Spaces []*Space `json:"data,omitempty"` Includes *SpaceIncludes `json:"includes,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type SpacesTweetsMeta ¶ added in v1.3.0
type SpacesTweetsMeta struct {
ResultCount int `json:"result_count,omitempty"`
}
type SpacesTweetsOption ¶ added in v1.3.0
type SpacesTweetsOption struct { Expansions []Expansion TweetFields []TweetField UserFields []UserField }
type SpacesTweetsResponse ¶ added in v1.3.0
type SpacesTweetsResponse struct { Tweets []*Tweet `json:"data"` Includes *TweetIncludes `json:"includes,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` Meta *SpacesTweetsMeta `json:"meta,omitempty"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type StateOption ¶
type StateOption string
const ( SpaceFieldAll StateOption = "all" SpaceFieldLive StateOption = "live" SpaceFieldScheduled StateOption = "scheduled" )
type TimeseriesCount ¶
type TopicField ¶
type TopicField string
const ( TopicFieldID TopicField = "id" TopicFieldName TopicField = "name" TopicFieldDescription TopicField = "description" )
type Trend ¶ added in v1.3.0
type Trend struct { TrendName string `json:"trend_name"` TweetCount int `json:"tweet_count,omitempty"` }
Trend represents a trending topic
type Trends ¶ added in v1.3.0
type Trends interface { // Trends TrendsByWOEID(ctx context.Context, woeid string) (*TrendsByWOEIDResponse, error) }
type TrendsByWOEIDResponse ¶ added in v1.3.0
type TrendsByWOEIDResponse struct { Trends []*Trend `json:"data,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
TrendsByWOEIDResponse represents the response for trends by WOEID lookup
type Tweet ¶
type Tweet struct { ID string `json:"id"` Text string `json:"text"` EditHistoryIDs []string `json:"edit_history_tweet_ids"` Attachments *TweetAttachment `json:"attachments,omitempty"` AuthorID string `json:"author_id,omitempty"` ContextAnnotations []*TweetContextAnnotation `json:"context_annotations,omitempty"` ConversationID string `json:"conversation_id,omitempty"` CreatedAt string `json:"created_at"` EditControls *TweetEditControls `json:"edit_controls,omitempty"` Entities *TweetEntity `json:"entities,omitempty"` Geo *TweetGeo `json:"geo,omitempty"` InReplyToUserID string `json:"in_reply_to_user_id,omitempty"` Lang string `json:"lang,omitempty"` NonPublicMetrics *TweetMetrics `json:"non_public_metrics,omitempty"` OrganicMetrics *TweetMetrics `json:"organic_metrics,omitempty"` PossiblySensitive bool `json:"possibly_sensitive,omitempty"` PromotedMetrics *TweetMetrics `json:"promoted_metrics,omitempty"` PublicMetrics *TweetMetrics `json:"public_metrics,omitempty"` ReferencedTweets []*TweetReferencedTweet `json:"referenced_tweets,omitempty"` ReplySettings string `json:"reply_settings,omitempty"` Source string `json:"source,omitempty"` Withheld *TweetWithheld `json:"withheld,omitempty"` }
func GetTopPerformingTweets ¶ added in v1.3.0
GetTopPerformingTweets sorts tweets by engagement rate
type TweetAnalyticsSummary ¶ added in v1.3.0
type TweetAnalyticsSummary struct { TotalTweets int `json:"total_tweets"` TotalImpressions int `json:"total_impressions"` TotalEngagements int `json:"total_engagements"` AverageMetrics *TweetMetrics `json:"average_metrics"` TopPerforming []*Tweet `json:"top_performing"` Timeframe *AnalyticsTimeframe `json:"timeframe"` }
TweetAnalyticsSummary provides aggregated tweet analytics
type TweetAnnotation ¶
type TweetAttachment ¶
type TweetCashtag ¶
type TweetContextAnnotation ¶
type TweetContextAnnotation struct { Domain *TweetContextObj `json:"domain"` Entity *TweetContextObj `json:"entity"` }
type TweetContextObj ¶
type TweetCoordinates ¶
type TweetCountMeta ¶
type TweetCountsAllOption ¶ added in v1.1.0
type TweetCountsOption ¶
type TweetCountsResponse ¶
type TweetCountsResponse struct { Counts []*TimeseriesCount `json:"data"` Meta *TweetCountMeta `json:"meta"` }
type TweetEditControls ¶ added in v1.3.0
type TweetEntity ¶
type TweetEntity struct { Annotations []*TweetAnnotation `json:"annotations"` Mentions []*TweetMention `json:"mentions"` URLs []*TweetURL `json:"urls"` }
type TweetField ¶
type TweetField string
const ( TweetFieldID TweetField = "id" TweetFieldText TweetField = "text" TweetEditHistoryIDs TweetField = "edit_history_tweet_ids" TweetFieldAttachments TweetField = "attachments" TweetFieldAuthorID TweetField = "author_id" TweetFieldContextAnnotations TweetField = "context_annotations" TweetFieldConversationID TweetField = "conversation_id" TweetFieldCreatedAt TweetField = "created_at" TweetFieldEditControls TweetField = "edit_controls" TweetFieldEntities TweetField = "entities" TweetFieldInReplyToUserID TweetField = "in_reply_to_user_id" TweetFieldLanguage TweetField = "lang" TweetFieldNonPublicMetrics TweetField = "non_public_metrics" TweetFieldOrganicMetrics TweetField = "organic_metrics" TweetFieldPossiblySensitve TweetField = "possibly_sensitive" TweetFieldPromotedMetrics TweetField = "promoted_metrics" TweetFieldPublicMetrics TweetField = "public_metrics" TweetFieldReferencedTweets TweetField = "referenced_tweets" TweetReplySettings TweetField = "reply_settings" TweetFieldSource TweetField = "source" TweetFieldWithHeld TweetField = "withheld" TweetFieldGeo TweetField = "geo" TweetFieldMaxResults TweetField = "max_results" )
type TweetGeo ¶
type TweetGeo struct { Coordinates *TweetCoordinates `json:"coordinates"` PlaceID string `json:"place_id"` }
type TweetHashtag ¶
type TweetImage ¶
type TweetIncludes ¶
type TweetMention ¶
type TweetMetrics ¶
type TweetMetrics struct { ImpressionCount int `json:"impression_count"` LikeCount int `json:"like_count"` ReplyCount int `json:"reply_count"` RetweetCount int `json:"retweet_count"` URLLinkClicks int `json:"url_link_clicks"` UserProfileClicks int `json:"user_profile_clicks"` QuoteCount int `json:"quote_count"` BookmarkCount int `json:"bookmark_count"` ViewCount int `json:"view_count"` }
type TweetReferencedTweet ¶
type TweetReply ¶ added in v1.1.0
type TweetResponse ¶
type TweetResponse struct { Tweet *Tweet `json:"data"` Includes *TweetIncludes `json:"includes,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type TweetURL ¶
type TweetURL struct { Start int `json:"start"` End int `json:"end"` URL string `json:"url"` ExpandedURL string `json:"expanded_url"` DisplayURL string `json:"display_url"` Images []*TweetImage `json:"images"` Status int `json:"status"` Title string `json:"title"` Description string `json:"description"` UnwoundURL string `json:"unwound_url"` }
type TweetWithheld ¶
type Tweets ¶
type Tweets interface { // Bookmarks RemoveBookmarkOfTweet(ctx context.Context, userID string, tweetID string) (*RemoveBookmarkOfTweetResponse, error) LookupUserBookmarks(ctx context.Context, userID string, opt ...*LookupUserBookmarksOption) (*LookupUserBookmarksResponse, error) BookmarkTweet(ctx context.Context, userID string, body *BookmarkTweetBody) (*BookmarkTweetResponse, error) // Filtered stream ConnectToStream(ctx context.Context, ch chan<- ConnectToStreamResponse, errCh chan<- error, opt ...*ConnectToStreamOption) *ConnectToStream RetrieveStreamRules(ctx context.Context, opt ...*RetrieveStreamRulesOption) (*RetrieveStreamRulesResponse, error) AddOrDeleteRules(ctx context.Context, body *AddOrDeleteJSONBody, opt ...*AddOrDeleteRulesOption) (*AddOrDeleteRulesResponse, error) // Hide replies HideReplies(ctx context.Context, tweetID string, hidden bool) (*HideRepliesResponse, error) // Likes UndoUsersLikingTweet(ctx context.Context, userID string, tweetID string) (*UndoUsersLikingTweetResponse, error) UsersLikingTweet(ctx context.Context, tweetID string, opt ...*UsersLikingTweetOption) (*UsersLikingTweetResponse, error) TweetsUserLiked(ctx context.Context, userID string, opt ...*TweetsUserLikedOption) (*TweetsUserLikedResponse, error) PostUsersLikingTweet(ctx context.Context, userID string, tweetID string) (*PostUsersLikingTweetResponse, error) // Manage Tweets DeleteTweet(ctx context.Context, tweetID string) (*DeleteTweetResponse, error) PostTweet(ctx context.Context, body *PostTweetOption) (*PostTweetResponse, error) // Quote tweets QuoteTweets(ctx context.Context, tweetID string, opt ...*QuoteTweetsOption) (*QuoteTweetsResponse, error) // Retweets UndoRetweet(ctx context.Context, userID string, sourceTweetID string) (*UndoRetweetResponse, error) RetweetsLookup(ctx context.Context, tweetID string, opt ...*RetweetsLookupOption) (*RetweetsResponse, error) PostRetweet(ctx context.Context, userID string, tweetID string) (*PostRetweetResponse, error) // Search Tweets SearchAllTweets(ctx context.Context, tweet string, opt ...*SearchTweetsOption) (*SearchTweetsResponse, error) SearchRecentTweets(ctx context.Context, tweet string, opt ...*SearchTweetsOption) (*SearchTweetsResponse, error) // Timelines UserMentionTimeline(ctx context.Context, userID string, opt ...*UserMentionTimelineOption) (*UserMentionTimelineResponse, error) UserReverseChronologicalTimeline(ctx context.Context, userID string, opt ...*UserReverseChronologicalTimelineOption) (*UserReverseChronologicalTimelineResponse, error) UserTweetTimeline(ctx context.Context, userID string, opt ...*UserTweetTimelineOption) (*UserTweetTimelineResponse, error) // Tweet counts CountAllTweets(ctx context.Context, tweet string, opt ...*TweetCountsAllOption) (*TweetCountsResponse, error) CountRecentTweets(ctx context.Context, tweet string, opt ...*TweetCountsOption) (*TweetCountsResponse, error) // Tweets lookup RetrieveMultipleTweets(ctx context.Context, tweetIDs []string, opt ...*RetriveTweetOption) (*TweetsResponse, error) RetrieveSingleTweet(ctx context.Context, tweetID string, opt ...*RetriveTweetOption) (*TweetResponse, error) // Volume stream VolumeStreams(ctx context.Context, ch chan<- VolumeStreamsResponse, errCh chan<- error, opt ...*VolumeStreamsOption) *VolumeStreams VolumeStreams10(ctx context.Context, ch chan<- VolumeStreamsResponse, errCh chan<- error, opt ...*VolumeStreamsOption) *VolumeStreams }
type TweetsResponse ¶
type TweetsResponse struct { Tweets []*Tweet `json:"data"` Includes *TweetIncludes `json:"includes,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type TweetsUserLiked ¶
type TweetsUserLiked struct { ID string `json:"id"` Text string `json:"text"` CreatedAt string `json:"created_at,omitempty"` AuthorID string `json:"author_id,omitempty"` ConversationID string `json:"conversation_id,omitempty"` InReplyToUserID string `json:"in_reply_to_user_id,omitempty"` ReferencedTweets []*TweetsUserLikedReferencedTweets `json:"referenced_tweets,omitempty"` Attachments *TweetsUserLikedAttachments `json:"attachments,omitempty"` Geo *TweetsUserLikedGeo `json:"geo,omitempty"` ContextAnnotations []*TweetsUserLikedContextAnnotations `json:"context_annotations,omitempty"` Entities *TweetsUserLikedEntities `json:"entities,omitempty"` Withheld *TweetsUserLikedWithheld `json:"withheld,omitempty"` PublicMetrics *TweetsUserLikedPublicMetrics `json:"public_metrics,omitempty"` NonPublicMetrics *TweetsUserLikedNonPublicMetrics `json:"non_public_metrics,omitempty"` // requires the use of OAuth 1.0a User Context authentication. OrganicMetrics *TweetsUserLikedOrganicMetrics `json:"organic_metrics,omitempty"` // requires user context authentication. PromotedMetrics *TweetsUserLikedPromotedMetrics `json:"promoted_metrics,omitempty"` // requires user context authentication. PossiblySensitive bool `json:"possibly_sensitive,omitempty"` Lang string `json:"lang,omitempty"` ReplySettings string `json:"reply_settings,omitempty"` Source string `json:"source,omitempty"` EditHistoryIDs []string `json:"edit_history_ids,omitempty"` EditControls *TweetsUserLikedEditControls `json:"edit_controls,omitempty"` }
type TweetsUserLikedContextAnnotations ¶
type TweetsUserLikedContextAnnotations struct { Domain *TweetsUserLikedContextAnnotationsDomain `json:"domain"` Entity *TweetsUserLikedContextAnnotationsEntity `json:"entity"` }
type TweetsUserLikedEditControls ¶ added in v1.2.0
type TweetsUserLikedEntities ¶
type TweetsUserLikedEntities struct { Annotations []*TweetsUserLikedEntitiesAnnotation `json:"annotations"` URLs []*TweetsUserLikedEntitiesURLContent `json:"urls"` HashTags []*TweetsUserLikedEntitiesHashTag `json:"hashtags"` Mentions []*TweetsUserLikedEntitiesMention `json:"mentions"` CashTags []*TweetsUserLikedEntitiesCashTag `json:"cashtags"` }
type TweetsUserLikedGeo ¶
type TweetsUserLikedGeo struct { Coordinates *TweetsUserLikedGeoCoordinates `json:"coordinates"` PlaceID string `json:"place_id"` }
type TweetsUserLikedMeta ¶
type TweetsUserLikedOption ¶ added in v1.1.0
type TweetsUserLikedOption struct { Expansions []Expansion MediaFields []MediaField PlaceFields []PlaceField PollFields []PollField TweetFields []TweetField UserFields []UserField MaxResults int PaginationToken string }
type TweetsUserLikedOrganicMetrics ¶
type TweetsUserLikedOrganicMetrics struct { ImpressionCount int `json:"impression_count"` // requires the use of OAuth 1.0a User Context authentication. URLLinkClicks int `json:"url_link_clicks"` // requires the use of OAuth 1.0a User Context authentication. UserProfileClicks int `json:"user_profile_clicks"` // requires the use of OAuth 1.0a User Context authentication. RetweetCount int `json:"retweet_count"` ReplyCount int `json:"reply_count"` LikeCount int `json:"like_count"` }
type TweetsUserLikedPromotedMetrics ¶
type TweetsUserLikedPromotedMetrics struct { ImpressionCount int `json:"impression_count"` // requires the use of OAuth 1.0a User Context authentication. URLLinkClicks int `json:"url_link_clicks"` // requires the use of OAuth 1.0a User Context authentication. UserProfileClicks int `json:"user_profile_clicks"` // requires the use of OAuth 1.0a User Context authentication. RetweetCount int `json:"retweet_count"` ReplyCount int `json:"reply_count"` LikeCount int `json:"like_count"` }
type TweetsUserLikedResponse ¶
type TweetsUserLikedResponse struct { Tweets []*TweetsUserLiked `json:"data"` Includes *TweetIncludes `json:"includes,omitempty"` Meta *TweetsUserLikedMeta `json:"meta"` Errors []*APIResponseError `json:"errors,omitempty"` }
type TweetsUserLikedWithheld ¶
type Twtr ¶
type Twtr interface { OAuth Tweets Users Spaces Lists Compliances DirectMessages CommunityNotes Trends MediaUpload Analytics }
Twtr is a main interface for all Twitter API calls.
type UndoBlockingResponse ¶ added in v1.1.0
type UndoBlockingResponse struct { Blocking *Blocking `json:"data"` Errors []*APIResponseError `json:"errors,omitempty"` }
type UndoDMBlockingResponse ¶ added in v1.3.0
type UndoDMBlockingResponse struct { DMBlocking *DMBlocking `json:"data,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
UndoDMBlockingResponse represents the response for unblocking DMs from a user
type UndoFollowingResponse ¶
type UndoFollowingResponse struct { Following *Following `json:"data"` Errors []*APIResponseError `json:"errors,omitempty"` }
type UndoListFollowsResponse ¶ added in v1.1.0
type UndoListFollowsResponse struct { Following *ListFollows `json:"data"` Errors []*APIResponseError `json:"errors,omitempty"` }
type UndoListMembersResponse ¶ added in v1.1.0
type UndoListMembersResponse struct { IsMember *IsMember `json:"data"` Errors []*APIResponseError `json:"errors,omitempty"` }
type UndoMutingResponse ¶ added in v1.1.0
type UndoMutingResponse struct { Muting *Muting `json:"data"` Errors []*APIResponseError `json:"errors,omitempty"` }
type UndoPinnedListsResponse ¶ added in v1.1.0
type UndoPinnedListsResponse struct { Pinned *Pinned `json:"data"` Errors []*APIResponseError `json:"errors,omitempty"` }
type UndoRetweetResponse ¶
type UndoRetweetResponse struct { Retweeted *Retweeted `json:"data"` Errors []*APIResponseError `json:"errors,omitempty"` }
type UndoUsersLikingTweetResponse ¶ added in v1.1.0
type UndoUsersLikingTweetResponse struct { Liked *Liked `json:"data"` Errors []*APIResponseError `json:"errors,omitempty"` }
type UpdateMetaDataForListBody ¶ added in v1.1.0
type UpdateMetaDataForListData ¶ added in v1.1.0
type UpdateMetaDataForListData struct {
Updated bool `json:"updated"`
}
type UpdateMetaDataForListResponse ¶ added in v1.1.0
type UpdateMetaDataForListResponse struct { UpdateMetaDataForListData *UpdateMetaDataForListData `json:"data"` Errors []*APIResponseError `json:"errors,omitempty"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type User ¶
type User struct { ID string `json:"id"` Name string `json:"name"` UserName string `json:"username"` CreatedAt string `json:"created_at,omitempty"` Description string `json:"description,omitempty"` Entities *UserEntity `json:"entities,omitempty"` Location string `json:"location,omitempty"` PinnedTweetID string `json:"pinned_tweet_id,omitempty"` ProfileImageURL string `json:"profile_image_url,omitempty"` Protected bool `json:"protected,omitempty"` PublicMetrics *UserPublicMetrics `json:"public_metrics,omitempty"` URL string `json:"url,omitempty"` Verified bool `json:"verified,omitempty"` VerifiedType string `json:"verified_type,omitempty"` SubscriptionType string `json:"subscription_type,omitempty"` Withheld *UserWithheld `json:"withheld,omitempty"` }
type UserAnalyticsSummary ¶ added in v1.3.0
type UserAnalyticsSummary struct { FollowerGrowth *AnalyticsComparison `json:"follower_growth"` EngagementTrends *EngagementMetrics `json:"engagement_trends"` TopTweets []*Tweet `json:"top_tweets"` Timeframe *AnalyticsTimeframe `json:"timeframe"` }
UserAnalyticsSummary provides aggregated user analytics
type UserCashtag ¶
type UserDescription ¶
type UserDescription struct { URLs []*UserURLs `json:"urls"` Mentions []*UserMention `json:"user_mentions"` }
type UserEntity ¶
type UserEntity struct { URL *UserURL `json:"url"` Description *UserDescription `json:"description"` }
type UserField ¶
type UserField string
const ( UserFieldID UserField = "id" UserFieldName UserField = "name" UserFieldUserName UserField = "username" UserFieldCreatedAt UserField = "created_at" UserFieldDescription UserField = "description" UserFieldEntities UserField = "entities" UserFieldLocation UserField = "location" UserFieldPinnedTweetID UserField = "pinned_tweet_id" UserFieldProfileImageURL UserField = "profile_image_url" UserFieldProtected UserField = "protected" UserFieldPublicMetrics UserField = "public_metrics" UserFieldURL UserField = "url" UserFieldVerified UserField = "verified" UserFieldVerifiedType UserField = "verified_type" UserFieldSubscriptionType UserField = "subscription_type" UserFieldWithHeld UserField = "withheld" )
type UserHashtag ¶
type UserIncludes ¶
type UserMention ¶
type UserMentionTimelineOption ¶
type UserMentionTimelineOption struct { EndTime time.Time Expansions []Expansion MaxResults int MediaFields []MediaField PaginationToken string PlaceFields []PlaceField PollFields []PollField SinceID string StartTime time.Time TweetFields []TweetField UntilID string UserFields []UserField }
type UserMentionTimelineResponse ¶
type UserMentionTimelineResponse struct { Tweets []*Tweet `json:"data"` Includes *TweetIncludes `json:"includes,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` Meta *UserTimelineMeta `json:"meta"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type UserPublicMetrics ¶
type UserResponse ¶
type UserResponse struct { User *User `json:"data"` Includes *UserIncludes `json:"includes,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type UserReverseChronologicalTimelineOption ¶ added in v1.3.0
type UserReverseChronologicalTimelineOption struct { EndTime time.Time Exclude []Exclude Expansions []Expansion MaxResults int MediaFields []MediaField PaginationToken string PlaceFields []PlaceField PollFields []PollField SinceID string StartTime time.Time TweetFields []TweetField UntilID string UserFields []UserField }
type UserReverseChronologicalTimelineResponse ¶ added in v1.3.0
type UserReverseChronologicalTimelineResponse struct { Tweets []*Tweet `json:"data"` Includes *TweetIncludes `json:"includes,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` Meta *UserTimelineMeta `json:"meta"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type UserTimelineMeta ¶
type UserTweetTimelineOption ¶
type UserTweetTimelineOption struct { EndTime time.Time Exclude []Exclude Expansions []Expansion MaxResults int MediaFields []MediaField PaginationToken string PlaceFields []PlaceField PollFields []PollField SinceID string StartTime time.Time TweetFields []TweetField UntilID string UserFields []UserField }
type UserTweetTimelineResponse ¶
type UserTweetTimelineResponse struct { Tweets []*Tweet `json:"data"` Includes *TweetIncludes `json:"includes,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` Meta *UserTimelineMeta `json:"meta"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type UserWithheld ¶
type Users ¶
type Users interface { // Blocks UndoBlocking(ctx context.Context, sourceUserID string, targetUserID string) (*UndoBlockingResponse, error) Blocking(ctx context.Context, userID string, opt ...*BlockOption) (*BlockingResponse, error) PostBlocking(ctx context.Context, userID string, targetUserID string) (*PostBlockingResponse, error) // Follows UndoFollowing(ctx context.Context, sourceUserID string, targetUserID string) (*UndoFollowingResponse, error) Followers(ctx context.Context, userID string, opt ...*FollowOption) (*FollowersResponse, error) Following(ctx context.Context, userID string, opt ...*FollowOption) (*FollowingResponse, error) PostFollowing(ctx context.Context, userID string, targetUserID string) (*PostFollowingResponse, error) // Mutes UndoMuting(ctx context.Context, sourceUserID string, targetUserID string) (*UndoMutingResponse, error) Muting(ctx context.Context, userID string, opt ...*MuteOption) (*MutingResponse, error) PostMuting(ctx context.Context, userID string, targetUserID string) (*PostMutingResponse, error) // Users lookup RetrieveMultipleUsersWithIDs(ctx context.Context, userIDs []string, opt ...*RetrieveUserOption) (*UsersResponse, error) RetrieveSingleUserWithID(ctx context.Context, userID string, opt ...*RetrieveUserOption) (*UserResponse, error) RetrieveMultipleUsersWithUserNames(ctx context.Context, userNames []string, opt ...*RetrieveUserOption) (*UsersResponse, error) RetrieveSingleUserWithUserName(ctx context.Context, userName string, opt ...*RetrieveUserOption) (*UserResponse, error) Me(ctx context.Context, opt ...*MeOption) (*MeResponse, error) // User search SearchUsers(ctx context.Context, query string, opt ...*SearchUsersOption) (*SearchUsersResponse, error) }
type UsersLikingBody ¶ added in v1.1.0
type UsersLikingBody struct {
TweetID string `json:"tweet_id"`
}
type UsersLikingTweetOption ¶
type UsersLikingTweetOption struct { Expansions []Expansion MediaFields []MediaField PlaceFields []PlaceField PollFields []PollField TweetFields []TweetField UserFields []UserField }
type UsersLikingTweetResponse ¶
type UsersLikingTweetResponse struct { Users []*LookUpUsersWhoLiked `json:"data"` Includes *LookUpUsersWhoLikedIncludes `json:"includes,omitempty"` Meta *LookUpUsersWhoLikedMeta `json:"meta"` Errors []*APIResponseError `json:"errors,omitempty"` }
type UsersPurchasedSpaceTicketOption ¶
type UsersPurchasedSpaceTicketOption struct { Expansions []Expansion MediaFields []MediaField PlaceFields []PlaceField PollFields []PollField TweetFields []TweetField UserFields []UserField }
type UsersPurchasedSpaceTicketResponse ¶
type UsersPurchasedSpaceTicketResponse struct { Users []*User `json:"data"` Includes *LookUpUsersWhoPurchasedSpaceTicketIncludes `json:"includes,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` }
type UsersResponse ¶
type UsersResponse struct { Users []*User `json:"data"` Includes *UserIncludes `json:"includes,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Type string `json:"type,omitempty"` }
type VolumeStreams ¶
type VolumeStreams struct {
// contains filtered or unexported fields
}
func (*VolumeStreams) Stop ¶
func (s *VolumeStreams) Stop()
type VolumeStreamsOption ¶
type VolumeStreamsOption struct { // BackfillMinutes int // This feature is currently only available to the Academic Research product track. Expansions []Expansion MediaFields []MediaField PlaceFields []PlaceField PollFields []PollField TweetFields []TweetField UserFields []UserField }
type VolumeStreamsResponse ¶
type VolumeStreamsResponse struct { Tweet *Tweet `json:"data"` Includes *TweetIncludes `json:"includes,omitempty"` Errors []*APIResponseError `json:"errors,omitempty"` }
Source Files
¶
- analytics.go
- block.go
- bookmarks.go
- client.go
- community_notes.go
- community_notes_lookup.go
- community_notes_option.go
- compliance.go
- compliance_jobs.go
- compliance_option.go
- direct_message.go
- direct_message_lookup.go
- direct_message_option.go
- discover_spaces.go
- dm_blocks.go
- doc.go
- endpoint.go
- error.go
- exclude.go
- expansion.go
- filtered_stream.go
- follow.go
- hide_replies.go
- likes_tweet.go
- list.go
- list_follows.go
- list_lookup.go
- list_members.go
- list_option.go
- list_pinned.go
- list_tweets_lookup.go
- manage_direct_message.go
- manage_list.go
- manage_tweet.go
- me.go
- media.go
- media_upload.go
- media_upload_lookup.go
- media_upload_option.go
- mute.go
- oauth2.go
- place.go
- poll.go
- retweet.go
- search_spaces.go
- search_tweet.go
- space.go
- space_lookup.go
- space_option.go
- timeline.go
- topic.go
- trends.go
- trends_lookup.go
- tweet.go
- tweet_counts.go
- tweet_lookup.go
- tweet_option.go
- user.go
- user_lookup.go
- user_option.go
- volume_stream.go