twitter

package
v0.0.0-...-919a832 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2017 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package twitter provides a Client for the Twitter API.

The twitter package provides a Client for accessing the Twitter API. Here are some example requests.

// Twitter client
client := twitter.NewClient(httpClient)
// Home Timeline
tweets, resp, err := client.Timelines.HomeTimeline(&HomeTimelineParams{})
// Send a Tweet
tweet, resp, err := client.Statuses.Update("just setting up my twttr", nil)
// Status Show
tweet, resp, err := client.Statuses.Show(585613041028431872, nil)
// User Show
params := &twitter.UserShowParams{ScreenName: "dghubble"}
user, resp, err := client.Users.Show(params)
// Followers
followers, resp, err := client.Followers.List(&FollowerListParams{})

Required parameters are passed as positional arguments. Optional parameters are passed in a typed params struct (or pass nil).

Authentication

By design, the Twitter Client accepts any http.Client so user auth (OAuth1) or application auth (OAuth2) requests can be made by using the appropriate authenticated client. Use the https://github.com/dghubble/oauth1 and https://github.com/golang/oauth2 packages to obtain an http.Client which transparently authorizes requests.

For example, make requests as a consumer application on behalf of a user who has granted access, with OAuth1.

// OAuth1
import (
	"github.com/thejokersthief/go-twitter/twitter"
	"github.com/dghubble/oauth1"
)

config := oauth1.NewConfig("consumerKey", "consumerSecret")
token := oauth1.NewToken("accessToken", "accessSecret")
// http.Client will automatically authorize Requests
httpClient := config.Client(oauth1.NoContext, token)

// twitter client
client := twitter.NewClient(httpClient)

If no user auth context is needed, make requests as your application with application auth.

// OAuth2
import (
	"github.com/thejokersthief/go-twitter/twitter"
	"golang.org/x/oauth2"
)

config := &oauth2.Config{}
token := &oauth2.Token{AccessToken: accessToken}
// http.Client will automatically authorize Requests
httpClient := config.Client(oauth2.NoContext, token)

// twitter client
client := twitter.NewClient(httpClient)

To implement Login with Twitter, see https://github.com/dghubble/gologin.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(v bool) *bool

Bool returns a new pointer to the given bool value.

func Float

func Float(v float64) *float64

Float returns a new pointer to the given float64 value.

Types

type APIError

type APIError struct {
	Errors []ErrorDetail `json:"errors"`
}

APIError represents a Twitter API Error response https://dev.twitter.com/overview/api/response-codes

func (APIError) Empty

func (e APIError) Empty() bool

Empty returns true if empty. Otherwise, at least 1 error message/code is present and false is returned.

func (APIError) Error

func (e APIError) Error() string

type AccountService

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

AccountService provides a method for account credential verification.

func (*AccountService) RemoveProfileBanner

func (s *AccountService) RemoveProfileBanner() (*User, *http.Response, error)

RemoveProfileBanner removes the uploaded profile banner for the authenticating user. Returns HTTP 200 upon success. https://dev.twitter.com/rest/reference/post/account/remove_profile_banner

func (*AccountService) Settings

Settings returns settings (including current trend, geo and sleep time information) for the authenticating user. https://dev.twitter.com/rest/reference/get/account/settings

func (*AccountService) UpdateProfile

func (s *AccountService) UpdateProfile(params *AccountSettingsUpdateProfileParams) (*User, *http.Response, error)

UpdateProfile sets some values that users are able to set under the “Account” tab of their settings page. Only the parameters specified will be updated. https://dev.twitter.com/rest/reference/post/account/update_profile

func (*AccountService) UpdateProfileBanner

func (s *AccountService) UpdateProfileBanner(params *AccountSettingsUpdateProfileBannerParams) (*User, *http.Response, error)

UpdateProfileBanner uploads a profile banner on behalf of the authenticating user. https://dev.twitter.com/rest/reference/post/account/update_profile_banner

func (*AccountService) UpdateProfileImage

func (s *AccountService) UpdateProfileImage(params *AccountSettingsUpdateProfileImageParams) (*User, *http.Response, error)

UpdateProfileImage updates the authenticating user’s profile image. Note that this method expects raw multipart data, not a URL to an image.

func (*AccountService) UpdateSettings

UpdateSettings updates the authenticating user’s settings. https://dev.twitter.com/rest/reference/post/account/settings

func (*AccountService) VerifyCredentials

func (s *AccountService) VerifyCredentials(params *AccountVerifyParams) (*User, *http.Response, error)

VerifyCredentials returns the authorized user if credentials are valid and returns an error otherwise. Requires a user auth context. https://dev.twitter.com/rest/reference/get/account/verify_credentials

type AccountSettingsResult

type AccountSettingsResult struct {
	AlwaysUseHTTPS           bool                                 `json:"always_use_https" url:"always_use_https,omitempty"`
	DiscoverableByEmail      bool                                 `json:"discoverable_by_email" url:"discoverable_by_email,omitempty"`
	GeoEnabled               bool                                 `json:"geo_enabled" url:"geo_enabled,omitempty"`
	Language                 string                               `json:"language" url:"language,omitempty"`
	Protected                bool                                 `json:"protected" url:"protected,omitempty"`
	ScreenName               string                               `json:"screen_name" url:"screen_name,omitempty"`
	ShowAllInlineMedia       bool                                 `json:"show_all_inline_media" url:"show_all_inline_media,omitempty"`
	UseCookiePersonalization bool                                 `json:"use_cookie_personalization" url:"use_cookie_personalization,omitempty"`
	AllowContributorRequest  string                               `json:"allow_contributor_request" url:"allow_contributor_request,omitempty"`
	SleepTime                AccountSettingsResultSleepTime       `json:"sleep_time" url:"sleep_time,omitempty"`
	TimeZone                 AccountSettingsResultTimeZone        `json:"time_zone" url:"time_zone,omitempty"`
	TrendLocation            []AccountSettingsResultTrendLocation `json:"trend_location" url:"trend_location,omitempty"`
}

AccountSettingsResult is the result from AccountService.Settings

type AccountSettingsResultPlaceType

type AccountSettingsResultPlaceType struct {
	Code int64  `json:"code" url:"code"`
	Name string `json:"name" url:"name"`
}

AccountSettingsResultPlaceType is part of the result from AccountService.Settings

type AccountSettingsResultSleepTime

type AccountSettingsResultSleepTime struct {
	Enabled   bool   `json:"enabled" url:"enabled"`
	EndTime   string `json:"end_time" url:"end_time"`
	StartTime string `json:"start_time" url:"start_time"`
}

AccountSettingsResultSleepTime is part of the result from AccountService.Settings

type AccountSettingsResultTimeZone

type AccountSettingsResultTimeZone struct {
	Name       string `json:"name" url:"name"`
	TzinfoName string `json:"tzinfo_name" url:"tzinfo_name"`
	UtcOffset  int64  `json:"utc_offset" url:"utc_offset"`
}

AccountSettingsResultTimeZone is part of the result from AccountService.Settings

type AccountSettingsResultTrendLocation

type AccountSettingsResultTrendLocation struct {
	Country     string                         `json:"country" url:"country"`
	CountryCode string                         `json:"countryCode" url:"countryCode"`
	Name        string                         `json:"name" url:"name"`
	ParentID    int64                          `json:"parentid" url:"parentid"`
	URL         string                         `json:"url" url:"url"`
	WoeID       int64                          `json:"woeid" url:"woeid"`
	PlaceType   AccountSettingsResultPlaceType `json:"placeType" url:"placeType"`
}

