listTrials method

Future<ListTrialsResponse> listTrials({
  1. DateTime? createdAfter,
  2. DateTime? createdBefore,
  3. String? experimentName,
  4. int? maxResults,
  5. String? nextToken,
  6. SortTrialsBy? sortBy,
  7. SortOrder? sortOrder,
  8. String? trialComponentName,
})

Lists the trials in your account. Specify an experiment name to limit the list to the trials that are part of that experiment. Specify a trial component name to limit the list to the trials that associated with that trial component. The list can be filtered to show only trials that were created in a specific time range. The list can be sorted by trial name or creation time.

May throw ResourceNotFound.

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

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

Parameter experimentName : A filter that returns only trials that are part of the specified experiment.

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

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

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

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

Parameter trialComponentName : A filter that returns only trials that are associated with the specified trial component.

Implementation

Future<ListTrialsResponse> listTrials({
  DateTime? createdAfter,
  DateTime? createdBefore,
  String? experimentName,
  int? maxResults,
  String? nextToken,
  SortTrialsBy? sortBy,
  SortOrder? sortOrder,
  String? trialComponentName,
}) async {
  _s.validateStringLength(
    'experimentName',
    experimentName,
    1,
    120,
  );
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    0,
    8192,
  );
  _s.validateStringLength(
    'trialComponentName',
    trialComponentName,
    1,
    120,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.ListTrials'
  };
  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 (experimentName != null) 'ExperimentName': experimentName,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
      if (sortBy != null) 'SortBy': sortBy.toValue(),
      if (sortOrder != null) 'SortOrder': sortOrder.toValue(),
      if (trialComponentName != null)
        'TrialComponentName': trialComponentName,
    },
  );

  return ListTrialsResponse.fromJson(jsonResponse.body);
}