1
0

IProvider.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\Mail\Provider;
  8. /**
  9. * Mail Provider Interface
  10. *
  11. * This interface is a base requirement of methods and functionality used to construct a mail provider object
  12. *
  13. * @since 30.0.0
  14. *
  15. */
  16. interface IProvider {
  17. /**
  18. * arbitrary unique text string identifying this provider
  19. *
  20. * @since 30.0.0
  21. *
  22. * @return string id of this provider (e.g. UUID or 'IMAP/SMTP' or anything else)
  23. */
  24. public function id(): string;
  25. /**
  26. * localized human friendly name of this provider
  27. *
  28. * @since 30.0.0
  29. *
  30. * @return string label/name of this provider (e.g. Plain Old IMAP/SMTP)
  31. */
  32. public function label(): string;
  33. /**
  34. * determine if any services are configured for a specific user
  35. *
  36. * @since 30.0.0
  37. *
  38. * @param string $userId user id
  39. *
  40. * @return bool true if any services are configure for the user
  41. */
  42. public function hasServices(string $userId): bool;
  43. /**
  44. * retrieve collection of services for a specific user
  45. *
  46. * @param string $userId user id
  47. *
  48. * @since 30.0.0
  49. *
  50. * @return array<string,IService> collection of service id and object ['1' => IServiceObject]
  51. */
  52. public function listServices(string $userId): array;
  53. /**
  54. * retrieve a service with a specific id
  55. *
  56. * @since 30.0.0
  57. *
  58. * @param string $userId user id
  59. * @param string $serviceId service id
  60. *
  61. * @return IService|null returns service object or null if none found
  62. */
  63. public function findServiceById(string $userId, string $serviceId): IService | null;
  64. /**
  65. * retrieve a service for a specific mail address
  66. *
  67. * @since 30.0.0
  68. *
  69. * @param string $userId user id
  70. * @param string $address mail address (e.g. test@example.com)
  71. *
  72. * @return IService|null returns service object or null if none found
  73. */
  74. public function findServiceByAddress(string $userId, string $address): IService | null;
  75. /**
  76. * construct a new empty service object
  77. *
  78. * @since 30.0.0
  79. *
  80. * @return IService blank service object
  81. */
  82. public function initiateService(): IService;
  83. }