listLabels method

Future<ListLabelsResponse> listLabels({
  1. required String labelGroupName,
  2. String? equipment,
  3. String? faultCode,
  4. DateTime? intervalEndTime,
  5. DateTime? intervalStartTime,
  6. int? maxResults,
  7. String? nextToken,
})

Provides a list of labels.

May throw AccessDeniedException. May throw InternalServerException. May throw ThrottlingException. May throw ValidationException.

Parameter labelGroupName : Returns the name of the label group.

Parameter equipment : Lists the labels that pertain to a particular piece of equipment.

Parameter faultCode : Returns labels with a particular fault code.

Parameter intervalEndTime : Returns all labels with a start time earlier than the end time given.

Parameter intervalStartTime : Returns all the labels with a end time equal to or later than the start time given.

Parameter maxResults : Specifies the maximum number of labels to list.

Parameter nextToken : An opaque pagination token indicating where to continue the listing of label groups.

Implementation

Future<ListLabelsResponse> listLabels({
  required String labelGroupName,
  String? equipment,
  String? faultCode,
  DateTime? intervalEndTime,
  DateTime? intervalStartTime,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    500,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'AWSLookoutEquipmentFrontendService.ListLabels'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'LabelGroupName': labelGroupName,
      if (equipment != null) 'Equipment': equipment,
      if (faultCode != null) 'FaultCode': faultCode,
      if (intervalEndTime != null)
        'IntervalEndTime': unixTimestampToJson(intervalEndTime),
      if (intervalStartTime != null)
        'IntervalStartTime': unixTimestampToJson(intervalStartTime),
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return ListLabelsResponse.fromJson(jsonResponse.body);
}