tweetlib

package module
v1.0.0-...-c8670ea Latest Latest
Warning

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

Go to latest
Published: May 2, 2013 License: BSD-3-Clause Imports: 17 Imported by: 0

README

tweetlib

A fully OAuth-authenticated library to interact with the new Twitter's REST API

Installing

Best way to isntall this package is by running goinstall:

goinstall github.com/robteix/tweetlib

And then you can import it in your code like this:

import (
        ...
        "github.com/robteix/tweetlib"
        ...
    )

And of course, if you want to do it manually, just check the code, cd to the project's root dir and do a:

gomake install

General use

  1. First create a tweetlib.Transport that will handle OAuth:

     config := &Config{
                 ConsumerKey: "your-consumer-key",
                 ConsumerSecret: "your-consumer-secret",
                 Callback: "http://www.my-app.com/my-callback"}
     token := &Token{
                 OAuthSecret: "your-oauth-secret",
                 OAuthToken: "your-oauth-token"}
     tr := &tweetlib.Transport{Config: config,
                           Token: token}
    
  2. Create a tweetlib object:

     tl := tweetlib.New(tr.Client())
    
  3. Post a tweet:

     tl.Tweets.Update("this is cool!").Do()
    
  4. Get the 10 last tweets of your home timeline:

     if tweets, ok := tl.Timelines.HomeTimeline().Count(10).Do(); ok {
         for _, tweet := range tweets {
             fmt.Println(tweet.Message)
         }
     }
    
  5. Get a specific tweet, get only basic User info

     tweet, err := tl.Tweets.Show("12345678").TrimUser(true).Do()
    
  6. Retweet a tweet

     tl.Tweets.Retweet("12345").Do()
    
  7. Delete a tweet

     tl.Tweets.Destroy("1234556").Do()
    

Check out http://dev.twitter.com/api/docs/ for more.

Obtaining a Twitter Access Token

In order to autheticate with Twitter and perform actions on behalf of an user, Twitter requires you to request an Access Token. The process is often confusing to many people, so I thought I'd go through the whole process here. You'll see that with tweetlib this will be quite simple to do:

  1. The first thing you need to do is to create a new Twitter application by going to: http://dev.twitter.com/apps/new

  2. You will need to take note of the Consumer Key and Consumer Secret of your new Twitter application.

  3. In order to take actions on behalf of a users, we need to start our OAuth dance with Twitter. The first thing to do is to create a new tweetlib Transport with an empty Token:

     config := &Config{
             ConsumerKey: "your-consumer-key",
             ConsumerSecret: "your-consumer-secret",
             Callback: "http://www.my-app.com/my-callback"}
     tr := &tweetlib.Transport{Config: config,
                           Token: &Token{}}
    
  4. (Optional) tweetlib.Transport uses the http package to talk to Twitter. If you need to (e.g., you're using Google App Engine), you can set a custom underlying transport to be used. E.g:

     tr.Transport = &urlfetch.Transport{Context: c}
    
  5. Now it's time to request a temporary token. This is the actual beginning of the OAuth dance with Twitter

     tt, err := tr.TempToken()
    
  6. With tweetlib.TempToken ready, you will not need your user to authorize your application to use Twitter on their behalf. This is done by redirecting your user to an authorization URL.

     authorizationURL := tt.AUthURL()
     // redirect the user to it...
    
  7. After the user authorizes your application to take action on their behalf, Twitter will send a verification code to your callback. More on that step 7 below.

  8. You now need to wait for Twitter to get back to you. They will do so by doing a GET on the callback specified in your tweetlib.Config (step 3 above.) Twitter will send two parameters to your callback: oauth_token (same as your TempToken.Token) and an oauth_verifier. You're almost ready. Now you only need to exchange your tweetlib.TempToken for a permanent one.

     tok, err := tr.AccessToken(tt, oauth_verifier)
    
  9. Note that you do not need to update your tweetlib.Transport.Token with the new token, since this is done automatically. You should save the token for future use, though, so you don't have to go through all this dance again.

License

Copyright 2011 The Tweetlib Authors. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of Google Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Documentation

Overview

tweetlib - A fully oauth-authenticated Go Twitter library

Copyright 2011 The Tweetlib Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrOAuth = errors.New("OAuth failure")
)

Functions

This section is empty.

Types

type AccountRateLimitStatusCall

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

func (*AccountRateLimitStatusCall) Do

type AccountService

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

func (*AccountService) RateLimitStatus

func (r *AccountService) RateLimitStatus() *AccountRateLimitStatusCall

