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
- Create a GetAllMembersRequest object using
GetAllMembersRequest.builder()
class by passing all the required parameters. - Call
getAllMembers()
function using the instance ofLMChatClient
. - 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
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
page | Int | Page number for pagination (default is 1) | |
pageSize | Int | Number of results per page (default is 10) | |
memberState | Int? | State of the members to filter by | ✔️ |
filterMemberRoles | [MemberTypes] | Array of member roles to filter by | ✔️ |
excludeSelfUser | Bool? | Whether to exclude the current user from results | ✔️ |
MemberTypes Enum
VALUE | DESCRIPTION |
---|---|
admin | Administrator role |
member | Regular member role |
GetAllMembersResponse
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
community | Community? | Information about the community | ✔️ |
members | [Member]? | Array of members matching the 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 | ✔️ |
pendingMembersCount | Int? | Count of pending members | ✔️ |
adminsCount | Int? | Count of administrators | ✔️ |
membersCount | Int? | Count of regular members | ✔️ |