{-# 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.MechanicalTurk.UpdateNotificationSettings
(
updateNotificationSettings
, UpdateNotificationSettings
, unsNotification
, unsActive
, unsHITTypeId
, updateNotificationSettingsResponse
, UpdateNotificationSettingsResponse
, unsrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.MechanicalTurk.Types
import Network.AWS.MechanicalTurk.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data UpdateNotificationSettings = UpdateNotificationSettings'
{ _unsNotification :: !(Maybe NotificationSpecification)
, _unsActive :: !(Maybe Bool)
, _unsHITTypeId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateNotificationSettings
:: Text
-> UpdateNotificationSettings
updateNotificationSettings pHITTypeId_ =
UpdateNotificationSettings'
{ _unsNotification = Nothing
, _unsActive = Nothing
, _unsHITTypeId = pHITTypeId_
}
unsNotification :: Lens' UpdateNotificationSettings (Maybe NotificationSpecification)
unsNotification = lens _unsNotification (\ s a -> s{_unsNotification = a})
unsActive :: Lens' UpdateNotificationSettings (Maybe Bool)
unsActive = lens _unsActive (\ s a -> s{_unsActive = a})
unsHITTypeId :: Lens' UpdateNotificationSettings Text
unsHITTypeId = lens _unsHITTypeId (\ s a -> s{_unsHITTypeId = a})
instance AWSRequest UpdateNotificationSettings where
type Rs UpdateNotificationSettings =
UpdateNotificationSettingsResponse
request = postJSON mechanicalTurk
response
= receiveEmpty
(\ s h x ->
UpdateNotificationSettingsResponse' <$>
(pure (fromEnum s)))
instance Hashable UpdateNotificationSettings where
instance NFData UpdateNotificationSettings where
instance ToHeaders UpdateNotificationSettings where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("MTurkRequesterServiceV20170117.UpdateNotificationSettings"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON UpdateNotificationSettings where
toJSON UpdateNotificationSettings'{..}
= object
(catMaybes
[("Notification" .=) <$> _unsNotification,
("Active" .=) <$> _unsActive,
Just ("HITTypeId" .= _unsHITTypeId)])
instance ToPath UpdateNotificationSettings where
toPath = const "/"
instance ToQuery UpdateNotificationSettings where
toQuery = const mempty
newtype UpdateNotificationSettingsResponse = UpdateNotificationSettingsResponse'
{ _unsrsResponseStatus :: Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateNotificationSettingsResponse
:: Int
-> UpdateNotificationSettingsResponse
updateNotificationSettingsResponse pResponseStatus_ =
UpdateNotificationSettingsResponse' {_unsrsResponseStatus = pResponseStatus_}
unsrsResponseStatus :: Lens' UpdateNotificationSettingsResponse Int
unsrsResponseStatus = lens _unsrsResponseStatus (\ s a -> s{_unsrsResponseStatus = a})
instance NFData UpdateNotificationSettingsResponse
where