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.

126 lines
3.9 KiB

3 years ago
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Bart Visscher <bartv@thisnet.nl>
  6. * @author Daniel Kesselberg <mail@danielkesselberg.de>
  7. * @author Georg Ehrke <oc.list@georgehrke.com>
  8. * @author John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
  9. * @author Julius Härtl <jus@bitgrid.net>
  10. * @author Morris Jobke <hey@morrisjobke.de>
  11. * @author Robin McCorkell <robin@mccorkell.me.uk>
  12. * @author Roeland Jago Douma <roeland@famdouma.nl>
  13. * @author Thomas Müller <thomas.mueller@tmit.eu>
  14. *
  15. * @license AGPL-3.0
  16. *
  17. * This code is free software: you can redistribute it and/or modify
  18. * it under the terms of the GNU Affero General Public License, version 3,
  19. * as published by the Free Software Foundation.
  20. *
  21. * This program is distributed in the hope that it will be useful,
  22. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  24. * GNU Affero General Public License for more details.
  25. *
  26. * You should have received a copy of the GNU Affero General Public License, version 3,
  27. * along with this program. If not, see <http://www.gnu.org/licenses/>
  28. *
  29. */
  30. /**
  31. * Public interface of ownCloud for apps to use.
  32. * IAddressBook interface
  33. */
  34. // use OCP namespace for all classes that are considered public.
  35. // This means that they should be used by apps instead of the internal ownCloud classes
  36. namespace OCP {
  37. /**
  38. * Interface IAddressBook
  39. *
  40. * @since 5.0.0
  41. */
  42. interface IAddressBook {
  43. /**
  44. * @return string defining the technical unique key
  45. * @since 5.0.0
  46. */
  47. public function getKey();
  48. /**
  49. * @return string defining the unique uri
  50. * @since 16.0.0
  51. * @return string
  52. */
  53. public function getUri(): string;
  54. /**
  55. * In comparison to getKey() this function returns a human readable (maybe translated) name
  56. * @return mixed
  57. * @since 5.0.0
  58. */
  59. public function getDisplayName();
  60. /**
  61. * @param string $pattern which should match within the $searchProperties
  62. * @param array $searchProperties defines the properties within the query pattern should match
  63. * @param array $options Options to define the output format and search behavior
  64. * - 'types' boolean (since 15.0.0) If set to true, fields that come with a TYPE property will be an array
  65. * example: ['id' => 5, 'FN' => 'Thomas Tanghus', 'EMAIL' => ['type => 'HOME', 'value' => 'g@h.i']]
  66. * - 'escape_like_param' - If set to false wildcards _ and % are not escaped
  67. * - 'limit' - Set a numeric limit for the search results
  68. * - 'offset' - Set the offset for the limited search results
  69. * @return array an array of contacts which are arrays of key-value-pairs
  70. * example result:
  71. * [
  72. * ['id' => 0, 'FN' => 'Thomas Müller', 'EMAIL' => 'a@b.c', 'GEO' => '37.386013;-122.082932'],
  73. * ['id' => 5, 'FN' => 'Thomas Tanghus', 'EMAIL' => ['d@e.f', 'g@h.i']]
  74. * ]
  75. * @since 5.0.0
  76. */
  77. public function search($pattern, $searchProperties, $options);
  78. /**
  79. * @param array $properties this array if key-value-pairs defines a contact
  80. * @return array an array representing the contact just created or updated
  81. * @since 5.0.0
  82. */
  83. public function createOrUpdate($properties);
  84. // // dummy
  85. // return array('id' => 0, 'FN' => 'Thomas Müller', 'EMAIL' => 'a@b.c',
  86. // 'PHOTO' => 'VALUE=uri:http://www.abc.com/pub/photos/jqpublic.gif',
  87. // 'ADR' => ';;123 Main Street;Any Town;CA;91921-1234'
  88. // );
  89. /**
  90. * @return mixed
  91. * @since 5.0.0
  92. */
  93. public function getPermissions();
  94. /**
  95. * @param object $id the unique identifier to a contact
  96. * @return bool successful or not
  97. * @since 5.0.0
  98. */
  99. public function delete($id);
  100. /**
  101. * Returns true if this address-book is not owned by the current user,
  102. * but shared with them.
  103. *
  104. * @return bool
  105. * @since 20.0.0
  106. */
  107. public function isShared(): bool;
  108. /**
  109. * @return bool
  110. * @since 20.0.0
  111. */
  112. public function isSystemAddressBook(): bool;
  113. }
  114. }