class JTwitterDirectmessages extends JTwitterObject

Twitter API Direct Messages 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
getDirectMessages( integer $since_id, integer $max_id, integer $count = 20, boolean $entities = null, boolean $skip_status = null)

Method to get the most recent direct messages sent to the authenticating user.

array
getSentDirectMessages( integer $since_id, integer $max_id, integer $count = 20, integer $page, boolean $entities = null)

Method to get the most recent direct messages sent by the authenticating user.

array
sendDirectMessages( mixed $user, string $text)

Method to send a new direct message to the specified user from the authenticating user.

array
getDirectMessagesById( integer $id)

Method to get a single direct message, specified by an id parameter.

array
deleteDirectMessages( integer $id, boolean $entities = null)

Method to delete the direct message specified in the required ID parameter.

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 getDirectMessages( integer $since_id, integer $max_id, integer $count = 20, boolean $entities = null, boolean $skip_status = null)

Method to get the most recent direct messages sent to the authenticating user.

Parameters

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) or equal to the specified ID.
integer $count Specifies the number of direct messages to try and retrieve, up to a maximum of 200.
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 $skip_status When set to either true, t or 1 statuses will not be included in the returned user objects.

Return Value

array The decoded JSON response

array getSentDirectMessages( integer $since_id, integer $max_id, integer $count = 20, integer $page, boolean $entities = null)

Method to get the most recent direct messages sent by the authenticating user.

Parameters

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) or equal to the specified ID.
integer $count Specifies the number of direct messages to try and retrieve, up to a maximum of 200.
integer $page Specifies the page of results to retrieve.
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.

Return Value

array The decoded JSON response

array sendDirectMessages( mixed $user, string $text)

Method to send a new direct message to the specified user from the authenticating user.

Parameters

mixed $user Either an integer containing the user ID or a string containing the screen name.
string $text The text of your direct message. Be sure to keep the message under 140 characters.

Return Value

array The decoded JSON response

Exceptions

RuntimeException

array getDirectMessagesById( integer $id)

Method to get a single direct message, specified by an id parameter.

Parameters

integer $id The ID of the direct message.

Return Value

array The decoded JSON response

array deleteDirectMessages( integer $id, boolean $entities = null)

Method to delete the direct message specified in the required ID parameter.

Parameters

integer $id The ID of the direct message.
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.

Return Value

array The decoded JSON response