{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Textract.GetDocumentAnalysis
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets the results for an Amazon Textract asynchronous operation that
-- analyzes text in a document.
--
-- You start asynchronous text analysis by calling StartDocumentAnalysis,
-- 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 @StartDocumentAnalysis@. To get the results of
-- the text-detection operation, first check that the status value
-- published to the Amazon SNS topic is @SUCCEEDED@. If so, call
-- @GetDocumentAnalysis@, and pass the job identifier (@JobId@) from the
-- initial call to @StartDocumentAnalysis@.
--
-- @GetDocumentAnalysis@ returns an array of Block objects. The following
-- types of information are returned:
--
-- -   Form data (key-value pairs). The related information is returned in
--     two Block objects, each of type @KEY_VALUE_SET@: a KEY @Block@
--     object and a VALUE @Block@ object. For example, /Name: Ana Silva
--     Carolina/ contains a key and value. /Name:/ is the key. /Ana Silva
--     Carolina/ is the value.
--
-- -   Table and table cell data. A TABLE @Block@ object contains
--     information about a detected table. A CELL @Block@ object is
--     returned for each cell in a table.
--
-- -   Lines and words of text. A LINE @Block@ object contains one or more
--     WORD @Block@ objects. All lines and words that are detected in the
--     document are returned (including text that doesn\'t have a
--     relationship with the value of the @StartDocumentAnalysis@
--     @FeatureTypes@ input parameter).
--
-- -   Query. A QUERY Block object contains the query text, alias and link
--     to the associated Query results block object.
--
-- -   Query Results. A QUERY_RESULT Block object contains the answer to
--     the query and an ID that connects it to the query asked. This Block
--     also contains a confidence score.
--
-- While processing a document with queries, look out for
-- @INVALID_REQUEST_PARAMETERS@ output. This indicates that either the per
-- page query limit has been exceeded or that the operation is trying to
-- query a page in the document which doesn’t exist.
--
-- Selection elements such as check boxes and option buttons (radio
-- buttons) can be detected in form data and in tables. A SELECTION_ELEMENT
-- @Block@ object contains information about a selection element, including
-- the selection status.
--
-- Use the @MaxResults@ parameter to limit the number of blocks that are
-- returned. If there are more results than specified in @MaxResults@, the
-- value of @NextToken@ in the operation response contains a pagination
-- token for getting the next set of results. To get the next page of
-- results, call @GetDocumentAnalysis@, and populate the @NextToken@
-- request parameter with the token value that\'s returned from the
-- previous call to @GetDocumentAnalysis@.
--
-- For more information, see
-- <https://docs.aws.amazon.com/textract/latest/dg/how-it-works-analyzing.html Document Text Analysis>.
module Amazonka.Textract.GetDocumentAnalysis
  ( -- * Creating a Request
    GetDocumentAnalysis (..),
    newGetDocumentAnalysis,

    -- * Request Lenses
    getDocumentAnalysis_maxResults,
    getDocumentAnalysis_nextToken,
    getDocumentAnalysis_jobId,

    -- * Destructuring the Response
    GetDocumentAnalysisResponse (..),
    newGetDocumentAnalysisResponse,

    -- * Response Lenses
    getDocumentAnalysisResponse_analyzeDocumentModelVersion,
    getDocumentAnalysisResponse_blocks,
    getDocumentAnalysisResponse_documentMetadata,
    getDocumentAnalysisResponse_jobStatus,
    getDocumentAnalysisResponse_nextToken,
    getDocumentAnalysisResponse_statusMessage,
    getDocumentAnalysisResponse_warnings,
    getDocumentAnalysisResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Textract.Types

-- | /See:/ 'newGetDocumentAnalysis' smart constructor.
data GetDocumentAnalysis = GetDocumentAnalysis'
  { -- | The maximum number of results to return per paginated call. The largest
    -- value that you can specify is 1,000. If you specify a value greater than
    -- 1,000, a maximum of 1,000 results is returned. The default value is
    -- 1,000.
    GetDocumentAnalysis -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | If the previous response was incomplete (because there are more blocks
    -- to retrieve), Amazon Textract returns a pagination token in the
    -- response. You can use this pagination token to retrieve the next set of
    -- blocks.
    GetDocumentAnalysis -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A unique identifier for the text-detection job. The @JobId@ is returned
    -- from @StartDocumentAnalysis@. A @JobId@ value is only valid for 7 days.
    GetDocumentAnalysis -> Text
jobId :: Prelude.Text
  }
  deriving (GetDocumentAnalysis -> GetDocumentAnalysis -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDocumentAnalysis -> GetDocumentAnalysis -> Bool
$c/= :: GetDocumentAnalysis -> GetDocumentAnalysis -> Bool
== :: GetDocumentAnalysis -> GetDocumentAnalysis -> Bool
$c== :: GetDocumentAnalysis -> GetDocumentAnalysis -> Bool
Prelude.Eq, ReadPrec [GetDocumentAnalysis]
ReadPrec GetDocumentAnalysis
Int -> ReadS GetDocumentAnalysis
ReadS [GetDocumentAnalysis]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDocumentAnalysis]
$creadListPrec :: ReadPrec [GetDocumentAnalysis]
readPrec :: ReadPrec GetDocumentAnalysis
$creadPrec :: ReadPrec GetDocumentAnalysis
readList :: ReadS [GetDocumentAnalysis]
$creadList :: ReadS [GetDocumentAnalysis]
readsPrec :: Int -> ReadS GetDocumentAnalysis
$creadsPrec :: Int -> ReadS GetDocumentAnalysis
Prelude.Read, Int -> GetDocumentAnalysis -> ShowS
[GetDocumentAnalysis] -> ShowS
GetDocumentAnalysis -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDocumentAnalysis] -> ShowS
$cshowList :: [GetDocumentAnalysis] -> ShowS
show :: GetDocumentAnalysis -> String
$cshow :: GetDocumentAnalysis -> String
showsPrec :: Int -> GetDocumentAnalysis -> ShowS
$cshowsPrec :: Int -> GetDocumentAnalysis -> ShowS
Prelude.Show, forall x. Rep GetDocumentAnalysis x -> GetDocumentAnalysis
forall x. GetDocumentAnalysis -> Rep GetDocumentAnalysis x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDocumentAnalysis x -> GetDocumentAnalysis
$cfrom :: forall x. GetDocumentAnalysis -> Rep GetDocumentAnalysis x
Prelude.Generic)

