twtr

package module
v0.0.0-...-5b2f51e Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2017 License: MIT Imports: 12 Imported by: 20

README

twtr

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountSettings

type AccountSettings struct {
	AllowContributorRequest   string           `json:"allow_contributor_request"`
	AllowDMsFrom              string           `json:"allow_dms_from"`
	AllowDMGroupsFrom         string           `json:"allow_dm_groups_from"`
	AlwaysUseHttps            bool             `json:"always_use_https"`
	DiscoverableByEmail       bool             `json:"discoverable_by_email"`
	DiscoverableByMobilePhone bool             `json:"discoverable_by_mobile_phone"`
	DisplaySensitiveMedia     bool             `json:"display_sensitive_media"`
	GeoEnabled                bool             `json:"geo_enabled"`
	Language                  string           `json:"language"`
	Protected                 bool             `json:"protected"`
	ScreenName                string           `json:"screen_name"`
	ShowAllInlineMedia        bool             `json:"show_all_inline_media"`
	SleepTime                 AccountSleepTime `json:"sleep_time"`
	TimeZone                  TimeZone         `json:"time_zone"`
	TranslatorType            string           `json:"translator_type"`
	TrendLocation             []TrendLocation  `json:"trend_location"`
	UseCookiePersonalization  bool             `json:"use_cookie_personalization"`
}

type AccountSleepTime

type AccountSleepTime struct {
	Enabled   bool `json:"enabled"`
	EndTime   int  `json:"end_time"`
	StartTime int  `json:"start_time"`
}

type Client

type Client struct {
	OAuthClient   oauth.Client
	AccessToken   *oauth.Credentials
	RequestToken  *oauth.Credentials
	URLFormat     string
	UserStreamURL string
}

func NewClient

func NewClient(consumer, token *oauth.Credentials) *Client

func (*Client) AddListMember

func (c *Client) AddListMember(params *Values) (*List, error)

func (*Client) AddListMembers

func (c *Client) AddListMembers(params *Values) (*List, error)

func (*Client) CreateList

func (c *Client) CreateList(params *Values) (*List, error)

func (*Client) DeleteList

func (c *Client) DeleteList(params *Values) (*List, error)

func (*Client) DeleteListMember

func (c *Client) DeleteListMember(params *Values) (*List, error)

func (*Client) DeleteListMembers

func (c *Client) DeleteListMembers(params *Values) (*List, error)

func (*Client) GET

func (c *Client) GET(path string, params *Values, data interface{}) error

func (*Client) GetAccessToken

func (c *Client) GetAccessToken(verifier string) error

func (*Client) GetAccountSettings

func (c *Client) GetAccountSettings(params *Values) (*AccountSettings, error)

func (*Client) GetFollowerIDs

func (c *Client) GetFollowerIDs(params *Values) (*UserIDs, error)

func (*Client) GetFriendsIDs

func (c *Client) GetFriendsIDs(params *Values) (*UserIDs, error)

func (*Client) GetList

func (c *Client) GetList(params *Values) (*List, error)

func (*Client) GetListMembers

func (c *Client) GetListMembers(params *Values) (*ListMembers, error)

func (*Client) GetLists

func (c *Client) GetLists(params *Values) ([]List, error)

func (*Client) GetUser

func (c *Client) GetUser(params *Values) (*User, error)

func (*Client) GetUserProfileBanner

func (c *Client) GetUserProfileBanner(params *Values) (*Images, error)

func (*Client) GetUsers

func (c *Client) GetUsers(params *Values) ([]User, error)

func (*Client) NewStreaming

func (c *Client) NewStreaming(method, urlStr string, params *Values) (*Streaming, error)

func (*Client) NewUserStream

func (c *Client) NewUserStream(params *Values) (*Streaming, error)

func (*Client) POST

func (c *Client) POST(path string, params *Values, data interface{}) error

func (*Client) ReportSpamUser

func (c *Client) ReportSpamUser(params *Values) (*User, error)

func (*Client) RequestTokenURL

func (c *Client) RequestTokenURL(callback string) (string, error)

func (*Client) SearchUsers

func (c *Client) SearchUsers(params *Values) ([]User, error)

