listDatasets method

Future<ListDatasetsResponse> listDatasets({
  1. String? datasetGroupArn,
  2. int? maxResults,
  3. String? nextToken,
})

Returns the list of datasets contained in the given dataset group. The response provides the properties for each dataset, including the Amazon Resource Name (ARN). For more information on datasets, see CreateDataset.

May throw InvalidInputException. May throw InvalidNextTokenException.

Parameter datasetGroupArn : The Amazon Resource Name (ARN) of the dataset group that contains the datasets to list.

Parameter maxResults : The maximum number of datasets to return.

Parameter nextToken : A token returned from the previous call to ListDatasetImportJobs for getting the next set of dataset import jobs (if they exist).

Implementation

Future<ListDatasetsResponse> listDatasets({
  String? datasetGroupArn,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateStringLength(
    'datasetGroupArn',
    datasetGroupArn,
    0,
    256,
  );
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    0,
    1300,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonPersonalize.ListDatasets'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (datasetGroupArn != null) 'datasetGroupArn': datasetGroupArn,
      if (maxResults != null) 'maxResults': maxResults,
      if (nextToken != null) 'nextToken': nextToken,
    },
  );

  return ListDatasetsResponse.fromJson(jsonResponse.body);
}