lib/SyncService.php
public function fetch($deviceUUID, $sessionId, $queue = 'main', array $options = array())
  {
    // @throws InvalidArgumentException
    $this->checkArgument($deviceUUID, 'deviceUUID');
    $this->checkArgument($sessionId, 'sessionId');
    $this->checkArgument($queue, 'queue');

    $options = array_merge($options, [
      'headers' => $this->buildHeaders($deviceUUID),
      'raw' => true
    ]);
    list($code, $root) = $this->httpClient->get("/sync/{$sessionId}/queues/{$queue}", null, $options);

    if ($code == 204) return [];
    return $root['items'];
  }
public function fetch($deviceUUID, $sessionId, $queue = 'main', array $options = array())
  {
    // @throws InvalidArgumentException
    $this->checkArgument($deviceUUID, 'deviceUUID');
    $this->checkArgument($sessionId, 'sessionId');
    $this->checkArgument($queue, 'queue');

    $options = array_merge($options, [
      'headers' => $this->buildHeaders($deviceUUID),
      'raw' => true
    ]);
    list($code, $root) = $this->httpClient->get("/sync/{$sessionId}/queues/{$queue}", null, $options);

    if ($code == 204) return [];
    return $root['items'];
  }
public function fetch ( $ deviceUUID , $ sessionId , $ queue = 'main' , array $ options = array ( ) ) { // @throws InvalidArgumentException $ this -> checkArgument ( $ deviceUUID , 'deviceUUID' ) ; $ this -> checkArgument ( $ sessionId , 'sessionId' ) ; $ this -> checkArgument ( $ queue , 'queue' ) ; $ options = array_merge ( $ options , [ 'headers' => $ this -> buildHeaders ( $ deviceUUID ) , 'raw' => true ] ) ; list ( $ code , $ root ) = $ this -> httpClient -> get ( "/sync/{$sessionId}/queues/{$queue}" , null , $ options ) ; if ( $ code == 204 ) return [ ] ; return $ root [ 'items' ] ; }
Get data from queue

get '/sync/{sessionId}/queues/main'

Fetch fresh data from the named queue.
Using session identifier you call continously the `#fetch` method to drain the named queue.

@param string $deviceUUID Device's UUID for which to perform synchronization.
@param string $sessionId Unique identifier of a synchronization session.
@param string $queue Queue name.
@param array $options Additional request's options.

@return array The list of resources and associated meta data or an empty array if there is no more data to synchronize.
Get data from queue