{-# 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.Comprehend.BatchDetectEntities
(
BatchDetectEntities (..),
newBatchDetectEntities,
batchDetectEntities_textList,
batchDetectEntities_languageCode,
BatchDetectEntitiesResponse (..),
newBatchDetectEntitiesResponse,
batchDetectEntitiesResponse_httpStatus,
batchDetectEntitiesResponse_resultList,
batchDetectEntitiesResponse_errorList,
)
where
import Amazonka.Comprehend.Types
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
data BatchDetectEntities = BatchDetectEntities'
{
BatchDetectEntities -> Sensitive (NonEmpty (Sensitive Text))
textList :: Data.Sensitive (Prelude.NonEmpty (Data.Sensitive Prelude.Text)),
BatchDetectEntities -> LanguageCode
languageCode :: LanguageCode
}
deriving (BatchDetectEntities -> BatchDetectEntities -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchDetectEntities -> BatchDetectEntities -> Bool
$c/= :: BatchDetectEntities -> BatchDetectEntities -> Bool
== :: BatchDetectEntities -> BatchDetectEntities -> Bool
$c== :: BatchDetectEntities -> BatchDetectEntities -> Bool
Prelude.Eq, Int -> BatchDetectEntities -> ShowS
[BatchDetectEntities] -> ShowS
BatchDetectEntities -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchDetectEntities] -> ShowS
$cshowList :: [BatchDetectEntities] -> ShowS
show :: BatchDetectEntities -> String
$cshow :: BatchDetectEntities -> String
showsPrec :: Int -> BatchDetectEntities -> ShowS
$cshowsPrec :: Int -> BatchDetectEntities -> ShowS
Prelude.Show, forall x. Rep BatchDetectEntities x -> BatchDetectEntities
forall x. BatchDetectEntities -> Rep BatchDetectEntities x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchDetectEntities x -> BatchDetectEntities
$cfrom :: forall x. BatchDetectEntities -> Rep BatchDetectEntities x
Prelude.Generic)
newBatchDetectEntities ::
Prelude.NonEmpty Prelude.Text ->
LanguageCode ->
BatchDetectEntities
newBatchDetectEntities :: NonEmpty Text -> LanguageCode -> BatchDetectEntities
newBatchDetectEntities NonEmpty Text
pTextList_ LanguageCode
pLanguageCode_ =
BatchDetectEntities'
{ $sel:textList:BatchDetectEntities' :: Sensitive (NonEmpty (Sensitive Text))
textList =
forall a. Iso' (Sensitive a) a
Data._Sensitive
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
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pTextList_,
$sel:languageCode:BatchDetectEntities' :: LanguageCode
languageCode = LanguageCode
pLanguageCode_
}
batchDetectEntities_textList :: Lens.Lens' BatchDetectEntities (Prelude.NonEmpty Prelude.Text)
batchDetectEntities_textList :: Lens' BatchDetectEntities (NonEmpty Text)
batchDetectEntities_textList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDetectEntities' {Sensitive (NonEmpty (Sensitive Text))
textList :: Sensitive (NonEmpty (Sensitive Text))
$sel:textList:BatchDetectEntities' :: BatchDetectEntities -> Sensitive (NonEmpty (Sensitive Text))
textList} -> Sensitive (NonEmpty (Sensitive Text))
textList) (\s :: BatchDetectEntities
s@BatchDetectEntities' {} Sensitive (NonEmpty (Sensitive Text))
a -> BatchDetectEntities
s {$sel:textList:BatchDetectEntities' :: Sensitive (NonEmpty (Sensitive Text))
textList = Sensitive (NonEmpty (Sensitive Text))
a} :: BatchDetectEntities) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive 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
batchDetectEntities_languageCode :: Lens.Lens' BatchDetectEntities LanguageCode
batchDetectEntities_languageCode :: Lens' BatchDetectEntities LanguageCode
batchDetectEntities_languageCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDetectEntities' {LanguageCode
languageCode :: LanguageCode
$sel:languageCode:BatchDetectEntities' :: BatchDetectEntities -> LanguageCode
languageCode} -> LanguageCode
languageCode) (\s :: BatchDetectEntities
s@BatchDetectEntities' {} LanguageCode
a -> BatchDetectEntities
s {$sel:languageCode:BatchDetectEntities' :: LanguageCode
languageCode = LanguageCode
a} :: BatchDetectEntities)
instance Core.AWSRequest BatchDetectEntities where
type
AWSResponse BatchDetectEntities =
BatchDetectEntitiesResponse
request :: (Service -> Service)
-> BatchDetectEntities -> Request BatchDetectEntities
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 BatchDetectEntities
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchDetectEntities)))
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 ->
Int
-> [BatchDetectEntitiesItemResult]
-> [BatchItemError]
-> BatchDetectEntitiesResponse
BatchDetectEntitiesResponse'
forall (f :: * -> *) a b. Functor 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))
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
"ResultList" 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
"ErrorList" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable BatchDetectEntities where
hashWithSalt :: Int -> BatchDetectEntities -> Int
hashWithSalt Int
_salt BatchDetectEntities' {Sensitive (NonEmpty (Sensitive Text))
LanguageCode
languageCode :: LanguageCode
textList :: Sensitive (NonEmpty (Sensitive Text))
$sel:languageCode:BatchDetectEntities' :: BatchDetectEntities -> LanguageCode
$sel:textList:BatchDetectEntities' :: BatchDetectEntities -> Sensitive (NonEmpty (Sensitive Text))
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive (NonEmpty (Sensitive Text))
textList
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` LanguageCode
languageCode
instance Prelude.NFData BatchDetectEntities where
rnf :: BatchDetectEntities -> ()
rnf BatchDetectEntities' {Sensitive (NonEmpty (Sensitive Text))
LanguageCode
languageCode :: LanguageCode
textList :: Sensitive (NonEmpty (Sensitive Text))
$sel:languageCode:BatchDetectEntities' :: BatchDetectEntities -> LanguageCode
$sel:textList:BatchDetectEntities' :: BatchDetectEntities -> Sensitive (NonEmpty (Sensitive Text))
..} =
forall a. NFData a => a -> ()
Prelude.rnf Sensitive (NonEmpty (Sensitive Text))
textList
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf LanguageCode
languageCode
instance Data.ToHeaders BatchDetectEntities where
toHeaders :: BatchDetectEntities -> 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
"Comprehend_20171127.BatchDetectEntities" ::
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 BatchDetectEntities where
toJSON :: BatchDetectEntities -> Value
toJSON BatchDetectEntities' {Sensitive (NonEmpty (Sensitive Text))
LanguageCode
languageCode :: LanguageCode
textList :: Sensitive (NonEmpty (Sensitive Text))
$sel:languageCode:BatchDetectEntities' :: BatchDetectEntities -> LanguageCode
$sel:textList:BatchDetectEntities' :: BatchDetectEntities -> Sensitive (NonEmpty (Sensitive Text))
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"TextList" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Sensitive (NonEmpty (Sensitive Text))
textList),
forall a. a -> Maybe a
Prelude.Just (Key
"LanguageCode" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= LanguageCode
languageCode)
]
)
instance Data.ToPath BatchDetectEntities where
toPath :: BatchDetectEntities -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery BatchDetectEntities where
toQuery :: BatchDetectEntities -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data BatchDetectEntitiesResponse = BatchDetectEntitiesResponse'
{
BatchDetectEntitiesResponse -> Int
httpStatus :: Prelude.Int,
BatchDetectEntitiesResponse -> [BatchDetectEntitiesItemResult]
resultList :: [BatchDetectEntitiesItemResult],
BatchDetectEntitiesResponse -> [BatchItemError]
errorList :: [BatchItemError]
}
deriving (BatchDetectEntitiesResponse -> BatchDetectEntitiesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchDetectEntitiesResponse -> BatchDetectEntitiesResponse -> Bool
$c/= :: BatchDetectEntitiesResponse -> BatchDetectEntitiesResponse -> Bool
== :: BatchDetectEntitiesResponse -> BatchDetectEntitiesResponse -> Bool
$c== :: BatchDetectEntitiesResponse -> BatchDetectEntitiesResponse -> Bool
Prelude.Eq, Int -> BatchDetectEntitiesResponse -> ShowS
[BatchDetectEntitiesResponse] -> ShowS
BatchDetectEntitiesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchDetectEntitiesResponse] -> ShowS
$cshowList :: [BatchDetectEntitiesResponse] -> ShowS
show :: BatchDetectEntitiesResponse -> String
$cshow :: BatchDetectEntitiesResponse -> String
showsPrec :: Int -> BatchDetectEntitiesResponse -> ShowS
$cshowsPrec :: Int -> BatchDetectEntitiesResponse -> ShowS
Prelude.Show, forall x.
Rep BatchDetectEntitiesResponse x -> BatchDetectEntitiesResponse
forall x.
BatchDetectEntitiesResponse -> Rep BatchDetectEntitiesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchDetectEntitiesResponse x -> BatchDetectEntitiesResponse
$cfrom :: forall x.
BatchDetectEntitiesResponse -> Rep BatchDetectEntitiesResponse x
Prelude.Generic)
newBatchDetectEntitiesResponse ::
Prelude.Int ->
BatchDetectEntitiesResponse
newBatchDetectEntitiesResponse :: Int -> BatchDetectEntitiesResponse
newBatchDetectEntitiesResponse Int
pHttpStatus_ =
BatchDetectEntitiesResponse'
{ $sel:httpStatus:BatchDetectEntitiesResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:resultList:BatchDetectEntitiesResponse' :: [BatchDetectEntitiesItemResult]
resultList = forall a. Monoid a => a
Prelude.mempty,
$sel:errorList:BatchDetectEntitiesResponse' :: [BatchItemError]
errorList = forall a. Monoid a => a
Prelude.mempty
}
batchDetectEntitiesResponse_httpStatus :: Lens.Lens' BatchDetectEntitiesResponse Prelude.Int
batchDetectEntitiesResponse_httpStatus :: Lens' BatchDetectEntitiesResponse Int
batchDetectEntitiesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDetectEntitiesResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchDetectEntitiesResponse' :: BatchDetectEntitiesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchDetectEntitiesResponse
s@BatchDetectEntitiesResponse' {} Int
a -> BatchDetectEntitiesResponse
s {$sel:httpStatus:BatchDetectEntitiesResponse' :: Int
httpStatus = Int
a} :: BatchDetectEntitiesResponse)
batchDetectEntitiesResponse_resultList :: Lens.Lens' BatchDetectEntitiesResponse [BatchDetectEntitiesItemResult]
batchDetectEntitiesResponse_resultList :: Lens' BatchDetectEntitiesResponse [BatchDetectEntitiesItemResult]
batchDetectEntitiesResponse_resultList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDetectEntitiesResponse' {[BatchDetectEntitiesItemResult]
resultList :: [BatchDetectEntitiesItemResult]
$sel:resultList:BatchDetectEntitiesResponse' :: BatchDetectEntitiesResponse -> [BatchDetectEntitiesItemResult]
resultList} -> [BatchDetectEntitiesItemResult]
resultList) (\s :: BatchDetectEntitiesResponse
s@BatchDetectEntitiesResponse' {} [BatchDetectEntitiesItemResult]
a -> BatchDetectEntitiesResponse
s {$sel:resultList:BatchDetectEntitiesResponse' :: [BatchDetectEntitiesItemResult]
resultList = [BatchDetectEntitiesItemResult]
a} :: BatchDetectEntitiesResponse) 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
batchDetectEntitiesResponse_errorList :: Lens.Lens' BatchDetectEntitiesResponse [BatchItemError]
batchDetectEntitiesResponse_errorList :: Lens' BatchDetectEntitiesResponse [BatchItemError]
batchDetectEntitiesResponse_errorList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDetectEntitiesResponse' {[BatchItemError]
errorList :: [BatchItemError]
$sel:errorList:BatchDetectEntitiesResponse' :: BatchDetectEntitiesResponse -> [BatchItemError]
errorList} -> [BatchItemError]
errorList) (\s :: BatchDetectEntitiesResponse
s@BatchDetectEntitiesResponse' {} [BatchItemError]
a -> BatchDetectEntitiesResponse
s {$sel:errorList:BatchDetectEntitiesResponse' :: [BatchItemError]
errorList = [BatchItemError]
a} :: BatchDetectEntitiesResponse) 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 Prelude.NFData BatchDetectEntitiesResponse where
rnf :: BatchDetectEntitiesResponse -> ()
rnf BatchDetectEntitiesResponse' {Int
[BatchItemError]
[BatchDetectEntitiesItemResult]
errorList :: [BatchItemError]
resultList :: [BatchDetectEntitiesItemResult]
httpStatus :: Int
$sel:errorList:BatchDetectEntitiesResponse' :: BatchDetectEntitiesResponse -> [BatchItemError]
$sel:resultList:BatchDetectEntitiesResponse' :: BatchDetectEntitiesResponse -> [BatchDetectEntitiesItemResult]
$sel:httpStatus:BatchDetectEntitiesResponse' :: BatchDetectEntitiesResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [BatchDetectEntitiesItemResult]
resultList
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [BatchItemError]
errorList