class JTwitterStatuses extends JTwitterObject

Twitter API Statuses class for the Joomla Platform.

Methods

__construct( Registry $options = null, JHttp $client = null, JTwitterOAuth $oauth = null)

Constructor.

void
checkRateLimit( string $resource = null, string $action = null)

Method to check the rate limit for the requesting IP address

string
fetchUrl( string $path, array $parameters = null)

Method to build and return a full request URL for the request. This method will add appropriate pagination details if necessary and also prepend the API url to have a complete URL for the request.

array
getRateLimit( string $resource)

Method to retrieve the rate limit for the requesting IP address

array
sendRequest( string $path, string $method = 'GET', mixed $data = array(), array $headers = array())

Method to send the request.

mixed
getOption( string $key)

Get an option from the JTwitterObject instance.

setOption( string $key, mixed $value)

Set an option for the JTwitterObject instance.

array
getTweetById( integer $id, boolean $trim_user = null, boolean $entities = null, boolean $my_retweet = null)

Method to get a single tweet with the given ID.

array
getUserTimeline( mixed $user, integer $count = 20, boolean $include_rts = null, boolean $no_replies = null, integer $since_id, integer $max_id, boolean $trim_user = null, boolean $contributor = null)

Method to retrieve the latest statuses from the specified user timeline.

array
tweet( string $status, integer $in_reply_to_status_id = null, float $lat = null, float $long = null, string $place_id = null, boolean $display_coordinates = null, boolean $trim_user = null)

Method to post a tweet.

array
getMentions( integer $count = 20, boolean $include_rts = null, boolean $entities = null, integer $since_id, integer $max_id, boolean $trim_user = null, string $contributor = null)

Method to retrieve the most recent mentions for the authenticating user.

array
getRetweetsOfMe( integer $count = 20, integer $since_id, boolean $entities = null, boolean $user_entities = null, integer $max_id, boolean $trim_user = null)

Method to get the most recent tweets of the authenticated user that have been retweeted by others.

array
getRetweeters( integer $id, integer $count = 20, integer $cursor = null, boolean $stringify_ids = null)

Method to show user objects of up to 100 members who retweeted the status.

array
getRetweetsById( integer $id, integer $count = 20, boolean $trim_user = null)

Method to get up to 100 of the first retweets of a given tweet.

array
deleteTweet( integer $id, boolean $trim_user = null)

Method to delete the status specified by the required ID parameter.

array
retweet( integer $id, boolean $trim_user = null)

Method to retweet a tweet.

array
tweetWithMedia( string $status, string $media, integer $in_reply_to_status_id = null, float $lat = null, float $long = null, string $place_id = null, boolean $display_coordinates = null, boolean $sensitive = null)

Method to post a tweet with media.

array
getOembed( integer $id = null, string $url = null, integer $maxwidth = null, boolean $hide_media = null, boolean $hide_thread = null, boolean $omit_script = null, string $align = null, string $related = null, string $lang = null)

Method to get information allowing the creation of an embedded representation of a Tweet on third party sites.

Details

__construct( Registry $options = null, JHttp $client = null, JTwitterOAuth $oauth = null)

Constructor.

Parameters

Registry $options &$options Twitter options object.
JHttp $client The HTTP client object.
JTwitterOAuth $oauth The OAuth client.

void checkRateLimit( string $resource = null, string $action = null)

Method to check the rate limit for the requesting IP address

Parameters

string $resource A resource or a comma-separated list of resource families you want to know the current rate limit disposition for.
string $action An action for the specified resource, if only one resource is specified.

Return Value

void

Exceptions

RuntimeException

string fetchUrl( string $path, array $parameters = null)

Method to build and return a full request URL for the request. This method will add appropriate pagination details if necessary and also prepend the API url to have a complete URL for the request.

Parameters

string $path URL to inflect
array $parameters The parameters passed in the URL.

Return Value

string The request URL.

array getRateLimit( string $resource)

Method to retrieve the rate limit for the requesting IP address

Parameters

string $resource A resource or a comma-separated list of resource families you want to know the current rate limit disposition for.

Return Value

array The JSON response decoded

array sendRequest( string $path, string $method = 'GET', mixed $data = array(), array $headers = array())

Method to send the request.

Parameters

string $path The path of the request to make
string $method The request method.
mixed $data Either an associative array or a string to be sent with the post request.
array $headers An array of name-value pairs to include in the header of the request

Return Value

array The decoded JSON response

Exceptions

