ICloudFederationProviderManager.php 2.8 KB

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