ICloudFederationProviderManager.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OCP\Federation;
  7. use OCP\Http\Client\IResponse;
  8. use OCP\OCM\Exceptions\OCMProviderException;
  9. /**
  10. * Class ICloudFederationProviderManager
  11. *
  12. * Manage cloud federation providers
  13. *
  14. * @since 14.0.0
  15. *
  16. */
  17. interface ICloudFederationProviderManager {
  18. /**
  19. * Registers an callback function which must return an cloud federation provider
  20. *
  21. * @param string $resourceType which resource type does the provider handles
  22. * @param string $displayName user facing name of the federated share provider
  23. * @param callable $callback
  24. * @throws Exceptions\ProviderAlreadyExistsException
  25. *
  26. * @since 14.0.0
  27. */
  28. public function addCloudFederationProvider($resourceType, $displayName, callable $callback);
  29. /**
  30. * remove cloud federation provider
  31. *
  32. * @param string $resourceType
  33. *
  34. * @since 14.0.0
  35. */
  36. public function removeCloudFederationProvider($resourceType);
  37. /**
  38. * get a list of all cloudFederationProviders
  39. *
  40. * @return array [resourceType => ['resourceType' => $resourceType, 'displayName' => $displayName, 'callback' => callback]]
  41. *
  42. * @since 14.0.0
  43. */
  44. public function getAllCloudFederationProviders();
  45. /**
  46. * get a specific cloud federation provider
  47. *
  48. * @param string $resourceType
  49. * @return ICloudFederationProvider
  50. * @throws Exceptions\ProviderDoesNotExistsException
  51. *
  52. * @since 14.0.0
  53. */
  54. public function getCloudFederationProvider($resourceType);
  55. /**
  56. * send federated share
  57. *
  58. * @param ICloudFederationShare $share
  59. * @return mixed
  60. *
  61. * @since 14.0.0
  62. * @deprecated 29.0.0 - Use {@see sendCloudShare()} instead and handle errors manually
  63. */
  64. public function sendShare(ICloudFederationShare $share);
  65. /**
  66. * @param ICloudFederationShare $share
  67. * @return IResponse
  68. * @throws OCMProviderException
  69. * @since 29.0.0
  70. */
  71. public function sendCloudShare(ICloudFederationShare $share): IResponse;
  72. /**
  73. * send notification about existing share
  74. *
  75. * @param string $url
  76. * @param ICloudFederationNotification $notification
  77. * @return array|false
  78. *
  79. * @since 14.0.0
  80. * @deprecated 29.0.0 - Use {@see sendCloudNotification()} instead and handle errors manually
  81. */
  82. public function sendNotification($url, ICloudFederationNotification $notification);
  83. /**
  84. * @param string $url
  85. * @param ICloudFederationNotification $notification
  86. * @return IResponse
  87. * @throws OCMProviderException
  88. * @since 29.0.0
  89. */
  90. public function sendCloudNotification(string $url, ICloudFederationNotification $notification): IResponse;
  91. /**
  92. * check if the new cloud federation API is ready to be used
  93. *
  94. * @return bool
  95. *
  96. * @since 14.0.0
  97. */
  98. public function isReady();
  99. }