listCommands method

Future<ListCommandsResponse> listCommands({
  1. String? commandParameterName,
  2. int? maxResults,
  3. CommandNamespace? namespace,
  4. String? nextToken,
  5. SortOrder? sortOrder,
})

List all commands in your account.

May throw InternalServerException. May throw ThrottlingException. May throw ValidationException.

Parameter commandParameterName : A filter that can be used to display the list of commands that have a specific command parameter name.

Parameter maxResults : The maximum number of results to return in this operation. By default, the API returns up to a maximum of 25 results. You can override this default value to return up to a maximum of 100 results for this operation.

Parameter namespace : The namespace of the command. By default, the API returns all commands that have been created for both AWS-IoT and AWS-IoT-FleetWise namespaces. You can override this default value if you want to return all commands that have been created only for a specific namespace.

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 sortOrder : Specify whether to list the commands that you have created in the ascending or descending order. By default, the API returns all commands in the descending order based on the time that they were created.

Implementation

Future<ListCommandsResponse> listCommands({
  String? commandParameterName,
  int? maxResults,
  CommandNamespace? namespace,
  String? nextToken,
  SortOrder? sortOrder,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  final $query = <String, List<String>>{
    if (commandParameterName != null)
      'commandParameterName': [commandParameterName],
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (namespace != null) 'namespace': [namespace.value],
    if (nextToken != null) 'nextToken': [nextToken],
    if (sortOrder != null) 'sortOrder': [sortOrder.value],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/commands',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListCommandsResponse.fromJson(response);
}