{-# 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.Rekognition.GetTextDetection
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets the text detection results of a Amazon Rekognition Video analysis
-- started by StartTextDetection.
--
-- Text detection with Amazon Rekognition Video is an asynchronous
-- operation. You start text detection by calling StartTextDetection which
-- returns a job identifier (@JobId@) When the text detection operation
-- finishes, Amazon Rekognition publishes a completion status to the Amazon
-- Simple Notification Service topic registered in the initial call to
-- @StartTextDetection@. 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 @GetTextDetection@ and pass the job
-- identifier (@JobId@) from the initial call of @StartLabelDetection@.
--
-- @GetTextDetection@ returns an array of detected text (@TextDetections@)
-- sorted by the time the text was detected, up to 50 words per frame of
-- video.
--
-- Each element of the array includes the detected text, the precentage
-- confidence in the acuracy of the detected text, the time the text was
-- detected, bounding box information for where the text was located, and
-- unique identifiers for words and their lines.
--
-- Use MaxResults parameter to limit the number of text detections
-- 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 @GetTextDetection@ and populate the @NextToken@ request
-- parameter with the token value returned from the previous call to
-- @GetTextDetection@.
module Amazonka.Rekognition.GetTextDetection
  ( -- * Creating a Request
    GetTextDetection (..),
    newGetTextDetection,

    -- * Request Lenses
    getTextDetection_nextToken,
    getTextDetection_maxResults,
    getTextDetection_jobId,

    -- * Destructuring the Response
    GetTextDetectionResponse (..),
    newGetTextDetectionResponse,

    -- * Response Lenses
    getTextDetectionResponse_textDetections,
    getTextDetectionResponse_nextToken,
    getTextDetectionResponse_videoMetadata,
    getTextDetectionResponse_statusMessage,
    getTextDetectionResponse_textModelVersion,
    getTextDetectionResponse_jobStatus,
    getTextDetectionResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Rekognition.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newGetTextDetection' smart constructor.
data GetTextDetection = GetTextDetection'
  { -- | If the previous response was incomplete (because there are more labels
    -- to retrieve), Amazon Rekognition Video returns a pagination token in the
    -- response. You can use this pagination token to retrieve the next set of
    -- text.
    GetTextDetection -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Maximum number of results to return per paginated call. The largest
    -- value you can specify is 1000.
    GetTextDetection -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | Job identifier for the text detection operation for which you want
    -- results returned. You get the job identifer from an initial call to
    -- @StartTextDetection@.
    GetTextDetection -> Text
jobId :: Prelude.Text
  }
  deriving (GetTextDetection -> GetTextDetection -> Bool
(GetTextDetection -> GetTextDetection -> Bool)
-> (GetTextDetection -> GetTextDetection -> Bool)
-> Eq GetTextDetection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetTextDetection -> GetTextDetection -> Bool
$c/= :: GetTextDetection -> GetTextDetection -> Bool
== :: GetTextDetection -> GetTextDetection -> Bool
$c== :: GetTextDetection -> GetTextDetection -> Bool
Prelude.Eq, ReadPrec [GetTextDetection]
ReadPrec GetTextDetection
Int -> ReadS GetTextDetection
ReadS [GetTextDetection]
(Int -> ReadS GetTextDetection)
-> ReadS [GetTextDetection]
-> ReadPrec GetTextDetection
-> ReadPrec [GetTextDetection]
-> Read GetTextDetection
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetTextDetection]
$creadListPrec :: ReadPrec [GetTextDetection]
readPrec :: ReadPrec GetTextDetection
$creadPrec :: ReadPrec GetTextDetection
readList :: ReadS [GetTextDetection]
$creadList :: ReadS [GetTextDetection]
readsPrec :: Int -> ReadS GetTextDetection
$creadsPrec :: Int -> ReadS GetTextDetection
Prelude.Read, Int -> GetTextDetection -> ShowS
[GetTextDetection] -> ShowS
GetTextDetection -> String
(Int -> GetTextDetection -> ShowS)
-> (GetTextDetection -> String)
-> ([GetTextDetection] -> ShowS)
-> Show GetTextDetection
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetTextDetection] -> ShowS
$cshowList :: [GetTextDetection] -> ShowS
show :: GetTextDetection -> String
$cshow :: GetTextDetection -> String
showsPrec :: Int -> GetTextDetection -> ShowS
$cshowsPrec :: Int -> GetTextDetection -> ShowS
Prelude.Show, (forall x. GetTextDetection -> Rep GetTextDetection x)
-> (forall x. Rep GetTextDetection x -> GetTextDetection)
-> Generic GetTextDetection
forall x. Rep GetTextDetection x -> GetTextDetection
forall x. GetTextDetection -> Rep GetTextDetection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetTextDetection x -> GetTextDetection
$cfrom :: forall x. GetTextDetection -> Rep GetTextDetection x
Prelude.Generic)

