{-# 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.CreateWorkerBlock
(
createWorkerBlock
, CreateWorkerBlock
, cwbWorkerId
, cwbReason
, createWorkerBlockResponse
, CreateWorkerBlockResponse
, cwbrsResponseStatus
) 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 CreateWorkerBlock = CreateWorkerBlock'
{ _cwbWorkerId :: !Text
, _cwbReason :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createWorkerBlock
:: Text
-> Text
-> CreateWorkerBlock
createWorkerBlock pWorkerId_ pReason_ =
CreateWorkerBlock' {_cwbWorkerId = pWorkerId_, _cwbReason = pReason_}
cwbWorkerId :: Lens' CreateWorkerBlock Text
cwbWorkerId = lens _cwbWorkerId (\ s a -> s{_cwbWorkerId = a})
cwbReason :: Lens' CreateWorkerBlock Text
cwbReason = lens _cwbReason (\ s a -> s{_cwbReason = a})
instance AWSRequest CreateWorkerBlock where
type Rs CreateWorkerBlock = CreateWorkerBlockResponse
request = postJSON mechanicalTurk
response
= receiveEmpty
(\ s h x ->
CreateWorkerBlockResponse' <$> (pure (fromEnum s)))
instance Hashable CreateWorkerBlock where
instance NFData CreateWorkerBlock where
instance ToHeaders CreateWorkerBlock where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("MTurkRequesterServiceV20170117.CreateWorkerBlock"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateWorkerBlock where
toJSON CreateWorkerBlock'{..}
= object
(catMaybes
[Just ("WorkerId" .= _cwbWorkerId),
Just ("Reason" .= _cwbReason)])
instance ToPath CreateWorkerBlock where
toPath = const "/"
instance ToQuery CreateWorkerBlock where
toQuery = const mempty
newtype CreateWorkerBlockResponse = CreateWorkerBlockResponse'
{ _cwbrsResponseStatus :: Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createWorkerBlockResponse
:: Int
-> CreateWorkerBlockResponse
createWorkerBlockResponse pResponseStatus_ =
CreateWorkerBlockResponse' {_cwbrsResponseStatus = pResponseStatus_}
cwbrsResponseStatus :: Lens' CreateWorkerBlockResponse Int
cwbrsResponseStatus = lens _cwbrsResponseStatus (\ s a -> s{_cwbrsResponseStatus = a})
instance NFData CreateWorkerBlockResponse where