{-# 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.StartDocumentTextDetection
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Starts the asynchronous detection of text in a document. Amazon Textract
-- can detect lines of text and the words that make up a line of text.
--
-- @StartDocumentTextDetection@ can analyze text in documents that are in
-- JPEG, PNG, TIFF, and PDF format. The documents are stored in an Amazon
-- S3 bucket. Use DocumentLocation to specify the bucket name and file name
-- of the document.
--
-- @StartTextDetection@ returns a job identifier (@JobId@) that you use to
-- get the results of the operation. When text detection is finished,
-- Amazon Textract publishes a completion status to the Amazon Simple
-- Notification Service (Amazon SNS) topic that you specify in
-- @NotificationChannel@. 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 GetDocumentTextDetection, and pass the
-- job identifier (@JobId@) from the initial call to
-- @StartDocumentTextDetection@.
--
-- For more information, see
-- <https://docs.aws.amazon.com/textract/latest/dg/how-it-works-detecting.html Document Text Detection>.
module Amazonka.Textract.StartDocumentTextDetection
  ( -- * Creating a Request
    StartDocumentTextDetection (..),
    newStartDocumentTextDetection,

    -- * Request Lenses
    startDocumentTextDetection_clientRequestToken,
    startDocumentTextDetection_jobTag,
    startDocumentTextDetection_kmsKeyId,
    startDocumentTextDetection_notificationChannel,
    startDocumentTextDetection_outputConfig,
    startDocumentTextDetection_documentLocation,

    -- * Destructuring the Response
    StartDocumentTextDetectionResponse (..),
    newStartDocumentTextDetectionResponse,

    -- * Response Lenses
    startDocumentTextDetectionResponse_jobId,
    startDocumentTextDetectionResponse_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:/ 'newStartDocumentTextDetection' smart constructor.
data StartDocumentTextDetection = StartDocumentTextDetection'
  { -- | The idempotent token that\'s used to identify the start request. If you
    -- use the same token with multiple @StartDocumentTextDetection@ requests,
    -- the same @JobId@ is returned. Use @ClientRequestToken@ to prevent the
    -- same job from being accidentally started more than once. For more
    -- information, see
    -- <https://docs.aws.amazon.com/textract/latest/dg/api-async.html Calling Amazon Textract Asynchronous Operations>.
    StartDocumentTextDetection -> Maybe Text
clientRequestToken :: Prelude.Maybe Prelude.Text,
    -- | An identifier that you specify that\'s included in the completion
    -- notification published to the Amazon SNS topic. For example, you can use
    -- @JobTag@ to identify the type of document that the completion
    -- notification corresponds to (such as a tax form or a receipt).
    StartDocumentTextDetection -> Maybe Text
jobTag :: Prelude.Maybe Prelude.Text,
    -- | The KMS key used to encrypt the inference results. This can be in either
    -- Key ID or Key Alias format. When a KMS key is provided, the KMS key will
    -- be used for server-side encryption of the objects in the customer
    -- bucket. When this parameter is not enabled, the result will be encrypted
    -- server side,using SSE-S3.
    StartDocumentTextDetection -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon SNS topic ARN that you want Amazon Textract to publish the
    -- completion status of the operation to.
    StartDocumentTextDetection -> Maybe NotificationChannel
notificationChannel :: Prelude.Maybe NotificationChannel,
    -- | Sets if the output will go to a customer defined bucket. By default
    -- Amazon Textract will save the results internally to be accessed with the
    -- GetDocumentTextDetection operation.
    StartDocumentTextDetection -> Maybe OutputConfig
outputConfig :: Prelude.Maybe OutputConfig,
    -- | The location of the document to be processed.
    StartDocumentTextDetection -> DocumentLocation
documentLocation :: DocumentLocation
  }
  deriving (StartDocumentTextDetection -> StartDocumentTextDetection -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartDocumentTextDetection -> StartDocumentTextDetection -> Bool
$c/= :: StartDocumentTextDetection -> StartDocumentTextDetection -> Bool
== :: StartDocumentTextDetection -> StartDocumentTextDetection -> Bool
$c== :: StartDocumentTextDetection -> StartDocumentTextDetection -> Bool
Prelude.Eq, ReadPrec [StartDocumentTextDetection]
ReadPrec StartDocumentTextDetection
Int -> ReadS StartDocumentTextDetection
ReadS [StartDocumentTextDetection]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartDocumentTextDetection]
$creadListPrec :: ReadPrec [StartDocumentTextDetection]
readPrec :: ReadPrec StartDocumentTextDetection
$creadPrec :: ReadPrec StartDocumentTextDetection
readList :: ReadS [StartDocumentTextDetection]
$creadList :: ReadS [StartDocumentTextDetection]
readsPrec :: Int -> ReadS StartDocumentTextDetection
$creadsPrec :: Int -> ReadS StartDocumentTextDetection
Prelude.Read, Int -> StartDocumentTextDetection -> ShowS
[StartDocumentTextDetection] -> ShowS
StartDocumentTextDetection -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartDocumentTextDetection] -> ShowS
$cshowList :: [StartDocumentTextDetection] -> ShowS
show :: StartDocumentTextDetection -> String
$cshow :: StartDocumentTextDetection -> String
showsPrec :: Int -> StartDocumentTextDetection -> ShowS
$cshowsPrec :: Int -> StartDocumentTextDetection -> ShowS
Prelude.Show, forall x.
Rep StartDocumentTextDetection x -> StartDocumentTextDetection
forall x.
StartDocumentTextDetection -> Rep StartDocumentTextDetection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartDocumentTextDetection x -> StartDocumentTextDetection
$cfrom :: forall x.
StartDocumentTextDetection -> Rep StartDocumentTextDetection x
Prelude.Generic)

