classifyDocument method

Future<ClassifyDocumentResponse> classifyDocument({
  1. required String endpointArn,
  2. required String text,
})

Creates a new document classification request to analyze a single document in real-time, using a previously created and trained custom model and an endpoint.

May throw InvalidRequestException. May throw ResourceUnavailableException. May throw TextSizeLimitExceededException. May throw InternalServerException.

Parameter endpointArn : The Amazon Resource Number (ARN) of the endpoint.

Parameter text : The document text to be analyzed.

Implementation

Future<ClassifyDocumentResponse> classifyDocument({
  required String endpointArn,
  required String text,
}) async {
  ArgumentError.checkNotNull(endpointArn, 'endpointArn');
  _s.validateStringLength(
    'endpointArn',
    endpointArn,
    0,
    256,
    isRequired: true,
  );
  ArgumentError.checkNotNull(text, 'text');
  _s.validateStringLength(
    'text',
    text,
    1,
    1152921504606846976,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Comprehend_20171127.ClassifyDocument'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'EndpointArn': endpointArn,
      'Text': text,
    },
  );

  return ClassifyDocumentResponse.fromJson(jsonResponse.body);
}