{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Network.AWS.Comprehend.BatchDetectKeyPhrases
(
batchDetectKeyPhrases
, BatchDetectKeyPhrases
, bdkpTextList
, bdkpLanguageCode
, batchDetectKeyPhrasesResponse
, BatchDetectKeyPhrasesResponse
, bdkprsResponseStatus
, bdkprsResultList
, bdkprsErrorList
) where
import Network.AWS.Comprehend.Types
import Network.AWS.Comprehend.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data BatchDetectKeyPhrases = BatchDetectKeyPhrases'
{ _bdkpTextList :: ![Text]
, _bdkpLanguageCode :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
batchDetectKeyPhrases
:: Text
-> BatchDetectKeyPhrases
batchDetectKeyPhrases pLanguageCode_ =
BatchDetectKeyPhrases'
{_bdkpTextList = mempty, _bdkpLanguageCode = pLanguageCode_}
bdkpTextList :: Lens' BatchDetectKeyPhrases [Text]
bdkpTextList = lens _bdkpTextList (\ s a -> s{_bdkpTextList = a}) . _Coerce
bdkpLanguageCode :: Lens' BatchDetectKeyPhrases Text
bdkpLanguageCode = lens _bdkpLanguageCode (\ s a -> s{_bdkpLanguageCode = a})
instance AWSRequest BatchDetectKeyPhrases where
type Rs BatchDetectKeyPhrases =
BatchDetectKeyPhrasesResponse
request = postJSON comprehend
response
= receiveJSON
(\ s h x ->
BatchDetectKeyPhrasesResponse' <$>
(pure (fromEnum s)) <*>
(x .?> "ResultList" .!@ mempty)
<*> (x .?> "ErrorList" .!@ mempty))
instance Hashable BatchDetectKeyPhrases where
instance NFData BatchDetectKeyPhrases where
instance ToHeaders BatchDetectKeyPhrases where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("Comprehend_20171127.BatchDetectKeyPhrases" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON BatchDetectKeyPhrases where
toJSON BatchDetectKeyPhrases'{..}
= object
(catMaybes
[Just ("TextList" .= _bdkpTextList),
Just ("LanguageCode" .= _bdkpLanguageCode)])
instance ToPath BatchDetectKeyPhrases where
toPath = const "/"
instance ToQuery BatchDetectKeyPhrases where
toQuery = const mempty
data BatchDetectKeyPhrasesResponse = BatchDetectKeyPhrasesResponse'
{ _bdkprsResponseStatus :: !Int
, _bdkprsResultList :: ![BatchDetectKeyPhrasesItemResult]
, _bdkprsErrorList :: ![BatchItemError]
} deriving (Eq, Read, Show, Data, Typeable, Generic)
batchDetectKeyPhrasesResponse
:: Int
-> BatchDetectKeyPhrasesResponse
batchDetectKeyPhrasesResponse pResponseStatus_ =
BatchDetectKeyPhrasesResponse'
{ _bdkprsResponseStatus = pResponseStatus_
, _bdkprsResultList = mempty
, _bdkprsErrorList = mempty
}
bdkprsResponseStatus :: Lens' BatchDetectKeyPhrasesResponse Int
bdkprsResponseStatus = lens _bdkprsResponseStatus (\ s a -> s{_bdkprsResponseStatus = a})
bdkprsResultList :: Lens' BatchDetectKeyPhrasesResponse [BatchDetectKeyPhrasesItemResult]
bdkprsResultList = lens _bdkprsResultList (\ s a -> s{_bdkprsResultList = a}) . _Coerce
bdkprsErrorList :: Lens' BatchDetectKeyPhrasesResponse [BatchItemError]
bdkprsErrorList = lens _bdkprsErrorList (\ s a -> s{_bdkprsErrorList = a}) . _Coerce
instance NFData BatchDetectKeyPhrasesResponse where