anaconda: github.com/ChimeraCoder/anaconda Index | Examples | Files

package anaconda

import "github.com/ChimeraCoder/anaconda"

Package anaconda provides structs and functions for accessing version 1.1 of the Twitter API.

Successful API queries return native Go structs that can be used immediately, with no need for type assertions.

Authentication

If you already have the access token (and secret) for your user (Twitter provides this for your own account on the developer portal), creating the client is simple:

anaconda.SetConsumerKey("your-consumer-key")
anaconda.SetConsumerSecret("your-consumer-secret")
api := anaconda.NewTwitterApi("your-access-token", "your-access-token-secret")

Queries

Executing queries on an authenticated TwitterApi struct is simple.

searchResult, _ := api.GetSearch("golang", nil)
for _ , tweet := range searchResult.Statuses {
    fmt.Print(tweet.Text)
}

Certain endpoints allow separate optional parameter; if desired, these can be passed as the final parameter.

v := url.Values{}
v.Set("count", "30")
result, err := api.GetSearch("golang", v)

Endpoints

Anaconda implements most of the endpoints defined in the Twitter API documentation: https://dev.twitter.com/docs/api/1.1. For clarity, in most cases, the function name is simply the name of the HTTP method and the endpoint (e.g., the endpoint `GET /friendships/incoming` is provided by the function `GetFriendshipsIncoming`).

In a few cases, a shortened form has been chosen to make life easier (for example, retweeting is simply the function `Retweet`)

More detailed information about the behavior of each particular endpoint can be found at the official Twitter API documentation.

Index

Examples

Package Files

account.go backoff.go blocks.go configuration.go directmessage.go directmessages.go errors.go favorites.go friends_followers.go geosearch.go list.go lists.go log.go media.go mutes.go oembed.go place.go rate_limit_status.go relationship.go search.go streaming.go timeline.go trends.go tweet.go tweets.go twitter.go twitter_entities.go twitter_user.go users.go webhook.go

Constants

const (
    //Error code defintions match the Twitter documentation
    //https://developer.twitter.com/en/docs/basics/response-codes
    TwitterErrorCouldNotAuthenticate    = 32
    TwitterErrorDoesNotExist            = 34
    TwitterErrorAccountSuspended        = 64
    TwitterErrorApi1Deprecation         = 68 //This should never be needed
    TwitterErrorRateLimitExceeded       = 88
    TwitterErrorInvalidToken            = 89
    TwitterErrorOverCapacity            = 130
    TwitterErrorInternalError           = 131
    TwitterErrorCouldNotAuthenticateYou = 135
    TwitterErrorStatusIsADuplicate      = 187
    TwitterErrorBadAuthenticationData   = 215
    TwitterErrorUserMustVerifyLogin     = 231

    // Undocumented by Twitter, but may be returned instead of 34
    TwitterErrorDoesNotExist2 = 144
)
const (
    BaseUrlUserStream = "https://userstream.twitter.com/1.1"
    BaseUrlSiteStream = "https://sitestream.twitter.com/1.1"
    BaseUrlStream     = "https://stream.twitter.com/1.1"
)
const (
    ClientTimeout = 20
    BaseUrlV1     = "https://api.twitter.com/1"
    BaseUrl       = "https://api.twitter.com/1.1"
    UploadBaseUrl = "https://upload.twitter.com/1.1"
)
const DEFAULT_CAPACITY = 5
const DEFAULT_DELAY = 0 * time.Second

func NewHTTP420ErrBackoff Uses

func NewHTTP420ErrBackoff() backoff.Interface

Back off exponentially for HTTP 420 errors.

Start with a 1 minute wait and double each attempt.
Note that every HTTP 420 received increases the time you must
wait until rate limiting will no longer will be in effect for your account.

func NewHTTPErrBackoff Uses

func NewHTTPErrBackoff() backoff.Interface

Back off exponentially for HTTP errors for which reconnecting would be appropriate.

Start with a 5 second wait, doubling each attempt, up to 320 seconds.

func NewTCPIPErrBackoff Uses

func NewTCPIPErrBackoff() backoff.Interface

Back off linearly for TCP/IP level network errors.

These problems are generally temporary and tend to clear quickly.
Increase the delay in reconnects by 250ms each attempt, up to 16 seconds.

func SetConsumerKey Uses

func SetConsumerKey(consumer_key string)

SetConsumerKey will set the application-specific consumer_key used in the initial OAuth process This key is listed on https://dev.twitter.com/apps/YOUR_APP_ID/show

func SetConsumerSecret Uses

func SetConsumerSecret(consumer_secret string)

SetConsumerSecret will set the application-specific secret used in the initial OAuth process This secret is listed on https://dev.twitter.com/apps/YOUR_APP_ID/show

type AddUserToListResponse Uses

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

type ApiError Uses

type ApiError struct {
    StatusCode int
    Header     http.Header
    Body       string
    Decoded    TwitterErrorResponse
    URL        *url.URL
}

func NewApiError Uses

func NewApiError(resp *http.Response) *ApiError

func (ApiError) Error Uses

func (aerr ApiError) Error() string

ApiError supports the error interface

func (*ApiError) RateLimitCheck Uses

func (aerr *ApiError) RateLimitCheck() (isRateLimitError bool, nextWindow time.Time)

Check to see if an error is a Rate Limiting error. If so, find the next available window in the header. Use like so:

  if aerr, ok := err.(*ApiError); ok {
	  if isRateLimitError, nextWindow := aerr.RateLimitCheck(); isRateLimitError {
     	<-time.After(nextWindow.Sub(time.Now()))
	  }
  }

type BaseResource Uses

type BaseResource struct {
    Limit     int `json:"limit"`
    Remaining int `json:"remaining"`
    Reset     int `json:"reset"`
}

type Category Uses

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

type ChunkedMedia Uses

type ChunkedMedia struct {
    MediaID          int64  `json:"media_id"`
    MediaIDString    string `json:"media_id_string"`
    ExpiresAfterSecs int    `json:"expires_after_secs"`
}