-- |
-- Create a value of 'GetDocumentAnalysis' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'maxResults', 'getDocumentAnalysis_maxResults' - The maximum number of results to return per paginated call. The largest
-- value that you can specify is 1,000. If you specify a value greater than
-- 1,000, a maximum of 1,000 results is returned. The default value is
-- 1,000.
--
-- 'nextToken', 'getDocumentAnalysis_nextToken' - If the previous response was incomplete (because there are more blocks
-- to retrieve), Amazon Textract returns a pagination token in the
-- response. You can use this pagination token to retrieve the next set of
-- blocks.
--
-- 'jobId', 'getDocumentAnalysis_jobId' - A unique identifier for the text-detection job. The @JobId@ is returned
-- from @StartDocumentAnalysis@. A @JobId@ value is only valid for 7 days.
newGetDocumentAnalysis ::
  -- | 'jobId'
  Prelude.Text ->
  GetDocumentAnalysis
newGetDocumentAnalysis :: Text -> GetDocumentAnalysis
newGetDocumentAnalysis Text
pJobId_ =
  GetDocumentAnalysis'
    { $sel:maxResults:GetDocumentAnalysis' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetDocumentAnalysis' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:jobId:GetDocumentAnalysis' :: Text
jobId = Text
pJobId_
    }

