{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.MechanicalTurk.RejectAssignment
(
RejectAssignment (..),
newRejectAssignment,
rejectAssignment_assignmentId,
rejectAssignment_requesterFeedback,
RejectAssignmentResponse (..),
newRejectAssignmentResponse,
rejectAssignmentResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MechanicalTurk.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data RejectAssignment = RejectAssignment'
{
RejectAssignment -> Text
assignmentId :: Prelude.Text,
RejectAssignment -> Text
requesterFeedback :: Prelude.Text
}
deriving (RejectAssignment -> RejectAssignment -> Bool
(RejectAssignment -> RejectAssignment -> Bool)
-> (RejectAssignment -> RejectAssignment -> Bool)
-> Eq RejectAssignment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RejectAssignment -> RejectAssignment -> Bool
$c/= :: RejectAssignment -> RejectAssignment -> Bool
== :: RejectAssignment -> RejectAssignment -> Bool
$c== :: RejectAssignment -> RejectAssignment -> Bool
Prelude.Eq, ReadPrec [RejectAssignment]
ReadPrec RejectAssignment
Int -> ReadS RejectAssignment
ReadS [RejectAssignment]
(Int -> ReadS RejectAssignment)
-> ReadS [RejectAssignment]
-> ReadPrec RejectAssignment
-> ReadPrec [RejectAssignment]
-> Read RejectAssignment
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RejectAssignment]
$creadListPrec :: ReadPrec [RejectAssignment]
readPrec :: ReadPrec RejectAssignment
$creadPrec :: ReadPrec RejectAssignment
readList :: ReadS [RejectAssignment]
$creadList :: ReadS [RejectAssignment]
readsPrec :: Int -> ReadS RejectAssignment
$creadsPrec :: Int -> ReadS RejectAssignment
Prelude.Read, Int -> RejectAssignment -> ShowS
[RejectAssignment] -> ShowS
RejectAssignment -> String
(Int -> RejectAssignment -> ShowS)
-> (RejectAssignment -> String)
-> ([RejectAssignment] -> ShowS)
-> Show RejectAssignment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RejectAssignment] -> ShowS
$cshowList :: [RejectAssignment] -> ShowS
show :: RejectAssignment -> String
$cshow :: RejectAssignment -> String
showsPrec :: Int -> RejectAssignment -> ShowS
$cshowsPrec :: Int -> RejectAssignment -> ShowS
Prelude.Show, (forall x. RejectAssignment -> Rep RejectAssignment x)
-> (forall x. Rep RejectAssignment x -> RejectAssignment)
-> Generic RejectAssignment
forall x. Rep RejectAssignment x -> RejectAssignment
forall x. RejectAssignment -> Rep RejectAssignment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RejectAssignment x -> RejectAssignment
$cfrom :: forall x. RejectAssignment -> Rep RejectAssignment x
Prelude.Generic)
newRejectAssignment ::
Prelude.Text ->
Prelude.Text ->
RejectAssignment
newRejectAssignment :: Text -> Text -> RejectAssignment
newRejectAssignment
Text
pAssignmentId_
Text
pRequesterFeedback_ =
RejectAssignment' :: Text -> Text -> RejectAssignment
RejectAssignment'
{ $sel:assignmentId:RejectAssignment' :: Text
assignmentId = Text
pAssignmentId_,
$sel:requesterFeedback:RejectAssignment' :: Text
requesterFeedback = Text
pRequesterFeedback_
}
rejectAssignment_assignmentId :: Lens.Lens' RejectAssignment Prelude.Text
rejectAssignment_assignmentId :: (Text -> f Text) -> RejectAssignment -> f RejectAssignment
rejectAssignment_assignmentId = (RejectAssignment -> Text)
-> (RejectAssignment -> Text -> RejectAssignment)
-> Lens RejectAssignment RejectAssignment Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RejectAssignment' {Text
assignmentId :: Text
$sel:assignmentId:RejectAssignment' :: RejectAssignment -> Text
assignmentId} -> Text
assignmentId) (\s :: RejectAssignment
s@RejectAssignment' {} Text
a -> RejectAssignment
s {$sel:assignmentId:RejectAssignment' :: Text
assignmentId = Text
a} :: RejectAssignment)
rejectAssignment_requesterFeedback :: Lens.Lens' RejectAssignment Prelude.Text
rejectAssignment_requesterFeedback :: (Text -> f Text) -> RejectAssignment -> f RejectAssignment
rejectAssignment_requesterFeedback = (RejectAssignment -> Text)
-> (RejectAssignment -> Text -> RejectAssignment)
-> Lens RejectAssignment RejectAssignment Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RejectAssignment' {Text
requesterFeedback :: Text
$sel:requesterFeedback:RejectAssignment' :: RejectAssignment -> Text
requesterFeedback} -> Text
requesterFeedback) (\s :: RejectAssignment
s@RejectAssignment' {} Text
a -> RejectAssignment
s {$sel:requesterFeedback:RejectAssignment' :: Text
requesterFeedback = Text
a} :: RejectAssignment)
instance Core.AWSRequest RejectAssignment where
type
AWSResponse RejectAssignment =
RejectAssignmentResponse
request :: RejectAssignment -> Request RejectAssignment
request = Service -> RejectAssignment -> Request RejectAssignment
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy RejectAssignment
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RejectAssignment)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse RejectAssignment))
-> Logger
-> Service
-> Proxy RejectAssignment
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RejectAssignment)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> RejectAssignmentResponse
RejectAssignmentResponse'
(Int -> RejectAssignmentResponse)
-> Either String Int -> Either String RejectAssignmentResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable RejectAssignment
instance Prelude.NFData RejectAssignment
instance Core.ToHeaders RejectAssignment where
toHeaders :: RejectAssignment -> ResponseHeaders
toHeaders =
ResponseHeaders -> RejectAssignment -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"MTurkRequesterServiceV20170117.RejectAssignment" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON RejectAssignment where
toJSON :: RejectAssignment -> Value
toJSON RejectAssignment' {Text
requesterFeedback :: Text
assignmentId :: Text
$sel:requesterFeedback:RejectAssignment' :: RejectAssignment -> Text
$sel:assignmentId:RejectAssignment' :: RejectAssignment -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"AssignmentId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
assignmentId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"RequesterFeedback" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
requesterFeedback)
]
)
instance Core.ToPath RejectAssignment where
toPath :: RejectAssignment -> ByteString
toPath = ByteString -> RejectAssignment -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery RejectAssignment where
toQuery :: RejectAssignment -> QueryString
toQuery = QueryString -> RejectAssignment -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data RejectAssignmentResponse = RejectAssignmentResponse'
{
RejectAssignmentResponse -> Int
httpStatus :: Prelude.Int
}
deriving (RejectAssignmentResponse -> RejectAssignmentResponse -> Bool
(RejectAssignmentResponse -> RejectAssignmentResponse -> Bool)
-> (RejectAssignmentResponse -> RejectAssignmentResponse -> Bool)
-> Eq RejectAssignmentResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RejectAssignmentResponse -> RejectAssignmentResponse -> Bool
$c/= :: RejectAssignmentResponse -> RejectAssignmentResponse -> Bool
== :: RejectAssignmentResponse -> RejectAssignmentResponse -> Bool
$c== :: RejectAssignmentResponse -> RejectAssignmentResponse -> Bool
Prelude.Eq, ReadPrec [RejectAssignmentResponse]
ReadPrec RejectAssignmentResponse
Int -> ReadS RejectAssignmentResponse
ReadS [RejectAssignmentResponse]
(Int -> ReadS RejectAssignmentResponse)
-> ReadS [RejectAssignmentResponse]
-> ReadPrec RejectAssignmentResponse
-> ReadPrec [RejectAssignmentResponse]
-> Read RejectAssignmentResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RejectAssignmentResponse]
$creadListPrec :: ReadPrec [RejectAssignmentResponse]
readPrec :: ReadPrec RejectAssignmentResponse
$creadPrec :: ReadPrec RejectAssignmentResponse
readList :: ReadS [RejectAssignmentResponse]
$creadList :: ReadS [RejectAssignmentResponse]
readsPrec :: Int -> ReadS RejectAssignmentResponse
$creadsPrec :: Int -> ReadS RejectAssignmentResponse
Prelude.Read, Int -> RejectAssignmentResponse -> ShowS
[RejectAssignmentResponse] -> ShowS
RejectAssignmentResponse -> String
(Int -> RejectAssignmentResponse -> ShowS)
-> (RejectAssignmentResponse -> String)
-> ([RejectAssignmentResponse] -> ShowS)
-> Show RejectAssignmentResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RejectAssignmentResponse] -> ShowS
$cshowList :: [RejectAssignmentResponse] -> ShowS
show :: RejectAssignmentResponse -> String
$cshow :: RejectAssignmentResponse -> String
showsPrec :: Int -> RejectAssignmentResponse -> ShowS
$cshowsPrec :: Int -> RejectAssignmentResponse -> ShowS
Prelude.Show, (forall x.
RejectAssignmentResponse -> Rep RejectAssignmentResponse x)
-> (forall x.
Rep RejectAssignmentResponse x -> RejectAssignmentResponse)
-> Generic RejectAssignmentResponse
forall x.
Rep RejectAssignmentResponse x -> RejectAssignmentResponse
forall x.
RejectAssignmentResponse -> Rep RejectAssignmentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RejectAssignmentResponse x -> RejectAssignmentResponse
$cfrom :: forall x.
RejectAssignmentResponse -> Rep RejectAssignmentResponse x
Prelude.Generic)
newRejectAssignmentResponse ::
Prelude.Int ->
RejectAssignmentResponse
newRejectAssignmentResponse :: Int -> RejectAssignmentResponse
newRejectAssignmentResponse Int
pHttpStatus_ =
RejectAssignmentResponse' :: Int -> RejectAssignmentResponse
RejectAssignmentResponse'
{ $sel:httpStatus:RejectAssignmentResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
rejectAssignmentResponse_httpStatus :: Lens.Lens' RejectAssignmentResponse Prelude.Int
rejectAssignmentResponse_httpStatus :: (Int -> f Int)
-> RejectAssignmentResponse -> f RejectAssignmentResponse
rejectAssignmentResponse_httpStatus = (RejectAssignmentResponse -> Int)
-> (RejectAssignmentResponse -> Int -> RejectAssignmentResponse)
-> Lens RejectAssignmentResponse RejectAssignmentResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RejectAssignmentResponse' {Int
httpStatus :: Int
$sel:httpStatus:RejectAssignmentResponse' :: RejectAssignmentResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RejectAssignmentResponse
s@RejectAssignmentResponse' {} Int
a -> RejectAssignmentResponse
s {$sel:httpStatus:RejectAssignmentResponse' :: Int
httpStatus = Int
a} :: RejectAssignmentResponse)
instance Prelude.NFData RejectAssignmentResponse