AccountSettingsResultTrendLocation is part of the result from AccountService.Settings

type AccountSettingsUpdateProfileBannerParams

type AccountSettingsUpdateProfileBannerParams struct {
	Banner     string `url:"banner,omitempty"` // base64-encoded image data
	Width      int64  `url:"width"`
	Height     int64  `url:"height"`
	OffsetLeft int64  `url:"offset_left"`
	OffsetTop  int64  `url:"offset_top"`
}

AccountSettingsUpdateProfileBannerParams are the parameters for AccountService.UpdateProfileBanner

type AccountSettingsUpdateProfileImageParams

type AccountSettingsUpdateProfileImageParams struct {
	Image           string `url:"image,omitempty"` // base64-encoded image data
	IncludeEntities bool   `url:"include_entities,omitempty"`
	SkipStatus      bool   `url:"skip_status,omitempty"`
}

AccountSettingsUpdateProfileImageParams are the parameters for AccountService.UpdateProfileImage

type AccountSettingsUpdateProfileParams

type AccountSettingsUpdateProfileParams struct {
	Name             string `url:"name"`
	URL              string `url:"url"`
	Location         string `url:"location"`
	Description      string `url:"description"`
	ProfileLinkColor string `url:"profile_link_color"`
	IncludeEntities  bool   `url:"include_entities"`
	SkipStatus       bool   `url:"skip_status"`
}

AccountSettingsUpdateProfileParams are the parameters for AccountService.UpdateProfile

type AccountVerifyParams

type AccountVerifyParams struct {
	IncludeEntities *bool `url:"include_entities,omitempty"`
	SkipStatus      *bool `url:"skip_status,omitempty"`
	IncludeEmail    *bool `url:"include_email,omitempty"`
}

AccountVerifyParams are the params for AccountService.VerifyCredentials.

type BlockService

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

BlockService provides methods for accessing Twitter status API endpoints.

func (*BlockService) Create

func (s *BlockService) Create(params *BlockServiceCreateParams) (*User, *http.Response, error)

Create blocks the specified user from following the authenticating user. In addition the blocked user will not show in the authenticating users mentions or timeline (unless retweeted by another user). https://dev.twitter.com/rest/reference/post/blocks/create

func (*BlockService) Destroy

func (s *BlockService) Destroy(params *BlockServiceCreateParams) (*User, *http.Response, error)

Destroy un-blocks the user specified in the ID parameter for the authenticating user. Returns the un-blocked user in the requested format when successful. https://dev.twitter.com/rest/reference/post/blocks/destroy

func (*BlockService) IDs

IDs returns an array of numeric user ids the authenticating user is blocking. https://dev.twitter.com/rest/reference/get/blocks/ids

func (*BlockService) List

List returns a collection of user objects that the authenticating user is blocking.

type BlockServiceCreateParams

type BlockServiceCreateParams struct {
	UserID          int64  `url:"user_id,omitempty"`
	ScreenName      string `url:"screen_name,omitempty"`
	IncludeEntities bool   `url:"block_entities,omitempty"`
	SkipStatus      bool   `url:"skip_status,omitempty"`
}

BlockServiceCreateParams are the params for BlockService.Create

type BlockServiceIDsParams

type BlockServiceIDsParams struct {
	StringifyIDs bool  `url:"stringify_ids,omitempty"`
	Cursor       int64 `url:"cursor,omitempty"`
}

BlockServiceIDsParams are the params for BlockService.IDs

type BlockServiceIDsResult

type BlockServiceIDsResult struct {
	IDs               []int64 `json:"ids"`
	PreviousCursor    int64   `json:"previous_cursor"`
	PreviousCursorStr string  `json:"previous_cursor_str"`
	NextCursor        int64   `json:"next_cursor"`
	NextCursorStr     string  `json:"next_cursor_str"`
}

BlockServiceIDsResult is the result for BlockService.IDs

type BlockServiceListParams

type BlockServiceListParams struct {
	IncludeEntities bool  `url:"block_entities,omitempty"`
	SkipStatus      bool  `url:"skip_status,omitempty"`
	Cursor          int64 `url:"cursor,omitempty"`
}

BlockServiceListParams are the parameters for BlockService.List

type BlockServiceListResult

type BlockServiceListResult struct {
	PreviousCursor    int64  `json:"previous_cursor"`
	PreviousCursorStr string `json:"previous_cursor_str"`
	NextCursor        int64  `json:"next_cursor"`
	NextCursorStr     string `json:"next_cursor_str"`
	Users             []User `json:"users"`
}

BlockServiceListResult is the result for BlockService.List

type BoundingBox

type BoundingBox struct {
	Coordinates [][][2]float64 `json:"coordinates"`
	Type        string         `json:"type"`
}

BoundingBox represents the bounding coordinates (longitude, latitutde) defining the bounds of a box containing a Place entity.

type Client

type Client struct {

	// Twitter API Services
	Accounts       *AccountService
	Statuses       *StatusService
	Timelines      *TimelineService
	Users          *UserService
	Favorites      *FavoriteService
	Followers      *FollowerService
	Friends        *FriendService
	DirectMessages *DirectMessageService
	Streams        *StreamService
	Friendships    *FriendshipService
	Search         *SearchService
	Block          *BlockService
	// contains filtered or unexported fields
}

Client is a Twitter client for making Twitter API requests.

func NewClient

func NewClient(httpClient *http.Client) *Client

NewClient returns a new Client.

type Contributor

type Contributor struct {
	ID         int64  `json:"id"`
	IDStr      string `json:"id_str"`
	ScreenName string `json:"screen_name"`
}

Contributor represents a brief summary of a User identifiers.

type Coordinates

type Coordinates struct {
	Coordinates [2]float64 `json:"coordinates"`
	Type        string     `json:"type"`
}

Coordinates are pairs of longitude and latitude locations.

type Demux

type Demux interface {
	Handle(message interface{})
	HandleChan(messages <-chan interface{})
}

A Demux receives interface{} messages individually or from a channel and sends those messages to one or more outputs determined by the implementation.

type DirectMessage

type DirectMessage struct {
	CreatedAt           string    `json:"created_at"`
	Entities            *Entities `json:"entities"`
	ID                  int64     `json:"id"`
	IDStr               string    `json:"id_str"`
	Recipient           *User     `json:"recipient"`
	RecipientID         int64     `json:"recipient_id"`
	RecipientScreenName string    `json:"recipient_screen_name"`
	Sender              *User     `json:"sender"`
	SenderID            int64     `json:"sender_id"`
	SenderScreenName    string    `json:"sender_screen_name"`
	Text                string    `json:"text"`
}

DirectMessage is a direct message to a single recipient.

type DirectMessageDestroyParams

type DirectMessageDestroyParams struct {
	ID              int64 `url:"id,omitempty"`
	IncludeEntities *bool `url:"include_entities,omitempty"`
}

DirectMessageDestroyParams are the parameters for DirectMessageService.Destroy

type DirectMessageGetParams

type DirectMessageGetParams struct {
	SinceID         int64 `url:"since_id,omitempty"`
	MaxID           int64 `url:"max_id,omitempty"`
	Count           int   `url:"count,omitempty"`
	IncludeEntities *bool `url:"include_entities,omitempty"`
	SkipStatus      *bool `url:"skip_status,omitempty"`
}

