getLendingAnalysis method

Future<GetLendingAnalysisResponse> getLendingAnalysis({
  1. required String jobId,
  2. int? maxResults,
  3. String? nextToken,
})

Gets the results for an Amazon Textract asynchronous operation that analyzes text in a lending document.

You start asynchronous text analysis by calling StartLendingAnalysis, which returns a job identifier (JobId). When the text analysis operation finishes, Amazon Textract publishes a completion status to the Amazon Simple Notification Service (Amazon SNS) topic that's registered in the initial call to StartLendingAnalysis.

To get the results of the text analysis operation, first check that the status value published to the Amazon SNS topic is SUCCEEDED. If so, call GetLendingAnalysis, and pass the job identifier (JobId) from the initial call to StartLendingAnalysis.

May throw AccessDeniedException. May throw InternalServerError. May throw InvalidJobIdException. May throw InvalidKMSKeyException. May throw InvalidParameterException. May throw InvalidS3ObjectException. May throw ProvisionedThroughputExceededException. May throw ThrottlingException.

Parameter jobId : A unique identifier for the lending or text-detection job. The JobId is returned from StartLendingAnalysis. A JobId value is only valid for 7 days.

Parameter maxResults : The maximum number of results to return per paginated call. The largest value that you can specify is 30. If you specify a value greater than 30, a maximum of 30 results is returned. The default value is 30.

Parameter nextToken : If the previous response was incomplete, Amazon Textract returns a pagination token in the response. You can use this pagination token to retrieve the next set of lending results.

Implementation

Future<GetLendingAnalysisResponse> getLendingAnalysis({
  required String jobId,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    1152921504606846976,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Textract.GetLendingAnalysis'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'JobId': jobId,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return GetLendingAnalysisResponse.fromJson(jsonResponse.body);
}