getModel method

Future<Model> getModel({
  1. required String modelName,
  2. required String restApiId,
  3. bool? flatten,
})

Describes an existing model defined for a RestApi resource.

May throw UnauthorizedException. May throw NotFoundException. May throw TooManyRequestsException.

Parameter modelName : Required The name of the model as an identifier.

Parameter restApiId : Required The RestApi identifier under which the Model exists.

Parameter flatten : A query parameter of a Boolean value to resolve (true) all external model references and returns a flattened model schema or not (false) The default is false.

Implementation

Future<Model> getModel({
  required String modelName,
  required String restApiId,
  bool? flatten,
}) async {
  ArgumentError.checkNotNull(modelName, 'modelName');
  ArgumentError.checkNotNull(restApiId, 'restApiId');
  final $query = <String, List<String>>{
    if (flatten != null) 'flatten': [flatten.toString()],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri:
        '/restapis/${Uri.encodeComponent(restApiId)}/models/${Uri.encodeComponent(modelName)}',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return Model.fromJson(response);
}