func (*AccountService) UpdateProfile

func (r *AccountService) UpdateProfile() *AccountUpdateProfileCall

func (*AccountService) VerifyCredentials

func (r *AccountService) VerifyCredentials() *AccountVerifyCredentialsCall

type AccountUpdateProfileCall

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

func (*AccountUpdateProfileCall) Description

func (c *AccountUpdateProfileCall) Description(description string) *AccountUpdateProfileCall

func (*AccountUpdateProfileCall) Do

func (c *AccountUpdateProfileCall) Do() (*User, error)

func (*AccountUpdateProfileCall) IncludeEntities

func (c *AccountUpdateProfileCall) IncludeEntities(include_entities bool) *AccountUpdateProfileCall

func (*AccountUpdateProfileCall) Location

func (*AccountUpdateProfileCall) Name

func (*AccountUpdateProfileCall) SkipStatus

func (c *AccountUpdateProfileCall) SkipStatus(skip_status bool) *AccountUpdateProfileCall

func (*AccountUpdateProfileCall) Url

type AccountVerifyCredentialsCall

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

func (*AccountVerifyCredentialsCall) Do

func (*AccountVerifyCredentialsCall) IncludeEntities

func (c *AccountVerifyCredentialsCall) IncludeEntities(include_entities bool) *AccountVerifyCredentialsCall

func (*AccountVerifyCredentialsCall) SkipStatus

type Category

type Category struct {
	Name  string    `json:"name"`
	Slug  string    `json:"slug"`
	Size  int       `json:"size"`
	Users *UserList `json:"users"`
}

type CategoryList

type CategoryList []Category

type Config

type Config struct {
	ConsumerKey    string
	ConsumerSecret string
	Callback       string
}

type Configuration

type Configuration struct {
	CharactersReservedPerMedia int                  `json:"characters_reserved_per_media"`
	MaxMediaPerUpload          int                  `json:"max_media_per_upload"`
	NonUsernamePaths           []string             `json:"non_username_paths"`
	PhotoSizeLimit             int                  `json:"photo_size_limit"`
	PhotoSizes                 map[string]PhotoSize `json:"photo_sizes"`
	ShortUrlLengthHttps        int                  `json:"short_url_length_https"`
	ShortUrlLength             int                  `json:"short_url_length"`
}

type DMDestroyCall

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

func (*DMDestroyCall) Do

func (c *DMDestroyCall) Do() (*Message, error)

func (*DMDestroyCall) Id

func (c *DMDestroyCall) Id(id string) *DMDestroyCall

func (*DMDestroyCall) IncludeEntities

func (c *DMDestroyCall) IncludeEntities(include_entities bool) *DMDestroyCall

type DMMessagesCall

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

func (*DMMessagesCall) Count

func (c *DMMessagesCall) Count(count int) *DMMessagesCall

func (*DMMessagesCall) Do

func (c *DMMessagesCall) Do() (*MessageList, error)

func (*DMMessagesCall) IncludeEntities

func (c *DMMessagesCall) IncludeEntities(include_entities bool) *DMMessagesCall

func (*DMMessagesCall) MaxId

func (c *DMMessagesCall) MaxId(max_id string) *DMMessagesCall

func (*DMMessagesCall) Page

func (c *DMMessagesCall) Page(page int) *DMMessagesCall

func (*DMMessagesCall) SinceId

func (c *DMMessagesCall) SinceId(since_id string) *DMMessagesCall

func (*DMMessagesCall) SkipStatus

func (c *DMMessagesCall) SkipStatus(skip_status bool) *DMMessagesCall

type DMMessagesSentCall

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

func (*DMMessagesSentCall) Count

func (c *DMMessagesSentCall) Count(count int) *DMMessagesSentCall

func (*DMMessagesSentCall) Do

func (c *DMMessagesSentCall) Do() (*MessageList, error)

func (*DMMessagesSentCall) IncludeEntities

func (c *DMMessagesSentCall) IncludeEntities(include_entities bool) *DMMessagesSentCall

func (*DMMessagesSentCall) MaxId

func (c *DMMessagesSentCall) MaxId(max_id string) *DMMessagesSentCall

func (*DMMessagesSentCall) Page

func (c *DMMessagesSentCall) Page(page int) *DMMessagesSentCall

func (*DMMessagesSentCall) SinceId

func (c *DMMessagesSentCall) SinceId(since_id string) *DMMessagesSentCall

type DMNewCall

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

func (*DMNewCall) Do

func (c *DMNewCall) Do() (*Tweet, error)