DirectMessageGetParams are the parameters for DirectMessageService.Get

type DirectMessageNewParams

type DirectMessageNewParams struct {
	UserID     int64  `url:"user_id,omitempty"`
	ScreenName string `url:"screen_name,omitempty"`
	Text       string `url:"text"`
}

DirectMessageNewParams are the parameters for DirectMessageService.New

type DirectMessageSentParams

type DirectMessageSentParams struct {
	SinceID         int64 `url:"since_id,omitempty"`
	MaxID           int64 `url:"max_id,omitempty"`
	Count           int   `url:"count,omitempty"`
	Page            int   `url:"page,omitempty"`
	IncludeEntities *bool `url:"include_entities,omitempty"`
}

DirectMessageSentParams are the parameters for DirectMessageService.Sent

type DirectMessageService

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

DirectMessageService provides methods for accessing Twitter direct message API endpoints.

func (*DirectMessageService) Destroy

Destroy deletes the Direct Message with the given id and returns it if successful. Requires a user auth context with DM scope. https://dev.twitter.com/rest/reference/post/direct_messages/destroy

func (*DirectMessageService) Get

Get returns recent Direct Messages received by the authenticated user. Requires a user auth context with DM scope. https://dev.twitter.com/rest/reference/get/direct_messages

func (*DirectMessageService) New

New sends a new Direct Message to a specified user as the authenticated user. Requires a user auth context with DM scope. https://dev.twitter.com/rest/reference/post/direct_messages/new

func (*DirectMessageService) Sent

Sent returns recent Direct Messages sent by the authenticated user. Requires a user auth context with DM scope. https://dev.twitter.com/rest/reference/get/direct_messages/sent

func (*DirectMessageService) Show

Show returns the requested Direct Message. Requires a user auth context with DM scope. https://dev.twitter.com/rest/reference/get/direct_messages/show

type Entities

type Entities struct {
	Hashtags     []HashtagEntity `json:"hashtags"`
	Media        []MediaEntity   `json:"media"`
	Urls         []URLEntity     `json:"urls"`
	UserMentions []MentionEntity `json:"user_mentions"`
}

Entities represent metadata and context info parsed from Twitter components. https://dev.twitter.com/overview/api/entities TODO: symbols

type ErrorDetail

type ErrorDetail struct {
	Message string `json:"message"`
	Code    int    `json:"code"`
}

ErrorDetail represents an individual item in an APIError.

type Event

type Event struct {
	Event     string `json:"event"`
	CreatedAt string `json:"created_at"`
	Target    *User  `json:"target"`
	Source    *User  `json:"source"`
	// TODO: add List or deprecate it
	TargetObject *Tweet `json:"target_object"`
}

Event is a non-Tweet notification message (e.g. like, retweet, follow). https://dev.twitter.com/streaming/overview/messages-types#Events_event

type ExtendedEntity

type ExtendedEntity struct {
	Media []MediaEntity `json:"media"`
}

ExtendedEntity contains media information. https://dev.twitter.com/overview/api/entities-in-twitter-objects#extended_entities

type FavoriteListParams

type FavoriteListParams struct {
	UserID          int64  `url:"user_id,omitempty"`
	ScreenName      string `url:"screen_name,omitempty"`
	Count           int    `url:"count,omitempty"`
	SinceID         int64  `url:"since_id,omitempty"`
	MaxID           int64  `url:"max_id,omitempty"`
	IncludeEntities *bool  `url:"include_entities,omitempty"`
}

FavoriteListParams are the parameters for FavoriteService.List.

type FavoriteService

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

FavoriteService provides methods for accessing Twitter favorite API endpoints.

Note: the like action was known as favorite before November 3, 2015; the historical naming remains in API methods and object properties.

func (*FavoriteService) List

func (s *FavoriteService) List(params *FavoriteListParams) ([]Tweet, *http.Response, error)

List returns liked Tweets from the specified user. https://dev.twitter.com/rest/reference/get/favorites/list

type FollowerIDParams

type FollowerIDParams struct {
	UserID     int64  `url:"user_id,omitempty"`
	ScreenName string `url:"screen_name,omitempty"`
	Cursor     int64  `url:"cursor,omitempty"`
	Count      int    `url:"count,omitempty"`
}

FollowerIDParams are the parameters for FollowerService.Ids

type FollowerIDs

type FollowerIDs struct {
	IDs               []int64 `json:"ids"`
	NextCursor        int64   `json:"next_cursor"`
	NextCursorStr     string  `json:"next_cursor_str"`
	PreviousCursor    int64   `json:"previous_cursor"`
	PreviousCursorStr string  `json:"previous_cursor_str"`
}

FollowerIDs is a cursored collection of follower ids.

type FollowerListParams

type FollowerListParams struct {
	UserID              int64  `url:"user_id,omitempty"`
	ScreenName          string `url:"screen_name,omitempty"`
	Cursor              int    `url:"cursor,omitempty"`
	Count               int    `url:"count,omitempty"`
	SkipStatus          *bool  `url:"skip_status,omitempty"`
	IncludeUserEntities *bool  `url:"include_user_entities,omitempty"`
}

FollowerListParams are the parameters for FollowerService.List

type FollowerService

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

FollowerService provides methods for accessing Twitter followers endpoints.

func (*FollowerService) IDs

IDs returns a cursored collection of user ids following the specified user. https://dev.twitter.com/rest/reference/get/followers/ids

func (*FollowerService) List

List returns a cursored collection of Users following the specified user. https://dev.twitter.com/rest/reference/get/followers/list

type Followers

type Followers struct {
	Users             []User `json:"users"`
	NextCursor        int64  `json:"next_cursor"`
	NextCursorStr     string `json:"next_cursor_str"`
	PreviousCursor    int64  `json:"previous_cursor"`
	PreviousCursorStr string `json:"previous_cursor_str"`
}

Followers is a cursored collection of followers.

type FriendIDParams

type FriendIDParams struct {
	UserID     int64  `url:"user_id,omitempty"`
	ScreenName string `url:"screen_name,omitempty"`
	Cursor     int64  `url:"cursor,omitempty"`
	Count      int    `url:"count,omitempty"`
}

FriendIDParams are the parameters for FriendService.Ids

type FriendIDs

type FriendIDs struct {
	IDs               []int64 `json:"ids"`
	NextCursor        int64   `json:"next_cursor"`
	NextCursorStr     string  `json:"next_cursor_str"`
	PreviousCursor    int64   `json:"previous_cursor"`
	PreviousCursorStr string  `json:"previous_cursor_str"`
}

FriendIDs is a cursored collection of friend ids.

type FriendListParams

type FriendListParams struct {
	UserID              int64  `url:"user_id,omitempty"`
	ScreenName          string `url:"screen_name,omitempty"`
	Cursor              int    `url:"cursor,omitempty"`
	Count               int    `url:"count,omitempty"`
	SkipStatus          *bool  `url:"skip_status,omitempty"`
	IncludeUserEntities *bool  `url:"include_user_entities,omitempty"`
}

FriendListParams are the parameters for FriendService.List

type FriendService

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

FriendService provides methods for accessing Twitter friends endpoints.

func (*FriendService) IDs

func (s *FriendService) IDs(params *FriendIDParams) (*FriendIDs, *http.Response, error)

IDs returns a cursored collection of user ids following the specified user. https://dev.twitter.com/rest/reference/get/friends/ids

