twistream: github.com/otiai10/twistream Index | Examples | Files

package twistream

import "github.com/otiai10/twistream"

Definitions of properties in Status

Index

Examples

Package Files

api.go properties.go status.go timeline.go

type Status Uses

type Status struct {
    CreatedAt            string   `json:"created_at"`
    Id                   int64    `json:"id"`
    IdStr                string   `json:"id_str"`
    Text                 string   `json:"text"`
    Source               string   `json:"source"`
    Truncated            bool     `json:"truncated"`
    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"`
    InReplyToScreenName  string   `json:"in_reply_to_screen_name"`
    User                 user     `json:"user"`
    Geo                  geo      `json:"geo"`
    Place                string   `json:"place"`
    Contributors         []int64  `json:"contributors"`
    RetweetCount         int      `json:"retweet_count"`
    FavoriteCount        int      `json:"favorite_count"`
    Entities             entities `json:"entities"`
    Favorited            bool     `json:"favorited"`
    Retweeted            bool     `json:"retweeted"`
    FilterLevel          string   `json:"filter_level"`
    Lang                 string   `json:"lang"`
}

func (Status) ToParams Uses

func (s Status) ToParams() map[string]string

type Timeline Uses

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

func New Uses

func New(endpoint, consumerKey, consumerSecret, accessToken, accessTokenSecret string) (tl *Timeline, e error)

New provides new reference for specified Timeline.

func (*Timeline) Listen Uses

func (tl *Timeline) Listen() <-chan Status

Listen bytes sent from Twitter Streaming API and send completed status to the channel.

Code:

timeline, _ := twistream.New(
    "https://userstream.twitter.com/1.1/user.json",
    "CONSUMER_KEY",
    "CONSUMER_SECRET",
    "ACCESS_TOKEN",
    "ACCESS_TOKEN_SECRET",
)
// Practically, you would run this loop by goroutine
for {
    status := <-timeline.Listen()
    fmt.Println(status)
}

func (*Timeline) Tweet Uses

func (tl *Timeline) Tweet(status Status) (e error)

Tweet posts status to the timeline

Package twistream imports 6 packages (graph). Updated 2016-07-22. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).