readWithHttpInfo method

Future<Response> readWithHttpInfo(
  1. ReadRequest readRequest, {
  2. required String uuidToken,
})

Creates a temporary connection and reads the given metric

Creates a temporary connection and reads the given metrics. 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. Returns an array of read values as Value object or an Error object if the reading went wrong. When an Internal Server Error occours, an Error object will be returned.

Note: This method returns the HTTP Response.

Parameters:

  • ReadRequest readRequest (required):

  • String uuidToken: Used for remote connections to device

Implementation

Future<Response> readWithHttpInfo(
  ReadRequest readRequest, {
  required String uuidToken,
}) async {
  // ignore: prefer_const_declarations
  final path = '${LbWriterEnvironment.getApiEndpoint(
    iotUuid: uuidToken,
  )}/connection/read';

  // ignore: prefer_final_locals
  Object? postBody = readRequest.toJson();

  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,
  );
}