ICloudFederationProviderManager.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. /**
  23. * Class ICloudFederationProviderManager
  24. *
  25. * Manage cloud federation providers
  26. *
  27. * @since 14.0.0
  28. *
  29. * @package OCP\Federation
  30. */
  31. interface ICloudFederationProviderManager {
  32. /**
  33. * Registers an callback function which must return an cloud federation provider
  34. *
  35. * @param string $resourceType which resource type does the provider handles
  36. * @param string $displayName user facing name of the federated share provider
  37. * @param callable $callback
  38. * @throws Exceptions\ProviderAlreadyExistsException
  39. *
  40. * @since 14.0.0
  41. */
  42. public function addCloudFederationProvider($resourceType, $displayName, callable $callback);
  43. /**
  44. * remove cloud federation provider
  45. *
  46. * @param string $resourceType
  47. *
  48. * @since 14.0.0
  49. */
  50. public function removeCloudFederationProvider($resourceType);
  51. /**
  52. * get a list of all cloudFederationProviders
  53. *
  54. * @return array [resourceType => ['resourceType' => $resourceType, 'displayName' => $displayName, 'callback' => callback]]
  55. *
  56. * @since 14.0.0
  57. */
  58. public function getAllCloudFederationProviders();
  59. /**
  60. * get a specific cloud federation provider
  61. *
  62. * @param string $resourceType
  63. * @return ICloudFederationProvider
  64. * @throws Exceptions\ProviderDoesNotExistsException
  65. *
  66. * @since 14.0.0
  67. */
  68. public function getCloudFederationProvider($resourceType);
  69. /**
  70. * send federated share
  71. *
  72. * @param ICloudFederationShare $share
  73. * @return mixed
  74. *
  75. * @since 14.0.0
  76. */
  77. public function sendShare(ICloudFederationShare $share);
  78. /**
  79. * send notification about existing share
  80. *
  81. * @param string $url
  82. * @param ICloudFederationNotification $notification
  83. * @return mixed
  84. *
  85. * @since 14.0.0
  86. */
  87. public function sendNotification($url, ICloudFederationNotification $notification);
  88. /**
  89. * check if the new cloud federation API is ready to be used
  90. *
  91. * @return bool
  92. *
  93. * @since 14.0.0
  94. */
  95. public function isReady();
  96. }