func (*FriendService) List

func (s *FriendService) List(params *FriendListParams) (*Friends, *http.Response, error)

List returns a cursored collection of Users following the specified user. https://dev.twitter.com/rest/reference/get/friends/list

type Friends

type Friends struct {
	Users             []User `json:"users"`
	NextCursor        int64  `json:"next_cursor"`
	NextCursorStr     string `json:"next_cursor_str"`
	PreviousCursor    int64  `json:"previous_cursor"`
	PreviousCursorStr string `json:"previous_cursor_str"`
}

Friends is a cursored collection of friends.

type FriendsList

type FriendsList struct {
	Friends []int64 `json:"friends"`
}

FriendsList is a list of some of a user's friends. https://dev.twitter.com/streaming/overview/messages-types#friends_list_friends

type FriendshipIncomingParams

type FriendshipIncomingParams struct {
	Cursor       int64 `url:"cursor,omitempty"`
	StringifyIDs bool  `url:"stringify_ids,omitempty"`
}

FriendshipIncomingParams are the parameters given to FriendshipService.Incoming

type FriendshipIncomingResult

type FriendshipIncomingResult struct {
	NextCursor        int64   `json:"next_cursor"`
	NextCursorStr     string  `json:"next_cursor_str"`
	PreviousCursor    int64   `json:"previous_cursor"`
	PreviousCursorStr string  `json:"previous_cursor_str"`
	IDs               []int64 `json:"ids"`
}

FriendshipIncomingResult is the result from FriendshipService.Incoming

type FriendshipLookupParams

type FriendshipLookupParams struct {
	UserID     string `url:"user_id,omitempty"`
	ScreenName string `url:"screen_name,omitempty"`
}

FriendshipLookupParams are Basic parameters for friendship requests

type FriendshipLookupStatus

type FriendshipLookupStatus struct {
	Name        string   `json:"name"`
	ScreenName  string   `json:"screen_name"`
	ID          int64    `json:"id"`
	IDStr       string   `json:"id_str"`
	Connections []string `json:"connections"`
}

FriendshipLookupStatus is The relationship status between the authenticated user and the target

type FriendshipRelationship

type FriendshipRelationship struct {
	Target FriendshipRelationshipTarget `json:"target"`
	Source FriendshipRelationshipSource `json:"source"`
}

FriendshipRelationship is the underlying relationship of the show function

type FriendshipRelationshipSource

type FriendshipRelationshipSource struct {
	CanDM                bool   `json:"can_dm"`
	Blocking             bool   `json:"blocking"`
	Muting               bool   `json:"muting"`
	IDStr                string `json:"id_str"`
	AllReplies           bool   `json:"all_replies"`
	WantRetweets         bool   `json:"want_retweets"`
	ID                   int64  `json:"id"`
	MarkedSpam           bool   `json:"marked_spam"`
	ScreenName           string `json:"screen_name"`
	Following            bool   `json:"following"`
	FollowedBy           bool   `json:"followed_by"`
	NotificationsEnabled bool   `json:"notifications_enabled"`
}

FriendshipRelationshipSource is the source's attributes from the show function

type FriendshipRelationshipTarget

type FriendshipRelationshipTarget struct {
	IDStr      string `json:"id_str"`
	ID         int64  `json:"id"`
	ScreenName string `json:"screen_name"`
	Following  bool   `json:"following"`
	FollowedBy bool   `json:"followed_by"`
}

FriendshipRelationshipTarget is the target's attributes from the show function

type FriendshipService

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

FriendshipService provides methods for accessing Twitter friendship endpoints.

func (*FriendshipService) Create

Create allows the authenticating users to follow the user specified in the ID/ScreenName parameter.

func (*FriendshipService) Destroy

func (s *FriendshipService) Destroy(params *FriendshipLookupParams) (*User, *http.Response, error)

Destroy allows the authenticating user to unfollow the user specified in the ID/ScreenName parameter.

func (*FriendshipService) Incoming

Incoming returns a collection of numeric IDs for every user who has a pending request to follow the authenticating user. https://dev.twitter.com/rest/reference/get/friendships/incoming

func (*FriendshipService) Lookup

Lookup returns the relationships of the authenticating user to target user

func (*FriendshipService) NoRetweets

func (s *FriendshipService) NoRetweets() (*[]int64, *http.Response, error)

NoRetweets reeturns a collection of user_ids that the currently authenticated user does not want to receive retweets from. https://dev.twitter.com/rest/reference/get/friendships/no_retweets/ids

func (*FriendshipService) Outgoing

Outgoing returns a collection of numeric IDs for every protected user for whom the authenticating user has a pending follow request. https://dev.twitter.com/rest/reference/get/friendships/outgoing

func (*FriendshipService) Show

Show Returns detailed information about the relationship between two arbitrary users.

func (*FriendshipService) Update

Update allows one to enable or disable retweets and device notifications from the specified user.

type FriendshipShowParams

type FriendshipShowParams struct {
	SourceScreenName string `url:"source_screen_name,omitempty"`
	SourceID         string `url:"source_id,omitempty"`
	TargetScreenName string `url:"target_screen_name,omitempty"`
	TargetID         string `url:"target_id,omitempty"`
}

FriendshipShowParams are the parameters given to the show function

type FriendshipShowResult

type FriendshipShowResult struct {
	Relationship FriendshipRelationship `json:"relationship"`
}

FriendshipShowResult is the result from the Friendship show function

type FriendshipUpdateParams

type FriendshipUpdateParams struct {
	ScreenName string `url:"screen_name,omitempty"` // The screen name of the user for whom to befriend.
	SourceID   string `url:"user_id,omitempty"`     // The ID of the user for whom to befriend.
	Device     bool   `url:"device,omitempty"`      // Enable/disable device notifications from the target user.
	Retweets   bool   `url:"retweets,omitempty"`    // Enable/disable retweets from the target user.
}

FriendshipUpdateParams are the parameters given to the Update function

type HashtagEntity

type HashtagEntity struct {
	Indices Indices `json:"indices"`
	Text    string  `json:"text"`
}

HashtagEntity represents a hashtag which has been parsed from text.

type HomeTimelineParams

type HomeTimelineParams struct {
	Count              int   `url:"count,omitempty"`
	SinceID            int64 `url:"since_id,omitempty"`
	MaxID              int64 `url:"max_id,omitempty"`
	TrimUser           *bool `url:"trim_user,omitempty"`
	ExcludeReplies     *bool `url:"exclude_replies,omitempty"`
	ContributorDetails *bool `url:"contributor_details,omitempty"`
	IncludeEntities    *bool `url:"include_entities,omitempty"`
}

HomeTimelineParams are the parameters for TimelineService.HomeTimeline.

type Indices

type Indices [2]int

Indices represent the start and end offsets within text.

func (Indices) End

func (i Indices) End() int

End returns the index at which an entity ends, exclusive.

func (Indices) Start

func (i Indices) Start() int

Start returns the index at which an entity starts, inclusive.

type LocationDeletion

type LocationDeletion struct {
	UserID          int64  `json:"user_id"`
	UserIDStr       string `json:"user_id_str"`
	UpToStatusID    int64  `json:"up_to_status_id"`
	UpToStatusIDStr string `json:"up_to_status_id_str"`
}

LocationDeletion indicates geolocation data must be stripped from a range of Tweets. https://dev.twitter.com/streaming/overview/messages-types#Location_deletion_notices_scrub_geo

