{-# 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.BatchDetectSentiment
(
batchDetectSentiment
, BatchDetectSentiment
, bdsTextList
, bdsLanguageCode
, batchDetectSentimentResponse
, BatchDetectSentimentResponse
, bdsrsResponseStatus
, bdsrsResultList
, bdsrsErrorList
) 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 BatchDetectSentiment = BatchDetectSentiment'
{ _bdsTextList :: ![Text]
, _bdsLanguageCode :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
batchDetectSentiment
:: Text
-> BatchDetectSentiment
batchDetectSentiment pLanguageCode_ =
BatchDetectSentiment'
{_bdsTextList = mempty, _bdsLanguageCode = pLanguageCode_}
bdsTextList :: Lens' BatchDetectSentiment [Text]
bdsTextList = lens _bdsTextList (\ s a -> s{_bdsTextList = a}) . _Coerce
bdsLanguageCode :: Lens' BatchDetectSentiment Text
bdsLanguageCode = lens _bdsLanguageCode (\ s a -> s{_bdsLanguageCode = a})
instance AWSRequest BatchDetectSentiment where
type Rs BatchDetectSentiment =
BatchDetectSentimentResponse
request = postJSON comprehend
response
= receiveJSON
(\ s h x ->
BatchDetectSentimentResponse' <$>
(pure (fromEnum s)) <*>
(x .?> "ResultList" .!@ mempty)
<*> (x .?> "ErrorList" .!@ mempty))
instance Hashable BatchDetectSentiment where
instance NFData BatchDetectSentiment where
instance ToHeaders BatchDetectSentiment where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("Comprehend_20171127.BatchDetectSentiment" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON BatchDetectSentiment where
toJSON BatchDetectSentiment'{..}
= object
(catMaybes
[Just ("TextList" .= _bdsTextList),
Just ("LanguageCode" .= _bdsLanguageCode)])
instance ToPath BatchDetectSentiment where
toPath = const "/"
instance ToQuery BatchDetectSentiment where
toQuery = const mempty
data BatchDetectSentimentResponse = BatchDetectSentimentResponse'
{ _bdsrsResponseStatus :: !Int
, _bdsrsResultList :: ![BatchDetectSentimentItemResult]
, _bdsrsErrorList :: ![BatchItemError]
} deriving (Eq, Read, Show, Data, Typeable, Generic)
batchDetectSentimentResponse
:: Int
-> BatchDetectSentimentResponse
batchDetectSentimentResponse pResponseStatus_ =
BatchDetectSentimentResponse'
{ _bdsrsResponseStatus = pResponseStatus_
, _bdsrsResultList = mempty
, _bdsrsErrorList = mempty
}
bdsrsResponseStatus :: Lens' BatchDetectSentimentResponse Int
bdsrsResponseStatus = lens _bdsrsResponseStatus (\ s a -> s{_bdsrsResponseStatus = a})
bdsrsResultList :: Lens' BatchDetectSentimentResponse [BatchDetectSentimentItemResult]
bdsrsResultList = lens _bdsrsResultList (\ s a -> s{_bdsrsResultList = a}) . _Coerce
bdsrsErrorList :: Lens' BatchDetectSentimentResponse [BatchItemError]
bdsrsErrorList = lens _bdsrsErrorList (\ s a -> s{_bdsrsErrorList = a}) . _Coerce
instance NFData BatchDetectSentimentResponse where