-- |
-- Create a value of 'StartDocumentTextDetection' 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:
--
-- 'clientRequestToken', 'startDocumentTextDetection_clientRequestToken' - The idempotent token that\'s used to identify the start request. If you
-- use the same token with multiple @StartDocumentTextDetection@ requests,
-- the same @JobId@ is returned. Use @ClientRequestToken@ to prevent the
-- same job from being accidentally started more than once. For more
-- information, see
-- <https://docs.aws.amazon.com/textract/latest/dg/api-async.html Calling Amazon Textract Asynchronous Operations>.
--
-- 'jobTag', 'startDocumentTextDetection_jobTag' - An identifier that you specify that\'s included in the completion
-- notification published to the Amazon SNS topic. For example, you can use
-- @JobTag@ to identify the type of document that the completion
-- notification corresponds to (such as a tax form or a receipt).
--
-- 'kmsKeyId', 'startDocumentTextDetection_kmsKeyId' - The KMS key used to encrypt the inference results. This can be in either
-- Key ID or Key Alias format. When a KMS key is provided, the KMS key will
-- be used for server-side encryption of the objects in the customer
-- bucket. When this parameter is not enabled, the result will be encrypted
-- server side,using SSE-S3.
--
-- 'notificationChannel', 'startDocumentTextDetection_notificationChannel' - The Amazon SNS topic ARN that you want Amazon Textract to publish the
-- completion status of the operation to.
--
-- 'outputConfig', 'startDocumentTextDetection_outputConfig' - Sets if the output will go to a customer defined bucket. By default
-- Amazon Textract will save the results internally to be accessed with the
-- GetDocumentTextDetection operation.
--
-- 'documentLocation', 'startDocumentTextDetection_documentLocation' - The location of the document to be processed.
newStartDocumentTextDetection ::
  -- | 'documentLocation'
  DocumentLocation ->
  StartDocumentTextDetection
newStartDocumentTextDetection :: DocumentLocation -> StartDocumentTextDetection
newStartDocumentTextDetection DocumentLocation
pDocumentLocation_ =
  StartDocumentTextDetection'
    { $sel:clientRequestToken:StartDocumentTextDetection' :: Maybe Text
clientRequestToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:jobTag:StartDocumentTextDetection' :: Maybe Text
jobTag = forall a. Maybe a
Prelude.Nothing,
      $sel:kmsKeyId:StartDocumentTextDetection' :: Maybe Text
kmsKeyId = forall a. Maybe a
Prelude.Nothing,
      $sel:notificationChannel:StartDocumentTextDetection' :: Maybe NotificationChannel
notificationChannel = forall a. Maybe a
Prelude.Nothing,
      $sel:outputConfig:StartDocumentTextDetection' :: Maybe OutputConfig
outputConfig = forall a. Maybe a
Prelude.Nothing,
      $sel:documentLocation:StartDocumentTextDetection' :: DocumentLocation
documentLocation = DocumentLocation
pDocumentLocation_
    }