type Configuration Uses

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                 struct {
        Thumb  photoSize `json:"thumb"`
        Small  photoSize `json:"small"`
        Medium photoSize `json:"medium"`
        Large  photoSize `json:"large"`
    }   `json:"photo_sizes"`
    ShortUrlLength      int `json:"short_url_length"`
    ShortUrlLengthHttps int `json:"short_url_length_https"`
}

type Contributor Uses

type Contributor struct {
    Id         int64  `json:"id"`
    IdStr      string `json:"id_str"`
    ScreenName string `json:"screen_name"`
}

Could also use User, since the fields match, but only these fields are possible in Contributor

type Coordinates Uses

type Coordinates struct {
    Coordinates [2]float64 `json:"coordinates"` // Coordinate always has to have exactly 2 values
    Type        string     `json:"type"`
}

type Cursor Uses

type Cursor struct {
    Previous_cursor     int64
    Previous_cursor_str string

    Ids []int64

    Next_cursor     int64
    Next_cursor_str string
}

type DirectMessage Uses

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"`
}

type DirectMessageDeletionNotice Uses

type DirectMessageDeletionNotice struct {
    Id        int64  `json:"id"`
    IdStr     string `json:"id_str"`
    UserId    int64  `json:"user_id"`
    UserIdStr string `json:"user_id_str"`
}

type DisconnectMessage Uses

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

type Entities Uses

type Entities struct {
    Urls []struct {
        Indices      []int  `json:"indices"`
        Url          string `json:"url"`
        Display_url  string `json:"display_url"`
        Expanded_url string `json:"expanded_url"`
    }   `json:"urls"`
    Hashtags []struct {
        Indices []int  `json:"indices"`
        Text    string `json:"text"`
    }   `json:"hashtags"`
    Url           UrlEntity `json:"url"`
    User_mentions []struct {
        Name        string `json:"name"`
        Indices     []int  `json:"indices"`
        Screen_name string `json:"screen_name"`
        Id          int64  `json:"id"`
        Id_str      string `json:"id_str"`
    }   `json:"user_mentions"`
    Media []EntityMedia `json:"media"`
}

type EntityMedia Uses

type EntityMedia struct {
    Id                   int64      `json:"id"`
    Id_str               string     `json:"id_str"`
    Media_url            string     `json:"media_url"`
    Media_url_https      string     `json:"media_url_https"`
    Url                  string     `json:"url"`
    Display_url          string     `json:"display_url"`
    Expanded_url         string     `json:"expanded_url"`
    Sizes                MediaSizes `json:"sizes"`
    Source_status_id     int64      `json:"source_status_id"`
    Source_status_id_str string     `json:"source_status_id_str"`
    Type                 string     `json:"type"`
    Indices              []int      `json:"indices"`
    VideoInfo            VideoInfo  `json:"video_info"`
    ExtAltText           string     `json:"ext_alt_text"`
}

type Event Uses

type Event struct {
    Target    *User  `json:"target"`
    Source    *User  `json:"source"`
    Event     string `json:"event"`
    CreatedAt string `json:"created_at"`
}

type EventFollow Uses

type EventFollow struct {
    Event
}

type EventList Uses

type EventList struct {
    Event
    TargetObject *List `json:"target_object"`
}

type EventTweet Uses

type EventTweet struct {
    Event
    TargetObject *Tweet `json:"target_object"`
}

type ExtendedTweet Uses

type ExtendedTweet struct {
    FullText         string   `json:"full_text"`
    DisplayTextRange []int    `json:"display_text_range"`
    Entities         Entities `json:"entities"`
    ExtendedEntities Entities `json:"extended_entities"`
}

type FollowersIdsPage Uses

type FollowersIdsPage struct {
    Ids   []int64
    Error error
}

FIXME: Might want to consolidate this with FriendsIdsPage and just

have "UserIdsPage".

type FollowersPage Uses

type FollowersPage struct {
    Followers []User
    Error     error
}

type FriendsIdsCursor Uses

type FriendsIdsCursor struct {
    Previous_cursor     int64
    Previous_cursor_str string
    Next_cursor         int64
    Next_cursor_str     string
    Ids                 []int64
}

type FriendsIdsPage Uses

type FriendsIdsPage struct {
    Ids   []int64
    Error error
}

type FriendsList Uses

type FriendsList []int64

type FriendsPage Uses

type FriendsPage struct {
    Friends []User
    Error   error
}

type Friendship Uses

type Friendship struct {
    Name        string
    Id_str      string
    Id          int64
    Connections []string
    Screen_name string
}

type GeoSearchResult Uses

type GeoSearchResult struct {
    Result struct {
        Places []struct {
            ID              string `json:"id"`
            URL             string `json:"url"`
            PlaceType       string `json:"place_type"`
            Name            string `json:"name"`
            FullName        string `json:"full_name"`
            CountryCode     string `json:"country_code"`
            Country         string `json:"country"`
            ContainedWithin []struct {
                ID          string    `json:"id"`
                URL         string    `json:"url"`
                PlaceType   string    `json:"place_type"`
                Name        string    `json:"name"`
                FullName    string    `json:"full_name"`
                CountryCode string    `json:"country_code"`
                Country     string    `json:"country"`
                Centroid    []float64 `json:"centroid"`
                BoundingBox struct {
                    Type        string        `json:"type"`
                    Coordinates [][][]float64 `json:"coordinates"`
                }   `json:"bounding_box"`
                Attributes struct {
                }   `json:"attributes"`
            }   `json:"contained_within"`
            Centroid    []float64 `json:"centroid"`
            BoundingBox struct {
                Type        string        `json:"type"`
                Coordinates [][][]float64 `json:"coordinates"`
            }   `json:"bounding_box"`
            Attributes struct {
            }   `json:"attributes"`
        } `json:"places"`
    }   `json:"result"`
    Query struct {
        URL    string `json:"url"`
        Type   string `json:"type"`
        Params struct {
            Accuracy     float64 `json:"accuracy"`
            Granularity  string  `json:"granularity"`
            Query        string  `json:"query"`
            Autocomplete bool    `json:"autocomplete"`
            TrimPlace    bool    `json:"trim_place"`
        }   `json:"params"`
    }   `json:"query"`
}

type Image Uses