-- |
-- Create a value of 'GetTextDetection' 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:
--
-- 'nextToken', 'getTextDetection_nextToken' - If the previous response was incomplete (because there are more labels
-- to retrieve), Amazon Rekognition Video returns a pagination token in the
-- response. You can use this pagination token to retrieve the next set of
-- text.
--
-- 'maxResults', 'getTextDetection_maxResults' - Maximum number of results to return per paginated call. The largest
-- value you can specify is 1000.
--
-- 'jobId', 'getTextDetection_jobId' - Job identifier for the text detection operation for which you want
-- results returned. You get the job identifer from an initial call to
-- @StartTextDetection@.
newGetTextDetection ::
  -- | 'jobId'
  Prelude.Text ->
  GetTextDetection
newGetTextDetection :: Text -> GetTextDetection
newGetTextDetection Text
pJobId_ =
  GetTextDetection' :: Maybe Text -> Maybe Natural -> Text -> GetTextDetection
GetTextDetection'
    { $sel:nextToken:GetTextDetection' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:GetTextDetection' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:jobId:GetTextDetection' :: Text
jobId = Text
pJobId_
    }

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

-- | Maximum number of results to return per paginated call. The largest
-- value you can specify is 1000.
getTextDetection_maxResults :: Lens.Lens' GetTextDetection (Prelude.Maybe Prelude.Natural)
getTextDetection_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> GetTextDetection -> f GetTextDetection
getTextDetection_maxResults = (GetTextDetection -> Maybe Natural)
-> (GetTextDetection -> Maybe Natural -> GetTextDetection)
-> Lens
     GetTextDetection GetTextDetection (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTextDetection' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetTextDetection' :: GetTextDetection -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetTextDetection
s@GetTextDetection' {} Maybe Natural
a -> GetTextDetection
s {$sel:maxResults:GetTextDetection' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetTextDetection)

-- | Job identifier for the text detection operation for which you want
-- results returned. You get the job identifer from an initial call to
-- @StartTextDetection@.
getTextDetection_jobId :: Lens.Lens' GetTextDetection Prelude.Text
getTextDetection_jobId :: (Text -> f Text) -> GetTextDetection -> f GetTextDetection
getTextDetection_jobId = (GetTextDetection -> Text)
-> (GetTextDetection -> Text -> GetTextDetection)
-> Lens GetTextDetection GetTextDetection Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTextDetection' {Text
jobId :: Text
$sel:jobId:GetTextDetection' :: GetTextDetection -> Text
jobId} -> Text
jobId) (\s :: GetTextDetection
s@GetTextDetection' {} Text
a -> GetTextDetection
s {$sel:jobId:GetTextDetection' :: Text
jobId = Text
a} :: GetTextDetection)

instance Core.AWSRequest GetTextDetection where
  type
    AWSResponse GetTextDetection =
      GetTextDetectionResponse
  request :: GetTextDetection -> Request GetTextDetection
request = Service -> GetTextDetection -> Request GetTextDetection
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetTextDetection
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetTextDetection)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetTextDetection))
-> Logger
-> Service
-> Proxy GetTextDetection
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetTextDetection)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe [TextDetectionResult]
-> Maybe Text
-> Maybe VideoMetadata
-> Maybe Text
-> Maybe Text
-> Maybe VideoJobStatus
-> Int
-> GetTextDetectionResponse
GetTextDetectionResponse'
            (Maybe [TextDetectionResult]
 -> Maybe Text
 -> Maybe VideoMetadata
 -> Maybe Text
 -> Maybe Text
 -> Maybe VideoJobStatus
 -> Int
 -> GetTextDetectionResponse)
