Documentation
¶
Overview ¶
Copyright 2009 Bill Casarin <billcasarin@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2009 Bill Casarin <billcasarin@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2009 Bill Casarin <billcasarin@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2009 Bill Casarin <billcasarin@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- type Api
- func (self *Api) ClearCredentials()
- func (self *Api) GetErrorChannel() <-chan error
- func (self *Api) GetFollowers(user interface{}, page int) <-chan []User
- func (self *Api) GetFriends(user interface{}, page int) <-chan []User
- func (self *Api) GetFriendsTimeline() <-chan []Status
- func (self *Api) GetLastError() error
- func (self *Api) GetPublicTimeline() <-chan []Status
- func (self *Api) GetRateLimitInfo() <-chan RateLimit
- func (self *Api) GetReplies() <-chan []Status
- func (self *Api) GetStatus(id int64) <-chan Status
- func (self *Api) GetUser(name string) <-chan User
- func (self *Api) GetUserById(id int64) <-chan User
- func (self *Api) GetUserTimeline() <-chan []Status
- func (self *Api) HasErrors() bool
- func (self *Api) PostUpdate(status string, inReplyToId int64) <-chan bool
- func (self *Api) Search(query string, page int, perPage int, sinceId int, locale string, lang string) <-chan []SearchResult
- func (self *Api) SearchSimple(query string) <-chan []SearchResult
- func (self *Api) SetClientString(client string)
- func (self *Api) SetCredentials(username, password string)
- func (self *Api) SetReceiveChannel(receiveChannel interface{})
- func (self *Api) SetUserAgent(agent string)
- func (self *Api) SetXTwitterHeaders(client, url_, version string)
- type RateLimit
- type SearchResult
- type Status
- type TwitterError
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Api ¶
type Api struct {
// contains filtered or unexported fields
}
func (*Api) ClearCredentials ¶
func (self *Api) ClearCredentials()
Disable Twitter authentication, subsequent REST calls will not use Authentication
func (*Api) GetErrorChannel ¶
Returns a channel which receives API errors. Can be used for logging errors.
monitorErrors - listens to api errors and logs them func monitorErrors(quit chan bool, errors <-chan os.Error) { for ;; { select { case err := <-errors: fmt.Fprintf(os.Stderr, err.String()); break; case <-quit: return; } } }
func (*Api) GetFollowers ¶
Gets the followers for a given user represented by a slice of twitter.User instances
user:
A user id or name to fetch the followers from. If this argument is nil, then the followers are fetched from the authenticated user. This paramater must be an int, int64, or string.
page:
Not yet implemented
func (*Api) GetFriends ¶
Gets the friends for a given user represented by a slice of twitter.User instances
user:
A user id or name to fetch the friends from. If this argument is nil, then the friends are fetched from the authenticated user. This paramater must be an int, int64, or string.
page:
Not yet implemented
func (*Api) GetFriendsTimeline ¶
Returns the 20 most recent statuses posted by the authenticating user and that user's friends. This is the equivalent of /timeline/home on the Web. Returns the statuses as a slice of Status objects
func (*Api) GetLastError ¶
Returns the last error sent to the error channel. Calling this function pops the last error, subsequent calls will be nil unless another error has occured.
func (*Api) GetPublicTimeline ¶
Retrieves the public timeline as a slice of Status objects
func (*Api) GetRateLimitInfo ¶
Returns rate limiting information
func (*Api) GetReplies ¶
Returns the 20 most recent mentions for the authenticated user Returns the statuses as a slice of Status objects
func (*Api) GetStatus ¶
Gets a Twitter status given a status id
The twitter.Api instance must be authenticated if the status message is private
Returns: a channel which receives a twitter.Status object when
the request is completed
func (*Api) GetUser ¶
Returns a channel which receives a twitter.User instance for the given username.
name:
The screenname of the user
func (*Api) GetUserById ¶
Returns a channel which receives a twitter.User instance for the given username.
id:
A twiter user id
func (*Api) GetUserTimeline ¶
Retrieves the currently authorized user's timeline as a slice of Status objects
func (*Api) PostUpdate ¶
Post a Twitter status message to the authenticated user
The twitter.Api instance must be authenticated
func (*Api) Search ¶
func (self *Api) Search(query string, page int, perPage int, sinceId int, locale string, lang string) <-chan []SearchResult
Performs a Twitter search. Returns a slice of twitter.SearchResult instances string fields are automatically URL Encoded query:
The string of text to search for.
page:
The page of results to return. Set to 0 to use the default value.
perPage:
The number of results per page. Set to 0 to use the default value.
sinceId:
Return tweets with status ids greater than the given id. Set to 0 to use the default value.
locale:
Specify the language of the query you are sending (only ja is currently effective). This is intended for language-specific clients and the default should work in the majority of cases. Set to an empty string to use the default value.
lang:
Restricts tweets to the given language, given by an ISO 639-1 code. Set to an empty string to use the default value.
func (*Api) SearchSimple ¶
func (self *Api) SearchSimple(query string) <-chan []SearchResult
Performs a simple Twitter search. Returns a slice of twitter.SearchResult instances
query:
The string of text to search for. This is URL encoded automatically.
func (*Api) SetClientString ¶
Sets the Twitter client header, aka the X-Twitter-Client http header on all POST operations
func (*Api) SetCredentials ¶
Sets the username and password string for all subsequent authorized HTTP requests
func (*Api) SetReceiveChannel ¶
func (self *Api) SetReceiveChannel(receiveChannel interface{})
func (*Api) SetUserAgent ¶
Overrides the default user agent (go-twitter)
func (*Api) SetXTwitterHeaders ¶
Set the X-Twitter HTTP headers that will be sent to the server.
client:
The client name as a string. Will be sent to the server as the 'X-Twitter-Client' header.
url:
The URL of the meta.xml as a string. Will be sent to the server as the 'X-Twitter-Client-URL' header.
version:
The client version as a string. Will be sent to the server as the 'X-Twitter-Client-Version' header.
type SearchResult ¶
type TwitterError ¶
type TwitterError struct {
// contains filtered or unexported fields
}
func (TwitterError) Error ¶
func (self TwitterError) Error() string
type that satisfies the os.Error interface
type User ¶
type User interface { GetId() int64 GetName() string GetScreenName() string GetLocation() string GetDescription() string GetProfileImageUrl() string GetProfileBackgroundTitle() bool GetProfileBackgroundImageUrl() string GetProfileSidebarFillColor() string GetProfileLinkColor() string GetProfileTextColor() string GetProtected() bool GetUtcOffset() int GetTimeZone() string GetURL() string GetStatus() Status GetStatusesCount() int GetFollowersCount() int GetFriendsCount() int GetFavoritesCount() int // contains filtered or unexported methods }