RuntimeException

mixed getOption( string $key)

Get an option from the JTwitterObject instance.

Parameters

string $key The name of the option to get.

Return Value

mixed The option value.

JTwitterObject setOption( string $key, mixed $value)

Set an option for the JTwitterObject instance.

Parameters

string $key The name of the option to set.
mixed $value The option value to set.

Return Value

JTwitterObject This object for method chaining.

array getTweetById( integer $id, boolean $trim_user = null, boolean $entities = null, boolean $my_retweet = null)

Method to get a single tweet with the given ID.

Parameters

integer $id The ID of the tweet to retrieve.
boolean $trim_user When set to true, each tweet returned in a timeline will include a user object including only the status author's numerical ID.
boolean $entities When set to true, each tweet will include a node called "entities,". This node offers a variety of metadata about the tweet in a discreet structure, including: user_mentions, urls, and hashtags.
boolean $my_retweet When set to either true, t or 1, any statuses returned that have been retweeted by the authenticating user will include an additional currentuserretweet node, containing the ID of the source status for the retweet.

Return Value

array The decoded JSON response

array getUserTimeline( mixed $user, integer $count = 20, boolean $include_rts = null, boolean $no_replies = null, integer $since_id, integer $max_id, boolean $trim_user = null, boolean $contributor = null)

Method to retrieve the latest statuses from the specified user timeline.

Parameters

mixed $user Either an integer containing the user ID or a string containing the screen name.
integer $count Specifies the number of tweets to try and retrieve, up to a maximum of 200. Retweets are always included in the count, so it is always suggested to set $include_rts to true
boolean $include_rts When set to true, the timeline will contain native retweets in addition to the standard stream of tweets.
boolean $no_replies This parameter will prevent replies from appearing in the returned timeline. This parameter is only supported for JSON and XML responses.
integer $since_id Returns results with an ID greater than (that is, more recent than) the specified ID.
integer $max_id Returns results with an ID less than (that is, older than) the specified ID.
boolean $trim_user When set to true, each tweet returned in a timeline will include a user object including only the status author's numerical ID.
boolean $contributor This parameter enhances the contributors element of the status response to include the screenname of the contributor. By default only the userid of the contributor is included.

Return Value

array The decoded JSON response

Exceptions

RuntimeException

array tweet( string $status, integer $in_reply_to_status_id = null, float $lat = null, float $long = null, string $place_id = null, boolean $display_coordinates = null, boolean $trim_user = null)

Method to post a tweet.

Parameters

string $status The text of the tweet.
integer $in_reply_to_status_id The ID of an existing status that the update is in reply to.
float $lat The latitude of the location this tweet refers to.
float $long The longitude of the location this tweet refers to.
string $place_id A place in the world.
boolean $display_coordinates Whether or not to put a pin on the exact coordinates a tweet has been sent from.
boolean $trim_user When set to true, each tweet returned in a timeline will include a user object including only the status author's numerical ID.

Return Value

array The decoded JSON response

array getMentions( integer $count = 20, boolean $include_rts = null, boolean $entities = null, integer $since_id, integer $max_id, boolean $trim_user = null, string $contributor = null)

Method to retrieve the most recent mentions for the authenticating user.

Parameters

integer $count Specifies the number of tweets to try and retrieve, up to a maximum of 200. Retweets are always included in the count, so it is always suggested to set $include_rts to true
boolean $include_rts When set to true, the timeline will contain native retweets in addition to the standard stream of tweets.
boolean $entities When set to true, each tweet will include a node called "entities,". This node offers a variety of metadata about the tweet in a discreet structure, including: user_mentions, urls, and hashtags.
integer $since_id Returns results with an ID greater than (that is, more recent than) the specified ID.
integer $max_id Returns results with an ID less than (that is, older than) the specified ID.
boolean $trim_user When set to true, each tweet returned in a timeline will include a user object including only the status author's numerical ID.
string $contributor This parameter enhances the contributors element of the status response to include the screen_name of the contributor.

Return Value

array The decoded JSON response

Exceptions

RuntimeException

array getRetweetsOfMe( integer $count = 20, integer $since_id, boolean $entities = null, boolean $user_entities = null, integer $max_id, boolean $trim_user = null)

Method to get the most recent tweets of the authenticated user that have been retweeted by others.

Parameters

