Example #1
0
 /**
  *  Get Edge
  *
  *  Request to Get edge from the collection
  *
  * @param string/Edge  $doc - Collection ID / Edge Object to get.
  * @param string  $id - specify the edge ID to get the edge.
  * @param array  $param - Array of parameters to send to the database as a header for edge request.
  *
  * @return array/Edge $response/$doc - Return a response array of the request/Edge object.
  */
 public function getEdge($doc, $id = NULL, $param = NULL)
 {
     $header = array();
     if (isset($param['ifnmatch'])) {
         $header['If-None-Match'] = $param['ifnmatch'];
     }
     if (isset($param['ifmatch'])) {
         $header['If-Match'] = $param['ifmatch'];
     }
     if ($doc instanceof Edge) {
         $collection = $doc->getCollectionID();
         $id = $doc->getId();
         $response = $this->get('edge/' . $collection . '/' . $id, NULL, 'json', NULL, $header);
         if ($response->code == '201' or $response->code == '202' or $response->code == '200') {
             $doc->setData($response);
             return $doc;
         } else {
             return $response;
         }
     } else {
         $collection = $doc;
         $response = $this->get('edge/' . $collection . '/' . $id, NULL, 'json', NULL, $header);
         return $response;
     }
 }
Example #2
0
 /**
  *  Get Index
  *
  *  Request to Get index from the collection
  *
  * @param string/Edge  $index - Collection ID / Edge Object to get.
  * @param string  $id - specify the edge ID to get the edge.
  * @param array  $param - Array of parameters to send to the database as a header for edge request.
  *
  * @return array/Edge $response/$doc - Return a response array of the request/Edge object.
  */
 public function getIndex($index, $id = NULL, $param = NULL)
 {
     if ($doc instanceof Index) {
         $collection = $index->getCollectionID();
         $id = $index->getId();
         $response = $this->get('index/' . $collection . '/' . $id, NULL, 'json');
         if ($response->code == '201' or $response->code == '202' or $response->code == '200') {
             $index->setData($response);
             return $index;
         } else {
             return $response;
         }
     } else {
         $collection = $index;
         $response = $this->get('index/' . $collection . '/' . $id, NULL, 'json');
         return $response;
     }
 }