@@ -55,134 +55,134 @@ |
||
| 55 | 55 | */ |
| 56 | 56 | interface IManager { |
| 57 | 57 | |
| 58 | - /** |
|
| 59 | - * This function is used to search and find contacts within the users address books. |
|
| 60 | - * In case $pattern is empty all contacts will be returned. |
|
| 61 | - * |
|
| 62 | - * Example: |
|
| 63 | - * Following function shows how to search for contacts for the name and the email address. |
|
| 64 | - * |
|
| 65 | - * public static function getMatchingRecipient($term) { |
|
| 66 | - * $cm = \OC::$server->getContactsManager(); |
|
| 67 | - * // The API is not active -> nothing to do |
|
| 68 | - * if (!$cm->isEnabled()) { |
|
| 69 | - * return array(); |
|
| 70 | - * } |
|
| 71 | - * |
|
| 72 | - * $result = $cm->search($term, array('FN', 'EMAIL')); |
|
| 73 | - * $receivers = array(); |
|
| 74 | - * foreach ($result as $r) { |
|
| 75 | - * $id = $r['id']; |
|
| 76 | - * $fn = $r['FN']; |
|
| 77 | - * $email = $r['EMAIL']; |
|
| 78 | - * if (!is_array($email)) { |
|
| 79 | - * $email = array($email); |
|
| 80 | - * } |
|
| 81 | - * |
|
| 82 | - * // loop through all email addresses of this contact |
|
| 83 | - * foreach ($email as $e) { |
|
| 84 | - * $displayName = $fn . " <$e>"; |
|
| 85 | - * $receivers[] = array( |
|
| 86 | - * 'id' => $id, |
|
| 87 | - * 'label' => $displayName, |
|
| 88 | - * 'value' => $displayName); |
|
| 89 | - * } |
|
| 90 | - * } |
|
| 91 | - * |
|
| 92 | - * return $receivers; |
|
| 93 | - * } |
|
| 94 | - * |
|
| 95 | - * |
|
| 96 | - * @param string $pattern which should match within the $searchProperties |
|
| 97 | - * @param array $searchProperties defines the properties within the query pattern should match |
|
| 98 | - * @param array $options = array() to define the search behavior |
|
| 99 | - * - 'escape_like_param' - If set to false wildcards _ and % are not escaped |
|
| 100 | - * - 'limit' - Set a numeric limit for the search results |
|
| 101 | - * - 'offset' - Set the offset for the limited search results |
|
| 102 | - * @return array an array of contacts which are arrays of key-value-pairs |
|
| 103 | - * @since 6.0.0 |
|
| 104 | - */ |
|
| 105 | - public function search($pattern, $searchProperties = [], $options = []); |
|
| 58 | + /** |
|
| 59 | + * This function is used to search and find contacts within the users address books. |
|
| 60 | + * In case $pattern is empty all contacts will be returned. |
|
| 61 | + * |
|
| 62 | + * Example: |
|
| 63 | + * Following function shows how to search for contacts for the name and the email address. |
|
| 64 | + * |
|
| 65 | + * public static function getMatchingRecipient($term) { |
|
| 66 | + * $cm = \OC::$server->getContactsManager(); |
|
| 67 | + * // The API is not active -> nothing to do |
|
| 68 | + * if (!$cm->isEnabled()) { |
|
| 69 | + * return array(); |
|
| 70 | + * } |
|
| 71 | + * |
|
| 72 | + * $result = $cm->search($term, array('FN', 'EMAIL')); |
|
| 73 | + * $receivers = array(); |
|
| 74 | + * foreach ($result as $r) { |
|
| 75 | + * $id = $r['id']; |
|
| 76 | + * $fn = $r['FN']; |
|
| 77 | + * $email = $r['EMAIL']; |
|
| 78 | + * if (!is_array($email)) { |
|
| 79 | + * $email = array($email); |
|
| 80 | + * } |
|
| 81 | + * |
|
| 82 | + * // loop through all email addresses of this contact |
|
| 83 | + * foreach ($email as $e) { |
|
| 84 | + * $displayName = $fn . " <$e>"; |
|
| 85 | + * $receivers[] = array( |
|
| 86 | + * 'id' => $id, |
|
| 87 | + * 'label' => $displayName, |
|
| 88 | + * 'value' => $displayName); |
|
| 89 | + * } |
|
| 90 | + * } |
|
| 91 | + * |
|
| 92 | + * return $receivers; |
|
| 93 | + * } |
|
| 94 | + * |
|
| 95 | + * |
|
| 96 | + * @param string $pattern which should match within the $searchProperties |
|
| 97 | + * @param array $searchProperties defines the properties within the query pattern should match |
|
| 98 | + * @param array $options = array() to define the search behavior |
|
| 99 | + * - 'escape_like_param' - If set to false wildcards _ and % are not escaped |
|
| 100 | + * - 'limit' - Set a numeric limit for the search results |
|
| 101 | + * - 'offset' - Set the offset for the limited search results |
|
| 102 | + * @return array an array of contacts which are arrays of key-value-pairs |
|
| 103 | + * @since 6.0.0 |
|
| 104 | + */ |
|
| 105 | + public function search($pattern, $searchProperties = [], $options = []); |
|
| 106 | 106 | |
| 107 | - /** |
|
| 108 | - * This function can be used to delete the contact identified by the given id |
|
| 109 | - * |
|
| 110 | - * @param object $id the unique identifier to a contact |
|
| 111 | - * @param string $address_book_key identifier of the address book in which the contact shall be deleted |
|
| 112 | - * @return bool successful or not |
|
| 113 | - * @since 6.0.0 |
|
| 114 | - */ |
|
| 115 | - public function delete($id, $address_book_key); |
|
| 107 | + /** |
|
| 108 | + * This function can be used to delete the contact identified by the given id |
|
| 109 | + * |
|
| 110 | + * @param object $id the unique identifier to a contact |
|
| 111 | + * @param string $address_book_key identifier of the address book in which the contact shall be deleted |
|
| 112 | + * @return bool successful or not |
|
| 113 | + * @since 6.0.0 |
|
| 114 | + */ |
|
| 115 | + public function delete($id, $address_book_key); |
|
| 116 | 116 | |
| 117 | - /** |
|
| 118 | - * This function is used to create a new contact if 'id' is not given or not present. |
|
| 119 | - * Otherwise the contact will be updated by replacing the entire data set. |
|
| 120 | - * |
|
| 121 | - * @param array $properties this array if key-value-pairs defines a contact |
|
| 122 | - * @param string $address_book_key identifier of the address book in which the contact shall be created or updated |
|
| 123 | - * @return array an array representing the contact just created or updated |
|
| 124 | - * @since 6.0.0 |
|
| 125 | - */ |
|
| 126 | - public function createOrUpdate($properties, $address_book_key); |
|
| 117 | + /** |
|
| 118 | + * This function is used to create a new contact if 'id' is not given or not present. |
|
| 119 | + * Otherwise the contact will be updated by replacing the entire data set. |
|
| 120 | + * |
|
| 121 | + * @param array $properties this array if key-value-pairs defines a contact |
|
| 122 | + * @param string $address_book_key identifier of the address book in which the contact shall be created or updated |
|
| 123 | + * @return array an array representing the contact just created or updated |
|
| 124 | + * @since 6.0.0 |
|
| 125 | + */ |
|
| 126 | + public function createOrUpdate($properties, $address_book_key); |
|
| 127 | 127 | |
| 128 | - /** |
|
| 129 | - * Check if contacts are available (e.g. contacts app enabled) |
|
| 130 | - * |
|
| 131 | - * @return bool true if enabled, false if not |
|
| 132 | - * @since 6.0.0 |
|
| 133 | - */ |
|
| 134 | - public function isEnabled(); |
|
| 128 | + /** |
|
| 129 | + * Check if contacts are available (e.g. contacts app enabled) |
|
| 130 | + * |
|
| 131 | + * @return bool true if enabled, false if not |
|
| 132 | + * @since 6.0.0 |
|
| 133 | + */ |
|
| 134 | + public function isEnabled(); |
|
| 135 | 135 | |
| 136 | - /** |
|
| 137 | - * Registers an address book |
|
| 138 | - * |
|
| 139 | - * @param \OCP\IAddressBook $address_book |
|
| 140 | - * @return void |
|
| 141 | - * @since 6.0.0 |
|
| 142 | - */ |
|
| 143 | - public function registerAddressBook(\OCP\IAddressBook $address_book); |
|
| 136 | + /** |
|
| 137 | + * Registers an address book |
|
| 138 | + * |
|
| 139 | + * @param \OCP\IAddressBook $address_book |
|
| 140 | + * @return void |
|
| 141 | + * @since 6.0.0 |
|
| 142 | + */ |
|
| 143 | + public function registerAddressBook(\OCP\IAddressBook $address_book); |
|
| 144 | 144 | |
| 145 | - /** |
|
| 146 | - * Unregisters an address book |
|
| 147 | - * |
|
| 148 | - * @param \OCP\IAddressBook $address_book |
|
| 149 | - * @return void |
|
| 150 | - * @since 6.0.0 |
|
| 151 | - */ |
|
| 152 | - public function unregisterAddressBook(\OCP\IAddressBook $address_book); |
|
| 145 | + /** |
|
| 146 | + * Unregisters an address book |
|
| 147 | + * |
|
| 148 | + * @param \OCP\IAddressBook $address_book |
|
| 149 | + * @return void |
|
| 150 | + * @since 6.0.0 |
|
| 151 | + */ |
|
| 152 | + public function unregisterAddressBook(\OCP\IAddressBook $address_book); |
|
| 153 | 153 | |
| 154 | - /** |
|
| 155 | - * In order to improve lazy loading a closure can be registered which will be called in case |
|
| 156 | - * address books are actually requested |
|
| 157 | - * |
|
| 158 | - * @param \Closure $callable |
|
| 159 | - * @return void |
|
| 160 | - * @since 6.0.0 |
|
| 161 | - */ |
|
| 162 | - public function register(\Closure $callable); |
|
| 154 | + /** |
|
| 155 | + * In order to improve lazy loading a closure can be registered which will be called in case |
|
| 156 | + * address books are actually requested |
|
| 157 | + * |
|
| 158 | + * @param \Closure $callable |
|
| 159 | + * @return void |
|
| 160 | + * @since 6.0.0 |
|
| 161 | + */ |
|
| 162 | + public function register(\Closure $callable); |
|
| 163 | 163 | |
| 164 | - /** |
|
| 165 | - * Return a list of the user's addressbooks display names |
|
| 166 | - * |
|
| 167 | - * @return array |
|
| 168 | - * @since 6.0.0 |
|
| 169 | - * @deprecated 16.0.0 - Use `$this->getUserAddressBooks()` instead |
|
| 170 | - */ |
|
| 171 | - public function getAddressBooks(); |
|
| 164 | + /** |
|
| 165 | + * Return a list of the user's addressbooks display names |
|
| 166 | + * |
|
| 167 | + * @return array |
|
| 168 | + * @since 6.0.0 |
|
| 169 | + * @deprecated 16.0.0 - Use `$this->getUserAddressBooks()` instead |
|
| 170 | + */ |
|
| 171 | + public function getAddressBooks(); |
|
| 172 | 172 | |
| 173 | - /** |
|
| 174 | - * Return a list of the user's addressbooks |
|
| 175 | - * |
|
| 176 | - * @return \OCP\IAddressBook[] |
|
| 177 | - * @since 16.0.0 |
|
| 178 | - */ |
|
| 179 | - public function getUserAddressBooks(); |
|
| 173 | + /** |
|
| 174 | + * Return a list of the user's addressbooks |
|
| 175 | + * |
|
| 176 | + * @return \OCP\IAddressBook[] |
|
| 177 | + * @since 16.0.0 |
|
| 178 | + */ |
|
| 179 | + public function getUserAddressBooks(); |
|
| 180 | 180 | |
| 181 | - /** |
|
| 182 | - * removes all registered address book instances |
|
| 183 | - * |
|
| 184 | - * @return void |
|
| 185 | - * @since 6.0.0 |
|
| 186 | - */ |
|
| 187 | - public function clear(); |
|
| 181 | + /** |
|
| 182 | + * removes all registered address book instances |
|
| 183 | + * |
|
| 184 | + * @return void |
|
| 185 | + * @since 6.0.0 |
|
| 186 | + */ |
|
| 187 | + public function clear(); |
|
| 188 | 188 | } |