You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

IOCMProvider.php 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2023 Maxence Lange <maxence@artificial-owl.com>
  5. *
  6. * @author Maxence Lange <maxence@artificial-owl.com>
  7. *
  8. * @license GNU AGPL version 3 or any later version
  9. *
  10. * This program is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License as
  12. * published by the Free Software Foundation, either version 3 of the
  13. * License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. *
  23. */
  24. namespace OCP\OCM;
  25. use OC\OCM\Model\OCMResource;
  26. use OCP\OCM\Exceptions\OCMArgumentException;
  27. use OCP\OCM\Exceptions\OCMProviderException;
  28. /**
  29. * Model based on the Open Cloud Mesh Discovery API
  30. * @link https://github.com/cs3org/OCM-API/
  31. * @since 28.0.0
  32. */
  33. interface IOCMProvider {
  34. /**
  35. * enable OCM
  36. *
  37. * @param bool $enabled
  38. *
  39. * @return self
  40. * @since 28.0.0
  41. */
  42. public function setEnabled(bool $enabled): self;
  43. /**
  44. * is set as enabled ?
  45. *
  46. * @return bool
  47. * @since 28.0.0
  48. */
  49. public function isEnabled(): bool;
  50. /**
  51. * get set API Version
  52. *
  53. * @param string $apiVersion
  54. *
  55. * @return self
  56. * @since 28.0.0
  57. */
  58. public function setApiVersion(string $apiVersion): self;
  59. /**
  60. * returns API version
  61. *
  62. * @return string
  63. * @since 28.0.0
  64. */
  65. public function getApiVersion(): string;
  66. /**
  67. * configure endpoint
  68. *
  69. * @param string $endPoint
  70. *
  71. * @return self
  72. * @since 28.0.0
  73. */
  74. public function setEndPoint(string $endPoint): self;
  75. /**
  76. * get configured endpoint
  77. *
  78. * @return string
  79. * @since 28.0.0
  80. */
  81. public function getEndPoint(): string;
  82. /**
  83. * add a single resource to the object
  84. *
  85. * @param OCMResource $resource
  86. *
  87. * @return self
  88. * @since 28.0.0
  89. */
  90. public function addResourceType(OCMResource $resource): self;
  91. /**
  92. * set resources
  93. *
  94. * @param OCMResource[] $resourceTypes
  95. *
  96. * @return self
  97. * @since 28.0.0
  98. */
  99. public function setResourceTypes(array $resourceTypes): self;
  100. /**
  101. * get all set resources
  102. *
  103. * @return IOCMResource[]
  104. * @since 28.0.0
  105. */
  106. public function getResourceTypes(): array;
  107. /**
  108. * extract a specific string value from the listing of protocols, based on resource-name and protocol-name
  109. *
  110. * @param string $resourceName
  111. * @param string $protocol
  112. *
  113. * @return string
  114. * @throws OCMArgumentException
  115. * @since 28.0.0
  116. */
  117. public function extractProtocolEntry(string $resourceName, string $protocol): string;
  118. /**
  119. * import data from an array
  120. *
  121. * @param array<string, int|string|bool|array> $data
  122. *
  123. * @return self
  124. * @throws OCMProviderException in case a descent provider cannot be generated from data
  125. * @since 28.0.0
  126. */
  127. public function import(array $data): self;
  128. }