type MediaEntity

type MediaEntity struct {
	URLEntity
	ID                int64      `json:"id"`
	IDStr             string     `json:"id_str"`
	MediaURL          string     `json:"media_url"`
	MediaURLHttps     string     `json:"media_url_https"`
	SourceStatusID    int64      `json:"source_status_id"`
	SourceStatusIDStr string     `json:"source_status_id_str"`
	Type              string     `json:"type"`
	Sizes             MediaSizes `json:"sizes"`
	VideoInfo         VideoInfo  `json:"video_info"`
}

MediaEntity represents media elements associated with a Tweet.

type MediaSize

type MediaSize struct {
	Width  int    `json:"w"`
	Height int    `json:"h"`
	Resize string `json:"resize"`
}

MediaSize describes the height, width, and resizing method used.

type MediaSizes

type MediaSizes struct {
	Thumb  MediaSize `json:"thumb"`
	Large  MediaSize `json:"large"`
	Medium MediaSize `json:"medium"`
	Small  MediaSize `json:"small"`
}

MediaSizes contain the different size media that are available. https://dev.twitter.com/overview/api/entities#obj-sizes

type MentionEntity

type MentionEntity struct {
	Indices    Indices `json:"indices"`
	ID         int64   `json:"id"`
	IDStr      string  `json:"id_str"`
	Name       string  `json:"name"`
	ScreenName string  `json:"screen_name"`
}

MentionEntity represents Twitter user mentions parsed from text.

type MentionTimelineParams

type MentionTimelineParams struct {
	Count              int   `url:"count,omitempty"`
	SinceID            int64 `url:"since_id,omitempty"`
	MaxID              int64 `url:"max_id,omitempty"`
	TrimUser           *bool `url:"trim_user,omitempty"`
	ContributorDetails *bool `url:"contributor_details,omitempty"`
	IncludeEntities    *bool `url:"include_entities,omitempty"`
}

MentionTimelineParams are the parameters for TimelineService.MentionTimeline.

type OEmbedTweet

type OEmbedTweet struct {
	URL          string `json:"url"`
	ProviderURL  string `json:"provider_url"`
	ProviderName string `json:"provider_name"`
	AuthorName   string `json:"author_name"`
	Version      string `json:"version"`
	AuthorURL    string `json:"author_url"`
	Type         string `json:"type"`
	HTML         string `json:"html"`
	Height       int64  `json:"height"`
	Width        int64  `json:"width"`
	CacheAge     string `json:"cache_age"`
}

OEmbedTweet represents a Tweet in oEmbed format.

type Place

type Place struct {
	Attributes  map[string]string `json:"attributes"`
	BoundingBox *BoundingBox      `json:"bounding_box"`
	Country     string            `json:"country"`
	CountryCode string            `json:"country_code"`
	FullName    string            `json:"full_name"`
	Geometry    *BoundingBox      `json:"geometry"`
	ID          string            `json:"id"`
	Name        string            `json:"name"`
	PlaceType   string            `json:"place_type"`
	Polylines   []string          `json:"polylines"`
	URL         string            `json:"url"`
}

Place represents a Twitter Place / Location https://dev.twitter.com/overview/api/places

type RetweetsOfMeTimelineParams

type RetweetsOfMeTimelineParams struct {
	Count               int   `url:"count,omitempty"`
	SinceID             int64 `url:"since_id,omitempty"`
	MaxID               int64 `url:"max_id,omitempty"`
	TrimUser            *bool `url:"trim_user,omitempty"`
	IncludeEntities     *bool `url:"include_entities,omitempty"`
	IncludeUserEntities *bool `url:"include_user_entities"`
}

RetweetsOfMeTimelineParams are the parameters for TimelineService.RetweetsOfMeTimeline.

type Search struct {
	SearchMetaData SearchMetaData `json:"search_metadata"`
	Statuses       []*Tweet       `json:"statuses"`
}

Search is the return results from a search query

type SearchMetaData

type SearchMetaData struct {
	CompletedIn float64 `json:"completed_in"`
	Count       int64   `json:"count"`
	MaxID       int64   `json:"max_id"`
	MaxIDStr    string  `json:"max_id_str"`
	NextResults string  `json:"next_results"`
	Query       string  `json:"query"`
	RefreshURL  string  `json:"refresh_url"`
	SinceID     int64   `json:"since_id"`
	SinceIDStr  string  `json:"since_id_str"`
}

SearchMetaData is the metadata related to a search query

type SearchParams

type SearchParams struct {
	Query           string `url:"q,omitempty"`
	Geocode         string `url:"geocode,omitempty"`
	Lang            string `url:"lang,omitempty"`
	Locale          string `url:"locale,omitempty"`
	ResultType      string `url:"result_type,omitempty"`
	Count           int64  `url:"count,omitempty"`
	Until           string `url:"until,omitempty"`
	SinceID         int64  `url:"since_id,omitempty"`
	MaxID           int64  `url:"max_id,omitempty"`
	IncludeEntities bool   `url:"include_entities,omitempty"`
	NextResults     bool   `url:"q,omitempty"`
}

SearchParams are the parameters for SearchService.Searchs

type SearchService

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

SearchService provides access to Twitter's search

func (*SearchService) Search

func (s *SearchService) Search(params *SearchParams) (*Search, *http.Response, error)

Search returns a cursored collection of user ids following the specified user. https://dev.twitter.com/rest/reference/get/friends/ids

type StallWarning

type StallWarning struct {
	Code        string `json:"code"`
	Message     string `json:"message"`
	PercentFull int    `json:"percent_full"`
}

StallWarning indicates the client is falling behind in the stream. https://dev.twitter.com/streaming/overview/messages-types#stall_warnings

type StatusDeletion

type StatusDeletion struct {
	ID        int64  `json:"id"`
	IDStr     string `json:"id_str"`
	UserID    int64  `json:"user_id"`
	UserIDStr string `json:"user_id_str"`
}

StatusDeletion indicates that a given Tweet has been deleted. https://dev.twitter.com/streaming/overview/messages-types#status_deletion_notices_delete

type StatusDestroyParams

type StatusDestroyParams struct {
	ID       int64 `url:"id,omitempty"`
	TrimUser *bool `url:"trim_user,omitempty"`
}

StatusDestroyParams are the parameters for StatusService.Destroy

type StatusLookupParams

type StatusLookupParams struct {
	ID              []int64 `url:"id,omitempty,comma"`
	TrimUser        *bool   `url:"trim_user,omitempty"`
	IncludeEntities *bool   `url:"include_entities,omitempty"`
	Map             *bool   `url:"map,omitempty"`
}

StatusLookupParams are the parameters for StatusService.Lookup

type StatusOEmbedParams

type StatusOEmbedParams struct {
	ID         int64  `url:"id,omitempty"`
	URL        string `url:"url,omitempty"`
	Align      string `url:"align,omitempty"`
	MaxWidth   int64  `url:"maxwidth,omitempty"`
	HideMedia  *bool  `url:"hide_media,omitempty"`
	HideThread *bool  `url:"hide_media,omitempty"`
	OmitScript *bool  `url:"hide_media,omitempty"`
	WidgetType string `url:"widget_type,omitempty"`
	HideTweet  *bool  `url:"hide_tweet,omitempty"`
}

StatusOEmbedParams are the parameters for StatusService.OEmbed

type StatusRetweetParams

