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.

90 lines
2.7 KiB

3 years ago
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2018 Julius Härtl <jus@bitgrid.net>
  5. *
  6. * @author Julius Härtl <jus@bitgrid.net>
  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\Accounts;
  25. use OCP\IUser;
  26. /**
  27. * Interface IAccount
  28. *
  29. * @since 15.0.0
  30. */
  31. interface IAccount extends \JsonSerializable {
  32. /**
  33. * Set a property with data
  34. *
  35. * @since 15.0.0
  36. *
  37. * @param string $property Must be one of the PROPERTY_ prefixed constants of \OCP\Accounts\IAccountManager
  38. * @param string $value
  39. * @param string $scope Must be one of the VISIBILITY_ prefixed constants of \OCP\Accounts\IAccountManager
  40. * @param string $verified \OCP\Accounts\IAccountManager::NOT_VERIFIED | \OCP\Accounts\IAccountManager::VERIFICATION_IN_PROGRESS | \OCP\Accounts\IAccountManager::VERIFIED
  41. * @return IAccount
  42. */
  43. public function setProperty(string $property, string $value, string $scope, string $verified): IAccount;
  44. /**
  45. * Get a property by its key
  46. *
  47. * @since 15.0.0
  48. *
  49. * @param string $property Must be one of the PROPERTY_ prefixed constants of \OCP\Accounts\IAccountManager
  50. * @return IAccountProperty
  51. * @throws PropertyDoesNotExistException
  52. */
  53. public function getProperty(string $property): IAccountProperty;
  54. /**
  55. * Get all properties of an account
  56. *
  57. * @since 15.0.0
  58. *
  59. * @return IAccountProperty[]
  60. */
  61. public function getProperties(): array;
  62. /**
  63. * Get all properties that match the provided filters for scope and verification status
  64. *
  65. * @since 15.0.0
  66. *
  67. * @param string $scope Must be one of the VISIBILITY_ prefixed constants of \OCP\Accounts\IAccountManager
  68. * @param string $verified \OCP\Accounts\IAccountManager::NOT_VERIFIED | \OCP\Accounts\IAccountManager::VERIFICATION_IN_PROGRESS | \OCP\Accounts\IAccountManager::VERIFIED
  69. * @return IAccountProperty[]
  70. */
  71. public function getFilteredProperties(string $scope = null, string $verified = null): array;
  72. /**
  73. * Get the related user for the account data
  74. *
  75. * @since 15.0.0
  76. *
  77. * @return IUser
  78. */
  79. public function getUser(): IUser;
  80. }