integer $count Specifies the number of tweets to try and retrieve, up to a maximum of 200. Retweets are always included in the count, so it is always suggested to set $include_rts to true
integer $since_id Returns results with an ID greater than (that is, more recent than) the specified ID.
boolean $entities When set to true, each tweet will include a node called "entities,". This node offers a variety of metadata about the tweet in a discreet structure, including: user_mentions, urls, and hashtags.
boolean $user_entities The user entities node will be disincluded when set to false.
integer $max_id Returns results with an ID less than (that is, older than) the specified ID.
boolean $trim_user When set to true, each tweet returned in a timeline will include a user object including only the status author's numerical ID.

Return Value

array The decoded JSON response

array getRetweeters( integer $id, integer $count = 20, integer $cursor = null, boolean $stringify_ids = null)

Method to show user objects of up to 100 members who retweeted the status.

Parameters

integer $id The numerical ID of the desired status.
integer $count Specifies the number of retweets to try and retrieve, up to a maximum of 100.
integer $cursor Causes the list of IDs to be broken into pages of no more than 100 IDs at a time. The number of IDs returned is not guaranteed to be 100 as suspended users are filtered out after connections are queried. If no cursor is provided, a value of -1 will be assumed, which is the first "page."
boolean $stringify_ids Set to true to return IDs as strings, false to return as integers.

Return Value

array The decoded JSON response

array getRetweetsById( integer $id, integer $count = 20, boolean $trim_user = null)

Method to get up to 100 of the first retweets of a given tweet.

Parameters

integer $id The numerical ID of the desired status.
integer $count Specifies the number of tweets to try and retrieve, up to a maximum of 200. Retweets are always included in the count, so it is always suggested to set $include_rts to true
boolean $trim_user When set to true, each tweet returned in a timeline will include a user object including only the status author's numerical ID.

Return Value

array The decoded JSON response

array deleteTweet( integer $id, boolean $trim_user = null)

Method to delete the status specified by the required ID parameter.

Parameters

integer $id The numerical ID of the desired status.
boolean $trim_user When set to true, each tweet returned in a timeline will include a user object including only the status author's numerical ID.

Return Value

array The decoded JSON response

array retweet( integer $id, boolean $trim_user = null)

Method to retweet a tweet.

Parameters

integer $id The numerical ID of the desired status.
boolean $trim_user When set to true, each tweet returned in a timeline will include a user object including only the status author's numerical ID.

Return Value

array The decoded JSON response

array tweetWithMedia( string $status, string $media, integer $in_reply_to_status_id = null, float $lat = null, float $long = null, string $place_id = null, boolean $display_coordinates = null, boolean $sensitive = null)

Method to post a tweet with media.

Parameters

string $status The text of the tweet.
string $media File to upload
integer $in_reply_to_status_id The ID of an existing status that the update is in reply to.
float $lat The latitude of the location this tweet refers to.
float $long The longitude of the location this tweet refers to.
string $place_id A place in the world.
boolean $display_coordinates Whether or not to put a pin on the exact coordinates a tweet has been sent from.
boolean $sensitive Set to true for content which may not be suitable for every audience.

Return Value

array The decoded JSON response

Exceptions

RuntimeException

array getOembed( integer $id = null, string $url = null, integer $maxwidth = null, boolean $hide_media = null, boolean $hide_thread = null, boolean $omit_script = null, string $align = null, string $related = null, string $lang = null)

Method to get information allowing the creation of an embedded representation of a Tweet on third party sites.

Note: either the id or url parameters must be specified in a request. It is not necessary to include both.

Parameters

integer $id The Tweet/status ID to return embed code for.
string $url The URL of the Tweet/status to be embedded.
integer $maxwidth The maximum width in pixels that the embed should be rendered at. This value is constrained to be between 250 and 550 pixels.
boolean $hide_media Specifies whether the embedded Tweet should automatically expand images which were uploaded via POST statuses/updatewithmedia.
boolean $hide_thread Specifies whether the embedded Tweet should automatically show the original message in the case that the embedded Tweet is a reply.
boolean $omit_script Specifies whether the embedded Tweet HTML should include a <script> element pointing to widgets.js. In cases where a page already includes widgets.js, setting this value to true will prevent a redundant script element from being included.
string $align Specifies whether the embedded Tweet should be left aligned, right aligned, or centered in the page. Valid values are left, right, center, and none.
string $related A value for the TWT related parameter, as described in Web Intents. This value will be forwarded to all Web Intents calls.
string $lang Language code for the rendered embed. This will affect the text and localization of the rendered HTML.

Return Value

array The decoded JSON response

Exceptions

RuntimeException