type Image struct {
    W         int    `json:"w"`
    H         int    `json:"h"`
    ImageType string `json:"image_type"`
}

type LimitNotice Uses

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

type List Uses

type List struct {
    Slug            string `json:"slug"`
    Name            string `json:"name"`
    URL             string `json:"uri"`
    CreatedAt       string `json:"created_at"`
    Id              int64  `json:"id"`
    SubscriberCount int64  `json:"subscriber_count"`
    MemberCount     int64  `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 ListResponse Uses

type ListResponse struct {
    PreviousCursor int    `json:"previous_cursor"`
    NextCursor     int    `json:"next_cursor"`
    Lists          []List `json:"lists"`
}

type Location Uses

type Location struct {
    Name  string `json:"name"`
    Woeid int    `json:"woeid"`
}

type LocationDeletionNotice Uses

type LocationDeletionNotice 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"`
}

type Logger Uses

type Logger interface {
    Fatal(args ...interface{})
    Fatalf(format string, args ...interface{})

    Panic(args ...interface{})
    Panicf(format string, args ...interface{})

    // Log functions
    Critical(args ...interface{})
    Criticalf(format string, args ...interface{})

    Error(args ...interface{})
    Errorf(format string, args ...interface{})

    Warning(args ...interface{})
    Warningf(format string, args ...interface{})

    Notice(args ...interface{})
    Noticef(format string, args ...interface{})

    Info(args ...interface{})
    Infof(format string, args ...interface{})

    Debug(args ...interface{})
    Debugf(format string, args ...interface{})
}

The Logger interface provides optional logging ability for the streaming API. It can also be used to log the rate limiting headers if desired.

var BasicLogger Logger

BasicLogger is the equivalent of using log from the standard library to print to STDERR.

type Media Uses

type Media struct {
    MediaID       int64  `json:"media_id"`
    MediaIDString string `json:"media_id_string"`
    Size          int    `json:"size"`
    Image         Image  `json:"image"`
}

type MediaSize Uses

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

type MediaSizes Uses

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

type OEmbed Uses

type OEmbed struct {
    Type          string
    Width         int
    Cache_age     string
    Height        int
    Author_url    string
    Html          string
    Version       string
    Provider_name string
    Provider_url  string
    Url           string
    Author_name   string
}

type Place Uses

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

type RateLimitContext Uses

type RateLimitContext struct {
    AccessToken string `json:"access_token"`
}

type RateLimitStatusResponse Uses

type RateLimitStatusResponse struct {
    RateLimitContext RateLimitContext                   `json:"rate_limit_context"`
    Resources        map[string]map[string]BaseResource `json:"resources"`
}

type Relationship Uses

type Relationship struct {
    Target Target `json:"target"`
    Source Source `json:"source"`
}

type RelationshipResponse Uses

type RelationshipResponse struct {
    Relationship Relationship `json:"relationship"`
}

type SearchMetadata Uses

type SearchMetadata struct {
    CompletedIn   float32 `json:"completed_in"`
    MaxId         int64   `json:"max_id"`
    MaxIdString   string  `json:"max_id_str"`
    Query         string  `json:"query"`
    RefreshUrl    string  `json:"refresh_url"`
    Count         int     `json:"count"`
    SinceId       int64   `json:"since_id"`
    SinceIdString string  `json:"since_id_str"`
    NextResults   string  `json:"next_results"`
}

type SearchResponse Uses

type SearchResponse struct {
    Statuses []Tweet        `json:"statuses"`
    Metadata SearchMetadata `json:"search_metadata"`
}

func (*SearchResponse) GetNext Uses

func (sr *SearchResponse) GetNext(a *TwitterApi) (SearchResponse, error)

type Source Uses

type Source struct {
    Id                    int64
    Id_str                string
    Screen_name           string
    Following             bool
    Followed_by           bool
    Can_dm                bool
    Blocking              bool
    Muting                bool
    Marked_spam           bool
    All_replies           bool
    Want_retweets         bool
    Notifications_enabled bool
}

type StallWarning Uses

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

type StatusDeletionNotice Uses

type StatusDeletionNotice struct {
    Id        int64  `json:"id"`
    IdStr     string `json:"id_str"`
    UserId    int64  `json:"user_id"`
    UserIdStr string `json:"user_id_str"`
}

type StatusWithheldNotice Uses

type StatusWithheldNotice struct {
    Id                  int64    `json:"id"`
    UserId              int64    `json:"user_id"`
    WithheldInCountries []string `json:"withheld_in_countries"`
}

type Stream Uses

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

func (*Stream) Stop Uses

func (s *Stream) Stop()

type Suggestions Uses

type Suggestions struct {
    Category
    Users []User
}

type Target Uses

type Target struct {
    Id          int64  `json:"id"`
    Id_str      string `json:"id_str"`
    Screen_name string `json:"screen_name"`
    Following   bool   `json:"following"`
    Followed_by bool   `json:"followed_by"`
}

type TooManyFollow Uses

type TooManyFollow struct {
    Warning *struct {
        Code    string `json:"code"`
        Message string `json:"message"`
        UserId  int64  `json:"user_id"`
    } `json:"warning"`
}

type Trend Uses

type Trend struct {
    Name            string `json:"name"`
    Query           string `json:"query"`
    Url             string `json:"url"`
    PromotedContent string `json:"promoted_content"`
}

type TrendLocation Uses

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

type TrendResponse Uses

type TrendResponse struct {
    Trends    []Trend    `json:"trends"`
    AsOf      string     `json:"as_of"`
    CreatedAt string     `json:"created_at"`
    Locations []Location `json:"locations"`
}

type Tweet Uses

