getModels method

Future<GetModelsResult> getModels({
  1. int? maxResults,
  2. String? modelId,
  3. ModelTypeEnum? modelType,
  4. String? nextToken,
})

Gets one or more models. Gets all models for the AWS account if no model type and no model id provided. Gets all models for the AWS account and model type, if the model type is specified but model id is not provided. Gets a specific model if (model type, model id) tuple is specified.

This is a paginated API. If you provide a null maxResults, this action retrieves a maximum of 10 records per page. If you provide a maxResults, the value must be between 1 and 10. To get the next page results, provide the pagination token from the response as part of your request. A null pagination token fetches the records from the beginning.

May throw ValidationException. May throw ResourceNotFoundException. May throw InternalServerException. May throw AccessDeniedException.

Parameter maxResults : The maximum number of objects to return for the request.

Parameter modelId : The model ID.

Parameter modelType : The model type.

Parameter nextToken : The next token for the subsequent request.

Implementation

Future<GetModelsResult> getModels({
  int? maxResults,
  String? modelId,
  ModelTypeEnum? modelType,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    10,
  );
  _s.validateStringLength(
    'modelId',
    modelId,
    1,
    64,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSHawksNestServiceFacade.GetModels'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (maxResults != null) 'maxResults': maxResults,
      if (modelId != null) 'modelId': modelId,
      if (modelType != null) 'modelType': modelType.toValue(),
      if (nextToken != null) 'nextToken': nextToken,
    },
  );

  return GetModelsResult.fromJson(jsonResponse.body);
}