listThingGroupsForThing method

Future<ListThingGroupsForThingResponse> listThingGroupsForThing({
  1. required String thingName,
  2. int? maxResults,
  3. String? nextToken,
})

List the thing groups to which the specified thing belongs.

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

Parameter thingName : The thing name.

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

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.

Implementation

Future<ListThingGroupsForThingResponse> listThingGroupsForThing({
  required String thingName,
  int? maxResults,
  String? nextToken,
}) async {
  ArgumentError.checkNotNull(thingName, 'thingName');
  _s.validateStringLength(
    'thingName',
    thingName,
    1,
    128,
    isRequired: true,
  );
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    250,
  );
  final $query = <String, List<String>>{
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (nextToken != null) 'nextToken': [nextToken],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/things/${Uri.encodeComponent(thingName)}/thing-groups',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListThingGroupsForThingResponse.fromJson(response);
}