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
- Create a GetChatroomRequest object using the builder pattern.
- Call the
getChatroom()
function using the instance ofLMChatClient
, passing therequest
object. - 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.
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
chatroomId | String | ID of the chatroom to retrieve |
GetChatroomResponse
Represents the response model containing chatroom details.
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
id | String | Unique identifier of the chatroom | |
name | String | Name of the chatroom | |
participantCount | Int | Number of participants in the chatroom | |
isMuted | Bool | Indicates if the chatroom is muted for the user | |
permissions | ChatroomPermission | List of user permissions in the chatroom |
ChatroomPermission
Describes the permissions a user has within the chatroom.
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
type | String | Type of permission available in the chatroom | |
allowed | Bool | Whether the user has this permission |