-- | The maximum number of results to return per paginated call. The largest
-- value that you can specify is 1,000. If you specify a value greater than
-- 1,000, a maximum of 1,000 results is returned. The default value is
-- 1,000.
getDocumentAnalysis_maxResults :: Lens.Lens' GetDocumentAnalysis (Prelude.Maybe Prelude.Natural)
getDocumentAnalysis_maxResults :: Lens' GetDocumentAnalysis (Maybe Natural)
getDocumentAnalysis_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentAnalysis' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetDocumentAnalysis' :: GetDocumentAnalysis -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetDocumentAnalysis
s@GetDocumentAnalysis' {} Maybe Natural
a -> GetDocumentAnalysis
s {$sel:maxResults:GetDocumentAnalysis' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetDocumentAnalysis)

-- | If the previous response was incomplete (because there are more blocks
-- to retrieve), Amazon Textract returns a pagination token in the
-- response. You can use this pagination token to retrieve the next set of
-- blocks.
getDocumentAnalysis_nextToken :: Lens.Lens' GetDocumentAnalysis (Prelude.Maybe Prelude.Text)
getDocumentAnalysis_nextToken :: Lens' GetDocumentAnalysis (Maybe Text)
getDocumentAnalysis_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentAnalysis' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetDocumentAnalysis' :: GetDocumentAnalysis -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetDocumentAnalysis
s@GetDocumentAnalysis' {} Maybe Text
a -> GetDocumentAnalysis
s {$sel:nextToken:GetDocumentAnalysis' :: Maybe Text
nextToken = Maybe Text
a} :: GetDocumentAnalysis)

-- | A unique identifier for the text-detection job. The @JobId@ is returned
-- from @StartDocumentAnalysis@. A @JobId@ value is only valid for 7 days.
getDocumentAnalysis_jobId :: Lens.Lens' GetDocumentAnalysis Prelude.Text
getDocumentAnalysis_jobId :: Lens' GetDocumentAnalysis Text
getDocumentAnalysis_jobId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentAnalysis' {Text
jobId :: Text
$sel:jobId:GetDocumentAnalysis' :: GetDocumentAnalysis -> Text
jobId} -> Text
jobId) (\s :: GetDocumentAnalysis
s@GetDocumentAnalysis' {} Text
a -> GetDocumentAnalysis
s {$sel:jobId:GetDocumentAnalysis' :: Text
jobId = Text
a} :: GetDocumentAnalysis)

instance Core.AWSRequest GetDocumentAnalysis where
  type
    AWSResponse GetDocumentAnalysis =
      GetDocumentAnalysisResponse
  request :: (Service -> Service)
-> GetDocumentAnalysis -> Request GetDocumentAnalysis
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetDocumentAnalysis
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetDocumentAnalysis)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe [Block]
-> Maybe DocumentMetadata
-> Maybe JobStatus
-> Maybe Text
-> Maybe Text
-> Maybe [Warning]
-> Int
-> GetDocumentAnalysisResponse
GetDocumentAnalysisResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"AnalyzeDocumentModelVersion")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Blocks" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"DocumentMetadata")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"JobStatus")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"NextToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"StatusMessage")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Warnings" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable GetDocumentAnalysis where
  hashWithSalt :: Int -> GetDocumentAnalysis -> Int
hashWithSalt Int
_salt GetDocumentAnalysis' {Maybe Natural
Maybe Text
Text
jobId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:jobId:GetDocumentAnalysis' :: GetDocumentAnalysis -> Text
$sel:nextToken:GetDocumentAnalysis' :: GetDocumentAnalysis -> Maybe Text
$sel:maxResults:GetDocumentAnalysis' :: GetDocumentAnalysis -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
jobId

instance Prelude.NFData GetDocumentAnalysis where
  rnf :: GetDocumentAnalysis -> ()
rnf GetDocumentAnalysis' {Maybe Natural
Maybe Text
Text
jobId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:jobId:GetDocumentAnalysis' :: GetDocumentAnalysis -> Text
$sel:nextToken:GetDocumentAnalysis' :: GetDocumentAnalysis -> Maybe Text
$sel:maxResults:GetDocumentAnalysis' :: GetDocumentAnalysis -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
jobId

instance Data.ToHeaders GetDocumentAnalysis where
  toHeaders :: GetDocumentAnalysis -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"Textract.GetDocumentAnalysis" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON GetDocumentAnalysis where
  toJSON :: GetDocumentAnalysis -> Value
