ICloudIdManager.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\Federation;
  8. /**
  9. * Interface for resolving federated cloud ids
  10. *
  11. * @since 12.0.0
  12. */
  13. interface ICloudIdManager {
  14. /**
  15. * @param string $cloudId
  16. * @return ICloudId
  17. * @throws \InvalidArgumentException
  18. *
  19. * @since 12.0.0
  20. */
  21. public function resolveCloudId(string $cloudId): ICloudId;
  22. /**
  23. * Get the cloud id for a remote user
  24. *
  25. * @param string $user
  26. * @param string|null $remote (optional since 23.0.0 for local users)
  27. * @return ICloudId
  28. *
  29. * @since 12.0.0
  30. */
  31. public function getCloudId(string $user, ?string $remote): ICloudId;
  32. /**
  33. * Check if the input is a correctly formatted cloud id
  34. *
  35. * @param string $cloudId
  36. * @return bool
  37. *
  38. * @since 12.0.0
  39. */
  40. public function isValidCloudId(string $cloudId): bool;
  41. /**
  42. * remove scheme/protocol from an url
  43. *
  44. * @param string $url
  45. * @param bool $httpsOnly
  46. *
  47. * @return string
  48. * @since 28.0.0
  49. * @since 30.0.0 - Optional parameter $httpsOnly was added
  50. */
  51. public function removeProtocolFromUrl(string $url, bool $httpsOnly = false): string;
  52. }