type Tweet struct {
    Contributors                []int64                `json:"contributors"`
    Coordinates                 *Coordinates           `json:"coordinates"`
    CreatedAt                   string                 `json:"created_at"`
    DisplayTextRange            []int                  `json:"display_text_range"`
    Entities                    Entities               `json:"entities"`
    ExtendedEntities            Entities               `json:"extended_entities"`
    ExtendedTweet               ExtendedTweet          `json:"extended_tweet"`
    FavoriteCount               int                    `json:"favorite_count"`
    Favorited                   bool                   `json:"favorited"`
    FilterLevel                 string                 `json:"filter_level"`
    FullText                    string                 `json:"full_text"`
    HasExtendedProfile          bool                   `json:"has_extended_profile"`
    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"`
    IsTranslationEnabled        bool                   `json:"is_translation_enabled"`
    Lang                        string                 `json:"lang"`
    Place                       Place                  `json:"place"`
    QuotedStatusID              int64                  `json:"quoted_status_id"`
    QuotedStatusIdStr           string                 `json:"quoted_status_id_str"`
    QuotedStatus                *Tweet                 `json:"quoted_status"`
    PossiblySensitive           bool                   `json:"possibly_sensitive"`
    PossiblySensitiveAppealable bool                   `json:"possibly_sensitive_appealable"`
    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"`
    User                        User                   `json:"user"`
    WithheldCopyright           bool                   `json:"withheld_copyright"`
    WithheldInCountries         []string               `json:"withheld_in_countries"`
    WithheldScope               string                 `json:"withheld_scope"`
}

func (Tweet) CreatedAtTime Uses

func (t Tweet) CreatedAtTime() (time.Time, error)

CreatedAtTime is a convenience wrapper that returns the Created_at time, parsed as a time.Time struct

func (Tweet) HasCoordinates Uses

func (t Tweet) HasCoordinates() bool

HasCoordinates is a helper function to easily determine if a Tweet has coordinates associated with it

func (Tweet) Latitude Uses

func (t Tweet) Latitude() (float64, error)

Latitude is a convenience wrapper that returns the latitude easily

func (Tweet) Longitude Uses

func (t Tweet) Longitude() (float64, error)

Longitude is a convenience wrapper that returns the longitude easily

func (*Tweet) UnmarshalJSON Uses

func (t *Tweet) UnmarshalJSON(data []byte) error

func (Tweet) X Uses

func (t Tweet) X() (float64, error)

X is a convenience wrapper which returns the X (Longitude) coordinate easily

func (Tweet) Y Uses

func (t Tweet) Y() (float64, error)

Y is a convenience wrapper which return the Y (Lattitude) corrdinate easily

type TwitterApi Uses

type TwitterApi struct {
    Credentials *oauth.Credentials

    HttpClient *http.Client

    // Currently used only for the streaming API
    // and for checking rate-limiting headers
    // Default logger is silent
    Log Logger
    // contains filtered or unexported fields
}

func NewTwitterApi Uses

func NewTwitterApi(access_token string, access_token_secret string) *TwitterApi

NewTwitterApi takes an user-specific access token and secret and returns a TwitterApi struct for that user. The TwitterApi struct can be used for accessing any of the endpoints available.

func NewTwitterApiWithCredentials Uses

func NewTwitterApiWithCredentials(access_token string, access_token_secret string, consumer_key string, consumer_secret string) *TwitterApi

NewTwitterApiWithCredentials takes an app-specific consumer key and secret, along with a user-specific access token and secret and returns a TwitterApi struct for that user. The TwitterApi struct can be used for accessing any of the endpoints available.

func (TwitterApi) AddMultipleUsersToList Uses

func (a TwitterApi) AddMultipleUsersToList(screenNames []string, listID int64, v url.Values) (list List, err error)

AddMultipleUsersToList implements /lists/members/create_all.json

func (TwitterApi) AddUserToList Uses

func (a TwitterApi) AddUserToList(screenName string, listID int64, v url.Values) (users []User, err error)

AddUserToList implements /lists/members/create.json

func (*TwitterApi) AuthorizationURL Uses

func (c *TwitterApi) AuthorizationURL(callback string) (string, *oauth.Credentials, error)

AuthorizationURL generates the authorization URL for the first part of the OAuth handshake. Redirect the user to this URL. This assumes that the consumer key has already been set (using SetConsumerKey or NewTwitterApiWithCredentials).

func (TwitterApi) Block Uses

func (a TwitterApi) Block(v url.Values) (user User, err error)

func (TwitterApi) BlockUser Uses

func (a TwitterApi) BlockUser(screenName string, v url.Values) (user User, err error)

func (TwitterApi) BlockUserId Uses

func (a TwitterApi) BlockUserId(id int64, v url.Values) (user User, err error)

func (*TwitterApi) Close Uses

func (c *TwitterApi) Close()

Close query queue

func (TwitterApi) CreateList Uses

func (a TwitterApi) CreateList(name, description string, v url.Values) (list List, err error)

CreateList implements /lists/create.json

func (TwitterApi) DeleteActivityWebhooks Uses

func (a TwitterApi) DeleteActivityWebhooks(v url.Values, webhookID string) (u interface{}, err error)

DeleteActivityWebhooks Removes the webhook from the provided application’s configuration. https://dev.twitter.com/webhooks/reference/del/account_activity/webhooks

func (TwitterApi) DeleteDirectMessage Uses

func (a TwitterApi) DeleteDirectMessage(id int64, includeEntities bool) (message DirectMessage, err error)

DeleteDirectMessage will destroy (delete) the direct message with the specified ID. https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/delete-message

func (TwitterApi) DeleteTweet Uses

func (a TwitterApi) DeleteTweet(id int64, trimUser bool) (tweet Tweet, err error)

DeleteTweet will destroy (delete) the status (tweet) with the specified ID, assuming that the authenticated user is the author of the status (tweet). If trimUser is set to true, only the user's Id will be provided in the user object returned.

func (TwitterApi) DeleteWHSubscription Uses

func (a TwitterApi) DeleteWHSubscription(v url.Values, webhookID string) (u interface{}, err error)

DeleteWHSubscription Deactivates subscription for the provided user context and app. After deactivation, all DM events for the requesting user will no longer be sent to the webhook URL.. https://dev.twitter.com/webhooks/reference/del/account_activity/webhooks

func (*TwitterApi) DisableThrottling Uses

func (c *TwitterApi) DisableThrottling()

Disable query throttling

func (*TwitterApi) EnableThrottling Uses

func (c *TwitterApi) EnableThrottling(rate time.Duration, bufferSize int64)

Enable query throttling using the tokenbucket algorithm