toJSON GetDocumentAnalysis' {Maybe Natural
Maybe Text
Text
jobId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:jobId:GetDocumentAnalysis' :: GetDocumentAnalysis -> Text
$sel:nextToken:GetDocumentAnalysis' :: GetDocumentAnalysis -> Maybe Text
$sel:maxResults:GetDocumentAnalysis' :: GetDocumentAnalysis -> Maybe Natural
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"MaxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            (Key
"NextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            forall a. a -> Maybe a
Prelude.Just (Key
"JobId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
jobId)
          ]
      )

instance Data.ToPath GetDocumentAnalysis where
  toPath :: GetDocumentAnalysis -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery GetDocumentAnalysis where
  toQuery :: GetDocumentAnalysis -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newGetDocumentAnalysisResponse' smart constructor.
data GetDocumentAnalysisResponse = GetDocumentAnalysisResponse'
  { GetDocumentAnalysisResponse -> Maybe Text
analyzeDocumentModelVersion :: Prelude.Maybe Prelude.Text,
    -- | The results of the text-analysis operation.
    GetDocumentAnalysisResponse -> Maybe [Block]
blocks :: Prelude.Maybe [Block],
    -- | Information about a document that Amazon Textract processed.
    -- @DocumentMetadata@ is returned in every page of paginated responses from
    -- an Amazon Textract video operation.
    GetDocumentAnalysisResponse -> Maybe DocumentMetadata
documentMetadata :: Prelude.Maybe DocumentMetadata,
    -- | The current status of the text detection job.
    GetDocumentAnalysisResponse -> Maybe JobStatus
jobStatus :: Prelude.Maybe JobStatus,
    -- | If the response is truncated, Amazon Textract returns this token. You
    -- can use this token in the subsequent request to retrieve the next set of
    -- text detection results.
    GetDocumentAnalysisResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Returns if the detection job could not be completed. Contains
    -- explanation for what error occured.
    GetDocumentAnalysisResponse -> Maybe Text
statusMessage :: Prelude.Maybe Prelude.Text,
    -- | A list of warnings that occurred during the document-analysis operation.
    GetDocumentAnalysisResponse -> Maybe [Warning]
warnings :: Prelude.Maybe [Warning],
    -- | The response's http status code.
    GetDocumentAnalysisResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetDocumentAnalysisResponse -> GetDocumentAnalysisResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDocumentAnalysisResponse -> GetDocumentAnalysisResponse -> Bool
$c/= :: GetDocumentAnalysisResponse -> GetDocumentAnalysisResponse -> Bool
== :: GetDocumentAnalysisResponse -> GetDocumentAnalysisResponse -> Bool
$c== :: GetDocumentAnalysisResponse -> GetDocumentAnalysisResponse -> Bool
Prelude.Eq, ReadPrec [GetDocumentAnalysisResponse]
ReadPrec GetDocumentAnalysisResponse
Int -> ReadS GetDocumentAnalysisResponse
ReadS [GetDocumentAnalysisResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDocumentAnalysisResponse]
$creadListPrec :: ReadPrec [GetDocumentAnalysisResponse]
readPrec :: ReadPrec GetDocumentAnalysisResponse
$creadPrec :: ReadPrec GetDocumentAnalysisResponse
readList :: ReadS [GetDocumentAnalysisResponse]
$creadList :: ReadS [GetDocumentAnalysisResponse]
readsPrec :: Int -> ReadS GetDocumentAnalysisResponse
$creadsPrec :: Int -> ReadS GetDocumentAnalysisResponse
Prelude.Read, Int -> GetDocumentAnalysisResponse -> ShowS
[GetDocumentAnalysisResponse] -> ShowS
GetDocumentAnalysisResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDocumentAnalysisResponse] -> ShowS
$cshowList :: [GetDocumentAnalysisResponse] -> ShowS
show :: GetDocumentAnalysisResponse -> String
$cshow :: GetDocumentAnalysisResponse -> String
showsPrec :: Int -> GetDocumentAnalysisResponse -> ShowS
$cshowsPrec :: Int -> GetDocumentAnalysisResponse -> ShowS
Prelude.Show, forall x.
Rep GetDocumentAnalysisResponse x -> GetDocumentAnalysisResponse
forall x.
GetDocumentAnalysisResponse -> Rep GetDocumentAnalysisResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetDocumentAnalysisResponse x -> GetDocumentAnalysisResponse
$cfrom :: forall x.
GetDocumentAnalysisResponse -> Rep GetDocumentAnalysisResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetDocumentAnalysisResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'analyzeDocumentModelVersion', 'getDocumentAnalysisResponse_analyzeDocumentModelVersion' -
--
-- 'blocks', 'getDocumentAnalysisResponse_blocks' - The results of the text-analysis operation.
--
-- 'documentMetadata', 'getDocumentAnalysisResponse_documentMetadata' - Information about a document that Amazon Textract processed.
-- @DocumentMetadata@ is returned in every page of paginated responses from
-- an Amazon Textract video operation.
--
-- 'jobStatus', 'getDocumentAnalysisResponse_jobStatus' - The current status of the text detection job.
--
-- 'nextToken', 'getDocumentAnalysisResponse_nextToken' - If the response is truncated, Amazon Textract returns this token. You
-- can use this token in the subsequent request to retrieve the next set of
-- text detection results.
--
-- 'statusMessage', 'getDocumentAnalysisResponse_statusMessage' - Returns if the detection job could not be completed. Contains
-- explanation for what error occured.
--
-- 'warnings', 'getDocumentAnalysisResponse_warnings' - A list of warnings that occurred during the document-analysis operation.
--
-- 'httpStatus', 'getDocumentAnalysisResponse_httpStatus' - The response's http status code.
newGetDocumentAnalysisResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetDocumentAnalysisResponse
newGetDocumentAnalysisResponse :: Int -> GetDocumentAnalysisResponse
newGetDocumentAnalysisResponse Int
pHttpStatus_ =
  GetDocumentAnalysisResponse'
    { $sel:analyzeDocumentModelVersion:GetDocumentAnalysisResponse' :: Maybe Text
analyzeDocumentModelVersion =
        forall a. Maybe a
Prelude.Nothing,
      $sel:blocks:GetDocumentAnalysisResponse' :: Maybe [Block]
blocks = forall a. Maybe a
Prelude.Nothing,
      $sel:documentMetadata:GetDocumentAnalysisResponse' :: Maybe DocumentMetadata
documentMetadata = forall a. Maybe a
Prelude.Nothing,
      $sel:jobStatus:GetDocumentAnalysisResponse' :: Maybe JobStatus
jobStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetDocumentAnalysisResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:statusMessage:GetDocumentAnalysisResponse' :: Maybe Text
statusMessage = forall a. Maybe a
Prelude.Nothing,
      $sel:warnings:GetDocumentAnalysisResponse' :: Maybe [Warning]
warnings = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetDocumentAnalysisResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

getDocumentAnalysisResponse_analyzeDocumentModelVersion :: Lens.Lens' GetDocumentAnalysisResponse (Prelude.Maybe Prelude.Text)
getDocumentAnalysisResponse_analyzeDocumentModelVersion :: Lens' GetDocumentAnalysisResponse (Maybe Text)
getDocumentAnalysisResponse_analyzeDocumentModelVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentAnalysisResponse' {Maybe Text
analyzeDocumentModelVersion :: Maybe Text
$sel:analyzeDocumentModelVersion:GetDocumentAnalysisResponse' :: GetDocumentAnalysisResponse -> Maybe Text
analyzeDocumentModelVersion} -> Maybe Text
analyzeDocumentModelVersion) (\s :: GetDocumentAnalysisResponse
s@GetDocumentAnalysisResponse' {} Maybe Text
a -> GetDocumentAnalysisResponse
s {$sel:analyzeDocumentModelVersion:GetDocumentAnalysisResponse' :: Maybe Text
analyzeDocumentModelVersion = Maybe Text
a} :: GetDocumentAnalysisResponse)

