Send DM Request
Sends a direct message request to another user. This function allows users to initiate or continue a direct message conversation by sending a message or updating the chat request state.
Steps to send a DM request
- Create a SendDMRequest object using
SendDMRequest.builder()
class by passing all the required parameters. - Call
sendDMRequest()
function using the instance ofLMChatClient
. - Process the response LMResponse<SendDMResponse> as per your requirement.
let request = SendDMRequest.builder()
.chatRequestState(1)
.text("YOUR_TEXT")
.chatroomId("ENTER_CHATROOM_ID")
.build()
LMChatClient.shared.sendDMRequest(request: request) { response in
if let data = response.data {
// Process the send DM response
processSendDMResponse(data)
} else if let error = response.error {
// Handle the error
handleError(error)
}
}
Models
SendDMRequest
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
chatRequestState | Int? | The state of the chat request | ✔️ |
text | String? | The message text to be sent | ✔️ |
chatroomId | String? | ID of the chatroom where the message is to be sent | ✔️ |
SendDMResponse
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
conversation | Conversation? | Information about the updated conversation | ✔️ |