func (TwitterApi) Favorite Uses

func (a TwitterApi) Favorite(id int64) (rt Tweet, err error)

Favorite will favorite the status (tweet) with the specified ID. https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-favorites-create

func (TwitterApi) FollowUser Uses

func (a TwitterApi) FollowUser(screenName string) (user User, err error)

FollowUserId follows the user with the specified screenname (username). This implements the /friendships/create endpoint, though the function name uses the terminology 'follow' as this is most consistent with colloquial Twitter terminology.

func (TwitterApi) FollowUserId Uses

func (a TwitterApi) FollowUserId(userId int64, v url.Values) (user User, err error)

FollowUserId follows the user with the specified userId. This implements the /friendships/create endpoint, though the function name uses the terminology 'follow' as this is most consistent with colloquial Twitter terminology.

func (TwitterApi) GeoSearch Uses

func (a TwitterApi) GeoSearch(v url.Values) (c GeoSearchResult, err error)

func (TwitterApi) GetActivityWebhooks Uses

func (a TwitterApi) GetActivityWebhooks(v url.Values) (u []WebHookResp, err error)

GetActivityWebhooks represents the twitter account_activity webhook Returns all URLs and their statuses for the given app. Currently, only one webhook URL can be registered to an application. https://dev.twitter.com/webhooks/reference/get/account_activity/webhooks

func (TwitterApi) GetBlocksIds Uses

func (a TwitterApi) GetBlocksIds(v url.Values) (c Cursor, err error)

func (TwitterApi) GetBlocksList Uses

func (a TwitterApi) GetBlocksList(v url.Values) (c UserCursor, err error)

func (TwitterApi) GetConfiguration Uses

func (a TwitterApi) GetConfiguration(v url.Values) (conf Configuration, err error)

func (*TwitterApi) GetCredentials Uses

func (c *TwitterApi) GetCredentials(tempCred *oauth.Credentials, verifier string) (*oauth.Credentials, url.Values, error)

GetCredentials gets the access token using the verifier received with the callback URL and the credentials in the first part of the handshake. GetCredentials implements the third part of the OAuth handshake. The returned url.Values holds the access_token, the access_token_secret, the user_id and the screen_name.

func (*TwitterApi) GetDelay Uses

func (c *TwitterApi) GetDelay() time.Duration

func (TwitterApi) GetDirectMessages Uses

func (a TwitterApi) GetDirectMessages(v url.Values) (messages []DirectMessage, err error)

func (TwitterApi) GetDirectMessagesSent Uses

func (a TwitterApi) GetDirectMessagesSent(v url.Values) (messages []DirectMessage, err error)

func (TwitterApi) GetDirectMessagesShow Uses

func (a TwitterApi) GetDirectMessagesShow(v url.Values) (message DirectMessage, err error)

func (TwitterApi) GetFavorites Uses

func (a TwitterApi) GetFavorites(v url.Values) (favorites []Tweet, err error)

func (TwitterApi) GetFollowersIds Uses

func (a TwitterApi) GetFollowersIds(v url.Values) (c Cursor, err error)

func (TwitterApi) GetFollowersIdsAll Uses

func (a TwitterApi) GetFollowersIdsAll(v url.Values) (result chan FollowersIdsPage)

Like GetFollowersIds, but returns a channel instead of a cursor and pre-fetches the remaining results This channel is closed once all values have been fetched

func (TwitterApi) GetFollowersList Uses

func (a TwitterApi) GetFollowersList(v url.Values) (c UserCursor, err error)

func (TwitterApi) GetFollowersListAll Uses

func (a TwitterApi) GetFollowersListAll(v url.Values) (result chan FollowersPage)

Like GetFollowersList, but returns a channel instead of a cursor and pre-fetches the remaining results This channel is closed once all values have been fetched

Fetch a list of all followers without any need for managing cursors (Each page is automatically fetched when the previous one is read)

Code:

pages := api.GetFollowersListAll(nil)
for page := range pages {
    //Print the current page of followers
    fmt.Println(page.Followers)
}

func (TwitterApi) GetFollowersUser Uses

func (a TwitterApi) GetFollowersUser(id int64, v url.Values) (c Cursor, err error)

func (TwitterApi) GetFriendsIds Uses

func (a TwitterApi) GetFriendsIds(v url.Values) (c Cursor, err error)

func (TwitterApi) GetFriendsIdsAll Uses

func (a TwitterApi) GetFriendsIdsAll(v url.Values) (result chan FriendsIdsPage)

Like GetFriendsIds, but returns a channel instead of a cursor and pre-fetches the remaining results This channel is closed once all values have been fetched

func (TwitterApi) GetFriendsList Uses

func (a TwitterApi) GetFriendsList(v url.Values) (c UserCursor, err error)

func (TwitterApi) GetFriendsListAll Uses

func (a TwitterApi) GetFriendsListAll(v url.Values) (result chan FriendsPage)

Like GetFriendsList, but returns a channel instead of a cursor and pre-fetches the remaining results This channel is closed once all values have been fetched

func (TwitterApi) GetFriendsUser Uses

func (a TwitterApi) GetFriendsUser(id int64, v url.Values) (c Cursor, err error)

func (TwitterApi) GetFriendshipsIncoming Uses

func (a TwitterApi) GetFriendshipsIncoming(v url.Values) (c Cursor, err error)

func (TwitterApi) GetFriendshipsLookup Uses

func (a TwitterApi) GetFriendshipsLookup(v url.Values) (friendships []Friendship, err error)

func (TwitterApi) GetFriendshipsNoRetweets Uses

func (a TwitterApi) GetFriendshipsNoRetweets() (ids []int64, err error)

GetFriendshipsNoRetweets returns a collection of user_ids that the currently authenticated user does not want to receive retweets from. It does not currently support the stringify_ids parameter.

func (TwitterApi) GetFriendshipsOutgoing Uses

func (a TwitterApi) GetFriendshipsOutgoing(v url.Values) (c Cursor, err error)

func (TwitterApi) GetFriendshipsShow Uses

func (a TwitterApi) GetFriendshipsShow(v url.Values) (relationshipResponse RelationshipResponse, err error)