func (*DMNewCall) ScreenName

func (c *DMNewCall) ScreenName(screen_name string) *DMNewCall

func (*DMNewCall) UserId

func (c *DMNewCall) UserId(user_id string) *DMNewCall
func (c *DMNewCall) WrapLinks(wrap_links bool) *DMNewCall

type DMService

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

func (*DMService) Destroy

func (r *DMService) Destroy(id string) *DMDestroyCall

func (*DMService) Messages

func (r *DMService) Messages() *DMMessagesCall

func (*DMService) MessagesSent

func (r *DMService) MessagesSent() *DMMessagesSentCall

func (*DMService) New

func (r *DMService) New(text string) *DMNewCall

func (*DMService) Show

func (r *DMService) Show(id string) *DMShowCall

type DMShowCall

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

func (*DMShowCall) Do

func (c *DMShowCall) Do() (*Message, error)

type Entities

type Entities struct {
	Media *[]MediaEntity
	Urls  *[]UrlEntity
}

type HelpConfigurationCall

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

func (*HelpConfigurationCall) Do

type HelpService

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

func (*HelpService) Configuration

func (r *HelpService) Configuration() *HelpConfigurationCall

type LimitStatus

type LimitStatus struct {
	RemainingHits      int          `json:"remaining_hits"`
	ResetTimeInSeconds int          `json:"reset_time_in_secods"`
	HourlyLimit        int          `json:"hourly_limit"`
	ResetTime          string       `json:"reset_time"`
	Photos             *PhotoLimits `json:"photos"`
}

type List

type List struct {
	User            *User  `json:"user"`
	Name            string `json:"name"`
	Slug            string `json:"slug"`
	Mode            string `json:"mode"`
	IdStr           string `json:"id_str"`
	Uri             string `json:"uri"`
	Id              int    `json:"id"`
	MemberCount     int    `json:"member_count"`
	Following       bool   `json:"following"`
	FullName        string `json:"full_name"`
	SubscriberCount int    `json:"subscriber_count"`
	Description     string `json:"description"`
}

type ListList

type ListList []List

type ListsAllCall

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

func (*ListsAllCall) Do

func (c *ListsAllCall) Do() (*ListList, error)

func (*ListsAllCall) ScreenName

func (c *ListsAllCall) ScreenName(screen_name string) *ListsAllCall

func (*ListsAllCall) UserId

func (c *ListsAllCall) UserId(user_id string) *ListsAllCall

type ListsService

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

func (*ListsService) All

func (r *ListsService) All() *ListsAllCall

type MediaEntity

type MediaEntity struct {
	Id_str          string
	Media_url       string
	Media_url_https string
}

type Message

type Message struct {
	CreatedAt           string `json:"created_at"`
	SenderScreenName    string `json:"sender_screen_name"`
	Sender              *User  `json:"sender"`
	Text                string `json:"text"`
	RecipientScreenName string `json:"recipient_screen_name"`
	Id                  string `json:"id"`
	Recipient           *User  `json:"recipient"`
	RecipientId         string `json:"recipient_id"`
	SenderId            string `json:"sender_id"`
}

type MessageList

type MessageList []Message

type PhotoLimits

type PhotoLimits struct {
	RemainingHits      int    `json:"remaining_hits"`
	ResetTimeInSeconds int    `json:"reset_time_in_secods"`
	ResetTime          string `json:"reset_time"`
	DailyLimit         int    `json:"daily_limit"`
}

type PhotoSize

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

type SearchSearchCall

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

func (*SearchSearchCall) Callback

func (c *SearchSearchCall) Callback(callback string) *SearchSearchCall

func (*SearchSearchCall) Do

func (c *SearchSearchCall) Do() (*TweetList, error)

func (*SearchSearchCall) Geocode

func (c *SearchSearchCall) Geocode(geocode string) *SearchSearchCall

func (*SearchSearchCall) IncludeEntities

func (c *SearchSearchCall) IncludeEntities(include_entities bool) *SearchSearchCall

func (*SearchSearchCall) Lang

func (c *SearchSearchCall) Lang(lang string) *SearchSearchCall

func (*SearchSearchCall) Locale

func (c *SearchSearchCall) Locale(locale string) *SearchSearchCall

func (*SearchSearchCall) Page

func (c *SearchSearchCall) Page(page int) *SearchSearchCall

func (*SearchSearchCall) ResultType

func (c *SearchSearchCall) ResultType(result_type string) *SearchSearchCall

func (*SearchSearchCall) Rpp

