listSubscriptions method

Future<ListSubscriptionsResponse> listSubscriptions({
  1. required String clientId,
  2. int? maxResults,
  3. String? nextToken,
})

Returns a list of all subscriptions for MQTT clients with active sessions, including offline clients with persistent sessions.

Requires permission to access the ListSubscriptions action.

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

Parameter clientId : The unique identifier of the MQTT client to list subscriptions for. The client ID can't start with a dollar sign ($).

MQTT client IDs must be URL encoded (percent-encoded) when they contain characters that are not valid in HTTP requests, such as spaces, forward slashes (/), and UTF-8 characters.

Parameter maxResults : The maximum number of subscriptions to return in a single request. By default, this is set to 20.

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<ListSubscriptionsResponse> listSubscriptions({
  required String clientId,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    200,
  );
  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: '/connections/${Uri.encodeComponent(clientId)}/subscriptions',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListSubscriptionsResponse.fromJson(response);
}