type StatusRetweetParams struct {
	ID       int64 `url:"id,omitempty"`
	TrimUser *bool `url:"trim_user,omitempty"`
}

StatusRetweetParams are the parameters for StatusService.Retweet

type StatusRetweetersParams

type StatusRetweetersParams struct {
	ID           int64 `url:"id"`
	Cursor       int64 `url:"cursor,omitempty"`
	StringifyIDs bool  `url:"stringify_ids,omitempty"`
}

StatusRetweetersParams are the parameters for StatusService.Retweeters

type StatusRetweetersResult

type StatusRetweetersResult struct {
	PreviousCursor    int64   `json:"previous_cursor"`
	PreviousCursorStr string  `json:"previous_cursor_str"`
	NextCursor        int64   `json:"next_cursor"`
	NextCursorStr     string  `json:"next_cursor_str"`
	IDs               []int64 `json:"ids"`
}

StatusRetweetersResult is the result from StatusService.Retweeters

type StatusRetweetsOfMeParams

type StatusRetweetsOfMeParams struct {
	Count               int64 `url:"count,omitempty"`
	SinceID             int64 `url:"since_id,omitempty"`
	MaxID               int64 `url:"max_id,omitempty"`
	TrimUser            bool  `url:"trim_user,omitempty"`
	IncludeEntities     bool  `url:"include_entities,omitempty"`
	IncludeUserEntities bool  `url:"include_user_entities,omitempty"`
}

StatusRetweetsOfMeParams are the parameters for StatusService.RetweetsOfMe

type StatusRetweetsParams

type StatusRetweetsParams struct {
	ID       int64 `url:"id,omitempty"`
	Count    int   `url:"count,omitempty"`
	TrimUser *bool `url:"trim_user,omitempty"`
}

StatusRetweetsParams are the parameters for StatusService.Retweets

type StatusService

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

StatusService provides methods for accessing Twitter status API endpoints.

func (*StatusService) Destroy

func (s *StatusService) Destroy(id int64, params *StatusDestroyParams) (*Tweet, *http.Response, error)

Destroy deletes the Tweet with the given id and returns it if successful. Requires a user auth context. https://dev.twitter.com/rest/reference/post/statuses/destroy/%3Aid

func (*StatusService) Lookup

func (s *StatusService) Lookup(ids []int64, params *StatusLookupParams) ([]Tweet, *http.Response, error)

Lookup returns the requested Tweets as a slice. Combines ids from the required ids argument and from params.Id. https://dev.twitter.com/rest/reference/get/statuses/lookup

func (*StatusService) OEmbed

OEmbed returns the requested Tweet in oEmbed format. https://dev.twitter.com/rest/reference/get/statuses/oembed

func (*StatusService) Retweet

func (s *StatusService) Retweet(id int64, params *StatusRetweetParams) (*Tweet, *http.Response, error)

Retweet retweets the Tweet with the given id and returns the original Tweet with embedded retweet details. Requires a user auth context. https://dev.twitter.com/rest/reference/post/statuses/retweet/%3Aid

func (*StatusService) Retweeters

Retweeters returns a collection of up to 100 user IDs belonging to users who have retweeted the tweet specified by the id parameter https://dev.twitter.com/rest/reference/get/statuses/retweeters/ids

func (*StatusService) Retweets

func (s *StatusService) Retweets(id int64, params *StatusRetweetsParams) ([]Tweet, *http.Response, error)

Retweets returns the most recent retweets of the Tweet with the given id. https://dev.twitter.com/rest/reference/get/statuses/retweets/%3Aid

func (*StatusService) RetweetsOfMe

func (s *StatusService) RetweetsOfMe(params *StatusRetweetsOfMeParams) ([]Tweet, *http.Response, error)

RetweetsOfMe returns the most recent tweets authored by the authenticating user that have been retweeted by others. https://dev.twitter.com/rest/reference/get/statuses/retweets_of_me

func (*StatusService) Show

func (s *StatusService) Show(id int64, params *StatusShowParams) (*Tweet, *http.Response, error)

Show returns the requested Tweet. https://dev.twitter.com/rest/reference/get/statuses/show/%3Aid

func (*StatusService) UnRetweet

func (s *StatusService) UnRetweet(id int64, params *StatusRetweetParams) (*Tweet, *http.Response, error)

UnRetweet untweets a retweeted status. Returns the original Tweet with retweet details embedded. https://dev.twitter.com/rest/reference/post/statuses/unretweet/%3Aid

func (*StatusService) Update

func (s *StatusService) Update(status string, params *StatusUpdateParams) (*Tweet, *http.Response, error)

Update updates the user's status, also known as Tweeting. Requires a user auth context. https://dev.twitter.com/rest/reference/post/statuses/update

type StatusShowParams

type StatusShowParams struct {
	ID               int64 `url:"id,omitempty"`
	TrimUser         *bool `url:"trim_user,omitempty"`
	IncludeMyRetweet *bool `url:"include_my_retweet,omitempty"`
	IncludeEntities  *bool `url:"include_entities,omitempty"`
}

StatusShowParams are the parameters for StatusService.Show

type StatusUpdateParams

type StatusUpdateParams struct {
	Status             string   `url:"status,omitempty"`
	InReplyToStatusID  int64    `url:"in_reply_to_status_id,omitempty"`
	PossiblySensitive  *bool    `url:"possibly_sensitive,omitempty"`
	Lat                *float64 `url:"lat,omitempty"`
	Long               *float64 `url:"long,omitempty"`
	PlaceID            string   `url:"place_id,omitempty"`
	DisplayCoordinates *bool    `url:"display_coordinates,omitempty"`
	TrimUser           *bool    `url:"trim_user,omitempty"`
	MediaIds           []int64  `url:"media_ids,omitempty,comma"`
}

StatusUpdateParams are the parameters for StatusService.Update

type StatusWithheld

type StatusWithheld struct {
	ID                  int64    `json:"id"`
	UserID              int64    `json:"user_id"`
	WithheldInCountries []string `json:"withheld_in_countries"`
}

StatusWithheld indicates a Tweet with the given ID, belonging to UserId, has been withheld in certain countries. https://dev.twitter.com/streaming/overview/messages-types#withheld_content_notices

type Stream

type Stream struct {
	Messages chan interface{}
	// contains filtered or unexported fields
}

Stream maintains a connection to the Twitter Streaming API, receives messages from the streaming response, and sends them on the Messages channel from a goroutine. The stream goroutine stops itself if an EOF is reached or retry errors occur, also closing the Messages channel.

The client must Stop() the stream when finished receiving, which will wait until the stream is properly stopped.

func (*Stream) Stop

func (s *Stream) Stop()

Stop signals retry and receiver to stop, closes the Messages channel, and blocks until done.

type StreamDisconnect

type StreamDisconnect struct {
	Code       int64  `json:"code"`
	StreamName string `json:"stream_name"`
	Reason     string `json:"reason"`
}

StreamDisconnect indicates the stream has been shutdown for some reason. https://dev.twitter.com/streaming/overview/messages-types#disconnect_messages

type StreamFilterParams

type StreamFilterParams struct {
	FilterLevel   string   `url:"filter_level,omitempty"`
	Follow        []string `url:"follow,omitempty,comma"`
	Language      []string `url:"language,omitempty,comma"`
	Locations     []string `url:"locations,omitempty,comma"`
	StallWarnings *bool    `url:"stall_warnings,omitempty"`
	Track         []string `url:"track,omitempty,comma"`
}