-> Either String (Maybe [TextDetectionResult])
-> Either
     String
     (Maybe Text
      -> Maybe VideoMetadata
      -> Maybe Text
      -> Maybe Text
      -> Maybe VideoJobStatus
      -> Int
      -> GetTextDetectionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Either String (Maybe (Maybe [TextDetectionResult]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"TextDetections" Either String (Maybe (Maybe [TextDetectionResult]))
-> Maybe [TextDetectionResult]
-> Either String (Maybe [TextDetectionResult])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [TextDetectionResult]
forall a. Monoid a => a
Prelude.mempty)
            Either
  String
  (Maybe Text
   -> Maybe VideoMetadata
   -> Maybe Text
   -> Maybe Text
   -> Maybe VideoJobStatus
   -> Int
   -> GetTextDetectionResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe VideoMetadata
      -> Maybe Text
      -> Maybe Text
      -> Maybe VideoJobStatus
      -> Int
      -> GetTextDetectionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
            Either
  String
  (Maybe VideoMetadata
   -> Maybe Text
   -> Maybe Text
   -> Maybe VideoJobStatus
   -> Int
   -> GetTextDetectionResponse)
-> Either String (Maybe VideoMetadata)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe VideoJobStatus
      -> Int
      -> GetTextDetectionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe VideoMetadata)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"VideoMetadata")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe VideoJobStatus
   -> Int
   -> GetTextDetectionResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe VideoJobStatus -> Int -> GetTextDetectionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"StatusMessage")
            Either
  String
  (Maybe Text
   -> Maybe VideoJobStatus -> Int -> GetTextDetectionResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe VideoJobStatus -> Int -> GetTextDetectionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"TextModelVersion")
            Either
  String (Maybe VideoJobStatus -> Int -> GetTextDetectionResponse)
-> Either String (Maybe VideoJobStatus)
-> Either String (Int -> GetTextDetectionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe VideoJobStatus)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"JobStatus")
            Either String (Int -> GetTextDetectionResponse)
-> Either String Int -> Either String GetTextDetectionResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable GetTextDetection

instance Prelude.NFData GetTextDetection

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

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

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

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

-- | /See:/ 'newGetTextDetectionResponse' smart constructor.
data GetTextDetectionResponse = GetTextDetectionResponse'
  { -- | An array of text detected in the video. Each element contains the
    -- detected text, the time in milliseconds from the start of the video that
    -- the text was detected, and where it was detected on the screen.
    GetTextDetectionResponse -> Maybe [TextDetectionResult]
textDetections :: Prelude.Maybe [TextDetectionResult],
    -- | If the response is truncated, Amazon Rekognition Video returns this
    -- token that you can use in the subsequent request to retrieve the next
    -- set of text.
    GetTextDetectionResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    GetTextDetectionResponse -> Maybe VideoMetadata
videoMetadata :: Prelude.Maybe VideoMetadata,
    -- | If the job fails, @StatusMessage@ provides a descriptive error message.
    GetTextDetectionResponse -> Maybe Text
statusMessage :: Prelude.Maybe Prelude.Text,
    -- | Version number of the text detection model that was used to detect text.
    GetTextDetectionResponse -> Maybe Text
textModelVersion :: Prelude.Maybe Prelude.Text,
    -- | Current status of the text detection job.
    GetTextDetectionResponse -> Maybe VideoJobStatus
jobStatus :: Prelude.Maybe VideoJobStatus,
    -- | The response's http status code.
    GetTextDetectionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetTextDetectionResponse -> GetTextDetectionResponse -> Bool
(GetTextDetectionResponse -> GetTextDetectionResponse -> Bool)
-> (GetTextDetectionResponse -> GetTextDetectionResponse -> Bool)
-> Eq GetTextDetectionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetTextDetectionResponse -> GetTextDetectionResponse -> Bool
$c/= :: GetTextDetectionResponse -> GetTextDetectionResponse -> Bool
== :: GetTextDetectionResponse -> GetTextDetectionResponse -> Bool
$c== :: GetTextDetectionResponse -> GetTextDetectionResponse -> Bool
Prelude.Eq, ReadPrec [GetTextDetectionResponse]
ReadPrec GetTextDetectionResponse
Int -> ReadS GetTextDetectionResponse
ReadS [GetTextDetectionResponse]
(Int -> ReadS GetTextDetectionResponse)
-> ReadS [GetTextDetectionResponse]
-> ReadPrec GetTextDetectionResponse
-> ReadPrec [GetTextDetectionResponse]
-> Read GetTextDetectionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetTextDetectionResponse]
$creadListPrec :: ReadPrec [GetTextDetectionResponse]
readPrec :: ReadPrec GetTextDetectionResponse
$creadPrec :: ReadPrec GetTextDetectionResponse
readList :: ReadS [GetTextDetectionResponse]
$creadList :: ReadS [GetTextDetectionResponse]
readsPrec :: Int -> ReadS GetTextDetectionResponse
$creadsPrec :: Int -> ReadS GetTextDetectionResponse
Prelude.Read, Int -> GetTextDetectionResponse -> ShowS
[GetTextDetectionResponse] -> ShowS
GetTextDetectionResponse -> String
(Int -> GetTextDetectionResponse -> ShowS)
-> (GetTextDetectionResponse -> String)
-> ([GetTextDetectionResponse] -> ShowS)
-> Show GetTextDetectionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetTextDetectionResponse] -> ShowS
$cshowList :: [GetTextDetectionResponse] -> ShowS
show :: GetTextDetectionResponse -> String
$cshow :: GetTextDetectionResponse -> String
showsPrec :: Int -> GetTextDetectionResponse -> ShowS
$cshowsPrec :: Int -> GetTextDetectionResponse -> ShowS
Prelude.Show, (forall x.
 GetTextDetectionResponse -> Rep GetTextDetectionResponse x)
-> (forall x.
    Rep GetTextDetectionResponse x -> GetTextDetectionResponse)
-> Generic GetTextDetectionResponse
forall x.
Rep GetTextDetectionResponse x -> GetTextDetectionResponse
forall x.
GetTextDetectionResponse -> Rep GetTextDetectionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetTextDetectionResponse x -> GetTextDetectionResponse
$cfrom :: forall x.
GetTextDetectionResponse -> Rep GetTextDetectionResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetTextDetectionResponse' 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:
--
-- 'textDetections', 'getTextDetectionResponse_textDetections' - An array of text detected in the video. Each element contains the
-- detected text, the time in milliseconds from the start of the video that
-- the text was detected, and where it was detected on the screen.
--
-- 'nextToken', 'getTextDetectionResponse_nextToken' - If the response is truncated, Amazon Rekognition Video returns this
-- token that you can use in the subsequent request to retrieve the next
-- set of text.
--
-- 'videoMetadata', 'getTextDetectionResponse_videoMetadata' - Undocumented member.
--
-- 'statusMessage', 'getTextDetectionResponse_statusMessage' - If the job fails, @StatusMessage@ provides a descriptive error message.
--
-- 'textModelVersion', 'getTextDetectionResponse_textModelVersion' - Version number of the text detection model that was used to detect text.
--
-- 'jobStatus', 'getTextDetectionResponse_jobStatus' - Current status of the text detection job.
--
-- 'httpStatus', 'getTextDetectionResponse_httpStatus' - The response's http status code.
newGetTextDetectionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetTextDetectionResponse
newGetTextDetectionResponse :: Int -> GetTextDetectionResponse
newGetTextDetectionResponse Int
pHttpStatus_ =
  GetTextDetectionResponse' :: Maybe [TextDetectionResult]
