Skip to main content

Get All Members

Retrieves all members within the community based on specified criteria. This function allows users to fetch members using various parameters including pagination options, member states, and role filters.

Steps to get all members

  1. Create a GetAllMembersRequest object using GetAllMembersRequest.builder() class by passing all the required parameters.
  2. Call getAllMembers() function using the instance of LMChatClient.
  3. Process the response LMResponse<GetAllMembersResponse> as per your requirement.
let request = GetAllMembersRequest.builder()
.page(1)
.pageSize(20)
.memberState(1)
.filterMemberRoles([.admin, .member])
.excludeSelfUser(true)
.build()

LMChatClient.shared.getAllMembers(request: request) { response in
if let data = response.data {
// Process the members data
processMembersData(data)
} else if let error = response.error {
// Handle the error
handleError(error)
}
}

Models

GetAllMembersRequest

VARIABLETYPEDESCRIPTIONOPTIONAL
pageIntPage number for pagination (default is 1)
pageSizeIntNumber of results per page (default is 10)
memberStateInt?State of the members to filter by✔️
filterMemberRoles[MemberTypes]Array of member roles to filter by✔️
excludeSelfUserBool?Whether to exclude the current user from results✔️

MemberTypes Enum

VALUEDESCRIPTION
adminAdministrator role
memberRegular member role

GetAllMembersResponse

VARIABLETYPEDESCRIPTIONOPTIONAL
communityCommunity?Information about the community✔️
members[Member]?Array of members matching the criteria✔️
totalFilteredMembersInt?Total number of members after applying filters✔️
totalMembersInt?Total number of members in the community✔️
totalOnlyMembersInt?Total number of regular members✔️
totalPendingMembersInt?Total number of pending members✔️
pendingMembersCountInt?Count of pending members✔️
adminsCountInt?Count of administrators✔️
membersCountInt?Count of regular members✔️