func (TwitterApi) GetHomeTimeline Uses

func (a TwitterApi) GetHomeTimeline(v url.Values) (timeline []Tweet, err error)

GetHomeTimeline returns the most recent tweets and retweets posted by the user and the users that they follow. https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-home_timeline By default, include_entities is set to "true"

func (TwitterApi) GetList Uses

func (a TwitterApi) GetList(listID int64, v url.Values) (list List, err error)

GetList implements /lists/show.json

func (TwitterApi) GetListMembers Uses

func (a TwitterApi) GetListMembers(screenName string, listID int64, v url.Values) (c UserCursor, err error)

GetListMembers implements /lists/members.json

func (TwitterApi) GetListTweets Uses

func (a TwitterApi) GetListTweets(listID int64, includeRTs bool, v url.Values) (tweets []Tweet, err error)

func (TwitterApi) GetListTweetsBySlug Uses

func (a TwitterApi) GetListTweetsBySlug(slug string, ownerScreenName string, includeRTs bool, v url.Values) (tweets []Tweet, err error)

func (TwitterApi) GetListsOwnedBy Uses

func (a TwitterApi) GetListsOwnedBy(userID int64, v url.Values) (lists []List, err error)

GetListsOwnedBy implements /lists/ownerships.json screen_name, count, and cursor are all optional values

func (TwitterApi) GetMentionsTimeline Uses

func (a TwitterApi) GetMentionsTimeline(v url.Values) (timeline []Tweet, err error)

GetMentionsTimeline returns the most recent mentions (Tweets containing a users’s @screen_name) for the authenticating user. The timeline returned is the equivalent of the one seen when you view your mentions on twitter.com. https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-mentions_timeline

func (TwitterApi) GetMutedUsersIds Uses

func (a TwitterApi) GetMutedUsersIds(v url.Values) (c Cursor, err error)

func (TwitterApi) GetMutedUsersList Uses

func (a TwitterApi) GetMutedUsersList(v url.Values) (c UserCursor, err error)

func (TwitterApi) GetOEmbed Uses

func (a TwitterApi) GetOEmbed(v url.Values) (o OEmbed, err error)

No authorization on this endpoint. Its the only one.

func (TwitterApi) GetOEmbedId Uses

func (a TwitterApi) GetOEmbedId(id int64, v url.Values) (o OEmbed, err error)

Calls GetOEmbed with the corresponding id. Convenience wrapper for GetOEmbed()

func (TwitterApi) GetRateLimits Uses

func (a TwitterApi) GetRateLimits(r []string) (rateLimitStatusResponse RateLimitStatusResponse, err error)

func (TwitterApi) GetRetweets Uses

func (a TwitterApi) GetRetweets(id int64, v url.Values) (tweets []Tweet, err error)

func (TwitterApi) GetRetweetsOfMe Uses

func (a TwitterApi) GetRetweetsOfMe(v url.Values) (tweets []Tweet, err error)

GetRetweetsOfMe returns the most recent Tweets authored by the authenticating user that have been retweeted by others. https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-retweets_of_me

func (TwitterApi) GetSearch Uses

func (a TwitterApi) GetSearch(queryString string, v url.Values) (sr SearchResponse, err error)

Code:

anaconda.SetConsumerKey("your-consumer-key")
anaconda.SetConsumerSecret("your-consumer-secret")
api := anaconda.NewTwitterApi("your-access-token", "your-access-token-secret")
search_result, err := api.GetSearch("golang", nil)
if err != nil {
    panic(err)
}
for _, tweet := range search_result.Statuses {
    fmt.Print(tweet.Text)
}

func (TwitterApi) GetSelf Uses

func (a TwitterApi) GetSelf(v url.Values) (u User, err error)

Get the user object for the authenticated user. Requests /account/verify_credentials

func (TwitterApi) GetTrendsAvailableLocations Uses

func (a TwitterApi) GetTrendsAvailableLocations(v url.Values) (locations []TrendLocation, err error)

https://developer.twitter.com/en/docs/trends/locations-with-trending-topics/api-reference/get-trends-available

func (TwitterApi) GetTrendsByPlace Uses

func (a TwitterApi) GetTrendsByPlace(id int64, v url.Values) (trendResp TrendResponse, err error)

https://developer.twitter.com/en/docs/trends/trends-for-location/api-reference/get-trends-place

func (TwitterApi) GetTrendsClosestLocations Uses

func (a TwitterApi) GetTrendsClosestLocations(lat float64, long float64, v url.Values) (locations []TrendLocation, err error)

https://developer.twitter.com/en/docs/trends/locations-with-trending-topics/api-reference/get-trends-closest

func (TwitterApi) GetTweet Uses

func (a TwitterApi) GetTweet(id int64, v url.Values) (tweet Tweet, err error)

func (TwitterApi) GetTweetsLookupByIds Uses

func (a TwitterApi) GetTweetsLookupByIds(ids []int64, v url.Values) (tweet []Tweet, err error)

func (TwitterApi) GetUserSearch Uses

func (a TwitterApi) GetUserSearch(searchTerm string, v url.Values) (u []User, err error)

func (TwitterApi) GetUserTimeline Uses

func (a TwitterApi) GetUserTimeline(v url.Values) (timeline []Tweet, err error)

GetUserTimeline returns a collection of the most recent Tweets posted by the user indicated by the screen_name or user_id parameters. https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-user_timeline

func (TwitterApi) GetUsersLookup Uses

func (a TwitterApi) GetUsersLookup(usernames string, v url.Values) (u []User, err error)

func (TwitterApi) GetUsersLookupByIds Uses

func (a TwitterApi) GetUsersLookupByIds(ids []int64, v url.Values) (u []User, err error)

func (TwitterApi) GetUsersShow Uses

func (a TwitterApi) GetUsersShow(username string, v url.Values) (u User, err error)

func (TwitterApi) GetUsersShowById Uses

func (a TwitterApi) GetUsersShowById(id int64, v url.Values) (u User, err error)

func (TwitterApi) GetUsersSuggestions Uses

func (a TwitterApi) GetUsersSuggestions(v url.Values) (c []Category, err error)

