fetchUsersByName

abstract suspend fun fetchUsersByName(channel: Channel, name: String, limit: Int = 20, offset: Int = 0): RainbowResult<List<ChannelUser>>

Fetch users matching a given name from a specific channel.

This method searches for users in the specified channel whose names match the provided input. The search is case-insensitive, accents-insensitive, and flexible regarding the order or partial matches of the first and last names.

Search behavior:

  • Exact match: "John Doe" matches "John Doe".

  • Partial match: "Jo Do" matches "John Doe".

  • Case-insensitive: "john doe" matches "John Doe".

  • Accents-insensitive: "herve mothe" matches "Hervé Mothé".

  • Matches on either first or last name: "john" matches "John Doe".

  • Flexible order: "doe john" matches "John Doe".

Return

A RainbowResult containing a list of ChannelUser objects that match the search criteria. If the operation fails, the result will include error details.

Parameters

channel

The Channel object within which the search is performed.

name

A String representing the name or part of the name to search for.

limit

An Int specifying the maximum number of users to retrieve (default value is 20).

offset

An Int specifying the position of the first user to retrieve (default value is 0).