/** * Share folder with other users * * @param folderId - required - * Id of the folder to be shared. * @param email - required - * Comma separated email addresses * of the users to share folders with. * @param message - optional - * The message that will go in the invitation email. * Optional parameter. Default: empty message. * @param permission - optional - * If set to read, the user cannot update the content of the folder. * If set to true, the user can update the content of the folder. * Optional parameter. Default: 'read'. * @return The Share object containing the status of the operation. */ public function shareFolder($folderId, $email, $message = '', $permission = '') { $parameters = array('email' => $email); if ($message !== '') { $parameters['Message'] = $message; } if ($permission !== '') { $parameters['permission'] = $permission; } $urld = 'dpi/v1/folder/' . $folderId . '/share'; $this->response = $this->restTransportInstance->sendRequest($urld, $parameters, self::HTTP_POST, $this->authToken); $responseBody = simplexml_load_string($this->response); $returnObject = new Share(); 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; }