func (TwitterApi) GetUsersSuggestionsBySlug Uses

func (a TwitterApi) GetUsersSuggestionsBySlug(slug string, v url.Values) (s Suggestions, err error)

func (TwitterApi) GetWHSubscription Uses

func (a TwitterApi) GetWHSubscription(v url.Values, webhookID string) (u interface{}, err error)

GetWHSubscription Provides a way to determine if a webhook configuration is subscribed to the provided user’s Direct Messages. https://dev.twitter.com/webhooks/reference/get/account_activity/webhooks/subscriptions

func (TwitterApi) IndicateTyping Uses

func (a TwitterApi) IndicateTyping(id int64) (err error)

IndicateTyping will create a typing indicator https://developer.twitter.com/en/docs/direct-messages/typing-indicator-and-read-receipts/api-reference/new-typing-indicator

func (TwitterApi) Mute Uses

func (a TwitterApi) Mute(v url.Values) (user User, err error)

func (TwitterApi) MuteUser Uses

func (a TwitterApi) MuteUser(screenName string, v url.Values) (user User, err error)

func (TwitterApi) MuteUserId Uses

func (a TwitterApi) MuteUserId(id int64, v url.Values) (user User, err error)

func (TwitterApi) PostAccountUpdateProfile Uses

func (a TwitterApi) PostAccountUpdateProfile(v url.Values) (u User, err error)

PostAccountUpdateProfile updates the active users profile with the provided values

func (TwitterApi) PostDMToScreenName Uses

func (a TwitterApi) PostDMToScreenName(text, screenName string) (message DirectMessage, err error)

https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/new-message

func (TwitterApi) PostDMToUserId Uses

func (a TwitterApi) PostDMToUserId(text string, userId int64) (message DirectMessage, err error)

https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/new-message

func (TwitterApi) PostTweet Uses

func (a TwitterApi) PostTweet(status string, v url.Values) (tweet Tweet, err error)

PostTweet will create a tweet with the specified status message

func (TwitterApi) PostUsersReportSpam Uses

func (a TwitterApi) PostUsersReportSpam(username string, v url.Values) (u User, err error)

PostUsersReportSpam : Reports and Blocks a User by screen_name Reference : https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-users-report_spam If you don't want to block the user you should add v.Set("perform_block", "false")

func (TwitterApi) PostUsersReportSpamById Uses

func (a TwitterApi) PostUsersReportSpamById(id int64, v url.Values) (u User, err error)

PostUsersReportSpamById : Reports and Blocks a User by user_id Reference : https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-users-report_spam If you don't want to block the user you should add v.Set("perform_block", "false")

func (TwitterApi) PublicStreamFilter Uses

func (a TwitterApi) PublicStreamFilter(v url.Values) (stream *Stream)

XXX: PublicStream(Track|Follow|Locations) func is needed?

func (TwitterApi) PublicStreamFirehose Uses

func (a TwitterApi) PublicStreamFirehose(v url.Values) (stream *Stream)

XXX: To use this API authority is requied. but I dont have this. I cant test.

func (TwitterApi) PublicStreamSample Uses

func (a TwitterApi) PublicStreamSample(v url.Values) (stream *Stream)

func (TwitterApi) PutActivityWebhooks Uses

func (a TwitterApi) PutActivityWebhooks(v url.Values, webhookID string) (u interface{}, err error)

PutActivityWebhooks update webhook which reenables the webhook by setting its status to valid. https://dev.twitter.com/webhooks/reference/put/account_activity/webhooks

func (TwitterApi) RemoveMultipleUsersFromList Uses

func (a TwitterApi) RemoveMultipleUsersFromList(screenNames []string, listID int64, v url.Values) (list List, err error)

RemoveMultipleUsersFromList implements /lists/members/destroy_all.json

func (TwitterApi) RemoveUserFromList Uses

func (a TwitterApi) RemoveUserFromList(screenName string, listID int64, v url.Values) (list List, err error)

RemoveUserFromList implements /lists/members/destroy.json

func (*TwitterApi) ReturnRateLimitError Uses

func (c *TwitterApi) ReturnRateLimitError(b bool)

ReturnRateLimitError specifies behavior when the Twitter API returns a rate-limit error. If set to true, the query will fail and return the error instead of automatically queuing and retrying the query when the rate limit expires

func (TwitterApi) Retweet Uses

func (a TwitterApi) Retweet(id int64, trimUser bool) (rt Tweet, err error)

Retweet will retweet the status (tweet) with the specified ID. trimUser functions as in DeleteTweet

func (TwitterApi) SetActivityWebhooks Uses

func (a TwitterApi) SetActivityWebhooks(v url.Values) (u WebHookResp, err error)

SetActivityWebhooks represents to set twitter account_activity webhook Registers a new webhook URL for the given application context. The URL will be validated via CRC request before saving. In case the validation fails, a comprehensive error is returned. message to the requester. Only one webhook URL can be registered to an application. https://api.twitter.com/1.1/account_activity/webhooks.json

func (*TwitterApi) SetBaseUrl Uses

func (c *TwitterApi) SetBaseUrl(baseUrl string)

SetBaseUrl is experimental and may be removed in future releases.

func (*TwitterApi) SetDelay Uses

func (c *TwitterApi) SetDelay(t time.Duration)

SetDelay will set the delay between throttled queries To turn of throttling, set it to 0 seconds

func (*TwitterApi) SetLogger Uses

func (c *TwitterApi) SetLogger(l Logger)

SetLogger sets the Logger used by the API client. The default logger is silent. BasicLogger will log to STDERR using the log package from the standard library.

func (TwitterApi) SetWHSubscription Uses

func (a TwitterApi) SetWHSubscription(v url.Values, webhookID string) (u interface{}, err error)

SetWHSubscription Subscribes the provided app to events for the provided user context. When subscribed, all DM events for the provided user will be sent to the app’s webhook via POST request. https://dev.twitter.com/webhooks/reference/post/account_activity/webhooks/subscriptions

func (TwitterApi) SiteStream Uses

func (a TwitterApi) SiteStream(v url.Values) (stream *Stream)

XXX: To use this API authority is requied. but I dont have this. I cant test.

