1
0

IAddressBook.php 4.0 KB

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