[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/externals/twilio-php/docs/usage/rest/ -> queues.rst (source)

   1  =============
   2  Queues
   3  =============
   4  
   5  Create a New Queue
   6  =====================
   7  
   8  To create a new queue, make an HTTP POST request to the Queues resource.
   9  
  10  .. code-block:: php
  11  
  12      require('/path/to/twilio-php/Services/Twilio.php');
  13  
  14      $client = new Services_Twilio('AC123', '123');
  15      // Default MaxSize is 100. Or change it by adding a parameter, like so
  16      $queue = $client->account->queues->create('First Queue', 
  17          array('MaxSize' => 10));
  18  
  19      print $queue->sid;
  20      print $queue->friendly_name;
  21  
  22  Listing Queues
  23  ====================
  24  
  25  It's easy to iterate over your list of queues.
  26  
  27  .. code-block:: php
  28  
  29      $client = new Services_Twilio('AC123', '123');
  30      foreach ($client->account->queues as $queue) {
  31          echo $queue->sid;
  32      }
  33  
  34  Deleting Queues
  35  ====================
  36  
  37  .. code-block:: php
  38  
  39      $client = new Services_Twilio('AC123', '123');
  40      $queue_sid = 'QQ123';
  41      $client->account->queues->delete('QQ123');
  42  
  43  Retrieve the Member at the Front of a Queue
  44  ===========================================
  45  
  46  The Members class has a method called ``front`` which can be used to retrieve
  47  the member at the front of the queue.
  48  
  49  .. code-block:: php
  50  
  51      $client = new Services_Twilio('AC123', '123');
  52      $queue = $client->account->queues->get('QQ123');
  53      $firstMember = $queue->members->front();
  54      echo $firstMember->position;
  55      echo $firstMember->call_sid;
  56  


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