Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: document types flag for search options #35632

Merged
merged 1 commit into from
Jan 19, 2023

Conversation

kesselb
Copy link
Contributor

@kesselb kesselb commented Dec 6, 2022

Summary

Psalm warning for Mail:

ERROR: InvalidArgument - lib/Service/ContactsIntegration.php:183:59 - Argument 3 of OCP\Contacts\IManager::search expects array{enumeration?: bool, escape_like_param?: bool, fullmatch?: bool, limit?: int, offset?: int, strict_search?: bool}, but array{limit: 1, types: true} with additional array shape fields (types) was provided (see https://psalm.dev/004)

$result = $this->contactsManager->search($uid, ['UID'], ['types' => true, 'limit' => 1]);

/**
* @param string $pattern which should match within the $searchProperties
* @param array $searchProperties defines the properties within the query pattern should match
* @param array $options Options to define the output format and search behavior
* - 'types' boolean (since 15.0.0) If set to true, fields that come with a TYPE property will be an array
* example: ['id' => 5, 'FN' => 'Thomas Tanghus', 'EMAIL' => ['type => 'HOME', 'value' => 'g@h.i']]
* - 'escape_like_param' - If set to false wildcards _ and % are not escaped
* - 'limit' - Set a numeric limit for the search results
* - 'offset' - Set the offset for the limited search results
* - 'wildcard' - (since 23.0.0) Whether the search should use wildcards
* @psalm-param array{types?: bool, escape_like_param?: bool, limit?: int, offset?: int, wildcard?: bool} $options
* @return array an array of contacts which are arrays of key-value-pairs
* example result:
* [
* ['id' => 0, 'FN' => 'Thomas Müller', 'EMAIL' => 'a@b.c', 'GEO' => '37.386013;-122.082932'],
* ['id' => 5, 'FN' => 'Thomas Tanghus', 'EMAIL' => ['d@e.f', 'g@h.i']]
* ]
* @since 5.0.0
*/
public function search($pattern, $searchProperties, $options);

The documentation for IAdressBook is up-to-date.
OCP\Contacts\IManager misses the types search options flag.

TODO

  • Make Psalm happy

Checklist

@kesselb kesselb requested review from nickvergessen, ChristophWurst, a team, juliusknorr, CarlSchwan and come-nc and removed request for a team December 6, 2022 19:35
@kesselb kesselb self-assigned this Dec 6, 2022
@kesselb kesselb added 3. to review Waiting for reviews technical debt labels Dec 6, 2022
@szaimen szaimen added this to the Nextcloud 26 milestone Dec 7, 2022
@come-nc come-nc added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Dec 8, 2022
@PVince81
Copy link
Member

/rebase

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
@nextcloud-command nextcloud-command force-pushed the debt/document-types-search-flag branch from 819eb6c to ffb76d5 Compare January 19, 2023 09:33
Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backport?

@PVince81 PVince81 merged commit aded13c into master Jan 19, 2023
@PVince81 PVince81 deleted the debt/document-types-search-flag branch January 19, 2023 16:45
@kesselb
Copy link
Contributor Author

kesselb commented Jan 19, 2023

/backport to stable25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release Ready to be released and/or waiting for tests to finish technical debt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants