/** * Get File Info * * @param fileId - required - * The id of the file. * @return The File object. If the operation was successful, the object contains the file info, if not, * the Folder object containing the error code and message. */ public function getFileInfo($fileId) { $urld = 'dpi/v1/folder/file/' . $fileId; $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->setClickableDownloadUrl((string) $responseBody->clickableDownloadUrl); $returnObject->setCreatedOn((string) $responseBody->createdOn); $returnObject->setDownloadUrl((string) $responseBody->downloadUrl); $returnObject->setName((string) $responseBody->name); $returnObject->setOwnedByStorage((string) $responseBody->ownedByStorage); $returnObject->setParentId((string) $responseBody->parentid); $returnObject->setSize((string) $responseBody->size); } else { $errorCode = (string) $responseBody->errorStatus->code; $errorMessage = (string) $responseBody->errorStatus->message; $errorObject = new ErrorStatus($errorCode, $errorMessage); $returnObject->setErrorStatus($errorObject); } } return $returnObject; }