[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/externals/twilio-php/Services/ -> Twilio.php (summary)

(no description)

File Size: 313 lines (11 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Services_Twilio:: (11 methods):
  __construct()
  qualifiedUserAgent()
  getVersion()
  getRetryAttempts()
  getRequestUri()
  _makeIdempotentRequest()
  retrieveData()
  deleteData()
  createData()
  buildQuery()
  _processResponse()

Defines 11 functions

  Services_Twilio_autoload()

Class: Services_Twilio  - X-Ref

Create a client to talk to the Twilio API.

:param string               $sid:      Your Account SID
:param string               $token:    Your Auth Token from `your dashboard
<https://www.twilio.com/user/account>`_
:param string               $version:  API version to use
:param $_http:    A HTTP client for making requests.
:type $_http: :php:class:`Services_Twilio_TinyHttp`
:param int                  $retryAttempts:
Number of times to retry failed requests. Currently only idempotent
requests (GET's and DELETE's) are retried.

Here's an example:

.. code-block:: php

require('Services/Twilio.php');
$client = new Services_Twilio('AC123', '456bef', null, null, 3);
// Take some action with the client, etc.
__construct($sid,$token,$version = null,Services_Twilio_TinyHttp $_http = null,$retryAttempts = 1)   X-Ref
No description

qualifiedUserAgent($php_version)   X-Ref
Fully qualified user agent with the current PHP Version.

:return: the user agent
:rtype: string

getVersion()   X-Ref
Get the api version used by the rest client

:return: the API version in use
:returntype: string

getRetryAttempts()   X-Ref
Get the retry attempt limit used by the rest client

:return: the number of retry attempts
:rtype: int

getRequestUri($path, $params, $full_uri = false)   X-Ref
Construct a URI based on initial path, query params, and paging
information

We want to use the query params, unless we have a next_page_uri from the
API.

:param string $path: The request path (may contain query params if it's
a next_page_uri)
:param array $params: Query parameters to use with the request
:param boolean $full_uri: Whether the $path contains the full uri

:return: the URI that should be requested by the library
:returntype: string

_makeIdempotentRequest($callable, $uri, $retriesLeft)   X-Ref
Helper method for implementing request retry logic

:param array  $callable:      The function that makes an HTTP request
:param string $uri:           The URI to request
:param int    $retriesLeft:   Number of times to retry

:return: The object representation of the resource
:rtype: object

retrieveData($path, $params = array()   X-Ref
GET the resource at the specified path.

:param string $path:   Path to the resource
:param array  $params: Query string parameters
:param boolean  $full_uri: Whether the full URI has been passed as an
argument

:return: The object representation of the resource
:rtype: object

deleteData($path, $params = array()   X-Ref
DELETE the resource at the specified path.

:param string $path:   Path to the resource
:param array  $params: Query string parameters

:return: The object representation of the resource
:rtype: object

createData($path, $params = array()   X-Ref
POST to the resource at the specified path.

:param string $path:   Path to the resource
:param array  $params: Query string parameters

:return: The object representation of the resource
:rtype: object

buildQuery($queryData, $numericPrefix = '')   X-Ref
Build a query string from query data

:param array $queryData: An associative array of keys and values. The
values can be a simple type or a list, in which case the list is
converted to multiple query parameters with the same key.
:param string $numericPrefix:
:param string $queryStringStyle: Determine how to build the url
- strict: Build a standards compliant query string without braces (can be hacked by using braces in key)
- php: Build a PHP compatible query string with nested array syntax
:return: The encoded query string
:rtype: string

_processResponse($response)   X-Ref
Convert the JSON encoded resource into a PHP object.

:param array $response: 3-tuple containing status, headers, and body

:return: PHP object decoded from JSON
:rtype: object
:throws: A :php:class:`Services_Twilio_RestException` if the Response is
in the 300-500 range of status codes.

Functions
Functions that are not part of a class:



Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1