-- | The idempotent token that\'s used to identify the start request. If you
-- use the same token with multiple @StartDocumentTextDetection@ requests,
-- the same @JobId@ is returned. Use @ClientRequestToken@ to prevent the
-- same job from being accidentally started more than once. For more
-- information, see
-- <https://docs.aws.amazon.com/textract/latest/dg/api-async.html Calling Amazon Textract Asynchronous Operations>.
startDocumentTextDetection_clientRequestToken :: Lens.Lens' StartDocumentTextDetection (Prelude.Maybe Prelude.Text)
startDocumentTextDetection_clientRequestToken :: Lens' StartDocumentTextDetection (Maybe Text)
startDocumentTextDetection_clientRequestToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDocumentTextDetection' {Maybe Text
clientRequestToken :: Maybe Text
$sel:clientRequestToken:StartDocumentTextDetection' :: StartDocumentTextDetection -> Maybe Text
clientRequestToken} -> Maybe Text
clientRequestToken) (\s :: StartDocumentTextDetection
s@StartDocumentTextDetection' {} Maybe Text
a -> StartDocumentTextDetection
s {$sel:clientRequestToken:StartDocumentTextDetection' :: Maybe Text
clientRequestToken = Maybe Text
a} :: StartDocumentTextDetection)

-- | An identifier that you specify that\'s included in the completion
-- notification published to the Amazon SNS topic. For example, you can use
-- @JobTag@ to identify the type of document that the completion
-- notification corresponds to (such as a tax form or a receipt).
startDocumentTextDetection_jobTag :: Lens.Lens' StartDocumentTextDetection (Prelude.Maybe Prelude.Text)
startDocumentTextDetection_jobTag :: Lens' StartDocumentTextDetection (Maybe Text)
startDocumentTextDetection_jobTag = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDocumentTextDetection' {Maybe Text
jobTag :: Maybe Text
$sel:jobTag:StartDocumentTextDetection' :: StartDocumentTextDetection -> Maybe Text
jobTag} -> Maybe Text
jobTag) (\s :: StartDocumentTextDetection
s@StartDocumentTextDetection' {} Maybe Text
a -> StartDocumentTextDetection
s {$sel:jobTag:StartDocumentTextDetection' :: Maybe Text
jobTag = Maybe Text
a} :: StartDocumentTextDetection)

-- | The KMS key used to encrypt the inference results. This can be in either
-- Key ID or Key Alias format. When a KMS key is provided, the KMS key will
-- be used for server-side encryption of the objects in the customer
-- bucket. When this parameter is not enabled, the result will be encrypted
-- server side,using SSE-S3.
startDocumentTextDetection_kmsKeyId :: Lens.Lens' StartDocumentTextDetection (Prelude.Maybe Prelude.Text)
startDocumentTextDetection_kmsKeyId :: Lens' StartDocumentTextDetection (Maybe Text)
startDocumentTextDetection_kmsKeyId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDocumentTextDetection' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:StartDocumentTextDetection' :: StartDocumentTextDetection -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: StartDocumentTextDetection
s@StartDocumentTextDetection' {} Maybe Text
a -> StartDocumentTextDetection
s {$sel:kmsKeyId:StartDocumentTextDetection' :: Maybe Text
kmsKeyId = Maybe Text
a} :: StartDocumentTextDetection)

-- | The Amazon SNS topic ARN that you want Amazon Textract to publish the
-- completion status of the operation to.
startDocumentTextDetection_notificationChannel :: Lens.Lens' StartDocumentTextDetection (Prelude.Maybe NotificationChannel)
startDocumentTextDetection_notificationChannel :: Lens' StartDocumentTextDetection (Maybe NotificationChannel)
startDocumentTextDetection_notificationChannel = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDocumentTextDetection' {Maybe NotificationChannel
notificationChannel :: Maybe NotificationChannel
$sel:notificationChannel:StartDocumentTextDetection' :: StartDocumentTextDetection -> Maybe NotificationChannel
notificationChannel} -> Maybe NotificationChannel
notificationChannel) (\s :: StartDocumentTextDetection
s@StartDocumentTextDetection' {} Maybe NotificationChannel
a -> StartDocumentTextDetection
s {$sel:notificationChannel:StartDocumentTextDetection' :: Maybe NotificationChannel
notificationChannel = Maybe NotificationChannel
a} :: StartDocumentTextDetection)