func (c *SearchSearchCall) Rpp(rpp int) *SearchSearchCall

func (*SearchSearchCall) ShowUser

func (c *SearchSearchCall) ShowUser(show_user bool) *SearchSearchCall

func (*SearchSearchCall) SinceId

func (c *SearchSearchCall) SinceId(since_id string) *SearchSearchCall

func (*SearchSearchCall) Until

func (c *SearchSearchCall) Until(until string) *SearchSearchCall

type SearchService

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

func (*SearchService) Search

func (r *SearchService) Search(q string) *SearchSearchCall

type Service

type Service struct {
	Timelines *TimelinesService
	Tweets    *TweetsService
	Help      *HelpService
	Search    *SearchService
	DM        *DMService
	Users     *UsersService
	Account   *AccountService
	Lists     *ListsService
	// contains filtered or unexported fields
}

func New

func New(client *http.Client) (*Service, error)

type TempToken

type TempToken struct {
	Token  string
	Secret string
}

func (*TempToken) AuthURL

func (tt *TempToken) AuthURL() string

type TimelinesHomeTimelineCall

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

func (*TimelinesHomeTimelineCall) ContributorDetails

func (c *TimelinesHomeTimelineCall) ContributorDetails(contributor_details bool) *TimelinesHomeTimelineCall

func (*TimelinesHomeTimelineCall) Count

func (*TimelinesHomeTimelineCall) Do

func (*TimelinesHomeTimelineCall) ExcludeReplies

func (c *TimelinesHomeTimelineCall) ExcludeReplies(exclude_replies bool) *TimelinesHomeTimelineCall

func (*TimelinesHomeTimelineCall) IncludeEntities

func (c *TimelinesHomeTimelineCall) IncludeEntities(include_entities bool) *TimelinesHomeTimelineCall

func (*TimelinesHomeTimelineCall) IncludeRTS

func (c *TimelinesHomeTimelineCall) IncludeRTS(include_rts bool) *TimelinesHomeTimelineCall

func (*TimelinesHomeTimelineCall) MaxId

func (*TimelinesHomeTimelineCall) Page

func (*TimelinesHomeTimelineCall) SinceId

func (*TimelinesHomeTimelineCall) TrimUser

type TimelinesListCall

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

func (*TimelinesListCall) Count

func (c *TimelinesListCall) Count(count int) *TimelinesListCall

Language sets the optional parameter "language": Specify the preferred language to search with. See search language codes for available values.

func (*TimelinesListCall) Do

func (c *TimelinesListCall) Do() (*TweetList, error)

type TimelinesMentionsCall

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

func (*TimelinesMentionsCall) ContributorDetails

func (c *TimelinesMentionsCall) ContributorDetails(contributor_details bool) *TimelinesMentionsCall

func (*TimelinesMentionsCall) Count

func (*TimelinesMentionsCall) Do

func (*TimelinesMentionsCall) ExcludeReplies

func (c *TimelinesMentionsCall) ExcludeReplies(exclude_replies bool) *TimelinesMentionsCall

func (*TimelinesMentionsCall) IncludeEntities

func (c *TimelinesMentionsCall) IncludeEntities(include_entities bool) *TimelinesMentionsCall

func (*TimelinesMentionsCall) IncludeRTS

func (c *TimelinesMentionsCall) IncludeRTS(include_rts bool) *TimelinesMentionsCall

func (*TimelinesMentionsCall) MaxId

func (*TimelinesMentionsCall) Page

func (*TimelinesMentionsCall) SinceId

func (c *TimelinesMentionsCall) SinceId(since_id string) *TimelinesMentionsCall

func (*TimelinesMentionsCall) TrimUser

func (c *TimelinesMentionsCall) TrimUser(trim_user bool) *TimelinesMentionsCall

type TimelinesPublicTimelineCall

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

func (*TimelinesPublicTimelineCall) Do

func (*TimelinesPublicTimelineCall) IncludeEntities

func (c *TimelinesPublicTimelineCall) IncludeEntities(include_entities bool) *TimelinesPublicTimelineCall

func (*TimelinesPublicTimelineCall) TrimUser

type TimelinesRetweetedByMeCall

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

func (*TimelinesRetweetedByMeCall) ContributorDetails

func (c *TimelinesRetweetedByMeCall) ContributorDetails(contributor_details bool) *TimelinesRetweetedByMeCall

func (*TimelinesRetweetedByMeCall) Count

func (*TimelinesRetweetedByMeCall) Do

func (*TimelinesRetweetedByMeCall) ExcludeReplies

