listExperiments method

Future<ListExperimentsResponse> listExperiments({
  1. DateTime? createdAfter,
  2. DateTime? createdBefore,
  3. int? maxResults,
  4. String? nextToken,
  5. SortExperimentsBy? sortBy,
  6. SortOrder? sortOrder,
})

Lists all the experiments in your account. The list can be filtered to show only experiments that were created in a specific time range. The list can be sorted by experiment name or creation time.

Parameter createdAfter : A filter that returns only experiments created after the specified time.

Parameter createdBefore : A filter that returns only experiments created before the specified time.

Parameter maxResults : The maximum number of experiments to return in the response. The default value is 10.

Parameter nextToken : If the previous call to ListExperiments didn't return the full set of experiments, the call returns a token for getting the next set of experiments.

Parameter sortBy : The property used to sort results. The default value is CreationTime.

Parameter sortOrder : The sort order. The default value is Descending.

Implementation

Future<ListExperimentsResponse> listExperiments({
  DateTime? createdAfter,
  DateTime? createdBefore,
  int? maxResults,
  String? nextToken,
  SortExperimentsBy? sortBy,
  SortOrder? sortOrder,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    0,
    8192,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.ListExperiments'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (createdAfter != null)
        'CreatedAfter': unixTimestampToJson(createdAfter),
      if (createdBefore != null)
        'CreatedBefore': unixTimestampToJson(createdBefore),
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
      if (sortBy != null) 'SortBy': sortBy.toValue(),
      if (sortOrder != null) 'SortOrder': sortOrder.toValue(),
    },
  );

  return ListExperimentsResponse.fromJson(jsonResponse.body);
}