Skip to main content

Get Chatroom

Fetches detailed information about a specific chatroom using the provided chatroom ID. The response includes details such as chatroom metadata, participants, and permissions.

Steps to get chatroom details

  1. Create a GetChatroomRequest object using the builder pattern.
  2. Call the getChatroom() function using the instance of LMChatClient, passing the request object.
  3. Process the response LMResponse<GetChatroomResponse> to handle the chatroom details or any errors.
// Create a request to fetch chatroom details
let request = GetChatroomRequest.builder()
.chatroomId("ENTER_CHATROOM_ID")
.build()

// Fetch chatroom details using LMChatClient
if let response = LMChatClient.shared.getChatroom(request: request) {
if let chatroomDetails = response.data {
// Handle success
print("Chatroom name: \(chatroomDetails.name)")
print("Participant count: \(chatroomDetails.participantCount)")
} else if let error = response.error {
// Handle error
print("Error fetching chatroom: \(error.localizedDescription)")
}
} else {
print("Failed to initialize request.")
}

Models

GetChatroomRequest

Represents the request model used to fetch chatroom details.

VARIABLETYPEDESCRIPTIONOPTIONAL
chatroomIdStringID of the chatroom to retrieve

GetChatroomResponse

Represents the response model containing chatroom details.

VARIABLETYPEDESCRIPTIONOPTIONAL
idStringUnique identifier of the chatroom
nameStringName of the chatroom
participantCountIntNumber of participants in the chatroom
isMutedBoolIndicates if the chatroom is muted for the user
permissionsChatroomPermissionList of user permissions in the chatroom

ChatroomPermission

Describes the permissions a user has within the chatroom.

VARIABLETYPEDESCRIPTIONOPTIONAL
typeStringType of permission available in the chatroom
allowedBoolWhether the user has this permission