func (c *TimelinesRetweetedByMeCall) ExcludeReplies(exclude_replies bool) *TimelinesRetweetedByMeCall

func (*TimelinesRetweetedByMeCall) IncludeEntities

func (c *TimelinesRetweetedByMeCall) IncludeEntities(include_entities bool) *TimelinesRetweetedByMeCall

func (*TimelinesRetweetedByMeCall) IncludeRTS

func (c *TimelinesRetweetedByMeCall) IncludeRTS(include_rts bool) *TimelinesRetweetedByMeCall

func (*TimelinesRetweetedByMeCall) MaxId

func (*TimelinesRetweetedByMeCall) Page

func (*TimelinesRetweetedByMeCall) SinceId

func (*TimelinesRetweetedByMeCall) TrimUser

type TimelinesRetweetedByUserCall

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

func (*TimelinesRetweetedByUserCall) Count

func (*TimelinesRetweetedByUserCall) Do

func (*TimelinesRetweetedByUserCall) IncludeEntities

func (c *TimelinesRetweetedByUserCall) IncludeEntities(include_entities bool) *TimelinesRetweetedByUserCall

func (*TimelinesRetweetedByUserCall) MaxId

func (*TimelinesRetweetedByUserCall) Page

func (*TimelinesRetweetedByUserCall) SinceId

func (*TimelinesRetweetedByUserCall) TrimUser

type TimelinesRetweetedToMeCall

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

func (*TimelinesRetweetedToMeCall) ContributorDetails

func (c *TimelinesRetweetedToMeCall) ContributorDetails(contributor_details bool) *TimelinesRetweetedToMeCall

func (*TimelinesRetweetedToMeCall) Count

func (*TimelinesRetweetedToMeCall) Do

func (*TimelinesRetweetedToMeCall) ExcludeReplies

func (c *TimelinesRetweetedToMeCall) ExcludeReplies(exclude_replies bool) *TimelinesRetweetedToMeCall

func (*TimelinesRetweetedToMeCall) IncludeEntities

func (c *TimelinesRetweetedToMeCall) IncludeEntities(include_entities bool) *TimelinesRetweetedToMeCall

func (*TimelinesRetweetedToMeCall) IncludeRTS

func (c *TimelinesRetweetedToMeCall) IncludeRTS(include_rts bool) *TimelinesRetweetedToMeCall

func (*TimelinesRetweetedToMeCall) MaxId

func (*TimelinesRetweetedToMeCall) Page

func (*TimelinesRetweetedToMeCall) SinceId

func (*TimelinesRetweetedToMeCall) TrimUser

type TimelinesRetweetedToUserCall

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

func (*TimelinesRetweetedToUserCall) Count

func (*TimelinesRetweetedToUserCall) Do

func (*TimelinesRetweetedToUserCall) IncludeEntities

func (c *TimelinesRetweetedToUserCall) IncludeEntities(include_entities bool) *TimelinesRetweetedToUserCall

func (*TimelinesRetweetedToUserCall) MaxId

func (*TimelinesRetweetedToUserCall) Page

func (*TimelinesRetweetedToUserCall) SinceId

func (*TimelinesRetweetedToUserCall) TrimUser

type TimelinesRetweetsOfMeCall

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

func (*TimelinesRetweetsOfMeCall) Count

func (*TimelinesRetweetsOfMeCall) Do

func (*TimelinesRetweetsOfMeCall) IncludeEntities

func (c *TimelinesRetweetsOfMeCall) IncludeEntities(include_entities bool) *TimelinesRetweetsOfMeCall

func (*TimelinesRetweetsOfMeCall) MaxId

func (*TimelinesRetweetsOfMeCall) Page

func (*TimelinesRetweetsOfMeCall) SinceId

func (*TimelinesRetweetsOfMeCall) TrimUser

type TimelinesService

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

func (*TimelinesService) HomeTimeline

func (r *TimelinesService) HomeTimeline() *TimelinesHomeTimelineCall

func (*TimelinesService) List

func (r *TimelinesService) List(userid string) *TimelinesListCall

Search: Search all public profiles.

func (*TimelinesService) Mentions

func (r *TimelinesService) Mentions() *TimelinesMentionsCall

func (*TimelinesService) PublicTimeline

func (r *TimelinesService) PublicTimeline() *TimelinesPublicTimelineCall

func (*TimelinesService) RetweetedByMe

func (r *TimelinesService) RetweetedByMe() *TimelinesRetweetedByMeCall

func (*TimelinesService) RetweetedByUser

