class JTwitterFriends extends JTwitterObject

Twitter API Friends 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
getFriendIds( mixed $user, integer $cursor = null, boolean $string_ids = null, integer $count)

Method to get an array of user IDs the specified user follows.

array
getFriendshipDetails( mixed $user_a, mixed $user_b)

Method to display detailed friend information between two users.

array
getFollowerIds( mixed $user, integer $cursor = null, boolean $string_ids = null, integer $count)

Method to get an array of user IDs the specified user is followed by.

array
getFriendshipsIncoming( integer $cursor = null, boolean $string_ids = null)

Method to determine pending requests to follow the authenticating user.

array
getFriendshipsOutgoing( integer $cursor = null, boolean $string_ids = null)

Method to determine every protected user for whom the authenticating user has a pending follow request.

array
follow( mixed $user, boolean $follow = false)

Allows the authenticating users to follow the user specified in the ID parameter.

array
unfollow( mixed $user)

Allows the authenticating users to unfollow the user specified in the ID parameter.

array
getFriendshipsLookup( string $screen_name = null, string $id = null)

Method to get the relationship of the authenticating user to the comma separated list of up to 100 screennames or userids provided.

array
updateFriendship( mixed $user, boolean $device = null, boolean $retweets = null)

Allows one to enable or disable retweets and device notifications from the specified user.

array
getFriendshipNoRetweetIds( boolean $string_ids = null)

Method to get the user ids that currently authenticated user does not want to see retweets from.

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 getFriendIds( mixed $user, integer $cursor = null, boolean $string_ids = null, integer $count)

Method to get an array of user IDs the specified user follows.

Parameters

mixed $user Either an integer containing the user ID or a string containing the screen name.
integer $cursor Causes the list of connections to be broken into pages of no more than 5000 IDs at a time. The number of IDs returned is not guaranteed to be 5000 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 $string_ids Set to true to return IDs as strings, false to return as integers.
integer $count Specifies the number of IDs attempt retrieval of, up to a maximum of 5,000 per distinct request.

Return Value

array The decoded JSON response

Exceptions

RuntimeException

array getFriendshipDetails( mixed $user_a, mixed $user_b)

Method to display detailed friend information between two users.

Parameters

mixed $user_a Either an integer containing the user ID or a string containing the screen name of the first user.
mixed $user_b Either an integer containing the user ID or a string containing the screen name of the second user.

Return Value

array The decoded JSON response

Exceptions

RuntimeException

array getFollowerIds( mixed $user, integer $cursor = null, boolean $string_ids = null, integer $count)

Method to get an array of user IDs the specified user is followed by.

Parameters

mixed $user Either an integer containing the user ID or a string containing the screen name.
integer $cursor Causes the list of IDs to be broken into pages of no more than 5000 IDs at a time. The number of IDs returned is not guaranteed to be 5000 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 $string_ids Set to true to return IDs as strings, false to return as integers.
integer $count Specifies the number of IDs attempt retrieval of, up to a maximum of 5,000 per distinct request.

Return Value

array The decoded JSON response

Exceptions

RuntimeException

array getFriendshipsIncoming( integer $cursor = null, boolean $string_ids = null)

Method to determine pending requests to follow the authenticating user.

Parameters

integer $cursor Causes the list of IDs to be broken into pages of no more than 5000 IDs at a time. The number of IDs returned is not guaranteed to be 5000 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 $string_ids Set to true to return IDs as strings, false to return as integers.

Return Value

array The decoded JSON response

array getFriendshipsOutgoing( integer $cursor = null, boolean $string_ids = null)

Method to determine every protected user for whom the authenticating user has a pending follow request.

Parameters

integer $cursor Causes the list of IDs to be broken into pages of no more than 5000 IDs at a time. The number of IDs returned is not guaranteed to be 5000 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 $string_ids Set to true to return IDs as strings, false to return as integers.

Return Value

array The decoded JSON response

array follow( mixed $user, boolean $follow = false)

Allows the authenticating users to follow the user specified in the ID parameter.

Parameters

mixed $user Either an integer containing the user ID or a string containing the screen name.
boolean $follow Enable notifications for the target user.

Return Value

array The decoded JSON response

Exceptions

RuntimeException

array unfollow( mixed $user)

Allows the authenticating users to unfollow the user specified in the ID parameter.

Parameters

mixed $user Either an integer containing the user ID or a string containing the screen name.

Return Value

array The decoded JSON response

Exceptions

RuntimeException

array getFriendshipsLookup( string $screen_name = null, string $id = null)

Method to get the relationship of the authenticating user to the comma separated list of up to 100 screennames or userids provided.

Parameters

string $screen_name A comma separated list of screen names, up to 100 are allowed in a single request.
string $id A comma separated list of user IDs, up to 100 are allowed in a single request.

Return Value

array The decoded JSON response

Exceptions

RuntimeException

array updateFriendship( mixed $user, boolean $device = null, boolean $retweets = null)

Allows one to enable or disable retweets and device notifications from the specified user.

Parameters

mixed $user Either an integer containing the user ID or a string containing the screen name.
boolean $device Enable/disable device notifications from the target user.
boolean $retweets Enable/disable retweets from the target user.

Return Value

array The decoded JSON response

Exceptions

RuntimeException

array getFriendshipNoRetweetIds( boolean $string_ids = null)

Method to get the user ids that currently authenticated user does not want to see retweets from.

Parameters

boolean $string_ids Set to true to return IDs as strings, false to return as integers.

Return Value

array The decoded JSON response