Skip to main content

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

  1. Create a SearchMembersRequest object using SearchMembersRequest.builder() class by passing all the required parameters.
  2. Call searchMembers() function using the instance of LMChatClient.
  3. 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

VARIABLETYPEDESCRIPTIONOPTIONAL
pageIntPage number for pagination (default is 1)
pageSizeIntNumber of results per page (default is 10)
searchStringSearch query string✔️
searchTypeStringType of search to perform✔️
memberState[Int]Array of member states to filter by✔️
excludeSelfUserBoolWhether to exclude the current user from results✔️

SearchMembersResponse

VARIABLETYPEDESCRIPTIONOPTIONAL
communityCommunityInformation about the community✔️
members[Member]Array of members matching the search criteria✔️
totalFilteredMembersIntTotal number of members after applying filters✔️
totalMembersIntTotal number of members in the community✔️
totalOnlyMembersIntTotal number of regular members✔️
totalPendingMembersIntTotal number of pending members✔️