func (r *TimelinesService) RetweetedByUser(id string) *TimelinesRetweetedByUserCall

func (*TimelinesService) RetweetedToMe

func (r *TimelinesService) RetweetedToMe() *TimelinesRetweetedToMeCall

func (*TimelinesService) RetweetedToUser

func (r *TimelinesService) RetweetedToUser(id string) *TimelinesRetweetedToUserCall

func (*TimelinesService) RetweetsOfMe

func (r *TimelinesService) RetweetsOfMe() *TimelinesRetweetsOfMeCall

type Token

type Token struct {
	OAuthSecret string
	OAuthToken  string
}

type Transport

type Transport struct {
	*Config
	*Token

	// Transport is the HTTP transport to use when making requests.
	// It will default to http.DefaultTransport if nil.
	// (It should never be an oauth.Transport.)
	Transport http.RoundTripper
}

func (*Transport) AccessToken

func (t *Transport) AccessToken(tempToken *TempToken, oauthVerifier string) (*Token, error)

func (*Transport) Client

func (t *Transport) Client() *http.Client

Client returns an *http.Client that makes OAuth-authenticated requests.

func (*Transport) RoundTrip

func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error)

func (*Transport) TempToken

func (t *Transport) TempToken() (*TempToken, error)

type TrendLocation

type TrendLocation struct {
	Woeid       int64  `json:"woeid"`
	Name        string `json:"name"`
	CountryCode string `json:"countryCode"`
	Country     string `json:"country"`
	Url         string `json:"url"`
	PlaceType   struct {
		Code int64  `json:"code"`
		Name string `json:"name"`
	} `json:"placeType"`
}

type TrendLocationList

type TrendLocationList []TrendLocation

type Tweet

type Tweet struct {
	Contributors        string `json:"contributors"`
	User                *User  `json:"user"` // Tweet author
	Truncated           bool   `json:"truncated"`
	Text                string `json:"text"`
	InReplyToScreenName string `json:"in_reply_to_screen_name"`
	RetweetCount        int64  `json:"retweet_count"`
	Entities            struct {
		Urls []struct {
			DisplayUrl  string  `json:"display_url"`
			Indices     []int64 `json:"indices"`
			Url         string  `json:"url"`
			ExpandedUrl string  `json:"expanded_url"`
		} `json:"urls"`
		Hashtags []struct {
			Text    string  `json:"text"`
			Indices []int64 `json:"indices"`
		} `json:"hashtags"`
		UserMentions []struct {
			ScreenName string  `json:"screen_name"`
			Name       string  `json:"name"`
			Indices    []int64 `json:"indices"`
			IdStr      string  `json:"id_str"`
			Id         int64   `json:"id"`
		} `json:"user_mentions"`
	} `json:"entities"`
	Geo                  string `json:"geo"`
	InReplyToUserId      int64  `json:"in_reply_to_user_id"`
	IdStr                string `json:"id_str"`
	CreatedAt            string `json:"created_at"`
	Source               string `json:"source"`
	Id                   int64  `json:"id"`
	InReplyToStatusId    string `json:"in_reply_to_status_id"`
	PossiblySensitive    bool   `json:"possibly_sensitive"`
	Retweeted            bool   `json:"retweeted"`
	InReplyToUserIdStr   string `json:"in_reply_to_user_id_str"`
	Coordinates          string `json:"coordinates"`
	Favorited            bool   `json:"favorited"`
	Place                string `json:"place"`
	InReplyToStatusIdStr string `json:"in_reply_to_status_id_str"`
}

Tweet represents a single tweet

type TweetList

type TweetList []Tweet

type TweetsDestroyCall

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

func (*TweetsDestroyCall) Do

func (c *TweetsDestroyCall) Do() (*Tweet, error)

func (*TweetsDestroyCall) IncludeEntities

func (c *TweetsDestroyCall) IncludeEntities(include_entities bool) *TweetsDestroyCall

func (*TweetsDestroyCall) TrimUser

func (c *TweetsDestroyCall) TrimUser(trim_user bool) *TweetsDestroyCall

type TweetsRetweetCall

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

func (*TweetsRetweetCall) Do

func (c *TweetsRetweetCall) Do() (*Tweet, error)

func (*TweetsRetweetCall) IncludeEntities

func (c *TweetsRetweetCall) IncludeEntities(include_entities bool) *TweetsRetweetCall

func (*TweetsRetweetCall) TrimUser

func (c *TweetsRetweetCall) TrimUser(trim_user bool) *TweetsRetweetCall

type TweetsRetweetedByCall

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