-- | The results of the text-analysis operation.
getDocumentAnalysisResponse_blocks :: Lens.Lens' GetDocumentAnalysisResponse (Prelude.Maybe [Block])
getDocumentAnalysisResponse_blocks :: Lens' GetDocumentAnalysisResponse (Maybe [Block])
getDocumentAnalysisResponse_blocks = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentAnalysisResponse' {Maybe [Block]
blocks :: Maybe [Block]
$sel:blocks:GetDocumentAnalysisResponse' :: GetDocumentAnalysisResponse -> Maybe [Block]
blocks} -> Maybe [Block]
blocks) (\s :: GetDocumentAnalysisResponse
s@GetDocumentAnalysisResponse' {} Maybe [Block]
a -> GetDocumentAnalysisResponse
s {$sel:blocks:GetDocumentAnalysisResponse' :: Maybe [Block]
blocks = Maybe [Block]
a} :: GetDocumentAnalysisResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Information about a document that Amazon Textract processed.
-- @DocumentMetadata@ is returned in every page of paginated responses from
-- an Amazon Textract video operation.
getDocumentAnalysisResponse_documentMetadata :: Lens.Lens' GetDocumentAnalysisResponse (Prelude.Maybe DocumentMetadata)
getDocumentAnalysisResponse_documentMetadata :: Lens' GetDocumentAnalysisResponse (Maybe DocumentMetadata)
getDocumentAnalysisResponse_documentMetadata = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentAnalysisResponse' {Maybe DocumentMetadata
documentMetadata :: Maybe DocumentMetadata
$sel:documentMetadata:GetDocumentAnalysisResponse' :: GetDocumentAnalysisResponse -> Maybe DocumentMetadata
documentMetadata} -> Maybe DocumentMetadata
documentMetadata) (\s :: GetDocumentAnalysisResponse
s@GetDocumentAnalysisResponse' {} Maybe DocumentMetadata
a -> GetDocumentAnalysisResponse
s {$sel:documentMetadata:GetDocumentAnalysisResponse' :: Maybe DocumentMetadata
documentMetadata = Maybe DocumentMetadata
a} :: GetDocumentAnalysisResponse)