func (TwitterApi) UnRetweet Uses

func (a TwitterApi) UnRetweet(id int64, trimUser bool) (rt Tweet, err error)

UnRetweet will renove retweet Untweets a retweeted status. Returns the original Tweet with retweet details embedded.

https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-unretweet-id trim_user: tweet returned in a timeline will include a user object including only the status authors numerical ID.

func (TwitterApi) Unblock Uses

func (a TwitterApi) Unblock(v url.Values) (user User, err error)

func (TwitterApi) UnblockUser Uses

func (a TwitterApi) UnblockUser(screenName string, v url.Values) (user User, err error)

func (TwitterApi) UnblockUserId Uses

func (a TwitterApi) UnblockUserId(id int64, v url.Values) (user User, err error)

func (TwitterApi) Unfavorite Uses

func (a TwitterApi) Unfavorite(id int64) (rt Tweet, err error)

Un-favorites the status specified in the ID parameter as the authenticating user. Returns the un-favorited status in the requested format when successful. https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-favorites-destroy

func (TwitterApi) UnfollowUser Uses

func (a TwitterApi) UnfollowUser(screenname string) (u User, err error)

UnfollowUser unfollows the user with the specified screenname (username) This implements the /friendships/destroy endpoint, though the function name uses the terminology 'unfollow' as this is most consistent with colloquial Twitter terminology.

func (TwitterApi) UnfollowUserId Uses

func (a TwitterApi) UnfollowUserId(userId int64) (u User, err error)

UnfollowUserId unfollows the user with the specified userId. This implements the /friendships/destroy endpoint, though the function name uses the terminology 'unfollow' as this is most consistent with colloquial Twitter terminology.

func (TwitterApi) Unmute Uses

func (a TwitterApi) Unmute(v url.Values) (user User, err error)

func (TwitterApi) UnmuteUser Uses

func (a TwitterApi) UnmuteUser(screenName string, v url.Values) (user User, err error)

func (TwitterApi) UnmuteUserId Uses

func (a TwitterApi) UnmuteUserId(id int64, v url.Values) (user User, err error)

func (TwitterApi) UploadMedia Uses

func (a TwitterApi) UploadMedia(base64String string) (media Media, err error)

func (TwitterApi) UploadVideoAppend Uses

func (a TwitterApi) UploadVideoAppend(mediaIdString string,
    segmentIndex int, base64String string) error

func (TwitterApi) UploadVideoFinalize Uses

func (a TwitterApi) UploadVideoFinalize(mediaIdString string) (videoMedia VideoMedia, err error)

func (TwitterApi) UploadVideoInit Uses

func (a TwitterApi) UploadVideoInit(totalBytes int, mimeType string) (chunkedMedia ChunkedMedia, err error)

func (TwitterApi) UserStream Uses

func (a TwitterApi) UserStream(v url.Values) (stream *Stream)

func (TwitterApi) VerifyCredentials Uses

func (a TwitterApi) VerifyCredentials() (ok bool, err error)

Verify the credentials by making a very small request

type TwitterError Uses

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

TwitterError represents a single Twitter error messages/code pair

func (TwitterError) Error Uses

func (te TwitterError) Error() string

type TwitterErrorResponse Uses

type TwitterErrorResponse struct {
    Errors []TwitterError `json:"errors"`
}

TwitterErrorResponse has an array of Twitter error messages It satisfies the "error" interface For the most part, Twitter seems to return only a single error message Currently, we assume that this always contains exactly one error message

func (TwitterErrorResponse) Error Uses

func (tr TwitterErrorResponse) Error() string

func (TwitterErrorResponse) First Uses

func (tr TwitterErrorResponse) First() error

type UrlEntity Uses

type UrlEntity struct {
    Urls []struct {
        Indices      []int  `json:"indices"`
        Url          string `json:"url"`
        Display_url  string `json:"display_url"`
        Expanded_url string `json:"expanded_url"`
    } `json:"urls"`
}

type User Uses

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                       Entities `json:"entities"`
    FavouritesCount                int      `json:"favourites_count"`
    FollowRequestSent              bool     `json:"follow_request_sent"`
    FollowersCount                 int      `json:"followers_count"`
    Following                      bool     `json:"following"`
    FriendsCount                   int      `json:"friends_count"`
    GeoEnabled                     bool     `json:"geo_enabled"`
    HasExtendedProfile             bool     `json:"has_extended_profile"`
    Id                             int64    `json:"id"`
    IdStr                          string   `json:"id_str"`
    IsTranslator                   bool     `json:"is_translator"`
    IsTranslationEnabled           bool     `json:"is_translation_enabled"`
    Lang                           string   `json:"lang"` // BCP-47 code of user defined language
    ListedCount                    int64    `json:"listed_count"`
    Location                       string   `json:"location"` // User defined 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"` // Only included if the user is a friend
    StatusesCount                  int64    `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 UserCursor Uses

type UserCursor struct {
    Previous_cursor     int64
    Previous_cursor_str string
    Next_cursor         int64
    Next_cursor_str     string
    Users               []User
}

type UserWithheldNotice Uses

type UserWithheldNotice struct {
    Id                  int64    `json:"id"`
    WithheldInCountries []string `json:"withheld_in_countries"`
}

type Variant Uses

type Variant struct {
    Bitrate     int    `json:"bitrate"`
    ContentType string `json:"content_type"`
    Url         string `json:"url"`
}

type Video Uses

type Video struct {
    VideoType string `json:"video_type"`
}

type VideoInfo Uses

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

type VideoMedia Uses

type VideoMedia struct {
    MediaID          int64  `json:"media_id"`
    MediaIDString    string `json:"media_id_string"`
    Size             int    `json:"size"`
    ExpiresAfterSecs int    `json:"expires_after_secs"`
    Video            Video  `json:"video"`
}

type WebHookResp Uses

type WebHookResp struct {
    ID        string
    URL       string
    Valid     bool
    CreatedAt string
}

WebHookResp represents the Get webhook responses

Package anaconda imports 17 packages (graph) and is imported by 244 packages. Updated 2018-11-11. Refresh now. Tools for package owners.