-> Maybe Text
-> Maybe VideoMetadata
-> Maybe Text
-> Maybe Text
-> Maybe VideoJobStatus
-> Int
-> GetTextDetectionResponse
GetTextDetectionResponse'
    { $sel:textDetections:GetTextDetectionResponse' :: Maybe [TextDetectionResult]
textDetections =
        Maybe [TextDetectionResult]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetTextDetectionResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:videoMetadata:GetTextDetectionResponse' :: Maybe VideoMetadata
videoMetadata = Maybe VideoMetadata
forall a. Maybe a
Prelude.Nothing,
      $sel:statusMessage:GetTextDetectionResponse' :: Maybe Text
statusMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:textModelVersion:GetTextDetectionResponse' :: Maybe Text
textModelVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:jobStatus:GetTextDetectionResponse' :: Maybe VideoJobStatus
jobStatus = Maybe VideoJobStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetTextDetectionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An array of text detected in the video. Each element contains the
-- detected text, the time in milliseconds from the start of the video that
-- the text was detected, and where it was detected on the screen.
getTextDetectionResponse_textDetections :: Lens.Lens' GetTextDetectionResponse (Prelude.Maybe [TextDetectionResult])
getTextDetectionResponse_textDetections :: (Maybe [TextDetectionResult] -> f (Maybe [TextDetectionResult]))
-> GetTextDetectionResponse -> f GetTextDetectionResponse
getTextDetectionResponse_textDetections = (GetTextDetectionResponse -> Maybe [TextDetectionResult])
-> (GetTextDetectionResponse
    -> Maybe [TextDetectionResult] -> GetTextDetectionResponse)
-> Lens
     GetTextDetectionResponse
     GetTextDetectionResponse
     (Maybe [TextDetectionResult])
     (Maybe [TextDetectionResult])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTextDetectionResponse' {Maybe [TextDetectionResult]
textDetections :: Maybe [TextDetectionResult]
$sel:textDetections:GetTextDetectionResponse' :: GetTextDetectionResponse -> Maybe [TextDetectionResult]
textDetections} -> Maybe [TextDetectionResult]
textDetections) (\s :: GetTextDetectionResponse
s@GetTextDetectionResponse' {} Maybe [TextDetectionResult]
a -> GetTextDetectionResponse
s {$sel:textDetections:GetTextDetectionResponse' :: Maybe [TextDetectionResult]
textDetections = Maybe [TextDetectionResult]
a} :: GetTextDetectionResponse) ((Maybe [TextDetectionResult] -> f (Maybe [TextDetectionResult]))
 -> GetTextDetectionResponse -> f GetTextDetectionResponse)
-> ((Maybe [TextDetectionResult]
     -> f (Maybe [TextDetectionResult]))
    -> Maybe [TextDetectionResult] -> f (Maybe [TextDetectionResult]))
-> (Maybe [TextDetectionResult] -> f (Maybe [TextDetectionResult]))
-> GetTextDetectionResponse
-> f GetTextDetectionResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [TextDetectionResult]
  [TextDetectionResult]
  [TextDetectionResult]
  [TextDetectionResult]
-> Iso
     (Maybe [TextDetectionResult])
     (Maybe [TextDetectionResult])
     (Maybe [TextDetectionResult])
     (Maybe [TextDetectionResult])
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 AnIso
  [TextDetectionResult]
  [TextDetectionResult]
  [TextDetectionResult]
  [TextDetectionResult]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If the response is truncated, Amazon Rekognition Video returns this
-- token that you can use in the subsequent request to retrieve the next
-- set of text.
getTextDetectionResponse_nextToken :: Lens.Lens' GetTextDetectionResponse (Prelude.Maybe Prelude.Text)
getTextDetectionResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetTextDetectionResponse -> f GetTextDetectionResponse
getTextDetectionResponse_nextToken = (GetTextDetectionResponse -> Maybe Text)
-> (GetTextDetectionResponse
    -> Maybe Text -> GetTextDetectionResponse)
-> Lens
     GetTextDetectionResponse
     GetTextDetectionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTextDetectionResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetTextDetectionResponse' :: GetTextDetectionResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetTextDetectionResponse
s@GetTextDetectionResponse' {} Maybe Text
a -> GetTextDetectionResponse
s {$sel:nextToken:GetTextDetectionResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetTextDetectionResponse)

-- | Undocumented member.
getTextDetectionResponse_videoMetadata :: Lens.Lens' GetTextDetectionResponse (Prelude.Maybe VideoMetadata)
getTextDetectionResponse_videoMetadata :: (Maybe VideoMetadata -> f (Maybe VideoMetadata))
-> GetTextDetectionResponse -> f GetTextDetectionResponse
getTextDetectionResponse_videoMetadata = (GetTextDetectionResponse -> Maybe VideoMetadata)
-> (GetTextDetectionResponse
    -> Maybe VideoMetadata -> GetTextDetectionResponse)
-> Lens
     GetTextDetectionResponse
     GetTextDetectionResponse
     (Maybe VideoMetadata)
     (Maybe VideoMetadata)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTextDetectionResponse' {Maybe VideoMetadata