func (*Client) UpdateAccountSettings

func (c *Client) UpdateAccountSettings(params *Values) (*AccountSettings, error)

func (*Client) VerifyCredentials

func (c *Client) VerifyCredentials(params *Values) (*User, error)

type Contributor

type Contributor struct {
	ID
	ScreenName string `json:"screen_name"`
}

type Coordinates

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

type Cursor

type Cursor struct {
	PreviousCursor    int64  `json:"previous_cursor"`
	PreviousCursorStr string `json:"previous_cursor_str"`
	NextCursor        int64  `json:"next_cursor"`
	NextCursorStr     string `json:"next_cursor_str"`
}

type DirectMessage

type DirectMessage struct {
	ID
	CreatedAt           Time     `json:"created_at"`
	Entities            Entities `json:"entities"`
	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"`
}

type Entities

type Entities struct {
	Hashtags     []HashtagEntity     `json:"hashtags"`
	Media        []MediaEntity       `json:"media"`
	URLs         []URLEntity         `json:"urls"`
	UserMentions []UserMentionEntity `json:"user_mentions"`
	Symbols      []SymbolEntity      `json:"symbols"`
}

type Entity

type Entity struct {
	Indices [2]int `json:"indices"`
}

type Error

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

func (*Error) Error

func (e *Error) Error() string

type Errors

type Errors struct {
	Status     string  `json:"status"`
	StatusCode int     `json:"status_code"`
	Errors     []Error `json:"errors"`
}

func NewErrors

func NewErrors(r *http.Response) *Errors

func (*Errors) Error

func (e *Errors) Error() string

type HashtagEntity

type HashtagEntity SymbolEntity

type ID

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

type Image

type Image struct {
	H   int    `json:"h"`
	W   int    `json:"w"`
	URL string `json:"url"`
}

type Images

type Images struct {
	Sizes map[string]Image `json:"sizes"`
}

type List

type List struct {
	ID
	Slug            string `json:"slug"`
	Name            string `json:"name"`
	CreatedAt       Time   `json:"created_at"`
	URI             string `json:"uri"`
	SubscriberCount int    `json:"subscriber_count"`
	MemberCount     int    `json:"member_count"`
	Mode            string `json:"mode"`
	FullName        string `json:"full_name"`
	Description     string `json:"description"`
	User            User   `json:"user"`
	Following       bool   `json:"following"`
}

type ListMembers

type ListMembers struct {
	Cursor
	Users []User `json:"users"`
}

type MediaEntity

type MediaEntity struct {
	URLEntity
	ID
	MediaURL      string           `json:"media_url"`
	MediaURLHttps string           `json:"media_url_https"`
	Sizes         MediaEntitySizes `json:"sizes"`
	Type          string           `json:"type"`
	VideoInfo     *VideoInfo       `json:"video_info"`
}

type MediaEntitySize

type MediaEntitySize struct {
	H      int    `json:"h"`
	Resize string `json:"resize"`
	W      int    `json:"w"`
}

type MediaEntitySizes

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

type Place

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

type PlaceBoundingBox

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

type Streaming

type Streaming struct {
	*http.Response
	Event chan interface{}
	Error chan error
	// contains filtered or unexported fields
}

func (*Streaming) Close

func (s *Streaming) Close()

func (*Streaming) Decode

func (s *Streaming) Decode() (interface{}, error)

func (*Streaming) Start

func (s *Streaming) Start()

func (*Streaming) Stop

func (s *Streaming) Stop()

type StreamingControlEvent

type StreamingControlEvent struct {
	Control struct {
		ControlURI string `json:"control_uri"`
	} `json:"control"`
}

type StreamingDeleteDirectMessageEvent

type StreamingDeleteDirectMessageEvent struct {
	Delete struct {
		DirectMessage StreamingDeletedObject `json:"direct_message"`
	} `json:"delete"`
}

type StreamingDeleteLocationEvent

type StreamingDeleteLocationEvent struct {
	ScrubGeo 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"`
	} `json:"scrub_geo"`
}

type StreamingDeleteTweetEvent

