diff options
author | Bjoern Schiessle <bjoern@schiessle.org> | 2018-05-09 18:06:35 +0300 |
---|---|---|
committer | Bjoern Schiessle <bjoern@schiessle.org> | 2018-07-02 12:29:27 +0300 |
commit | db428ea5471a5be5517911b3bf2f3a6d3f86e297 (patch) | |
tree | 3921525a302150e75d968a47dff14be79f9ffa3b /lib/public/Federation | |
parent | a3948e8a126d6f84629841c8886fe0819ab04ad5 (diff) |
send accept share notification (WIP)
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'lib/public/Federation')
4 files changed, 52 insertions, 9 deletions
diff --git a/lib/public/Federation/Exceptions/ActionNotSupportedException.php b/lib/public/Federation/Exceptions/ActionNotSupportedException.php new file mode 100644 index 00000000000..7e7fe70f480 --- /dev/null +++ b/lib/public/Federation/Exceptions/ActionNotSupportedException.php @@ -0,0 +1,39 @@ +<?php +/** + * @copyright Copyright (c) 2018 Bjoern Schiessle <bjoern@schiessle.org> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OCP\Federation\Exceptions; + +use OC\HintException; + +class ActionNotSupportedException extends HintException { + + /** + * ActionNotSupportedException constructor. + * + */ + public function __construct($action) { + $l = \OC::$server->getL10N('federation'); + $message = 'Action "' . $action . '" not supported or implemented.'; + $hint = $l->t('Action "%s" not supported or implemented.', [$action]); + parent::__construct($message, $hint); + } + +} diff --git a/lib/public/Federation/ICloudFederationNotification.php b/lib/public/Federation/ICloudFederationNotification.php index 5db93ef0a8c..dcdb5b73bd0 100644 --- a/lib/public/Federation/ICloudFederationNotification.php +++ b/lib/public/Federation/ICloudFederationNotification.php @@ -26,15 +26,16 @@ interface ICloudFederationNotification { /** * add a message to the notification * - * @param string $identifier - * @param string $message + * @param string $notificationType (e.g. SHARE_ACCEPTED) + * @param string $resourceType (e.g. file, calendar, contact,...) + * @param array $message * * @since 14.0.0 */ - public function setMessage($identifier, $message); + public function setMessage($notificationType, $resourceType, array $message); /** - * get JSON encoded Message, ready to send out + * get message, ready to send out * * @return string * diff --git a/lib/public/Federation/ICloudFederationProvider.php b/lib/public/Federation/ICloudFederationProvider.php index 38a551000f0..0d87d76ee55 100644 --- a/lib/public/Federation/ICloudFederationProvider.php +++ b/lib/public/Federation/ICloudFederationProvider.php @@ -21,6 +21,7 @@ namespace OCP\Federation; +use OCP\Federation\Exceptions\ActionNotSupportedException; use OCP\Federation\Exceptions\ProviderCouldNotAddShareException; use OCP\Federation\Exceptions\ShareNotFoundException; @@ -60,13 +61,14 @@ interface ICloudFederationProvider { /** * notification received from another server * - * @param string $id unique ID of a already existing share - * @param array $notification provider specific notification + * @param string $notificationType (e.g SHARE_ACCEPTED) + * @param array $message provider specific notification * * @throws ShareNotFoundException + * @throws ActionNotSupportedException * * @since 14.0.0 */ - public function notificationReceived($id, $notification); + public function notificationReceived($notificationType, array $message); } diff --git a/lib/public/Federation/ICloudFederationProviderManager.php b/lib/public/Federation/ICloudFederationProviderManager.php index 81558c631f7..714c6234b71 100644 --- a/lib/public/Federation/ICloudFederationProviderManager.php +++ b/lib/public/Federation/ICloudFederationProviderManager.php @@ -86,12 +86,13 @@ interface ICloudFederationProviderManager { /** * send notification about existing share * + * @param string $url * @param ICloudFederationNotification $notification - * @return mixed + * @return bool * * @since 14.0.0 */ - public function sendNotification(ICloudFederationNotification $notification); + public function sendNotification($url, ICloudFederationNotification $notification); /** * check if the new cloud federation API is ready to be used |