connectionDiscover method

Future<List<DiscoverResponse>?> connectionDiscover(
  1. String id, {
  2. required String uuidToken,
  3. ConnectionDiscoverRequest? connectionDiscoverRequest,
})

Discovers PLC metrics.

Discovers the metrics of the given connection. Returns an array of string's object. This option is currently avaiable only for the OPCUA connection. If another connection is given, an error will be returned. If an Internal Server Error occours, an Error object will be returned.

Parameters:

Implementation

Future<List<DiscoverResponse>?> connectionDiscover(
  String id, {
  required String uuidToken,
  ConnectionDiscoverRequest? connectionDiscoverRequest,
}) async {
  final response = await connectionDiscoverWithHttpInfo(
    id,
    uuidToken: uuidToken,
    connectionDiscoverRequest: connectionDiscoverRequest,
  );
  if (response.statusCode >= HttpStatus.badRequest) {
    throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  }
  // When a remote server returns no body with a status of 204, we shall not decode it.
  // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  // FormatException when trying to decode an empty string.
  if (response.body.isNotEmpty &&
      response.statusCode != HttpStatus.noContent) {
    final responseBody = await _decodeBodyBytes(response);
    return (await apiClient.deserializeAsync(
            responseBody, 'List<DiscoverResponse>') as List)
        .cast<DiscoverResponse>()
        .toList();
  }
  return null;
}