Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions docs/03-developer-interface/02-interactions/11-search-users.mdx
Original file line number Diff line number Diff line change
@@ -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

<Tabs groupId="programming-language">
<TabItem value="kotlin" label="Kotlin">

```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})")
}
```

</TabItem>
<TabItem value="java" label="Java">

```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() + ")");
}
```

</TabItem>
</Tabs>
1 change: 1 addition & 0 deletions docs/03-developer-interface/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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)