public function getObjectRecordsInAccountInCommunity($communityId, $accountId, $query, $hasImages, $sort, $direction, $offset, $limit)
 {
     require_once EHIVE_API_ROOT_DIR . '/domain/objectrecords/ObjectRecordsCollection.php';
     $path = VERSION_ID . "/communities/{$communityId}/accounts/{$accountId}/objectrecords";
     $queryString = DaoHelper::getObjectsQueryString($query, $hasImages, $sort, $direction, $offset, $limit);
     $json = $this->transport->get($path, $queryString);
     return new ObjectRecordsCollection($json);
 }
 public function getPopularObjectRecordsInAccountInCommunity($communityId, $accountId, $catalogueType, $hasImages, $offset, $limit)
 {
     require_once EHIVE_API_ROOT_DIR . '/domain/objectrecords/ObjectRecordsCollection.php';
     $path = VERSION_ID . "/communities/{$communityId}/accounts/{$accountId}/objectrecords/popular";
     $path = DaoHelper::urlWithCatalogueType($path, $catalogueType);
     $queryString = DaoHelper::getObjectsQueryString(null, $hasImages, null, null, $offset, $limit);
     $json = $this->transport->get($path, $queryString);
     return new ObjectRecordsCollection($json);
 }
Exemple #3
0
 /**
  *  A method to load objects from the eHive API using the parameters specified in the @getObjectsFromAccount method, the query is built and executed using a multiple cURL request handler.
  *
  * @param array $params
  * @return array $response
  */
 private function _getObjectsFromAccount(&$params)
 {
     extract($params);
     $params['offset'] =& $offset;
     $queries = array();
     for ($i = 0; $i < 10; $i++) {
         $queries[] = DaoHelper::getObjectsQueryString($query, $hasImages, $sort, $direction, $offset, $limit);
         $offset += $limit;
     }
     // Endpoints should be in an ini file or helper class.
     $path = EHIVE_VERSION_ID . "/accounts/" . $account . "/objectrecords";
     $query = array('path' => $path, 'context' => $queries);
     $response = $this->_execute('getMultiple', $query);
     return $response && is_array($response) ? $response : array();
 }
Exemple #4
0
require_once EHIVE_API_ROOT_DIR . '/dao/DAOHelper.php';
require_once EHIVE_API_ROOT_DIR . '/domain/objectrecords/ObjectRecordsCollection.php';
// The path for this demo.
$path = VERSION_ID . "/accounts/" . ACCOUNT . "/objectrecords";
$query = DaoHelper::getObjectsQueryString(QUERY, TRUE, 'name', 'desc', 0, INCRE);
$transport = new Multi_Transport(CLIENT_ID, CLIENT_SECRET, TRACKING_ID);
$responses = array();
$response = $transport->get($path, $query);
$queries = array();
if (is_object($response)) {
    $responses = array_merge($responses, array($response));
    $total = $response->totalObjects;
    $range = array_chunk(range(0, $total), 10);
    $offset = INCRE;
    for ($i = 0; $i < count($range); $i++) {
        $queries[] = DaoHelper::getObjectsQueryString(QUERY, TRUE, 'name', 'desc', $offset, INCRE);
        $offset += INCRE;
        if ($offset == 100) {
            break;
        }
    }
}
$response = $transport->getMultiple($path, $queries);
$responses = array_merge($responses, $response);
unset($response);
if (is_array($responses) && !empty($responses)) {
    $objects['objects'] = array();
    foreach ($responses as $response) {
        $objects['objects'] = array_merge($objects['objects'], $response->objectRecords);
    }
    print '<pre>';