/**
  * Get File Revisions
  *
  * @param fileId - required -
  *		The id of the file.
  *
  * @return 	A File object is return with all the revisions
  * or the error code and message returned by the server.
  */
 public function getFileRevisions($fileId)
 {
     $urld = 'dpi/v1/folder/file/' . $fileId . '/revisions';
     $parameters = array();
     $this->response = $this->restTransportInstance->sendRequest($urld, $parameters, self::HTTP_GET, $this->authToken);
     $responseBody = simplexml_load_string($this->response);
     $returnObject = new File();
     if ($responseBody === false) {
         $errorCode = 'N/A';
         $errorMessage = 'The server has encountered an error, please try again.';
         $errorObject = new ErrorStatus($errorCode, $errorMessage);
         $returnObject->setErrorStatus($errorObject);
     } else {
         $errorStatus = $responseBody->errorStatus;
         if (empty($errorStatus)) {
             $returnObject->setRevision((string) $responseBody->attributes()->revision);
             $returnObject->setId((string) $responseBody->attributes()->id);
             $returnObject->setStatus((string) $responseBody->status);
             $returnObject->setCreatedOn((string) $responseBody->createdOn);
             $returnObject->setName((string) $responseBody->name);
             $returnObject->setOwnedByStorage((string) $responseBody->ownedByStorage);
             $returnObject->setParentId((string) $responseBody->parentid);
             $returnObject->setRevisionCount((string) $responseBody->revisionCount);
             $returnObject->setSize((string) $responseBody->size);
             $revisions = array();
             $revisionsTag = (string) $responseBody->revisions->count();
             if ($revisionsTag > 0) {
                 foreach ($responseBody->revisions->children() as $currentRevision) {
                     if ($currentRevision->count() > 0) {
                         $revision = new Revision();
                         $revision->setId((string) $currentRevision->attributes()->id);
                         $revision->setCurrent((string) $currentRevision->current);
                         $revision->setDownloadUrl((string) $currentRevision->downloadUrl);
                         $revision->setSize((string) $currentRevision->size);
                         array_push($revisions, $revision);
                     }
                 }
                 $returnObject->setRevisions($revisions);
             }
         } else {
             $errorCode = (string) $responseBody->errorStatus->code;
             $errorMessage = (string) $responseBody->errorStatus->message;
             $errorObject = new ErrorStatus($errorCode, $errorMessage);
             $returnObject->setErrorStatus($errorObject);
         }
     }
     return $returnObject;
 }
 /**
  * Send a file from the folder
  *
  * @param fileId - required -
  * 		Id of the file to be sent.
  * @param recipients - required -
  * 		Comma separated email addresses
  * 		of the users to whom the file link will be sent.
  * @return The File object containing the status of the operation.
  */
 public function sendFile($fileId, $recipients)
 {
     $parameters = array('recipients' => $recipients);
     $urld = 'dpi/v1/folder/file/' . $fileId . '/send';
     $this->response = $this->restTransportInstance->sendRequest($urld, $parameters, self::HTTP_POST, $this->authToken);
     $responseBody = simplexml_load_string($this->response);
     $returnObject = new File();
     if ($responseBody === false) {
         $errorCode = 'N/A';
         $errorMessage = 'The server has encountered an error, please try again.';
         $errorObject = new ErrorStatus($errorCode, $errorMessage);
         $returnObject->setErrorStatus($errorObject);
     } else {
         $errorStatus = $responseBody->errorStatus;
         if (empty($errorStatus)) {
             $returnObject->setStatus((string) $responseBody->status);
         } else {
             $errorCode = (string) $responseBody->errorStatus->code;
             $errorMessage = (string) $responseBody->errorStatus->message;
             $errorObject = new ErrorStatus($errorCode, $errorMessage);
             $returnObject->setErrorStatus($errorObject);
         }
     }
     return $returnObject;
 }