StreamFilterParams are parameters for StreamService.Filter.

type StreamFirehoseParams

type StreamFirehoseParams struct {
	Count         int      `url:"count,omitempty"`
	FilterLevel   string   `url:"filter_level,omitempty"`
	Language      []string `url:"language,omitempty,comma"`
	StallWarnings *bool    `url:"stall_warnings,omitempty"`
}

StreamFirehoseParams are the parameters for StreamService.Firehose.

type StreamLimit

type StreamLimit struct {
	Track int64 `json:"track"`
}

StreamLimit indicates a stream matched more statuses than its rate limit allowed. The track number is the number of undelivered matches. https://dev.twitter.com/streaming/overview/messages-types#limit_notices

type StreamSampleParams

type StreamSampleParams struct {
	StallWarnings *bool `url:"stall_warnings,omitempty"`
}

StreamSampleParams are the parameters for StreamService.Sample.

type StreamService

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

StreamService provides methods for accessing the Twitter Streaming API.

func (*StreamService) Filter

func (srv *StreamService) Filter(params *StreamFilterParams) (*Stream, error)

Filter returns messages that match one or more filter predicates. https://dev.twitter.com/streaming/reference/post/statuses/filter

func (*StreamService) Firehose

func (srv *StreamService) Firehose(params *StreamFirehoseParams) (*Stream, error)

Firehose returns all public messages and statuses. Requires special permission to access. https://dev.twitter.com/streaming/reference/get/statuses/firehose

func (*StreamService) Sample

func (srv *StreamService) Sample(params *StreamSampleParams) (*Stream, error)

Sample returns a small sample of public stream messages. https://dev.twitter.com/streaming/reference/get/statuses/sample

func (*StreamService) Site

func (srv *StreamService) Site(params *StreamSiteParams) (*Stream, error)

Site returns messages for a set of users. Requires special permission to access. https://dev.twitter.com/streaming/reference/get/site

func (*StreamService) User

func (srv *StreamService) User(params *StreamUserParams) (*Stream, error)

User returns a stream of messages specific to the authenticated User. https://dev.twitter.com/streaming/reference/get/user

type StreamSiteParams

type StreamSiteParams struct {
	FilterLevel   string   `url:"filter_level,omitempty"`
	Follow        []string `url:"follow,omitempty,comma"`
	Language      []string `url:"language,omitempty,comma"`
	Replies       string   `url:"replies,omitempty"`
	StallWarnings *bool    `url:"stall_warnings,omitempty"`
	With          string   `url:"with,omitempty"`
}

StreamSiteParams are the parameters for StreamService.Site.

type StreamUserParams

type StreamUserParams struct {
	FilterLevel   string   `url:"filter_level,omitempty"`
	Language      []string `url:"language,omitempty,comma"`
	Locations     []string `url:"locations,omitempty,comma"`
	Replies       string   `url:"replies,omitempty"`
	StallWarnings *bool    `url:"stall_warnings,omitempty"`
	Track         []string `url:"track,omitempty,comma"`
	With          string   `url:"with,omitempty"`
}

StreamUserParams are the parameters for StreamService.User.

type SwitchDemux

type SwitchDemux struct {
	All              func(message interface{})
	Tweet            func(tweet *Tweet)
	DM               func(dm *DirectMessage)
	StatusDeletion   func(deletion *StatusDeletion)
	LocationDeletion func(LocationDeletion *LocationDeletion)
	StreamLimit      func(limit *StreamLimit)
	StatusWithheld   func(statusWithheld *StatusWithheld)
	UserWithheld     func(userWithheld *UserWithheld)
	StreamDisconnect func(disconnect *StreamDisconnect)
	Warning          func(warning *StallWarning)
	FriendsList      func(friendsList *FriendsList)
	Event            func(event *Event)
	Other            func(message interface{})
}

SwitchDemux receives messages and uses a type switch to send each typed message to a handler function.

func NewSwitchDemux

func NewSwitchDemux() SwitchDemux

NewSwitchDemux returns a new SwitchMux which has NoOp handler functions.

func (SwitchDemux) Handle

func (d SwitchDemux) Handle(message interface{})

Handle determines the type of a message and calls the corresponding receiver function with the typed message. All messages are passed to the All func. Messages with unmatched types are passed to the Other func.

func (SwitchDemux) HandleChan

func (d SwitchDemux) HandleChan(messages <-chan interface{})

HandleChan receives messages and calls the corresponding receiver function with the typed message. All messages are passed to the All func. Messages with unmatched type are passed to the Other func.

type TimelineService

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

TimelineService provides methods for accessing Twitter status timeline API endpoints.

func (*TimelineService) HomeTimeline

func (s *TimelineService) HomeTimeline(params *HomeTimelineParams) ([]Tweet, *http.Response, error)

HomeTimeline returns recent Tweets and retweets from the user and those users they follow. Requires a user auth context. https://dev.twitter.com/rest/reference/get/statuses/home_timeline

func (*TimelineService) MentionTimeline

func (s *TimelineService) MentionTimeline(params *MentionTimelineParams) ([]Tweet, *http.Response, error)

MentionTimeline returns recent Tweet mentions of the authenticated user. Requires a user auth context. https://dev.twitter.com/rest/reference/get/statuses/mentions_timeline

func (*TimelineService) RetweetsOfMeTimeline

func (s *TimelineService) RetweetsOfMeTimeline(params *RetweetsOfMeTimelineParams) ([]Tweet, *http.Response, error)

RetweetsOfMeTimeline returns the most recent Tweets by the authenticated user that have been retweeted by others. Requires a user auth context. https://dev.twitter.com/rest/reference/get/statuses/retweets_of_me

func (*TimelineService) UserTimeline

func (s *TimelineService) UserTimeline(params *UserTimelineParams) ([]Tweet, *http.Response, error)

UserTimeline returns recent Tweets from the specified user. https://dev.twitter.com/rest/reference/get/statuses/user_timeline

type Tweet

type Tweet struct {
	Contributors         []Contributor          `json:"contributors"`
	Coordinates          *Coordinates           `json:"coordinates"`
	CreatedAt            string                 `json:"created_at"`
	CurrentUserRetweet   *TweetIdentifier       `json:"current_user_retweet"`
	Entities             *Entities              `json:"entities"`
	FavoriteCount        int                    `json:"favorite_count"`
	Favorited            bool                   `json:"favorited"`
	FilterLevel          string                 `json:"filter_level"`
	ID                   int64                  `json:"id"`
	IDStr                string                 `json:"id_str"`
	InReplyToScreenName  string                 `json:"in_reply_to_screen_name"`
	InReplyToStatusID    int64                  `json:"in_reply_to_status_id"`
	InReplyToStatusIDStr string                 `json:"in_reply_to_status_id_str"`
	InReplyToUserID      int64                  `json:"in_reply_to_user_id"`
	InReplyToUserIDStr   string                 `json:"in_reply_to_user_id_str"`
	Lang                 string                 `json:"lang"`
	PossiblySensitive    bool                   `json:"possibly_sensitive"`
	RetweetCount         int                    `json:"retweet_count"`
	Retweeted            bool                   `json:"retweeted"`
	RetweetedStatus      *Tweet                 `json:"retweeted_status"`
	Source               string                 `json:"source"`
	Scopes               map[string]interface{} `json:"scopes"`
	Text                 string                 `json:"text"`
	Place                *Place                 `json:"place"`
	Truncated            bool                   `json:"truncated"`
	User                 *User                  `json:"user"`
	WithheldCopyright    bool                   `json:"withheld_copyright"`
	WithheldInCountries  []string               `json:"withheld_in_countries"`
	WithheldScope        string                 `json:"withheld_scope"`
	ExtendedEntities     *ExtendedEntity        `json:"extended_entities"`
	QuotedStatusID       int64                  `json:"quoted_status_id"`
	QuotedStatusIDStr    string                 `json:"quoted_status_id_str"`
	QuotedStatus         *Tweet                 `json:"quoted_status"`
}