-- | Sets if the output will go to a customer defined bucket. By default
-- Amazon Textract will save the results internally to be accessed with the
-- GetDocumentTextDetection operation.
startDocumentTextDetection_outputConfig :: Lens.Lens' StartDocumentTextDetection (Prelude.Maybe OutputConfig)
startDocumentTextDetection_outputConfig :: Lens' StartDocumentTextDetection (Maybe OutputConfig)
startDocumentTextDetection_outputConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDocumentTextDetection' {Maybe OutputConfig
outputConfig :: Maybe OutputConfig
$sel:outputConfig:StartDocumentTextDetection' :: StartDocumentTextDetection -> Maybe OutputConfig
outputConfig} -> Maybe OutputConfig
outputConfig) (\s :: StartDocumentTextDetection
s@StartDocumentTextDetection' {} Maybe OutputConfig
a -> StartDocumentTextDetection
s {$sel:outputConfig:StartDocumentTextDetection' :: Maybe OutputConfig
outputConfig = Maybe OutputConfig
a} :: StartDocumentTextDetection)

-- | The location of the document to be processed.
startDocumentTextDetection_documentLocation :: Lens.Lens' StartDocumentTextDetection DocumentLocation
startDocumentTextDetection_documentLocation :: Lens' StartDocumentTextDetection DocumentLocation
startDocumentTextDetection_documentLocation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDocumentTextDetection' {DocumentLocation
documentLocation :: DocumentLocation
$sel:documentLocation:StartDocumentTextDetection' :: StartDocumentTextDetection -> DocumentLocation
documentLocation} -> DocumentLocation
documentLocation) (\s :: StartDocumentTextDetection
s@StartDocumentTextDetection' {} DocumentLocation
a -> StartDocumentTextDetection
s {$sel:documentLocation:StartDocumentTextDetection' :: DocumentLocation
documentLocation = DocumentLocation
a} :: StartDocumentTextDetection)

instance Core.AWSRequest StartDocumentTextDetection where
  type
    AWSResponse StartDocumentTextDetection =
      StartDocumentTextDetectionResponse
  request :: (Service -> Service)
-> StartDocumentTextDetection -> Request StartDocumentTextDetection
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 StartDocumentTextDetection
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StartDocumentTextDetection)))
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 -> Int -> StartDocumentTextDetectionResponse
StartDocumentTextDetectionResponse'
            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
"JobId")
            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 StartDocumentTextDetection where
  hashWithSalt :: Int -> StartDocumentTextDetection -> Int
