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 BadRequestException. May throw NotFoundException. May throw TooManyRequestsException. May throw UnauthorizedException.

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

Parameter restApiId : 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 {
  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);
}