{-# 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.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data BatchDetectEntities = BatchDetectEntities'
{
BatchDetectEntities -> Sensitive [Sensitive Text]
textList :: Core.Sensitive [Core.Sensitive Prelude.Text],
BatchDetectEntities -> LanguageCode
languageCode :: LanguageCode
}
deriving (BatchDetectEntities -> BatchDetectEntities -> Bool
(BatchDetectEntities -> BatchDetectEntities -> Bool)
-> (BatchDetectEntities -> BatchDetectEntities -> Bool)
-> Eq BatchDetectEntities
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
(Int -> BatchDetectEntities -> ShowS)
-> (BatchDetectEntities -> String)
-> ([BatchDetectEntities] -> ShowS)
-> Show BatchDetectEntities
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. BatchDetectEntities -> Rep BatchDetectEntities x)
-> (forall x. Rep BatchDetectEntities x -> BatchDetectEntities)
-> Generic BatchDetectEntities
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 ::
LanguageCode ->
BatchDetectEntities
newBatchDetectEntities :: LanguageCode -> BatchDetectEntities
newBatchDetectEntities LanguageCode
pLanguageCode_ =
BatchDetectEntities' :: Sensitive [Sensitive Text] -> LanguageCode -> BatchDetectEntities
BatchDetectEntities'
{ $sel:textList:BatchDetectEntities' :: Sensitive [Sensitive Text]
textList = Sensitive [Sensitive Text]
forall a. Monoid a => a
Prelude.mempty,
$sel:languageCode:BatchDetectEntities' :: LanguageCode
languageCode = LanguageCode
pLanguageCode_
}
batchDetectEntities_textList :: Lens.Lens' BatchDetectEntities [Prelude.Text]
batchDetectEntities_textList :: ([Text] -> f [Text])
-> BatchDetectEntities -> f BatchDetectEntities
batchDetectEntities_textList = (BatchDetectEntities -> Sensitive [Sensitive Text])
-> (BatchDetectEntities
-> Sensitive [Sensitive Text] -> BatchDetectEntities)
-> Lens
BatchDetectEntities
BatchDetectEntities
(Sensitive [Sensitive Text])
(Sensitive [Sensitive Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDetectEntities' {Sensitive [Sensitive Text]
textList :: Sensitive [Sensitive Text]
$sel:textList:BatchDetectEntities' :: BatchDetectEntities -> Sensitive [Sensitive Text]
textList} -> Sensitive [Sensitive Text]
textList) (\s :: BatchDetectEntities
s@BatchDetectEntities' {} Sensitive [Sensitive Text]
a -> BatchDetectEntities
s {$sel:textList:BatchDetectEntities' :: Sensitive [Sensitive Text]
textList = Sensitive [Sensitive Text]
a} :: BatchDetectEntities) ((Sensitive [Sensitive Text] -> f (Sensitive [Sensitive Text]))
-> BatchDetectEntities -> f BatchDetectEntities)
-> (([Text] -> f [Text])
-> Sensitive [Sensitive Text] -> f (Sensitive [Sensitive Text]))
-> ([Text] -> f [Text])
-> BatchDetectEntities
-> f BatchDetectEntities
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Sensitive Text] -> f [Sensitive Text])
-> Sensitive [Sensitive Text] -> f (Sensitive [Sensitive Text])
forall a. Iso' (Sensitive a) a
Core._Sensitive (([Sensitive Text] -> f [Sensitive Text])
-> Sensitive [Sensitive Text] -> f (Sensitive [Sensitive Text]))
-> (([Text] -> f [Text]) -> [Sensitive Text] -> f [Sensitive Text])
-> ([Text] -> f [Text])
-> Sensitive [Sensitive Text]
-> f (Sensitive [Sensitive Text])
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Sensitive Text] -> f [Sensitive Text]
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 :: (LanguageCode -> f LanguageCode)
-> BatchDetectEntities -> f BatchDetectEntities
batchDetectEntities_languageCode = (BatchDetectEntities -> LanguageCode)
-> (BatchDetectEntities -> LanguageCode -> BatchDetectEntities)
-> Lens
BatchDetectEntities BatchDetectEntities LanguageCode 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 :: BatchDetectEntities -> Request BatchDetectEntities
request = Service -> BatchDetectEntities -> Request BatchDetectEntities
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy BatchDetectEntities
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchDetectEntities)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse BatchDetectEntities))
-> Logger
-> Service
-> Proxy BatchDetectEntities
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchDetectEntities)))
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 ->
Int
-> [BatchDetectEntitiesItemResult]
-> [BatchItemError]
-> BatchDetectEntitiesResponse
BatchDetectEntitiesResponse'
(Int
-> [BatchDetectEntitiesItemResult]
-> [BatchItemError]
-> BatchDetectEntitiesResponse)
-> Either String Int
-> Either
String
([BatchDetectEntitiesItemResult]
-> [BatchItemError] -> BatchDetectEntitiesResponse)
forall (f :: * -> *) a b. Functor 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))
Either
String
([BatchDetectEntitiesItemResult]
-> [BatchItemError] -> BatchDetectEntitiesResponse)
-> Either String [BatchDetectEntitiesItemResult]
-> Either String ([BatchItemError] -> BatchDetectEntitiesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Either String (Maybe [BatchDetectEntitiesItemResult])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ResultList" Either String (Maybe [BatchDetectEntitiesItemResult])
-> [BatchDetectEntitiesItemResult]
-> Either String [BatchDetectEntitiesItemResult]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [BatchDetectEntitiesItemResult]
forall a. Monoid a => a
Prelude.mempty)
Either String ([BatchItemError] -> BatchDetectEntitiesResponse)
-> Either String [BatchItemError]
-> Either String BatchDetectEntitiesResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe [BatchItemError])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ErrorList" Either String (Maybe [BatchItemError])
-> [BatchItemError] -> Either String [BatchItemError]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [BatchItemError]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable BatchDetectEntities
instance Prelude.NFData BatchDetectEntities
instance Core.ToHeaders BatchDetectEntities where
toHeaders :: BatchDetectEntities -> ResponseHeaders
toHeaders =
ResponseHeaders -> BatchDetectEntities -> 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
"Comprehend_20171127.BatchDetectEntities" ::
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 BatchDetectEntities where
toJSON :: BatchDetectEntities -> Value
toJSON BatchDetectEntities' {Sensitive [Sensitive Text]
LanguageCode
languageCode :: LanguageCode
textList :: Sensitive [Sensitive Text]
$sel:languageCode:BatchDetectEntities' :: BatchDetectEntities -> LanguageCode
$sel:textList:BatchDetectEntities' :: BatchDetectEntities -> Sensitive [Sensitive Text]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TextList" Text -> Sensitive [Sensitive Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive [Sensitive Text]
textList),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"LanguageCode" Text -> LanguageCode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= LanguageCode
languageCode)
]
)
instance Core.ToPath BatchDetectEntities where
toPath :: BatchDetectEntities -> ByteString
toPath = ByteString -> BatchDetectEntities -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery BatchDetectEntities where
toQuery :: BatchDetectEntities -> QueryString
toQuery = QueryString -> BatchDetectEntities -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(BatchDetectEntitiesResponse
-> BatchDetectEntitiesResponse -> Bool)
-> (BatchDetectEntitiesResponse
-> BatchDetectEntitiesResponse -> Bool)
-> Eq BatchDetectEntitiesResponse
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
(Int -> BatchDetectEntitiesResponse -> ShowS)
-> (BatchDetectEntitiesResponse -> String)
-> ([BatchDetectEntitiesResponse] -> ShowS)
-> Show BatchDetectEntitiesResponse
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.
BatchDetectEntitiesResponse -> Rep BatchDetectEntitiesResponse x)
-> (forall x.
Rep BatchDetectEntitiesResponse x -> BatchDetectEntitiesResponse)
-> Generic BatchDetectEntitiesResponse
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' :: Int
-> [BatchDetectEntitiesItemResult]
-> [BatchItemError]
-> BatchDetectEntitiesResponse
BatchDetectEntitiesResponse'
{ $sel:httpStatus:BatchDetectEntitiesResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:resultList:BatchDetectEntitiesResponse' :: [BatchDetectEntitiesItemResult]
resultList = [BatchDetectEntitiesItemResult]
forall a. Monoid a => a
Prelude.mempty,
$sel:errorList:BatchDetectEntitiesResponse' :: [BatchItemError]
errorList = [BatchItemError]
forall a. Monoid a => a
Prelude.mempty
}
batchDetectEntitiesResponse_httpStatus :: Lens.Lens' BatchDetectEntitiesResponse Prelude.Int
batchDetectEntitiesResponse_httpStatus :: (Int -> f Int)
-> BatchDetectEntitiesResponse -> f BatchDetectEntitiesResponse
batchDetectEntitiesResponse_httpStatus = (BatchDetectEntitiesResponse -> Int)
-> (BatchDetectEntitiesResponse
-> Int -> BatchDetectEntitiesResponse)
-> Lens
BatchDetectEntitiesResponse BatchDetectEntitiesResponse Int Int
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 :: ([BatchDetectEntitiesItemResult]
-> f [BatchDetectEntitiesItemResult])
-> BatchDetectEntitiesResponse -> f BatchDetectEntitiesResponse
batchDetectEntitiesResponse_resultList = (BatchDetectEntitiesResponse -> [BatchDetectEntitiesItemResult])
-> (BatchDetectEntitiesResponse
-> [BatchDetectEntitiesItemResult] -> BatchDetectEntitiesResponse)
-> Lens
BatchDetectEntitiesResponse
BatchDetectEntitiesResponse
[BatchDetectEntitiesItemResult]
[BatchDetectEntitiesItemResult]
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) (([BatchDetectEntitiesItemResult]
-> f [BatchDetectEntitiesItemResult])
-> BatchDetectEntitiesResponse -> f BatchDetectEntitiesResponse)
-> (([BatchDetectEntitiesItemResult]
-> f [BatchDetectEntitiesItemResult])
-> [BatchDetectEntitiesItemResult]
-> f [BatchDetectEntitiesItemResult])
-> ([BatchDetectEntitiesItemResult]
-> f [BatchDetectEntitiesItemResult])
-> BatchDetectEntitiesResponse
-> f BatchDetectEntitiesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([BatchDetectEntitiesItemResult]
-> f [BatchDetectEntitiesItemResult])
-> [BatchDetectEntitiesItemResult]
-> f [BatchDetectEntitiesItemResult]
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 :: ([BatchItemError] -> f [BatchItemError])
-> BatchDetectEntitiesResponse -> f BatchDetectEntitiesResponse
batchDetectEntitiesResponse_errorList = (BatchDetectEntitiesResponse -> [BatchItemError])
-> (BatchDetectEntitiesResponse
-> [BatchItemError] -> BatchDetectEntitiesResponse)
-> Lens
BatchDetectEntitiesResponse
BatchDetectEntitiesResponse
[BatchItemError]
[BatchItemError]
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) (([BatchItemError] -> f [BatchItemError])
-> BatchDetectEntitiesResponse -> f BatchDetectEntitiesResponse)
-> (([BatchItemError] -> f [BatchItemError])
-> [BatchItemError] -> f [BatchItemError])
-> ([BatchItemError] -> f [BatchItemError])
-> BatchDetectEntitiesResponse
-> f BatchDetectEntitiesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([BatchItemError] -> f [BatchItemError])
-> [BatchItemError] -> f [BatchItemError]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData BatchDetectEntitiesResponse