hashWithSalt Int
_salt StartDocumentTextDetection' {Maybe Text
Maybe NotificationChannel
Maybe OutputConfig
DocumentLocation
documentLocation :: DocumentLocation
outputConfig :: Maybe OutputConfig
notificationChannel :: Maybe NotificationChannel
kmsKeyId :: Maybe Text
jobTag :: Maybe Text
clientRequestToken :: Maybe Text
$sel:documentLocation:StartDocumentTextDetection' :: StartDocumentTextDetection -> DocumentLocation
$sel:outputConfig:StartDocumentTextDetection' :: StartDocumentTextDetection -> Maybe OutputConfig
$sel:notificationChannel:StartDocumentTextDetection' :: StartDocumentTextDetection -> Maybe NotificationChannel
$sel:kmsKeyId:StartDocumentTextDetection' :: StartDocumentTextDetection -> Maybe Text
$sel:jobTag:StartDocumentTextDetection' :: StartDocumentTextDetection -> Maybe Text
$sel:clientRequestToken:StartDocumentTextDetection' :: StartDocumentTextDetection -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clientRequestToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
jobTag
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
kmsKeyId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe NotificationChannel
notificationChannel
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe OutputConfig
outputConfig
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` DocumentLocation
documentLocation

instance Prelude.NFData StartDocumentTextDetection where
  rnf :: StartDocumentTextDetection -> ()
rnf StartDocumentTextDetection' {Maybe Text
Maybe NotificationChannel
Maybe OutputConfig
DocumentLocation
documentLocation :: DocumentLocation
outputConfig :: Maybe OutputConfig
notificationChannel :: Maybe NotificationChannel
kmsKeyId :: Maybe Text
jobTag :: Maybe Text
clientRequestToken :: Maybe Text
$sel:documentLocation:StartDocumentTextDetection' :: StartDocumentTextDetection -> DocumentLocation
$sel:outputConfig:StartDocumentTextDetection' :: StartDocumentTextDetection -> Maybe OutputConfig
$sel:notificationChannel:StartDocumentTextDetection' :: StartDocumentTextDetection -> Maybe NotificationChannel
$sel:kmsKeyId:StartDocumentTextDetection' :: StartDocumentTextDetection -> Maybe Text
$sel:jobTag:StartDocumentTextDetection' :: StartDocumentTextDetection -> Maybe Text
$sel:clientRequestToken:StartDocumentTextDetection' :: StartDocumentTextDetection -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clientRequestToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
jobTag
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
kmsKeyId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe NotificationChannel
notificationChannel
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe OutputConfig
outputConfig
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf DocumentLocation
documentLocation

instance Data.ToHeaders StartDocumentTextDetection where
  toHeaders :: StartDocumentTextDetection -> 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.StartDocumentTextDetection" ::
                          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 StartDocumentTextDetection where
  toJSON :: StartDocumentTextDetection -> Value
toJSON StartDocumentTextDetection' {Maybe Text
Maybe NotificationChannel
Maybe OutputConfig
DocumentLocation
documentLocation :: DocumentLocation
outputConfig :: Maybe OutputConfig
notificationChannel :: Maybe NotificationChannel
kmsKeyId :: Maybe Text
jobTag :: Maybe Text
clientRequestToken :: Maybe Text
$sel:documentLocation:StartDocumentTextDetection' :: StartDocumentTextDetection -> DocumentLocation
$sel:outputConfig:StartDocumentTextDetection' :: StartDocumentTextDetection -> Maybe OutputConfig
$sel:notificationChannel:StartDocumentTextDetection' :: StartDocumentTextDetection -> Maybe NotificationChannel
$sel:kmsKeyId:StartDocumentTextDetection' :: StartDocumentTextDetection -> Maybe Text
$sel:jobTag:StartDocumentTextDetection' :: StartDocumentTextDetection -> Maybe Text
$sel:clientRequestToken:StartDocumentTextDetection' :: StartDocumentTextDetection -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ClientRequestToken" 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
clientRequestToken,
            (Key
"JobTag" 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
jobTag,
            (Key
"KMSKeyId" 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
kmsKeyId,
            (Key
"NotificationChannel" 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 NotificationChannel
notificationChannel,
            (Key
"OutputConfig" 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 OutputConfig
outputConfig,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"DocumentLocation" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= DocumentLocation
documentLocation)
          ]
      )

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

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

-- | /See:/ 'newStartDocumentTextDetectionResponse' smart constructor.
data StartDocumentTextDetectionResponse = StartDocumentTextDetectionResponse'
  { -- | The identifier of the text detection job for the document. Use @JobId@
    -- to identify the job in a subsequent call to @GetDocumentTextDetection@.
    -- A @JobId@ value is only valid for 7 days.
    StartDocumentTextDetectionResponse -> Maybe Text
jobId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    StartDocumentTextDetectionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (StartDocumentTextDetectionResponse
-> StartDocumentTextDetectionResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartDocumentTextDetectionResponse
-> StartDocumentTextDetectionResponse -> Bool
$c/= :: StartDocumentTextDetectionResponse
-> StartDocumentTextDetectionResponse -> Bool
== :: StartDocumentTextDetectionResponse
-> StartDocumentTextDetectionResponse -> Bool
$c== :: StartDocumentTextDetectionResponse
-> StartDocumentTextDetectionResponse -> Bool
Prelude.Eq, ReadPrec [StartDocumentTextDetectionResponse]
ReadPrec StartDocumentTextDetectionResponse
Int -> ReadS StartDocumentTextDetectionResponse
ReadS [StartDocumentTextDetectionResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartDocumentTextDetectionResponse]
$creadListPrec :: ReadPrec [StartDocumentTextDetectionResponse]
readPrec :: ReadPrec StartDocumentTextDetectionResponse
$creadPrec :: ReadPrec StartDocumentTextDetectionResponse
readList :: ReadS [StartDocumentTextDetectionResponse]
$creadList :: ReadS [StartDocumentTextDetectionResponse]
readsPrec :: Int -> ReadS StartDocumentTextDetectionResponse
$creadsPrec :: Int -> ReadS StartDocumentTextDetectionResponse
Prelude.Read, Int -> StartDocumentTextDetectionResponse -> ShowS
[StartDocumentTextDetectionResponse] -> ShowS
StartDocumentTextDetectionResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartDocumentTextDetectionResponse] -> ShowS
$cshowList :: [StartDocumentTextDetectionResponse] -> ShowS
show :: StartDocumentTextDetectionResponse -> String
$cshow :: StartDocumentTextDetectionResponse -> String
showsPrec :: Int -> StartDocumentTextDetectionResponse -> ShowS
$cshowsPrec :: Int -> StartDocumentTextDetectionResponse -> ShowS
Prelude.Show, forall x.
Rep StartDocumentTextDetectionResponse x
-> StartDocumentTextDetectionResponse
forall x.
StartDocumentTextDetectionResponse
-> Rep StartDocumentTextDetectionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartDocumentTextDetectionResponse x
-> StartDocumentTextDetectionResponse
$cfrom :: forall x.
StartDocumentTextDetectionResponse
-> Rep StartDocumentTextDetectionResponse x
Prelude.Generic)

-- |
-- Create a value of 'StartDocumentTextDetectionResponse' 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:
--
-- 'jobId', 'startDocumentTextDetectionResponse_jobId' - The identifier of the text detection job for the document. Use @JobId@
-- to identify the job in a subsequent call to @GetDocumentTextDetection@.
-- A @JobId@ value is only valid for 7 days.
--
-- 'httpStatus', 'startDocumentTextDetectionResponse_httpStatus' - The response's http status code.
newStartDocumentTextDetectionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StartDocumentTextDetectionResponse
newStartDocumentTextDetectionResponse :: Int -> StartDocumentTextDetectionResponse
newStartDocumentTextDetectionResponse Int
pHttpStatus_ =
  StartDocumentTextDetectionResponse'
    { $sel:jobId:StartDocumentTextDetectionResponse' :: Maybe Text
jobId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:StartDocumentTextDetectionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The identifier of the text detection job for the document. Use @JobId@
-- to identify the job in a subsequent call to @GetDocumentTextDetection@.
-- A @JobId@ value is only valid for 7 days.
startDocumentTextDetectionResponse_jobId :: Lens.Lens' StartDocumentTextDetectionResponse (Prelude.Maybe Prelude.Text)
startDocumentTextDetectionResponse_jobId :: Lens' StartDocumentTextDetectionResponse (Maybe Text)
startDocumentTextDetectionResponse_jobId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDocumentTextDetectionResponse' {Maybe Text
jobId :: Maybe Text
$sel:jobId:StartDocumentTextDetectionResponse' :: StartDocumentTextDetectionResponse -> Maybe Text
jobId} -> Maybe Text
jobId) (\s :: StartDocumentTextDetectionResponse
s@StartDocumentTextDetectionResponse' {} Maybe Text
a -> StartDocumentTextDetectionResponse
s {$sel:jobId:StartDocumentTextDetectionResponse' :: Maybe Text
jobId = Maybe Text
a} :: StartDocumentTextDetectionResponse)

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

instance
  Prelude.NFData
    StartDocumentTextDetectionResponse
  where
  rnf :: StartDocumentTextDetectionResponse -> ()
rnf StartDocumentTextDetectionResponse' {Int
Maybe Text
httpStatus :: Int
jobId :: Maybe Text
$sel:httpStatus:StartDocumentTextDetectionResponse' :: StartDocumentTextDetectionResponse -> Int
$sel:jobId:StartDocumentTextDetectionResponse' :: StartDocumentTextDetectionResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
jobId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus