sendManagedThingCommand method

Future<SendManagedThingCommandResponse> sendManagedThingCommand({
  1. required List<CommandEndpoint> endpoints,
  2. required String managedThingId,
  3. String? accountAssociationId,
  4. String? connectorAssociationId,
})

Send the command to the device represented by the managed thing.

May throw AccessDeniedException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceUnavailableException. May throw ThrottlingException. May throw UnauthorizedException. May throw ValidationException.

Parameter endpoints : The device endpoint.

Parameter managedThingId : The id of the device.

Parameter accountAssociationId : The identifier of the account association to use when sending a command to a managed thing.

Parameter connectorAssociationId : The ID tracking the current discovery process for one connector association.

Implementation

Future<SendManagedThingCommandResponse> sendManagedThingCommand({
  required List<CommandEndpoint> endpoints,
  required String managedThingId,
  String? accountAssociationId,
  String? connectorAssociationId,
}) async {
  final $payload = <String, dynamic>{
    'Endpoints': endpoints,
    if (accountAssociationId != null)
      'AccountAssociationId': accountAssociationId,
    if (connectorAssociationId != null)
      'ConnectorAssociationId': connectorAssociationId,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/managed-things-command/${Uri.encodeComponent(managedThingId)}',
    exceptionFnMap: _exceptionFns,
  );
  return SendManagedThingCommandResponse.fromJson(response);
}