listThings method

Future<ListThingsResponse> listThings({
  1. String? attributeName,
  2. String? attributeValue,
  3. int? maxResults,
  4. String? nextToken,
  5. String? thingTypeName,
})

Lists your things. Use the attributeName and attributeValue parameters to filter your things. For example, calling ListThings with attributeName=Color and attributeValue=Red retrieves all things in the registry that contain an attribute Color with the value Red.

May throw InvalidRequestException. May throw ThrottlingException. May throw UnauthorizedException. May throw ServiceUnavailableException. May throw InternalFailureException.

Parameter attributeName : The attribute name used to search for things.

Parameter attributeValue : The attribute value used to search for things.

Parameter maxResults : The maximum number of results to return in this operation.

Parameter nextToken : To retrieve the next set of results, the nextToken value from a previous response; otherwise null to receive the first set of results.

Parameter thingTypeName : The name of the thing type used to search for things.

Implementation

Future<ListThingsResponse> listThings({
  String? attributeName,
  String? attributeValue,
  int? maxResults,
  String? nextToken,
  String? thingTypeName,
}) async {
  _s.validateStringLength(
    'attributeName',
    attributeName,
    0,
    128,
  );
  _s.validateStringLength(
    'attributeValue',
    attributeValue,
    0,
    800,
  );
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    250,
  );
  _s.validateStringLength(
    'thingTypeName',
    thingTypeName,
    1,
    128,
  );
  final $query = <String, List<String>>{
    if (attributeName != null) 'attributeName': [attributeName],
    if (attributeValue != null) 'attributeValue': [attributeValue],
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (nextToken != null) 'nextToken': [nextToken],
    if (thingTypeName != null) 'thingTypeName': [thingTypeName],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/things',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListThingsResponse.fromJson(response);
}