ICloudIdManager.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2017, Robin Appelman <robin@icewind.nl>
  5. *
  6. * @author Joas Schilling <coding@schilljs.com>
  7. * @author Robin Appelman <robin@icewind.nl>
  8. * @author Roeland Jago Douma <roeland@famdouma.nl>
  9. *
  10. * @license GNU AGPL version 3 or any later version
  11. *
  12. * This program is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License as
  14. * published by the Free Software Foundation, either version 3 of the
  15. * License, or (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU Affero General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Affero General Public License
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  24. *
  25. */
  26. namespace OCP\Federation;
  27. /**
  28. * Interface for resolving federated cloud ids
  29. *
  30. * @since 12.0.0
  31. */
  32. interface ICloudIdManager {
  33. /**
  34. * @param string $cloudId
  35. * @return ICloudId
  36. * @throws \InvalidArgumentException
  37. *
  38. * @since 12.0.0
  39. */
  40. public function resolveCloudId(string $cloudId): ICloudId;
  41. /**
  42. * Get the cloud id for a remote user
  43. *
  44. * @param string $user
  45. * @param string|null $remote (optional since 23.0.0 for local users)
  46. * @return ICloudId
  47. *
  48. * @since 12.0.0
  49. */
  50. public function getCloudId(string $user, ?string $remote): ICloudId;
  51. /**
  52. * Check if the input is a correctly formatted cloud id
  53. *
  54. * @param string $cloudId
  55. * @return bool
  56. *
  57. * @since 12.0.0
  58. */
  59. public function isValidCloudId(string $cloudId): bool;
  60. /**
  61. * remove scheme/protocol from an url
  62. *
  63. * @param string $url
  64. *
  65. * @return string
  66. * @since 28.0.0
  67. */
  68. public function removeProtocolFromUrl(string $url): string;
  69. }