You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
2.5 KiB

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