discontinuedPackage thingsboard_pe_client has been discontinued and replaced by thingsboard_client.

getRuleChainOutputLabelsUsage method

Future<Response<BuiltList<RuleChainOutputLabelsUsage>>> getRuleChainOutputLabelsUsage({
  1. required String ruleChainId,
  2. CancelToken? cancelToken,
  3. Map<String, dynamic>? headers,
  4. Map<String, dynamic>? extra,
  5. ValidateStatus? validateStatus,
  6. ProgressCallback? onSendProgress,
  7. ProgressCallback? onReceiveProgress,
})

Get output labels usage (getRuleChainOutputLabelsUsage) Fetch the list of rule chains and the relation types (labels) they use to process output of the current rule chain based on the provided Rule Chain Id. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object. Available for users with 'TENANT_ADMIN' authority.

Parameters:

  • ruleChainId - A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'
  • cancelToken - A CancelToken that can be used to cancel the operation
  • headers - Can be used to add additional headers to the request
  • extras - Can be used to add flags to the request
  • validateStatus - A ValidateStatus callback that can be used to determine request success based on the HTTP status of the response
  • onSendProgress - A ProgressCallback that can be used to get the send progress
  • onReceiveProgress - A ProgressCallback that can be used to get the receive progress

Returns a Future containing a Response with a BuiltList<RuleChainOutputLabelsUsage> as data Throws DioException if API call or serialization fails

Implementation

Future<Response<BuiltList<RuleChainOutputLabelsUsage>>>
getRuleChainOutputLabelsUsage({
  required String ruleChainId,
  CancelToken? cancelToken,
  Map<String, dynamic>? headers,
  Map<String, dynamic>? extra,
  ValidateStatus? validateStatus,
  ProgressCallback? onSendProgress,
  ProgressCallback? onReceiveProgress,
}) async {
  final _serializers =
      this._serializers ??
      apiSerializers(registerListOfRuleChainOutputLabelsUsage);
  final _path = r'/api/ruleChain/{ruleChainId}/output/labels/usage'
      .replaceAll(
        '{'
        r'ruleChainId'
        '}',
        encodeQueryParameter(
          _serializers,
          ruleChainId,
          const FullType(String),
        ).toString(),
      );
  final _options = Options(
    method: r'GET',
    headers: <String, dynamic>{...?headers},
    extra: <String, dynamic>{
      'secure': <Map<String, String>>[
        {
          'type': 'apiKey',
          'name': 'ApiKeyForm',
          'keyName': 'X-Authorization',
          'where': 'header',
        },
        {'type': 'http', 'scheme': 'loginPassword', 'name': 'HttpLoginForm'},
      ],
      ...?extra,
    },
    validateStatus: validateStatus,
  );

  final _response = await _dio.request<Object>(
    _path,
    options: _options,
    cancelToken: cancelToken,
    onSendProgress: onSendProgress,
    onReceiveProgress: onReceiveProgress,
  );

  BuiltList<RuleChainOutputLabelsUsage>? _responseData;

  try {
    final rawResponse = _response.data;
    _responseData = rawResponse == null
        ? null
        : _serializers.deserialize(
                rawResponse,
                specifiedType: const FullType(BuiltList, [
                  FullType(RuleChainOutputLabelsUsage),
                ]),
              )
              as BuiltList<RuleChainOutputLabelsUsage>;
  } catch (error, stackTrace) {
    throw DioException(
      requestOptions: _response.requestOptions,
      response: _response,
      type: DioExceptionType.unknown,
      error: error,
      stackTrace: stackTrace,
    );
  }

  return Response<BuiltList<RuleChainOutputLabelsUsage>>(
    data: _responseData,
    headers: _response.headers,
    isRedirect: _response.isRedirect,
    requestOptions: _response.requestOptions,
    redirects: _response.redirects,
    statusCode: _response.statusCode,
    statusMessage: _response.statusMessage,
    extra: _response.extra,
  );
}