Ejemplo n.º 1
0
 /**
  * Move Folder
  *
  * @param folderId - required -
  *            The id of the folder.
  * @param parentId - required -
  *            The id of the parent where the file should be moved.
  * @return The Move object which contains the status of the operation.
  */
 public function moveFolder($folderId, $parentId)
 {
     $parameters = array('folderId' => $folderId, 'parentId' => $parentId);
     $urld = 'dpi/v1/folder/' . $folderId . '/move';
     $this->response = $this->restTransportInstance->sendRequest($urld, $parameters, self::HTTP_PUT, $this->authToken);
     $responseBody = simplexml_load_string($this->response);
     $returnObject = new Move();
     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;
 }