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

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

Parameter restApiId : The string identifier of the associated RestApi.

Implementation

Future<Template> getModelTemplate({
  required String modelName,
  required String restApiId,
}) async {
  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);
}