testMapping method

Future<TestMappingResponse> testMapping({
  1. required FileFormat fileFormat,
  2. required String inputFileContent,
  3. required String mappingTemplate,
})

Maps the input file according to the provided template file. The API call downloads the file contents from the Amazon S3 location, and passes the contents in as a string, to the inputFileContent parameter.

May throw AccessDeniedException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter fileFormat : Specifies that the currently supported file formats for EDI transformations are JSON and XML.

Parameter inputFileContent : Specify the contents of the EDI (electronic data interchange) XML or JSON file that is used as input for the transform.

Parameter mappingTemplate : Specifies the mapping template for the transformer. This template is used to map the parsed EDI file using JSONata or XSLT.

Implementation

Future<TestMappingResponse> testMapping({
  required FileFormat fileFormat,
  required String inputFileContent,
  required String mappingTemplate,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'B2BI.TestMapping'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'fileFormat': fileFormat.value,
      'inputFileContent': inputFileContent,
      'mappingTemplate': mappingTemplate,
    },
  );

  return TestMappingResponse.fromJson(jsonResponse.body);
}