Tweet represents a Twitter Tweet, previously called a status. https://dev.twitter.com/overview/api/tweets Unused or deprecated fields not provided: Geo, Annotations

type TweetIdentifier

type TweetIdentifier struct {
	ID    int64  `json:"id"`
	IDStr string `json:"id_str"`
}

TweetIdentifier represents the id by which a Tweet can be identified.

type URLEntity

type URLEntity struct {
	Indices     Indices `json:"indices"`
	DisplayURL  string  `json:"display_url"`
	ExpandedURL string  `json:"expanded_url"`
	URL         string  `json:"url"`
}

URLEntity represents a URL which has been parsed from text.

type User

type User struct {
	ContributorsEnabled            bool          `json:"contributors_enabled"`
	CreatedAt                      string        `json:"created_at"`
	DefaultProfile                 bool          `json:"default_profile"`
	DefaultProfileImage            bool          `json:"default_profile_image"`
	Description                    string        `json:"description"`
	Email                          string        `json:"email"`
	Entities                       *UserEntities `json:"entities"`
	FavouritesCount                int           `json:"favourites_count"`
	FollowRequestSent              bool          `json:"follow_request_sent"`
	Following                      bool          `json:"following"`
	FollowersCount                 int           `json:"followers_count"`
	FriendsCount                   int           `json:"friends_count"`
	GeoEnabled                     bool          `json:"geo_enabled"`
	ID                             int64         `json:"id"`
	IDStr                          string        `json:"id_str"`
	IsTranslator                   bool          `json:"id_translator"`
	Lang                           string        `json:"lang"`
	ListedCount                    int           `json:"listed_count"`
	Location                       string        `json:"location"`
	Name                           string        `json:"name"`
	Notifications                  bool          `json:"notifications"`
	ProfileBackgroundColor         string        `json:"profile_background_color"`
	ProfileBackgroundImageURL      string        `json:"profile_background_image_url"`
	ProfileBackgroundImageURLHttps string        `json:"profile_background_image_url_https"`
	ProfileBackgroundTile          bool          `json:"profile_background_tile"`
	ProfileBannerURL               string        `json:"profile_banner_url"`
	ProfileImageURL                string        `json:"profile_image_url"`
	ProfileImageURLHttps           string        `json:"profile_image_url_https"`
	ProfileLinkColor               string        `json:"profile_link_color"`
	ProfileSidebarBorderColor      string        `json:"profile_sidebar_border_color"`
	ProfileSidebarFillColor        string        `json:"profile_sidebar_fill_color"`
	ProfileTextColor               string        `json:"profile_text_color"`
	ProfileUseBackgroundImage      bool          `json:"profile_use_background_image"`
	Protected                      bool          `json:"protected"`
	ScreenName                     string        `json:"screen_name"`
	ShowAllInlineMedia             bool          `json:"show_all_inline_media"`
	Status                         *Tweet        `json:"status"`
	StatusesCount                  int           `json:"statuses_count"`
	Timezone                       string        `json:"time_zone"`
	URL                            string        `json:"url"`
	UtcOffset                      int           `json:"utc_offset"`
	Verified                       bool          `json:"verified"`
	WithheldInCountries            string        `json:"withheld_in_countries"`
	WithholdScope                  string        `json:"withheld_scope"`
}

User represents a Twitter User. https://dev.twitter.com/overview/api/users

type UserEntities

type UserEntities struct {
	URL         Entities `json:"url"`
	Description Entities `json:"description"`
}

UserEntities contain Entities parsed from User url and description fields. https://dev.twitter.com/overview/api/entities-in-twitter-objects#users

type UserLookupParams

type UserLookupParams struct {
	UserID          []int64  `url:"user_id,omitempty,comma"`
	ScreenName      []string `url:"screen_name,omitempty,comma"`
	IncludeEntities *bool    `url:"include_entities,omitempty"` // whether 'status' should include entities
}

UserLookupParams are the parameters for UserService.Lookup.

type UserSearchParams

type UserSearchParams struct {
	Query           string `url:"q,omitempty"`
	Page            int    `url:"page,omitempty"` // 1-based page number
	Count           int    `url:"count,omitempty"`
	IncludeEntities *bool  `url:"include_entities,omitempty"` // whether 'status' should include entities
}

UserSearchParams are the parameters for UserService.Search.

type UserService

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

UserService provides methods for accessing Twitter user API endpoints.

func (*UserService) Lookup

func (s *UserService) Lookup(params *UserLookupParams) ([]User, *http.Response, error)

Lookup returns the requested Users as a slice. https://dev.twitter.com/rest/reference/get/users/lookup

func (*UserService) Search

func (s *UserService) Search(query string, params *UserSearchParams) ([]User, *http.Response, error)

Search queries public user accounts. Requires a user auth context. https://dev.twitter.com/rest/reference/get/users/search

func (*UserService) Show

func (s *UserService) Show(params *UserShowParams) (*User, *http.Response, error)

Show returns the requested User. https://dev.twitter.com/rest/reference/get/users/show

type UserShowParams

type UserShowParams struct {
	UserID          int64  `url:"user_id,omitempty"`
	ScreenName      string `url:"screen_name,omitempty"`
	IncludeEntities *bool  `url:"include_entities,omitempty"` // whether 'status' should include entities
}

UserShowParams are the parameters for UserService.Show.

type UserTimelineParams

type UserTimelineParams struct {
	UserID             int64  `url:"user_id,omitempty"`
	ScreenName         string `url:"screen_name,omitempty"`
	Count              int    `url:"count,omitempty"`
	SinceID            int64  `url:"since_id,omitempty"`
	MaxID              int64  `url:"max_id,omitempty"`
	TrimUser           *bool  `url:"trim_user,omitempty"`
	ExcludeReplies     *bool  `url:"exclude_replies,omitempty"`
	ContributorDetails *bool  `url:"contributor_details,omitempty"`
	IncludeRetweets    *bool  `url:"include_rts,omitempty"`
}

UserTimelineParams are the parameters for TimelineService.UserTimeline.

type UserWithheld

type UserWithheld struct {
	ID                  int64    `json:"id"`
	WithheldInCountries []string `json:"withheld_in_countries"`
}

UserWithheld indicates a User with the given ID has been withheld in certain countries. https://dev.twitter.com/streaming/overview/messages-types#withheld_content_notices

type VideoInfo

type VideoInfo struct {
	AspectRatio    [2]int         `json:"aspect_ratio"`
	DurationMillis int            `json:"duration_millis"`
	Variants       []VideoVariant `json:"variants"`
}

VideoInfo is available on video media objects.

type VideoVariant

type VideoVariant struct {
	ContentType string `json:"content_type"`
	Bitrate     int    `json:"bitrate"`
	URL         string `json:"url"`
}

VideoVariant describes one of the available video formats.

Jump to

Keyboard shortcuts

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