You are here

public function Twitter::call in Twitter 7.6

Same name and namespace in other branches
  1. 6.5 twitter.lib.php \Twitter::call()
  2. 6.3 twitter.lib.php \Twitter::call()
  3. 7.3 twitter.lib.php \Twitter::call()
  4. 7.5 twitter.lib.php \Twitter::call()

Calls a Twitter API endpoint.

Parameters

string $path: The location of the endpoint.

array $params: Any parameters the endpoint needs to complete the call.

string $method: The REST method to use when making the call.

Return value

array The decoded JSON reply.

36 calls to Twitter::call()
Twitter::account_profile_banner in ./twitter.lib.php
Returns a map of the available size variations of the specified user's profile banner.
Twitter::account_remove_profile_banner in ./twitter.lib.php
Removes the uploaded profile banner for the authenticating user.
Twitter::account_settings in ./twitter.lib.php
Returns settings (including current trend, geo and sleep time information) for the authenticating user.
Twitter::account_settings_update in ./twitter.lib.php
Updates the authenticating user's settings.
Twitter::account_update_delivery_device in ./twitter.lib.php
Sets which device Twitter delivers updates to for the authenticating user.

... See full list

File

./twitter.lib.php, line 1315
Integration layer to communicate with the Twitter REST API 1.1. https://dev.twitter.com/docs/api/1.1

Class

Twitter
Primary Twitter API implementation class

Code

public function call($path, $params = array(), $method = 'GET') {
  $parsed_response = $this
    ->getParsedResponse($path, $params, $method);

  // If 'truncated' is set to 1 or TRUE, then the full tweet was not
  // retrieved and the extended mode version of the tweet needs to be called
  // to retrieve the full tweet.
  // Check first a respoonse that includes only one item.
  if (isset($parsed_response['id'])) {
    if (!empty($parsed_response['truncated'])) {
      $parsed_response = $this
        ->getParsedResponse($path, $params, $method, TRUE);
    }
  }
  else {

    // Check a respoonse that includes multiple items.
    foreach ($parsed_response as $response) {
      if (!empty($response['truncated'])) {
        $parsed_response = $this
          ->getParsedResponse($path, $params, $method, TRUE);
        break;
      }
    }
  }
  return $parsed_response;
}