getModelTemplate method

Future<Template> getModelTemplate({
  1. required String modelName,
  2. required String restApiId,
})

Generates a sample mapping template that can be used to transform a payload into the structure of a model.

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

Parameter modelName : Required The name of the model for which to generate a template.

Parameter restApiId : Required The string identifier of the associated RestApi.

Implementation

Future<Template> getModelTemplate({
  required String modelName,
  required String restApiId,
}) async {
  ArgumentError.checkNotNull(modelName, 'modelName');
  ArgumentError.checkNotNull(restApiId, 'restApiId');
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri:
        '/restapis/${Uri.encodeComponent(restApiId)}/models/${Uri.encodeComponent(modelName)}/default_template',
    exceptionFnMap: _exceptionFns,
  );
  return Template.fromJson(response);
}