Send Connection
The sendConnection()
function is used to send a connection request to a specified user.
Steps to Send a Connection Request
Build a
SendConnectionRequest
object using theSendConnectionRequestBuilder
class.Call the
sendConnection()
function using an instance of the appropriate class or repository.Use the response (
LMResponse<void>
) as needed.// Create a SendConnectionRequest object using the builder
final SendConnectionRequest sendConnectionRequest = SendConnectionRequestBuilder()
..receiverUUID('receiver_user_id')
..connectionType(ConnectionType.onWay) // on way connection type
..connectionRequestAutoAccepted(true) // Optional: Set to true to auto-accept the request
.build();
// Send the connection request
final LMResponse<void> sendConnectionResponse = await sendConnection(sendConnectionRequest);
// Process the response, as needed
if (response.success) {
// Handle successful connection request
handleSendConnectionSuccess(sendConnectionResponse);
} else {
// Handle error message
handleSendConnectionError(sendConnectionResponse.errorMessage);
}
Models
SendConnectionRequest
The SendConnectionRequest
class represents a request to send a connection.
List of parameters for the SendConnectionRequest
class:
Variable | Type | Description | Optional |
---|---|---|---|
receiverUUID | String | The UUID of the user to whom the connection request is sent. | |
connectionType | ConnectionType | The type of connection being requested (e.g., oneWay, twoWay). | |
connectionRequestAutoAccepted | bool? | Optional flag indicating if the connection request should be auto-accepted. | ✔ |