{-# 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.BatchDetectKeyPhrases
(
BatchDetectKeyPhrases (..),
newBatchDetectKeyPhrases,
batchDetectKeyPhrases_textList,
batchDetectKeyPhrases_languageCode,
BatchDetectKeyPhrasesResponse (..),
newBatchDetectKeyPhrasesResponse,
batchDetectKeyPhrasesResponse_httpStatus,
batchDetectKeyPhrasesResponse_resultList,
batchDetectKeyPhrasesResponse_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 BatchDetectKeyPhrases = BatchDetectKeyPhrases'
{
BatchDetectKeyPhrases -> Sensitive (NonEmpty (Sensitive Text))
textList :: Data.Sensitive (Prelude.NonEmpty (Data.Sensitive Prelude.Text)),
BatchDetectKeyPhrases -> LanguageCode
languageCode :: LanguageCode
}
deriving (BatchDetectKeyPhrases -> BatchDetectKeyPhrases -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchDetectKeyPhrases -> BatchDetectKeyPhrases -> Bool
$c/= :: BatchDetectKeyPhrases -> BatchDetectKeyPhrases -> Bool
== :: BatchDetectKeyPhrases -> BatchDetectKeyPhrases -> Bool
$c== :: BatchDetectKeyPhrases -> BatchDetectKeyPhrases -> Bool
Prelude.Eq, Int -> BatchDetectKeyPhrases -> ShowS
[BatchDetectKeyPhrases] -> ShowS
BatchDetectKeyPhrases -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchDetectKeyPhrases] -> ShowS
$cshowList :: [BatchDetectKeyPhrases] -> ShowS
show :: BatchDetectKeyPhrases -> String
$cshow :: BatchDetectKeyPhrases -> String
showsPrec :: Int -> BatchDetectKeyPhrases -> ShowS
$cshowsPrec :: Int -> BatchDetectKeyPhrases -> ShowS
Prelude.Show, forall x. Rep BatchDetectKeyPhrases x -> BatchDetectKeyPhrases
forall x. BatchDetectKeyPhrases -> Rep BatchDetectKeyPhrases x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchDetectKeyPhrases x -> BatchDetectKeyPhrases
$cfrom :: forall x. BatchDetectKeyPhrases -> Rep BatchDetectKeyPhrases x
Prelude.Generic)
newBatchDetectKeyPhrases ::
Prelude.NonEmpty Prelude.Text ->
LanguageCode ->
BatchDetectKeyPhrases
newBatchDetectKeyPhrases :: NonEmpty Text -> LanguageCode -> BatchDetectKeyPhrases
newBatchDetectKeyPhrases NonEmpty Text
pTextList_ LanguageCode
pLanguageCode_ =
BatchDetectKeyPhrases'
{ $sel:textList:BatchDetectKeyPhrases' :: 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:BatchDetectKeyPhrases' :: LanguageCode
languageCode = LanguageCode
pLanguageCode_
}
batchDetectKeyPhrases_textList :: Lens.Lens' BatchDetectKeyPhrases (Prelude.NonEmpty Prelude.Text)
batchDetectKeyPhrases_textList :: Lens' BatchDetectKeyPhrases (NonEmpty Text)
batchDetectKeyPhrases_textList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDetectKeyPhrases' {Sensitive (NonEmpty (Sensitive Text))
textList :: Sensitive (NonEmpty (Sensitive Text))
$sel:textList:BatchDetectKeyPhrases' :: BatchDetectKeyPhrases -> Sensitive (NonEmpty (Sensitive Text))
textList} -> Sensitive (NonEmpty (Sensitive Text))
textList) (\s :: BatchDetectKeyPhrases
s@BatchDetectKeyPhrases' {} Sensitive (NonEmpty (Sensitive Text))
a -> BatchDetectKeyPhrases
s {$sel:textList:BatchDetectKeyPhrases' :: Sensitive (NonEmpty (Sensitive Text))
textList = Sensitive (NonEmpty (Sensitive Text))
a} :: BatchDetectKeyPhrases) 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
batchDetectKeyPhrases_languageCode :: Lens.Lens' BatchDetectKeyPhrases LanguageCode
batchDetectKeyPhrases_languageCode :: Lens' BatchDetectKeyPhrases LanguageCode
batchDetectKeyPhrases_languageCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDetectKeyPhrases' {LanguageCode
languageCode :: LanguageCode
$sel:languageCode:BatchDetectKeyPhrases' :: BatchDetectKeyPhrases -> LanguageCode
languageCode} -> LanguageCode
languageCode) (\s :: BatchDetectKeyPhrases
s@BatchDetectKeyPhrases' {} LanguageCode
a -> BatchDetectKeyPhrases
s {$sel:languageCode:BatchDetectKeyPhrases' :: LanguageCode
languageCode = LanguageCode
a} :: BatchDetectKeyPhrases)
instance Core.AWSRequest BatchDetectKeyPhrases where
type
AWSResponse BatchDetectKeyPhrases =
BatchDetectKeyPhrasesResponse
request :: (Service -> Service)
-> BatchDetectKeyPhrases -> Request BatchDetectKeyPhrases
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 BatchDetectKeyPhrases
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchDetectKeyPhrases)))
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
-> [BatchDetectKeyPhrasesItemResult]
-> [BatchItemError]
-> BatchDetectKeyPhrasesResponse
BatchDetectKeyPhrasesResponse'
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 BatchDetectKeyPhrases where
hashWithSalt :: Int -> BatchDetectKeyPhrases -> Int
hashWithSalt Int
_salt BatchDetectKeyPhrases' {Sensitive (NonEmpty (Sensitive Text))
LanguageCode
languageCode :: LanguageCode
textList :: Sensitive (NonEmpty (Sensitive Text))
$sel:languageCode:BatchDetectKeyPhrases' :: BatchDetectKeyPhrases -> LanguageCode
$sel:textList:BatchDetectKeyPhrases' :: BatchDetectKeyPhrases -> 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 BatchDetectKeyPhrases where
rnf :: BatchDetectKeyPhrases -> ()
rnf BatchDetectKeyPhrases' {Sensitive (NonEmpty (Sensitive Text))
LanguageCode
languageCode :: LanguageCode
textList :: Sensitive (NonEmpty (Sensitive Text))
$sel:languageCode:BatchDetectKeyPhrases' :: BatchDetectKeyPhrases -> LanguageCode
$sel:textList:BatchDetectKeyPhrases' :: BatchDetectKeyPhrases -> 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 BatchDetectKeyPhrases where
toHeaders :: BatchDetectKeyPhrases -> 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.BatchDetectKeyPhrases" ::
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 BatchDetectKeyPhrases where
toJSON :: BatchDetectKeyPhrases -> Value
toJSON BatchDetectKeyPhrases' {Sensitive (NonEmpty (Sensitive Text))
LanguageCode
languageCode :: LanguageCode
textList :: Sensitive (NonEmpty (Sensitive Text))
$sel:languageCode:BatchDetectKeyPhrases' :: BatchDetectKeyPhrases -> LanguageCode
$sel:textList:BatchDetectKeyPhrases' :: BatchDetectKeyPhrases -> 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 BatchDetectKeyPhrases where
toPath :: BatchDetectKeyPhrases -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery BatchDetectKeyPhrases where
toQuery :: BatchDetectKeyPhrases -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data BatchDetectKeyPhrasesResponse = BatchDetectKeyPhrasesResponse'
{
BatchDetectKeyPhrasesResponse -> Int
httpStatus :: Prelude.Int,
BatchDetectKeyPhrasesResponse -> [BatchDetectKeyPhrasesItemResult]
resultList :: [BatchDetectKeyPhrasesItemResult],
BatchDetectKeyPhrasesResponse -> [BatchItemError]
errorList :: [BatchItemError]
}
deriving (BatchDetectKeyPhrasesResponse
-> BatchDetectKeyPhrasesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchDetectKeyPhrasesResponse
-> BatchDetectKeyPhrasesResponse -> Bool
$c/= :: BatchDetectKeyPhrasesResponse
-> BatchDetectKeyPhrasesResponse -> Bool
== :: BatchDetectKeyPhrasesResponse
-> BatchDetectKeyPhrasesResponse -> Bool
$c== :: BatchDetectKeyPhrasesResponse
-> BatchDetectKeyPhrasesResponse -> Bool
Prelude.Eq, Int -> BatchDetectKeyPhrasesResponse -> ShowS
[BatchDetectKeyPhrasesResponse] -> ShowS
BatchDetectKeyPhrasesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchDetectKeyPhrasesResponse] -> ShowS
$cshowList :: [BatchDetectKeyPhrasesResponse] -> ShowS
show :: BatchDetectKeyPhrasesResponse -> String
$cshow :: BatchDetectKeyPhrasesResponse -> String
showsPrec :: Int -> BatchDetectKeyPhrasesResponse -> ShowS
$cshowsPrec :: Int -> BatchDetectKeyPhrasesResponse -> ShowS
Prelude.Show, forall x.
Rep BatchDetectKeyPhrasesResponse x
-> BatchDetectKeyPhrasesResponse
forall x.
BatchDetectKeyPhrasesResponse
-> Rep BatchDetectKeyPhrasesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchDetectKeyPhrasesResponse x
-> BatchDetectKeyPhrasesResponse
$cfrom :: forall x.
BatchDetectKeyPhrasesResponse
-> Rep BatchDetectKeyPhrasesResponse x
Prelude.Generic)
newBatchDetectKeyPhrasesResponse ::
Prelude.Int ->
BatchDetectKeyPhrasesResponse
newBatchDetectKeyPhrasesResponse :: Int -> BatchDetectKeyPhrasesResponse
newBatchDetectKeyPhrasesResponse Int
pHttpStatus_ =
BatchDetectKeyPhrasesResponse'
{ $sel:httpStatus:BatchDetectKeyPhrasesResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:resultList:BatchDetectKeyPhrasesResponse' :: [BatchDetectKeyPhrasesItemResult]
resultList = forall a. Monoid a => a
Prelude.mempty,
$sel:errorList:BatchDetectKeyPhrasesResponse' :: [BatchItemError]
errorList = forall a. Monoid a => a
Prelude.mempty
}
batchDetectKeyPhrasesResponse_httpStatus :: Lens.Lens' BatchDetectKeyPhrasesResponse Prelude.Int
batchDetectKeyPhrasesResponse_httpStatus :: Lens' BatchDetectKeyPhrasesResponse Int
batchDetectKeyPhrasesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDetectKeyPhrasesResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchDetectKeyPhrasesResponse' :: BatchDetectKeyPhrasesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchDetectKeyPhrasesResponse
s@BatchDetectKeyPhrasesResponse' {} Int
a -> BatchDetectKeyPhrasesResponse
s {$sel:httpStatus:BatchDetectKeyPhrasesResponse' :: Int
httpStatus = Int
a} :: BatchDetectKeyPhrasesResponse)
batchDetectKeyPhrasesResponse_resultList :: Lens.Lens' BatchDetectKeyPhrasesResponse [BatchDetectKeyPhrasesItemResult]
batchDetectKeyPhrasesResponse_resultList :: Lens'
BatchDetectKeyPhrasesResponse [BatchDetectKeyPhrasesItemResult]
batchDetectKeyPhrasesResponse_resultList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDetectKeyPhrasesResponse' {[BatchDetectKeyPhrasesItemResult]
resultList :: [BatchDetectKeyPhrasesItemResult]
$sel:resultList:BatchDetectKeyPhrasesResponse' :: BatchDetectKeyPhrasesResponse -> [BatchDetectKeyPhrasesItemResult]
resultList} -> [BatchDetectKeyPhrasesItemResult]
resultList) (\s :: BatchDetectKeyPhrasesResponse
s@BatchDetectKeyPhrasesResponse' {} [BatchDetectKeyPhrasesItemResult]
a -> BatchDetectKeyPhrasesResponse
s {$sel:resultList:BatchDetectKeyPhrasesResponse' :: [BatchDetectKeyPhrasesItemResult]
resultList = [BatchDetectKeyPhrasesItemResult]
a} :: BatchDetectKeyPhrasesResponse) 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
batchDetectKeyPhrasesResponse_errorList :: Lens.Lens' BatchDetectKeyPhrasesResponse [BatchItemError]
batchDetectKeyPhrasesResponse_errorList :: Lens' BatchDetectKeyPhrasesResponse [BatchItemError]
batchDetectKeyPhrasesResponse_errorList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDetectKeyPhrasesResponse' {[BatchItemError]
errorList :: [BatchItemError]
$sel:errorList:BatchDetectKeyPhrasesResponse' :: BatchDetectKeyPhrasesResponse -> [BatchItemError]
errorList} -> [BatchItemError]
errorList) (\s :: BatchDetectKeyPhrasesResponse
s@BatchDetectKeyPhrasesResponse' {} [BatchItemError]
a -> BatchDetectKeyPhrasesResponse
s {$sel:errorList:BatchDetectKeyPhrasesResponse' :: [BatchItemError]
errorList = [BatchItemError]
a} :: BatchDetectKeyPhrasesResponse) 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 BatchDetectKeyPhrasesResponse where
rnf :: BatchDetectKeyPhrasesResponse -> ()
rnf BatchDetectKeyPhrasesResponse' {Int
[BatchItemError]
[BatchDetectKeyPhrasesItemResult]
errorList :: [BatchItemError]
resultList :: [BatchDetectKeyPhrasesItemResult]
httpStatus :: Int
$sel:errorList:BatchDetectKeyPhrasesResponse' :: BatchDetectKeyPhrasesResponse -> [BatchItemError]
$sel:resultList:BatchDetectKeyPhrasesResponse' :: BatchDetectKeyPhrasesResponse -> [BatchDetectKeyPhrasesItemResult]
$sel:httpStatus:BatchDetectKeyPhrasesResponse' :: BatchDetectKeyPhrasesResponse -> 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 [BatchDetectKeyPhrasesItemResult]
resultList
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [BatchItemError]
errorList