Follow/Unfollow Chatroom
Allows a user to follow or unfollow a specific chatroom. This function requires the chatroom ID, a UUID for the user, and a value indicating whether to follow or unfollow the chatroom. This function is only available for open chatrooms.
Steps to follow or unfollow a chatroom
- Create a FollowChatroomRequest object using the builder pattern.
- Call the
followChatroom()
function using the instance ofLMChatClient
, passing therequest
object and an optional response handler. - Process the response LMResponse<NoData> to confirm whether the operation was successful or handle any errors.
let request = FollowChatroomRequest.builder()
.chatroomId("ENTER_CHATROOM_ID")
.uuid("ENTER_UUID")
.value(true) // Set to true to follow, false to unfollow
.build()
LMChatClient.shared.followChatroom(request: request) { response in
if response?.error == nil {
// Handle success
print("Successfully followed the chatroom.")
} else {
// Handle error
print("Error following the chatroom: \(response?.error?.localizedDescription ?? "Unknown error")")
}
}
Models
FollowChatroomRequest
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
chatroomId | String | ID of the chatroom to follow or unfollow | |
uuid | String | Unique identifier for the user following the chatroom | |
value | Bool | Set to true to follow the chatroom, false to unfollow |