listThings method
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. For more information, see List
Things from the Amazon Web Services IoT Core Developer Guide.
Requires permission to access the ListThings action.
May throw InternalFailureException.
May throw InvalidRequestException.
May throw ServiceUnavailableException.
May throw ThrottlingException.
May throw UnauthorizedException.
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.
Parameter usePrefixAttributeValue :
When true, the action returns the thing resources with
attribute values that start with the attributeValue provided.
When false, or not present, the action returns only the thing
resources with attribute values that match the entire
attributeValue provided.
Implementation
Future<ListThingsResponse> listThings({
String? attributeName,
String? attributeValue,
int? maxResults,
String? nextToken,
String? thingTypeName,
bool? usePrefixAttributeValue,
}) async {
_s.validateNumRange(
'maxResults',
maxResults,
1,
250,
);
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],
if (usePrefixAttributeValue != null)
'usePrefixAttributeValue': [usePrefixAttributeValue.toString()],
};
final response = await _protocol.send(
payload: null,
method: 'GET',
requestUri: '/things',
queryParams: $query,
exceptionFnMap: _exceptionFns,
);
return ListThingsResponse.fromJson(response);
}