writeWithHttpInfo method

Future<Response> writeWithHttpInfo(
  1. WriteRequest writeRequest, {
  2. required String uuidToken,
})

Creates a temporary connection and writes the given metric

Creates a temporary connection and writes the given metric. Requires either AddConnectionS7 or AddConnectionModbus or AddConnectionOPCUA object as request body. Requires also the associated metrics as an array of MetricS7, MetricModbus or MetricOPCUA objects and the value that must be written. Return an array of written values as Value objects or a Error if the write went wrong. You should always ensure that the values were written correctly by reading them right after their writing. If an Internal Server Error occours, an Error object will be returned.

Note: This method returns the HTTP Response.

Parameters:

  • WriteRequest writeRequest (required):

  • String uuidToken: Used for remote connections to device

Implementation

Future<Response> writeWithHttpInfo(
  WriteRequest writeRequest, {
  required String uuidToken,
}) async {
  // ignore: prefer_const_declarations
  final path = '${LbWriterEnvironment.getApiEndpoint(
    iotUuid: uuidToken,
  )}/connection/write';

  // ignore: prefer_final_locals
  Object? postBody = writeRequest;

  final queryParams = <QueryParam>[];
  final headerParams = <String, String>{};
  final formParams = <String, String>{};

  const contentTypes = <String>['application/json'];

  return apiClient.invokeAPI(
    path,
    'POST',
    queryParams,
    postBody,
    headerParams,
    formParams,
    contentTypes.isEmpty ? null : contentTypes.first,
  );
}