type StreamingDeleteTweetEvent struct {
	Delete struct {
		Status      StreamingDeletedObject `json:"status"`
		TimestampMS int64                  `json:"timestamp_ms"`
	} `json:"delete"`
}

type StreamingDeletedObject

type StreamingDeletedObject struct {
	ID
	UserID    int64  `json:"user_id"`
	UserIDStr string `json:"user_id_str"`
}

type StreamingDirectMessageEvent

type StreamingDirectMessageEvent struct {
	DirectMessage DirectMessage `json:"direct_message"`
}

type StreamingDisconnectEvent

type StreamingDisconnectEvent struct {
	Disconnect struct {
		Code       int    `json:"code"`
		StreamName string `json:"stream_name"`
		Reason     string `json:"reason"`
	} `json:"disconnect"`
}

type StreamingEnvelopeEvent

type StreamingEnvelopeEvent struct {
	ForUser int64 `json:"for_user"`
	Message struct {
		Friends []int64 `json:"friends"`
	} `json:"message"`
}

type StreamingFriendsEvent

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

type StreamingGeneralEvent

type StreamingGeneralEvent struct {
	Event        string      `json:"event"`
	Source       User        `json:"source"`
	Target       User        `json:"target"`
	TargetObject interface{} `json:"target_object"`
	CreatedAt    Time        `json:"created_at"`
}

type StreamingLimitEvent

type StreamingLimitEvent struct {
	Limit struct {
		Track int `json:"track"`
	} `json:"limit"`
}

type StreamingListEvent

type StreamingListEvent struct {
	StreamingGeneralEvent
	TargetObject List `json:"target_object"`
}

type StreamingStatusWithheldEvent

type StreamingStatusWithheldEvent struct {
	StatusWithheld StreamingWithheldObject `json:"status_withheld"`
}

type StreamingTweetEvent

type StreamingTweetEvent struct {
	StreamingGeneralEvent
	TargetObject Tweet `json:"target_object"`
}

type StreamingUserWithheldEvent

type StreamingUserWithheldEvent struct {
	UserWithheld StreamingWithheldObject `json:"user_withheld"`
}

type StreamingWarningEvent

type StreamingWarningEvent struct {
	Warning struct {
		Code        int    `json:"code"`
		Message     string `json:"message"`
		PercentFull int    `json:"percent_full"`
		UserID      int64  `json:"user_id"`
	} `json:"warning"`
}

type StreamingWithheldObject

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

type SymbolEntity

type SymbolEntity struct {
	Entity
	Text string `json:"text"`
}

type Time

type Time struct {
	time.Time
}

func (*Time) MarshalJSON

func (t *Time) MarshalJSON() ([]byte, error)

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(b []byte) (err error)

type TimeZone

type TimeZone struct {
	Name       string `json:"name"`
	UTCOffset  int    `json:"utc_offset"`
	TZInfoName string `json:"tzinfo_name"`
}

type TrendLocation

type TrendLocation struct {
	Name        string         `json:"name"`
	CountryCode string         `json:"country_code"`
	URL         string         `json:"url"`
	WOEID       int            `json:"woeid"`
	PlaceType   TrendPlaceType `json:"placeType"`
	ParentID    int            `json:"parentid"`
	Country     string         `json:"country"`
}

type TrendPlaceType

type TrendPlaceType struct {
	Name string `json:"name"`
	Code int    `json:"code"`
}

type Tweet

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

type URLEntity

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

type User

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

type UserIDs

type UserIDs struct {
	Cursor
	IDs []int64 `json:"ids"`
}

type UserMentionEntity

type UserMentionEntity struct {
	Entity
	ID
	Name       string `json:"name"`
	ScreenName string `json:"screen_name"`
}

type Values

type Values map[string]string

func (*Values) AddNextCursor

func (v *Values) AddNextCursor(cursor Cursor) *Values

func (*Values) AddPreviousCursor

func (v *Values) AddPreviousCursor(cursor Cursor) *Values

func (*Values) ParseURL

func (v *Values) ParseURL(urlStr string) string

func (*Values) ToURLValues

func (v *Values) ToURLValues() (u url.Values)

type VideoInfo

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

type VideoInfoVariant

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

Jump to

Keyboard shortcuts

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