listModels method

Future<ListModelsOutput> listModels({
  1. DateTime? creationTimeAfter,
  2. DateTime? creationTimeBefore,
  3. int? maxResults,
  4. String? nameContains,
  5. String? nextToken,
  6. ModelSortKey? sortBy,
  7. OrderKey? sortOrder,
})

Lists models created with the CreateModel API.

Parameter creationTimeAfter : A filter that returns only models with a creation time greater than or equal to the specified time (timestamp).

Parameter creationTimeBefore : A filter that returns only models created before the specified time (timestamp).

Parameter maxResults : The maximum number of models to return in the response.

Parameter nameContains : A string in the training job name. This filter returns only models in the training job whose name contains the specified string.

Parameter nextToken : If the response to a previous ListModels request was truncated, the response includes a NextToken. To retrieve the next set of models, use the token in the next request.

Parameter sortBy : Sorts the list of results. The default is CreationTime.

Parameter sortOrder : The sort order for results. The default is Descending.

Implementation

Future<ListModelsOutput> listModels({
  DateTime? creationTimeAfter,
  DateTime? creationTimeBefore,
  int? maxResults,
  String? nameContains,
  String? nextToken,
  ModelSortKey? sortBy,
  OrderKey? sortOrder,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  _s.validateStringLength(
    'nameContains',
    nameContains,
    0,
    63,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    0,
    8192,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.ListModels'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (creationTimeAfter != null)
        'CreationTimeAfter': unixTimestampToJson(creationTimeAfter),
      if (creationTimeBefore != null)
        'CreationTimeBefore': unixTimestampToJson(creationTimeBefore),
      if (maxResults != null) 'MaxResults': maxResults,
      if (nameContains != null) 'NameContains': nameContains,
      if (nextToken != null) 'NextToken': nextToken,
      if (sortBy != null) 'SortBy': sortBy.toValue(),
      if (sortOrder != null) 'SortOrder': sortOrder.toValue(),
    },
  );

  return ListModelsOutput.fromJson(jsonResponse.body);
}