videoMetadata :: Maybe VideoMetadata
$sel:videoMetadata:GetTextDetectionResponse' :: GetTextDetectionResponse -> Maybe VideoMetadata
videoMetadata} -> Maybe VideoMetadata
videoMetadata) (\s :: GetTextDetectionResponse
s@GetTextDetectionResponse' {} Maybe VideoMetadata
a -> GetTextDetectionResponse
s {$sel:videoMetadata:GetTextDetectionResponse' :: Maybe VideoMetadata
videoMetadata = Maybe VideoMetadata
a} :: GetTextDetectionResponse)

-- | If the job fails, @StatusMessage@ provides a descriptive error message.
getTextDetectionResponse_statusMessage :: Lens.Lens' GetTextDetectionResponse (Prelude.Maybe Prelude.Text)
getTextDetectionResponse_statusMessage :: (Maybe Text -> f (Maybe Text))
-> GetTextDetectionResponse -> f GetTextDetectionResponse
getTextDetectionResponse_statusMessage = (GetTextDetectionResponse -> Maybe Text)
-> (GetTextDetectionResponse
    -> Maybe Text -> GetTextDetectionResponse)
-> Lens
     GetTextDetectionResponse
     GetTextDetectionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTextDetectionResponse' {Maybe Text
statusMessage :: Maybe Text
$sel:statusMessage:GetTextDetectionResponse' :: GetTextDetectionResponse -> Maybe Text
statusMessage} -> Maybe Text
statusMessage) (\s :: GetTextDetectionResponse
s@GetTextDetectionResponse' {} Maybe Text
a -> GetTextDetectionResponse
s {$sel:statusMessage:GetTextDetectionResponse' :: Maybe Text
statusMessage = Maybe Text
a} :: GetTextDetectionResponse)

-- | Version number of the text detection model that was used to detect text.
getTextDetectionResponse_textModelVersion :: Lens.Lens' GetTextDetectionResponse (Prelude.Maybe Prelude.Text)
getTextDetectionResponse_textModelVersion :: (Maybe Text -> f (Maybe Text))
-> GetTextDetectionResponse -> f GetTextDetectionResponse
getTextDetectionResponse_textModelVersion = (GetTextDetectionResponse -> Maybe Text)
-> (GetTextDetectionResponse
    -> Maybe Text -> GetTextDetectionResponse)
-> Lens
     GetTextDetectionResponse
     GetTextDetectionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTextDetectionResponse' {Maybe Text
textModelVersion :: Maybe Text
$sel:textModelVersion:GetTextDetectionResponse' :: GetTextDetectionResponse -> Maybe Text
textModelVersion} -> Maybe Text
textModelVersion) (\s :: GetTextDetectionResponse
s@GetTextDetectionResponse' {} Maybe Text
a -> GetTextDetectionResponse
s {$sel:textModelVersion:GetTextDetectionResponse' :: Maybe Text
textModelVersion = Maybe Text
a} :: GetTextDetectionResponse)

-- | Current status of the text detection job.
getTextDetectionResponse_jobStatus :: Lens.Lens' GetTextDetectionResponse (Prelude.Maybe VideoJobStatus)
getTextDetectionResponse_jobStatus :: (Maybe VideoJobStatus -> f (Maybe VideoJobStatus))
-> GetTextDetectionResponse -> f GetTextDetectionResponse
getTextDetectionResponse_jobStatus = (GetTextDetectionResponse -> Maybe VideoJobStatus)
-> (GetTextDetectionResponse
    -> Maybe VideoJobStatus -> GetTextDetectionResponse)
-> Lens
     GetTextDetectionResponse
     GetTextDetectionResponse
     (Maybe VideoJobStatus)
     (Maybe VideoJobStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTextDetectionResponse' {Maybe VideoJobStatus
jobStatus :: Maybe VideoJobStatus
$sel:jobStatus:GetTextDetectionResponse' :: GetTextDetectionResponse -> Maybe VideoJobStatus
jobStatus} -> Maybe VideoJobStatus
jobStatus) (\s :: GetTextDetectionResponse
s@GetTextDetectionResponse' {} Maybe VideoJobStatus
a -> GetTextDetectionResponse
s {$sel:jobStatus:GetTextDetectionResponse' :: Maybe VideoJobStatus
jobStatus = Maybe VideoJobStatus
a} :: GetTextDetectionResponse)

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

instance Prelude.NFData GetTextDetectionResponse