{-# 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 #-}
module Amazonka.Textract.AnalyzeID
(
AnalyzeID (..),
newAnalyzeID,
analyzeID_documentPages,
AnalyzeIDResponse (..),
newAnalyzeIDResponse,
analyzeIDResponse_analyzeIDModelVersion,
analyzeIDResponse_documentMetadata,
analyzeIDResponse_identityDocuments,
analyzeIDResponse_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
data AnalyzeID = AnalyzeID'
{
AnalyzeID -> NonEmpty Document
documentPages :: Prelude.NonEmpty Document
}
deriving (AnalyzeID -> AnalyzeID -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AnalyzeID -> AnalyzeID -> Bool
$c/= :: AnalyzeID -> AnalyzeID -> Bool
== :: AnalyzeID -> AnalyzeID -> Bool
$c== :: AnalyzeID -> AnalyzeID -> Bool
Prelude.Eq, ReadPrec [AnalyzeID]
ReadPrec AnalyzeID
Int -> ReadS AnalyzeID
ReadS [AnalyzeID]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AnalyzeID]
$creadListPrec :: ReadPrec [AnalyzeID]
readPrec :: ReadPrec AnalyzeID
$creadPrec :: ReadPrec AnalyzeID
readList :: ReadS [AnalyzeID]
$creadList :: ReadS [AnalyzeID]
readsPrec :: Int -> ReadS AnalyzeID
$creadsPrec :: Int -> ReadS AnalyzeID
Prelude.Read, Int -> AnalyzeID -> ShowS
[AnalyzeID] -> ShowS
AnalyzeID -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AnalyzeID] -> ShowS
$cshowList :: [AnalyzeID] -> ShowS
show :: AnalyzeID -> String
$cshow :: AnalyzeID -> String
showsPrec :: Int -> AnalyzeID -> ShowS
$cshowsPrec :: Int -> AnalyzeID -> ShowS
Prelude.Show, forall x. Rep AnalyzeID x -> AnalyzeID
forall x. AnalyzeID -> Rep AnalyzeID x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AnalyzeID x -> AnalyzeID
$cfrom :: forall x. AnalyzeID -> Rep AnalyzeID x
Prelude.Generic)
newAnalyzeID ::
Prelude.NonEmpty Document ->
AnalyzeID
newAnalyzeID :: NonEmpty Document -> AnalyzeID
newAnalyzeID NonEmpty Document
pDocumentPages_ =
AnalyzeID'
{ $sel:documentPages:AnalyzeID' :: NonEmpty Document
documentPages =
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty Document
pDocumentPages_
}
analyzeID_documentPages :: Lens.Lens' AnalyzeID (Prelude.NonEmpty Document)
analyzeID_documentPages :: Lens' AnalyzeID (NonEmpty Document)
analyzeID_documentPages = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnalyzeID' {NonEmpty Document
documentPages :: NonEmpty Document
$sel:documentPages:AnalyzeID' :: AnalyzeID -> NonEmpty Document
documentPages} -> NonEmpty Document
documentPages) (\s :: AnalyzeID
s@AnalyzeID' {} NonEmpty Document
a -> AnalyzeID
s {$sel:documentPages:AnalyzeID' :: NonEmpty Document
documentPages = NonEmpty Document
a} :: AnalyzeID) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest AnalyzeID where
type AWSResponse AnalyzeID = AnalyzeIDResponse
request :: (Service -> Service) -> AnalyzeID -> Request AnalyzeID
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 AnalyzeID
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AnalyzeID)))
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 DocumentMetadata
-> Maybe [IdentityDocument]
-> Int
-> AnalyzeIDResponse
AnalyzeIDResponse'
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
"AnalyzeIDModelVersion")
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
"IdentityDocuments"
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 AnalyzeID where
hashWithSalt :: Int -> AnalyzeID -> Int
hashWithSalt Int
_salt AnalyzeID' {NonEmpty Document
documentPages :: NonEmpty Document
$sel:documentPages:AnalyzeID' :: AnalyzeID -> NonEmpty Document
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Document
documentPages
instance Prelude.NFData AnalyzeID where
rnf :: AnalyzeID -> ()
rnf AnalyzeID' {NonEmpty Document
documentPages :: NonEmpty Document
$sel:documentPages:AnalyzeID' :: AnalyzeID -> NonEmpty Document
..} = forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Document
documentPages
instance Data.ToHeaders AnalyzeID where
toHeaders :: AnalyzeID -> 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.AnalyzeID" :: 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 AnalyzeID where
toJSON :: AnalyzeID -> Value
toJSON AnalyzeID' {NonEmpty Document
documentPages :: NonEmpty Document
$sel:documentPages:AnalyzeID' :: AnalyzeID -> NonEmpty Document
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
(Key
"DocumentPages" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Document
documentPages)
]
)
instance Data.ToPath AnalyzeID where
toPath :: AnalyzeID -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery AnalyzeID where
toQuery :: AnalyzeID -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data AnalyzeIDResponse = AnalyzeIDResponse'
{
AnalyzeIDResponse -> Maybe Text
analyzeIDModelVersion :: Prelude.Maybe Prelude.Text,
AnalyzeIDResponse -> Maybe DocumentMetadata
documentMetadata :: Prelude.Maybe DocumentMetadata,
AnalyzeIDResponse -> Maybe [IdentityDocument]
identityDocuments :: Prelude.Maybe [IdentityDocument],
AnalyzeIDResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AnalyzeIDResponse -> AnalyzeIDResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AnalyzeIDResponse -> AnalyzeIDResponse -> Bool
$c/= :: AnalyzeIDResponse -> AnalyzeIDResponse -> Bool
== :: AnalyzeIDResponse -> AnalyzeIDResponse -> Bool
$c== :: AnalyzeIDResponse -> AnalyzeIDResponse -> Bool
Prelude.Eq, ReadPrec [AnalyzeIDResponse]
ReadPrec AnalyzeIDResponse
Int -> ReadS AnalyzeIDResponse
ReadS [AnalyzeIDResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AnalyzeIDResponse]
$creadListPrec :: ReadPrec [AnalyzeIDResponse]
readPrec :: ReadPrec AnalyzeIDResponse
$creadPrec :: ReadPrec AnalyzeIDResponse
readList :: ReadS [AnalyzeIDResponse]
$creadList :: ReadS [AnalyzeIDResponse]
readsPrec :: Int -> ReadS AnalyzeIDResponse
$creadsPrec :: Int -> ReadS AnalyzeIDResponse
Prelude.Read, Int -> AnalyzeIDResponse -> ShowS
[AnalyzeIDResponse] -> ShowS
AnalyzeIDResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AnalyzeIDResponse] -> ShowS
$cshowList :: [AnalyzeIDResponse] -> ShowS
show :: AnalyzeIDResponse -> String
$cshow :: AnalyzeIDResponse -> String
showsPrec :: Int -> AnalyzeIDResponse -> ShowS
$cshowsPrec :: Int -> AnalyzeIDResponse -> ShowS
Prelude.Show, forall x. Rep AnalyzeIDResponse x -> AnalyzeIDResponse
forall x. AnalyzeIDResponse -> Rep AnalyzeIDResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AnalyzeIDResponse x -> AnalyzeIDResponse
$cfrom :: forall x. AnalyzeIDResponse -> Rep AnalyzeIDResponse x
Prelude.Generic)
newAnalyzeIDResponse ::
Prelude.Int ->
AnalyzeIDResponse
newAnalyzeIDResponse :: Int -> AnalyzeIDResponse
newAnalyzeIDResponse Int
pHttpStatus_ =
AnalyzeIDResponse'
{ $sel:analyzeIDModelVersion:AnalyzeIDResponse' :: Maybe Text
analyzeIDModelVersion =
forall a. Maybe a
Prelude.Nothing,
$sel:documentMetadata:AnalyzeIDResponse' :: Maybe DocumentMetadata
documentMetadata = forall a. Maybe a
Prelude.Nothing,
$sel:identityDocuments:AnalyzeIDResponse' :: Maybe [IdentityDocument]
identityDocuments = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AnalyzeIDResponse' :: Int
httpStatus = Int
pHttpStatus_
}
analyzeIDResponse_analyzeIDModelVersion :: Lens.Lens' AnalyzeIDResponse (Prelude.Maybe Prelude.Text)
analyzeIDResponse_analyzeIDModelVersion :: Lens' AnalyzeIDResponse (Maybe Text)
analyzeIDResponse_analyzeIDModelVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnalyzeIDResponse' {Maybe Text
analyzeIDModelVersion :: Maybe Text
$sel:analyzeIDModelVersion:AnalyzeIDResponse' :: AnalyzeIDResponse -> Maybe Text
analyzeIDModelVersion} -> Maybe Text
analyzeIDModelVersion) (\s :: AnalyzeIDResponse
s@AnalyzeIDResponse' {} Maybe Text
a -> AnalyzeIDResponse
s {$sel:analyzeIDModelVersion:AnalyzeIDResponse' :: Maybe Text
analyzeIDModelVersion = Maybe Text
a} :: AnalyzeIDResponse)
analyzeIDResponse_documentMetadata :: Lens.Lens' AnalyzeIDResponse (Prelude.Maybe DocumentMetadata)
analyzeIDResponse_documentMetadata :: Lens' AnalyzeIDResponse (Maybe DocumentMetadata)
analyzeIDResponse_documentMetadata = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnalyzeIDResponse' {Maybe DocumentMetadata
documentMetadata :: Maybe DocumentMetadata
$sel:documentMetadata:AnalyzeIDResponse' :: AnalyzeIDResponse -> Maybe DocumentMetadata
documentMetadata} -> Maybe DocumentMetadata
documentMetadata) (\s :: AnalyzeIDResponse
s@AnalyzeIDResponse' {} Maybe DocumentMetadata
a -> AnalyzeIDResponse
s {$sel:documentMetadata:AnalyzeIDResponse' :: Maybe DocumentMetadata
documentMetadata = Maybe DocumentMetadata
a} :: AnalyzeIDResponse)
analyzeIDResponse_identityDocuments :: Lens.Lens' AnalyzeIDResponse (Prelude.Maybe [IdentityDocument])
analyzeIDResponse_identityDocuments :: Lens' AnalyzeIDResponse (Maybe [IdentityDocument])
analyzeIDResponse_identityDocuments = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnalyzeIDResponse' {Maybe [IdentityDocument]
identityDocuments :: Maybe [IdentityDocument]
$sel:identityDocuments:AnalyzeIDResponse' :: AnalyzeIDResponse -> Maybe [IdentityDocument]
identityDocuments} -> Maybe [IdentityDocument]
identityDocuments) (\s :: AnalyzeIDResponse
s@AnalyzeIDResponse' {} Maybe [IdentityDocument]
a -> AnalyzeIDResponse
s {$sel:identityDocuments:AnalyzeIDResponse' :: Maybe [IdentityDocument]
identityDocuments = Maybe [IdentityDocument]
a} :: AnalyzeIDResponse) 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
analyzeIDResponse_httpStatus :: Lens.Lens' AnalyzeIDResponse Prelude.Int
analyzeIDResponse_httpStatus :: Lens' AnalyzeIDResponse Int
analyzeIDResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnalyzeIDResponse' {Int
httpStatus :: Int
$sel:httpStatus:AnalyzeIDResponse' :: AnalyzeIDResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AnalyzeIDResponse
s@AnalyzeIDResponse' {} Int
a -> AnalyzeIDResponse
s {$sel:httpStatus:AnalyzeIDResponse' :: Int
httpStatus = Int
a} :: AnalyzeIDResponse)
instance Prelude.NFData AnalyzeIDResponse where
rnf :: AnalyzeIDResponse -> ()
rnf AnalyzeIDResponse' {Int
Maybe [IdentityDocument]
Maybe Text
Maybe DocumentMetadata
httpStatus :: Int
identityDocuments :: Maybe [IdentityDocument]
documentMetadata :: Maybe DocumentMetadata
analyzeIDModelVersion :: Maybe Text
$sel:httpStatus:AnalyzeIDResponse' :: AnalyzeIDResponse -> Int
$sel:identityDocuments:AnalyzeIDResponse' :: AnalyzeIDResponse -> Maybe [IdentityDocument]
$sel:documentMetadata:AnalyzeIDResponse' :: AnalyzeIDResponse -> Maybe DocumentMetadata
$sel:analyzeIDModelVersion:AnalyzeIDResponse' :: AnalyzeIDResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
analyzeIDModelVersion
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 [IdentityDocument]
identityDocuments
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus