IService.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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 Service Interface
  10. *
  11. * This interface is a base requirement of methods and functionality used to construct a mail service object
  12. *
  13. * @since 30.0.0
  14. *
  15. */
  16. interface IService {
  17. /**
  18. * arbitrary unique text string identifying this service
  19. *
  20. * @since 30.0.0
  21. *
  22. * @return string id of this service (e.g. 1 or service1 or anything else)
  23. */
  24. public function id(): string;
  25. /**
  26. * checks if a service is able of performing an specific action
  27. *
  28. * @since 30.0.0
  29. *
  30. * @param string $value required ability e.g. 'MessageSend'
  31. *
  32. * @return bool true/false if ability is supplied and found in collection
  33. */
  34. public function capable(string $value): bool;
  35. /**
  36. * retrieves a collection of what actions a service can perfrom
  37. *
  38. * @since 30.0.0
  39. *
  40. * @return array collection of abilities otherwise empty collection
  41. */
  42. public function capabilities(): array;
  43. /**
  44. * gets the localized human frendly name of this service
  45. *
  46. * @since 30.0.0
  47. *
  48. * @return string label/name of service (e.g. ACME Company Mail Service)
  49. */
  50. public function getLabel(): string;
  51. /**
  52. * sets the localized human frendly name of this service
  53. *
  54. * @since 30.0.0
  55. *
  56. * @param string $value label/name of service (e.g. ACME Company Mail Service)
  57. *
  58. * @return self return this object for command chaining
  59. */
  60. public function setLabel(string $value): self;
  61. /**
  62. * gets the primary mailing address for this service
  63. *
  64. * @since 30.0.0
  65. *
  66. * @return IAddress mail address object
  67. */
  68. public function getPrimaryAddress(): IAddress;
  69. /**
  70. * sets the primary mailing address for this service
  71. *
  72. * @since 30.0.0
  73. *
  74. * @param IAddress $value mail address object
  75. *
  76. * @return self return this object for command chaining
  77. */
  78. public function setPrimaryAddress(IAddress $value): self;
  79. /**
  80. * gets the secondary mailing addresses (aliases) collection for this service
  81. *
  82. * @since 30.0.0
  83. *
  84. * @return array<int, IAddress> collection of mail address objects
  85. */
  86. public function getSecondaryAddresses(): array;
  87. /**
  88. * sets the secondary mailing addresses (aliases) for this service
  89. *
  90. * @since 30.0.0
  91. *
  92. * @param IAddress ...$value collection of one or more mail address objects
  93. *
  94. * @return self return this object for command chaining
  95. */
  96. public function setSecondaryAddresses(IAddress ...$value): self;
  97. /**
  98. * construct a new empty message object
  99. *
  100. * @since 30.0.0
  101. *
  102. * @return IMessage blank message object
  103. */
  104. public function initiateMessage(): IMessage;
  105. }