generateMapping method
Takes sample input and output documents and uses Amazon Bedrock to generate a mapping automatically. Depending on the accuracy and other factors, you can then edit the mapping for your needs. To generate a mapping, perform the following steps:
- Start with an X12 EDI document to use as the input.
-
Call
TestMappingusing your EDI document. -
Use the output from the
TestMappingoperation as either input or output for your GenerateMapping call, along with your sample file.
May throw AccessDeniedException.
May throw InternalServerException.
May throw ThrottlingException.
May throw ValidationException.
Parameter inputFileContent :
Provide the contents of a sample X12 EDI file, either in JSON or XML
format, to use as a starting point for the mapping.
Parameter mappingType :
Specify the mapping type: either JSONATA or
XSLT.
Parameter outputFileContent :
Provide the contents of a sample X12 EDI file, either in JSON or XML
format, to use as a target for the mapping.
Implementation
Future<GenerateMappingResponse> generateMapping({
required String inputFileContent,
required MappingType mappingType,
required String outputFileContent,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target': 'B2BI.GenerateMapping'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'inputFileContent': inputFileContent,
'mappingType': mappingType.value,
'outputFileContent': outputFileContent,
},
);
return GenerateMappingResponse.fromJson(jsonResponse.body);
}