trailer

package module
v0.0.0-...-6e86a73 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2014 License: MIT Imports: 8 Imported by: 0

README

twitter-trailer
===============

-----
About
-----
This is a Twitter Streaming API Client written in Go.


-------
License
-------
twitter-trailer is licensed under the MIT LICENSE.
See `./LICENSE.rst <./LICENSE.rst>`_.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(token, secret string) *Client

func (*Client) Filter

func (client *Client) Filter(follow []string, track []string, locations []string, handler Handler, numGoroutine int) (err error)

func (*Client) Sample

func (client *Client) Sample(handler Handler, numGoroutine int) (err error)

func (*Client) SetAccessToken

func (client *Client) SetAccessToken(token, secret string)

func (*Client) UserStream

func (client *Client) UserStream(handler Handler, numGoroutine int) (err error)

type DeleteEvent

type DeleteEvent struct {
	Delete struct {
		Status struct {
			Id     uint64 `json:"id"`
			UserId uint64 `json:"user_id"`
		} `json:"status"`
	} `json:"delete"`
}

type Entity

type Entity struct {
	Indices Indices `json:"indices"`
}

type Event

type Event struct {
	Target       User                   `json:"target"`
	Source       User                   `json:"source"`
	Event        string                 `json:"event"`
	TargetObject map[string]interface{} `json:"target_object"`
}

type Handler

type Handler interface {
	OnStatus(*Tweet)
	OnDelete(*DeleteEvent)
	OnEvent(*Event)
}

type Hashtag

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

type Indices

type Indices [2]uint

type TrailerError

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

func (*TrailerError) Error

func (err *TrailerError) Error() string

type Tweet

type Tweet struct {
	Id uint64 `json:"id"`

	Favorited       bool   `json:"favorited"`
	Retweeted       bool   `json:"retweeted"`
	RetweetedStatus *Tweet `json:"retweeted_status"`

	RetweetCount   uint `json:"retweet_count"`
	FavoritesCount uint `json:"favourites_count"`

	Text string `json:"text"`

	User     User `json:"user"`
	Entities struct {
		Urls         []Url         `json:"urls"`
		Hashtags     []Hashtag     `json:"hashtags"`
		UserMentions []UserMention `json:"user_mentions"`
	} `json:"entities"`

	InReplyToUserId     uint64 `json:"in_reply_to_user_id"`
	InReplyToScreenName string `json:"in_reply_to_screen_name"`
	InReplyToStatusId   uint64 `json:"in_reply_to_status_id"`
}

type Url

type Url struct {
	ExpandedUrl string `json:"expanded_url"`
	Url         string `json:"url"`
	DisplayUrl  string `json:"display_url"`
	Entity
}

type User

type User struct {
	Id          uint64 `json:"id"`
	ScreenName  string `json:"screen_name"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Url         string `json:"url"`

	StatusesCount  uint64 `json:"statuses_count"`
	FriendsCount   uint64 `json:"friends_count"`
	FollowersCount uint64 `json:"followers_count"`
	FavoritesCount uint64 `json:"favourites_count"`
	ListedCount    uint64 `json:"listed_count"`

	Verified            bool `json:"verified"`
	IsTranslator        bool `json:"is_translator"`
	IsTranslatorEnabled bool `json:"is_translation_enabled"`

	ProfileImageUrl      string `json:"profile_image_url"`
	ProfileImageUrlHttps string `json:"profile_image_url_https"`
	DefaultProfileImage  bool   `json:"default_profile_image"`

	ProfileBackgroundImageUrl      string `json:"profile_background_image_url"`
	ProfileBackgroundImageUrlHttps string `json:"profile_background_image_url_https"`
	ProfileBackgroundTile          bool   `json:"profile_background_tile"`
	ProfileBackgroundColor         string `json:"profile_background_color"`
	ProfileUseBackgroundImage      bool   `json:"profile_use_background_image"`

	ProfileLinkColor string `json:"profile_link_color"`
	ProfileTextColor string `json:"profile_text_color"`

	ProfileSidebarBorderColor string `json:"profile_sidebar_border_color"`
	ProfileSidebarFillColor   string `json:"profile_sidebar_fill_color"`

	DefaultProfile bool `json:"default_profile"`
}

type UserMention

type UserMention struct {
	Id         uint64 `json:"id"`
	ScreenName string `json:"screen_name"`
	Name       string `json:"name"`
	Entity
}

Jump to

Keyboard shortcuts

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