-- | The current status of the text detection job.
getDocumentAnalysisResponse_jobStatus :: Lens.Lens' GetDocumentAnalysisResponse (Prelude.Maybe JobStatus)
getDocumentAnalysisResponse_jobStatus :: Lens' GetDocumentAnalysisResponse (Maybe JobStatus)
getDocumentAnalysisResponse_jobStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentAnalysisResponse' {Maybe JobStatus
jobStatus :: Maybe JobStatus
$sel:jobStatus:GetDocumentAnalysisResponse' :: GetDocumentAnalysisResponse -> Maybe JobStatus
jobStatus} -> Maybe JobStatus
jobStatus) (\s :: GetDocumentAnalysisResponse
s@GetDocumentAnalysisResponse' {} Maybe JobStatus
a -> GetDocumentAnalysisResponse
s {$sel:jobStatus:GetDocumentAnalysisResponse' :: Maybe JobStatus
jobStatus = Maybe JobStatus
a} :: GetDocumentAnalysisResponse)

-- | If the response is truncated, Amazon Textract returns this token. You
-- can use this token in the subsequent request to retrieve the next set of
-- text detection results.
getDocumentAnalysisResponse_nextToken :: Lens.Lens' GetDocumentAnalysisResponse (Prelude.Maybe Prelude.Text)
getDocumentAnalysisResponse_nextToken :: Lens' GetDocumentAnalysisResponse (Maybe Text)
getDocumentAnalysisResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentAnalysisResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetDocumentAnalysisResponse' :: GetDocumentAnalysisResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetDocumentAnalysisResponse
s@GetDocumentAnalysisResponse' {} Maybe Text
a -> GetDocumentAnalysisResponse
s {$sel:nextToken:GetDocumentAnalysisResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetDocumentAnalysisResponse)

-- | Returns if the detection job could not be completed. Contains
-- explanation for what error occured.
getDocumentAnalysisResponse_statusMessage :: Lens.Lens' GetDocumentAnalysisResponse (Prelude.Maybe Prelude.Text)
getDocumentAnalysisResponse_statusMessage :: Lens' GetDocumentAnalysisResponse (Maybe Text)
getDocumentAnalysisResponse_statusMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentAnalysisResponse' {Maybe Text
statusMessage :: Maybe Text
$sel:statusMessage:GetDocumentAnalysisResponse' :: GetDocumentAnalysisResponse -> Maybe Text
statusMessage} -> Maybe Text
statusMessage) (\s :: GetDocumentAnalysisResponse
s@GetDocumentAnalysisResponse' {} Maybe Text
a -> GetDocumentAnalysisResponse
s {$sel:statusMessage:GetDocumentAnalysisResponse' :: Maybe Text
statusMessage = Maybe Text
a} :: GetDocumentAnalysisResponse)

-- | A list of warnings that occurred during the document-analysis operation.
getDocumentAnalysisResponse_warnings :: Lens.Lens' GetDocumentAnalysisResponse (Prelude.Maybe [Warning])
getDocumentAnalysisResponse_warnings :: Lens' GetDocumentAnalysisResponse (Maybe [Warning])
getDocumentAnalysisResponse_warnings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentAnalysisResponse' {Maybe [Warning]
warnings :: Maybe [Warning]
$sel:warnings:GetDocumentAnalysisResponse' :: GetDocumentAnalysisResponse -> Maybe [Warning]
warnings} -> Maybe [Warning]
warnings) (\s :: GetDocumentAnalysisResponse
s@GetDocumentAnalysisResponse' {} Maybe [Warning]
a -> GetDocumentAnalysisResponse
s {$sel:warnings:GetDocumentAnalysisResponse' :: Maybe [Warning]
warnings = Maybe [Warning]
a} :: GetDocumentAnalysisResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The response's http status code.
getDocumentAnalysisResponse_httpStatus :: Lens.Lens' GetDocumentAnalysisResponse Prelude.Int
getDocumentAnalysisResponse_httpStatus :: Lens' GetDocumentAnalysisResponse Int
getDocumentAnalysisResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentAnalysisResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetDocumentAnalysisResponse' :: GetDocumentAnalysisResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetDocumentAnalysisResponse
s@GetDocumentAnalysisResponse' {} Int
a -> GetDocumentAnalysisResponse
s {$sel:httpStatus:GetDocumentAnalysisResponse' :: Int
httpStatus = Int
a} :: GetDocumentAnalysisResponse)

instance Prelude.NFData GetDocumentAnalysisResponse where
  rnf :: GetDocumentAnalysisResponse -> ()
rnf GetDocumentAnalysisResponse' {Int
Maybe [Block]
Maybe [Warning]
Maybe Text
Maybe DocumentMetadata
Maybe JobStatus
httpStatus :: Int
warnings :: Maybe [Warning]
statusMessage :: Maybe Text
nextToken :: Maybe Text
jobStatus :: Maybe JobStatus
documentMetadata :: Maybe DocumentMetadata
blocks :: Maybe [Block]
analyzeDocumentModelVersion :: Maybe Text
$sel:httpStatus:GetDocumentAnalysisResponse' :: GetDocumentAnalysisResponse -> Int
$sel:warnings:GetDocumentAnalysisResponse' :: GetDocumentAnalysisResponse -> Maybe [Warning]
$sel:statusMessage:GetDocumentAnalysisResponse' :: GetDocumentAnalysisResponse -> Maybe Text
$sel:nextToken:GetDocumentAnalysisResponse' :: GetDocumentAnalysisResponse -> Maybe Text
$sel:jobStatus:GetDocumentAnalysisResponse' :: GetDocumentAnalysisResponse -> Maybe JobStatus
$sel:documentMetadata:GetDocumentAnalysisResponse' :: GetDocumentAnalysisResponse -> Maybe DocumentMetadata
$sel:blocks:GetDocumentAnalysisResponse' :: GetDocumentAnalysisResponse -> Maybe [Block]
$sel:analyzeDocumentModelVersion:GetDocumentAnalysisResponse' :: GetDocumentAnalysisResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
analyzeDocumentModelVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Block]
blocks
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DocumentMetadata
documentMetadata
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe JobStatus
jobStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
statusMessage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Warning]
warnings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus