ICloudFederationProvider.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2018 Bjoern Schiessle <bjoern@schiessle.org>
  4. *
  5. * @license GNU AGPL version 3 or any later version
  6. *
  7. * This program is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU Affero General Public License as
  9. * published by the Free Software Foundation, either version 3 of the
  10. * License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU Affero General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Affero General Public License
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. *
  20. */
  21. namespace OCP\Federation;
  22. use OCP\Federation\Exceptions\ActionNotSupportedException;
  23. use OCP\Federation\Exceptions\AuthenticationFailedException;
  24. use OCP\Federation\Exceptions\BadRequestException;
  25. use OCP\Federation\Exceptions\ProviderCouldNotAddShareException;
  26. use \OCP\Share\Exceptions\ShareNotFound;
  27. /**
  28. * Interface ICloudFederationProvider
  29. *
  30. * Enable apps to create their own cloud federation provider
  31. *
  32. * @since 14.0.0
  33. *
  34. * @package OCP\Federation
  35. */
  36. interface ICloudFederationProvider {
  37. /**
  38. * get the name of the share type, handled by this provider
  39. *
  40. * @return string
  41. *
  42. * @since 14.0.0
  43. */
  44. public function getShareType();
  45. /**
  46. * share received from another server
  47. *
  48. * @param ICloudFederationShare $share
  49. * @return string provider specific unique ID of the share
  50. *
  51. * @throws ProviderCouldNotAddShareException
  52. *
  53. * @since 14.0.0
  54. */
  55. public function shareReceived(ICloudFederationShare $share);
  56. /**
  57. * notification received from another server
  58. *
  59. * @param string $notificationType (e.g SHARE_ACCEPTED)
  60. * @param string $providerId share ID
  61. * @param array $notification provider specific notification
  62. * @return array $data send back to sender
  63. *
  64. * @throws ShareNotFound
  65. * @throws ActionNotSupportedException
  66. * @throws BadRequestException
  67. * @throws AuthenticationFailedException
  68. *
  69. * @since 14.0.0
  70. */
  71. public function notificationReceived($notificationType, $providerId, array $notification);
  72. /**
  73. * get the supported share types, e.g. "user", "group", etc.
  74. *
  75. * @return array
  76. *
  77. * @since 14.0.0
  78. */
  79. public function getSupportedShareTypes();
  80. }