listThingGroups method

Future<ListThingGroupsResponse> listThingGroups({
  1. int? maxResults,
  2. String? namePrefixFilter,
  3. String? nextToken,
  4. String? parentGroup,
  5. bool? recursive,
})

List the thing groups in your account.

May throw InvalidRequestException. May throw InternalFailureException. May throw ResourceNotFoundException. May throw ThrottlingException.

Parameter maxResults : The maximum number of results to return at one time.

Parameter namePrefixFilter : A filter that limits the results to those with the specified name prefix.

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 parentGroup : A filter that limits the results to those with the specified parent group.

Parameter recursive : If true, return child groups as well.

Implementation

Future<ListThingGroupsResponse> listThingGroups({
  int? maxResults,
  String? namePrefixFilter,
  String? nextToken,
  String? parentGroup,
  bool? recursive,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    250,
  );
  _s.validateStringLength(
    'namePrefixFilter',
    namePrefixFilter,
    1,
    128,
  );
  _s.validateStringLength(
    'parentGroup',
    parentGroup,
    1,
    128,
  );
  final $query = <String, List<String>>{
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (namePrefixFilter != null) 'namePrefixFilter': [namePrefixFilter],
    if (nextToken != null) 'nextToken': [nextToken],
    if (parentGroup != null) 'parentGroup': [parentGroup],
    if (recursive != null) 'recursive': [recursive.toString()],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/thing-groups',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListThingGroupsResponse.fromJson(response);
}