Send DM Request
The sendDMRequest()
method is used to send a direct message (DM) request. You can pass parameters such as chatroomId
, chatRequestState
, and text
.
Steps to Send a DM Request
- Create a
SendDMRequest
object with the required parameters:chatroomId
,chatRequestState
, andtext
. - Call the
sendDMRequest()
function using the instance of theLMChatClient
class. - Use the response LMResponse<
SendDMResponse
> to fetch details about the conversation after sending the DM request.
SendDMRequest request = (SendDMRequestBuilder()
..chatroomId("ENTER_CHATROOM_ID") // Provide the chatroom ID
..chatRequestState(1) // Provide the request state (e.g., 1 for sending)
..text("ENTER_TEXT")) // Provide the message text
.build();
final LMResponse<SendDMResponse> response = await lmChatClient.sendDMRequest(request);
if (response.success) {
// Use the returned conversation details
handleConversation(response.data.conversation);
} else {
// Handle error
handleError(response);
}
Models
SendDMRequest
List of parameters for the SendDMRequest
class:
Variable | Type | Description | Optional |
---|---|---|---|
chatroomId | int | The ID of the chatroom where the DM request will be sent | |
chatRequestState | int | The state of the DM request - 0 is for initiating - 1 for accepting - 2 for rejecting | |
text | String | The message text to be sent in the DM request |
SendDMResponse
List of parameters for the SendDMResponse
class:
Variable | Type | Description | Optional |
---|---|---|---|
conversation | Conversation | The updated conversation after sending the DM request | ✔️ |