/** * Commit item send * * @param itemId - required - * The item id. * @param sendEmailNotifications - optional - * If true, an email notification is sent to the sender and the recipients. * If false, no email is sent. * @param expiration - optional - * The expiration duration in minutes. * A value of 0 indicates that the item never expires. * @return The Commit object containing the download URL (link to the download page) * or the error code and message returned by the server. * */ public function commitSend($itemId, $sendEmailNotifications = '', $expiration = '') { $parameters = array(); $urld = 'dpi/v1/item/commit/' . $itemId; if ($expiration !== '') { $parameters['expiration'] = $expiration; } if ($sendEmailNotifications !== '') { $parameters['sendEmailNotifications'] = $sendEmailNotifications; } $this->response = $this->_restTransportInstance->sendRequest($urld, $parameters, 'POST', $this->_authToken); $responseBody = simplexml_load_string($this->response); $returnObject = new Commit(); 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 { if (empty($responseBody->errorStatus)) { $downloadUrl = (string) $responseBody->downloadUrl; $returnObject->setDownloadUrl($downloadUrl); } else { $errorCode = (string) $responseBody->errorStatus->code; $errorMessage = (string) $responseBody->errorStatus->message; $errorObject = new ErrorStatus($errorCode, $errorMessage); $returnObject->setErrorStatus($errorObject); } } return $returnObject; }