Search Members
Searches for members within the community based on specified criteria. This function allows users to find members using various search parameters and pagination options.
Steps to search members
- Create a SearchMembersRequest object using
SearchMembersRequest.builder()
class by passing all the required parameters. - Call
searchMembers()
function using the instance ofLMChatClient
. - Process the response LMResponse<SearchMembersResponse> as per your requirement.
let request = SearchMembersRequest.builder()
.search("ENTER_SEARCH_TERM")
.page(1)
.pageSize(20)
.build()
LMChatClient.shared.searchMembers(request: request) { response in
if let data = response.data {
// Process the search results
processSearchResults(data)
} else if let error = response.error {
// Handle the error
handleError(error)
}
}
Models
SearchMembersRequest
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
page | Int | Page number for pagination (default is 1) | |
pageSize | Int | Number of results per page (default is 10) | |
search | String | Search query string | ✔️ |
searchType | String | Type of search to perform | ✔️ |
memberState | [Int] | Array of member states to filter by | ✔️ |
excludeSelfUser | Bool | Whether to exclude the current user from results | ✔️ |
SearchMembersResponse
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
community | Community | Information about the community | ✔️ |
members | [Member] | Array of members matching the search criteria | ✔️ |
totalFilteredMembers | Int | Total number of members after applying filters | ✔️ |
totalMembers | Int | Total number of members in the community | ✔️ |
totalOnlyMembers | Int | Total number of regular members | ✔️ |
totalPendingMembers | Int | Total number of pending members | ✔️ |