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 Amazon Web Services account if no model type and no model id provided. Gets all models for the Amazon Web Services 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 AccessDeniedException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

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,
  );
  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.value,
      if (nextToken != null) 'nextToken': nextToken,
    },
  );

  return GetModelsResult.fromJson(jsonResponse.body);
}