func (*TweetsRetweetedByCall) Count

func (*TweetsRetweetedByCall) Do

func (c *TweetsRetweetedByCall) Do() (*UserList, error)

func (*TweetsRetweetedByCall) Page

type TweetsRetweetedByIdsCall

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

func (*TweetsRetweetedByIdsCall) Count

func (*TweetsRetweetedByIdsCall) Do

func (c *TweetsRetweetedByIdsCall) Do() (*[]string, error)

func (*TweetsRetweetedByIdsCall) Page

type TweetsRetweetsCall

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

func (*TweetsRetweetsCall) Count

func (c *TweetsRetweetsCall) Count(count int) *TweetsRetweetsCall

func (*TweetsRetweetsCall) Do

func (c *TweetsRetweetsCall) Do() (*TweetList, error)

func (*TweetsRetweetsCall) IncludeEntities

func (c *TweetsRetweetsCall) IncludeEntities(include_entities bool) *TweetsRetweetsCall

func (*TweetsRetweetsCall) Page

func (c *TweetsRetweetsCall) Page(page int) *TweetsRetweetsCall

func (*TweetsRetweetsCall) TrimUser

func (c *TweetsRetweetsCall) TrimUser(trim_user bool) *TweetsRetweetsCall

type TweetsService

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

func (*TweetsService) Destroy

func (r *TweetsService) Destroy(id string) *TweetsDestroyCall

func (*TweetsService) Retweet

func (r *TweetsService) Retweet(id string) *TweetsRetweetCall

func (*TweetsService) RetweetedBy

func (r *TweetsService) RetweetedBy(id string) *TweetsRetweetedByCall

func (*TweetsService) RetweetedByIds

func (r *TweetsService) RetweetedByIds(id string) *TweetsRetweetedByIdsCall

func (*TweetsService) Retweets

func (r *TweetsService) Retweets(id string) *TweetsRetweetsCall

func (*TweetsService) Show

func (r *TweetsService) Show(id string) *TweetsShowCall

func (*TweetsService) Update

func (r *TweetsService) Update(status string) *TweetsUpdateCall

Search: Search all public profiles.

func (*TweetsService) UpdateWithMedia

func (r *TweetsService) UpdateWithMedia(status, mediaName string, mediaData []byte) *TweetsUpdateWithMediaCall

type TweetsShowCall

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

func (*TweetsShowCall) Do

func (c *TweetsShowCall) Do() (*Tweet, error)

func (*TweetsShowCall) IncludeEntities

func (c *TweetsShowCall) IncludeEntities(include_entities bool) *TweetsShowCall

func (*TweetsShowCall) TrimUser

func (c *TweetsShowCall) TrimUser(trim_user bool) *TweetsShowCall

type TweetsUpdateCall

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

func (*TweetsUpdateCall) Do

func (c *TweetsUpdateCall) Do() (*Tweet, error)

type TweetsUpdateWithMediaCall

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

func (*TweetsUpdateWithMediaCall) Do

type UrlEntity

type UrlEntity struct {
	Expanded_url string
}

type User

type User struct {
	ScreenName                string `json:"screen_name"`
	ListedCount               int64  `json:"listed_count"`
	FollowersCount            int64  `json:"followers_count"`
	Location                  string `json:"location"`
	ProfileBackgroundImageUrl string `json:"profile_background_image_url"`
	Name                      string `json:"name"`
	Notifications             bool   `json:"notifications"`
	Protected                 bool   `json:"protected"`
	IdStr                     string `json:"id_str"`
	ProfileBackgroundColor    string `json:"profile_background_color"`
	CreatedAt                 string `json:"created_at"`
	Url                       string `json:"url"`
	TimeZone                  string `json:"time_zone"`
	Id                        int64  `json:"id"`
	Verified                  bool   `json:"verified"`
	ProfileLinkColor          string `json:"profile_link_color"`
	ProfileImageUrl           string `json:"profile_image_url"`
	Status                    *Tweet `json:"status"`
	ProfileUseBackgroundImage bool   `json:"profile_use_background_image"`
	FavouritesCount           int64  `json:"favourites_count"`
	ProfileSidebarFillColor   string `json:"profile_sidebar_fill_color"`
	UtcOffset                 int64  `json:"utc_offset"`
	IsTranslator              bool   `json:"is_translator"`
	FollowRequestSent         bool   `json:"follow_request_sent"`
	Following                 bool   `json:"following"`
	ProfileBackgroundTile     bool   `json:"profile_background_tile"`
	ShowAllInlineMedia        bool   `json:"show_all_inline_media"`
	ProfileTextColor          string `json:"profile_text_color"`
	Lang                      string `json:"lang"`
	StatusesCount             int64  `json:"statuses_count"`
	ContributorsEnabled       bool   `json:"contributors_enabled"`
	FriendsCount              int64  `json:"friends_count"`
	GeoEnabled                bool   `json:"geo_enabled"`
	Description               string `json:"description"`
	ProfileSidebarBorderColor string `json:"profile_sidebar_border_color"`
}

