diff --git a/docs/03-developer-interface/02-interactions/11-search-users.mdx b/docs/03-developer-interface/02-interactions/11-search-users.mdx new file mode 100644 index 0000000..582b411 --- /dev/null +++ b/docs/03-developer-interface/02-interactions/11-search-users.mdx @@ -0,0 +1,64 @@ +# Searching users + +Through the `WireApplicationManager` you can search for Wire users by name or handle. + +```mdx-code-block +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; +``` + +## SearchContactsResponse + +The `searchUsers` method returns a `SearchContactsResponse` object containing: +- **documents** — List of `ContactDocument` objects matching the search query +- **found** — Total number of users found on the backend + +### ContactDocument + +Each entry in `documents` contains: +- **id** — The user's UUID +- **qualifiedId** — The user's `QualifiedId` (id + domain) +- **name** — The user's display name +- **handle** — The user's unique handle (username) +- **accentId** — The user's accent color ID (if available) +- **team** — The UUID of the team the user belongs to (if any) +- **type** — The user type (`regular`, `bot`, `external`, `federated`, `guest`) + +### Use Case: Search for a user by name + + + + +```kotlin +val applicationManager = wireAppSdk.getApplicationManager() + +val results: SearchContactsResponse = applicationManager.searchUsersSuspending( + query = "Alice", + domain = "wire.com", + numberOfResults = 25 +) + +results.documents.forEach { contact -> + println("Found: ${contact.name} (@${contact.handle})") +} +``` + + + + +```java +WireApplicationManager applicationManager = wireAppSdk.getApplicationManager(); + +SearchContactsResponse results = applicationManager.searchUsers( + "Alice", + "wire.com", + 25 +); + +for (ContactDocument contact : results.getDocuments()) { + System.out.println("Found: " + contact.name() + " (@" + contact.handle() + ")"); +} +``` + + + \ No newline at end of file diff --git a/docs/03-developer-interface/index.mdx b/docs/03-developer-interface/index.mdx index 21cabb2..d03a873 100644 --- a/docs/03-developer-interface/index.mdx +++ b/docs/03-developer-interface/index.mdx @@ -36,3 +36,4 @@ Here are some example of things you can do via the SDK to interact with the Wire - [Updating member's role in a conversation](02-interactions/08-update-member-role.mdx) - [Removing members from a conversation](02-interactions/09-remove-members-from-conversation.mdx) - [Get user info based on their id](02-interactions/10-get-user-info.mdx) + - [Search users by their name or handle](02-interactions/11-search-users.mdx)