listDatasets method

Future<ListDatasetsResponse> listDatasets({
  1. required DatasetSourceType sourceType,
  2. DatasetTypeEnum? datasetType,
  3. int? maxResults,
  4. String? nextToken,
  5. String? workspaceName,
})

Retrieves a paginated list of datasets for a specific target resource.

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

Parameter sourceType : The type of data source for the dataset.

Parameter datasetType : The type of dataset to filter by: a session dataset, a curated dataset, or a connection to an external datasource.

Parameter maxResults : The maximum number of results to return for each paginated request.

Parameter nextToken : The token for the next set of results, or null if there are no additional results.

Parameter workspaceName : The name of the workspace to filter datasets by.

Implementation

Future<ListDatasetsResponse> listDatasets({
  required DatasetSourceType sourceType,
  DatasetTypeEnum? datasetType,
  int? maxResults,
  String? nextToken,
  String? workspaceName,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    250,
  );
  final $query = <String, List<String>>{
    'sourceType': [sourceType.value],
    if (datasetType != null) 'datasetType': [datasetType.value],
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (nextToken != null) 'nextToken': [nextToken],
    if (workspaceName != null) 'workspaceName': [workspaceName],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/datasets',
    queryParams: $query,
    hostPrefix: 'api.',
    exceptionFnMap: _exceptionFns,
  );
  return ListDatasetsResponse.fromJson(response);
}