Skip to main content

Send Connection

The sendConnection() function is used to send a connection request to a specified user.

Steps to Send a Connection Request

  1. Build a SendConnectionRequest object using the SendConnectionRequestBuilder class.

  2. Call the sendConnection() function using an instance of the appropriate class or repository.

  3. 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:

VariableTypeDescriptionOptional
receiverUUIDStringThe UUID of the user to whom the connection request is sent.
connectionTypeConnectionTypeThe type of connection being requested (e.g., oneWay, twoWay).
connectionRequestAutoAcceptedbool?Optional flag indicating if the connection request should be auto-accepted.