예제 #1
0
        public async Task <List <GetDocumentTextDetectionResponse> > GetJobResults(string jobId)
        {
            var result   = new List <GetDocumentTextDetectionResponse>();
            var response = await _textract.GetDocumentTextDetectionAsync(new GetDocumentTextDetectionRequest
            {
                JobId = jobId
            });

            result.Add(response);

            var nextToken = response.NextToken;

            while (nextToken != null)
            {
                await Wait();

                response = await _textract.GetDocumentTextDetectionAsync(new GetDocumentTextDetectionRequest
                {
                    JobId     = jobId,
                    NextToken = response.NextToken
                });

                result.Add(response);
                nextToken = response.NextToken;
            }

            return(result);
        }
        private bool IsJobComplete(string jobId)
        {
            var response = _textract.GetDocumentTextDetectionAsync(new GetDocumentTextDetectionRequest
            {
                JobId = jobId
            });

            response.Wait();
            return(!response.Result.JobStatus.Equals("IN_PROGRESS"));
        }
 private Amazon.Textract.Model.GetDocumentTextDetectionResponse CallAWSServiceOperation(IAmazonTextract client, Amazon.Textract.Model.GetDocumentTextDetectionRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Textract", "GetDocumentTextDetection");
     try
     {
         #if DESKTOP
         return(client.GetDocumentTextDetection(request));
         #elif CORECLR
         return(client.GetDocumentTextDetectionAsync(request).GetAwaiter().GetResult());
         #else
                 #error "Unknown build edition"
         #endif
     }
     catch (AmazonServiceException exc)
     {
         var webException = exc.InnerException as System.Net.WebException;
         if (webException != null)
         {
             throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
         }
         throw;
     }
 }