{-# 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.GetHIT
(
getHIT
, GetHIT
, ghitHITId
, getHITResponse
, GetHITResponse
, ghitrsHIT
, ghitrsResponseStatus
) 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
newtype GetHIT = GetHIT'
{ _ghitHITId :: Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getHIT
:: Text
-> GetHIT
getHIT pHITId_ = GetHIT' {_ghitHITId = pHITId_}
ghitHITId :: Lens' GetHIT Text
ghitHITId = lens _ghitHITId (\ s a -> s{_ghitHITId = a})
instance AWSRequest GetHIT where
type Rs GetHIT = GetHITResponse
request = postJSON mechanicalTurk
response
= receiveJSON
(\ s h x ->
GetHITResponse' <$>
(x .?> "HIT") <*> (pure (fromEnum s)))
instance Hashable GetHIT where
instance NFData GetHIT where
instance ToHeaders GetHIT where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("MTurkRequesterServiceV20170117.GetHIT" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetHIT where
toJSON GetHIT'{..}
= object (catMaybes [Just ("HITId" .= _ghitHITId)])
instance ToPath GetHIT where
toPath = const "/"
instance ToQuery GetHIT where
toQuery = const mempty
data GetHITResponse = GetHITResponse'
{ _ghitrsHIT :: !(Maybe HIT)
, _ghitrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getHITResponse
:: Int
-> GetHITResponse
getHITResponse pResponseStatus_ =
GetHITResponse'
{_ghitrsHIT = Nothing, _ghitrsResponseStatus = pResponseStatus_}
ghitrsHIT :: Lens' GetHITResponse (Maybe HIT)
ghitrsHIT = lens _ghitrsHIT (\ s a -> s{_ghitrsHIT = a})
ghitrsResponseStatus :: Lens' GetHITResponse Int
ghitrsResponseStatus = lens _ghitrsResponseStatus (\ s a -> s{_ghitrsResponseStatus = a})
instance NFData GetHITResponse where