type UserList

type UserList []User

type UsersContributeesCall

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

func (*UsersContributeesCall) Do

func (c *UsersContributeesCall) Do() (*UserList, error)

func (*UsersContributeesCall) IncludeEntities

func (c *UsersContributeesCall) IncludeEntities(include_entities bool) *UsersContributeesCall

func (*UsersContributeesCall) ScreenName

func (c *UsersContributeesCall) ScreenName(screen_name string) *UsersContributeesCall

func (*UsersContributeesCall) SkipStatus

func (c *UsersContributeesCall) SkipStatus(skip_status bool) *UsersContributeesCall

func (*UsersContributeesCall) UserId

type UsersContributorsCall

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

func (*UsersContributorsCall) Do

func (c *UsersContributorsCall) Do() (*Tweet, error)

func (*UsersContributorsCall) IncludeEntities

func (c *UsersContributorsCall) IncludeEntities(include_entities bool) *UsersContributorsCall

func (*UsersContributorsCall) ScreenName

func (c *UsersContributorsCall) ScreenName(screen_name string) *UsersContributorsCall

func (*UsersContributorsCall) SkipStatus

func (c *UsersContributorsCall) SkipStatus(skip_status bool) *UsersContributorsCall

func (*UsersContributorsCall) UserId

type UsersLookUpCall

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

func (*UsersLookUpCall) Do

func (c *UsersLookUpCall) Do() (*UserList, error)

func (*UsersLookUpCall) IncludeEntities

func (c *UsersLookUpCall) IncludeEntities(include_entities bool) *UsersLookUpCall

func (*UsersLookUpCall) ScreenName

func (c *UsersLookUpCall) ScreenName(screen_name string) *UsersLookUpCall

func (*UsersLookUpCall) UserId

func (c *UsersLookUpCall) UserId(user_id string) *UsersLookUpCall

type UsersSearchCall

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

func (*UsersSearchCall) Do

func (c *UsersSearchCall) Do() (*UserList, error)

func (*UsersSearchCall) IncludeEntities

func (c *UsersSearchCall) IncludeEntities(include_entities bool) *UsersSearchCall

func (*UsersSearchCall) Page

func (c *UsersSearchCall) Page(page int) *UsersSearchCall

func (*UsersSearchCall) PerPage

func (c *UsersSearchCall) PerPage(per_page int) *UsersSearchCall

type UsersService

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

func (*UsersService) Contributees

func (r *UsersService) Contributees() *UsersContributeesCall

func (*UsersService) Contributors

func (r *UsersService) Contributors() *UsersContributorsCall

func (*UsersService) LookUp

func (r *UsersService) LookUp() *UsersLookUpCall

func (*UsersService) Search

func (r *UsersService) Search(q string) *UsersSearchCall

func (*UsersService) Show

func (r *UsersService) Show() *UsersShowCall

func (*UsersService) SuggestedCategories

func (r *UsersService) SuggestedCategories() *UsersSuggestedCategoriesCall

func (*UsersService) SuggestedUsers

func (r *UsersService) SuggestedUsers(slug string) *UsersSuggestedUsersCall

type UsersShowCall

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

func (*UsersShowCall) Do

func (c *UsersShowCall) Do() (*User, error)

func (*UsersShowCall) IncludeEntities

func (c *UsersShowCall) IncludeEntities(include_entities bool) *UsersShowCall

func (*UsersShowCall) ScreenName

func (c *UsersShowCall) ScreenName(screen_name string) *UsersShowCall

func (*UsersShowCall) UserId

func (c *UsersShowCall) UserId(user_id string) *UsersShowCall

type UsersSuggestedCategoriesCall

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

func (*UsersSuggestedCategoriesCall) Do

func (*UsersSuggestedCategoriesCall) Lang

type UsersSuggestedUsersCall

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

func (*UsersSuggestedUsersCall) Do

func (*UsersSuggestedUsersCall) Lang

Directories

Path Synopsis
misc
gen

Jump to

Keyboard shortcuts

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