{-# 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.ApproveAssignment
(
ApproveAssignment (..),
newApproveAssignment,
approveAssignment_overrideRejection,
approveAssignment_requesterFeedback,
approveAssignment_assignmentId,
ApproveAssignmentResponse (..),
newApproveAssignmentResponse,
approveAssignmentResponse_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 ApproveAssignment = ApproveAssignment'
{
ApproveAssignment -> Maybe Bool
overrideRejection :: Prelude.Maybe Prelude.Bool,
ApproveAssignment -> Maybe Text
requesterFeedback :: Prelude.Maybe Prelude.Text,
ApproveAssignment -> Text
assignmentId :: Prelude.Text
}
deriving (ApproveAssignment -> ApproveAssignment -> Bool
(ApproveAssignment -> ApproveAssignment -> Bool)
-> (ApproveAssignment -> ApproveAssignment -> Bool)
-> Eq ApproveAssignment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ApproveAssignment -> ApproveAssignment -> Bool
$c/= :: ApproveAssignment -> ApproveAssignment -> Bool
== :: ApproveAssignment -> ApproveAssignment -> Bool
$c== :: ApproveAssignment -> ApproveAssignment -> Bool
Prelude.Eq, ReadPrec [ApproveAssignment]
ReadPrec ApproveAssignment
Int -> ReadS ApproveAssignment
ReadS [ApproveAssignment]
(Int -> ReadS ApproveAssignment)
-> ReadS [ApproveAssignment]
-> ReadPrec ApproveAssignment
-> ReadPrec [ApproveAssignment]
-> Read ApproveAssignment
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ApproveAssignment]
$creadListPrec :: ReadPrec [ApproveAssignment]
readPrec :: ReadPrec ApproveAssignment
$creadPrec :: ReadPrec ApproveAssignment
readList :: ReadS [ApproveAssignment]
$creadList :: ReadS [ApproveAssignment]
readsPrec :: Int -> ReadS ApproveAssignment
$creadsPrec :: Int -> ReadS ApproveAssignment
Prelude.Read, Int -> ApproveAssignment -> ShowS
[ApproveAssignment] -> ShowS
ApproveAssignment -> String
(Int -> ApproveAssignment -> ShowS)
-> (ApproveAssignment -> String)
-> ([ApproveAssignment] -> ShowS)
-> Show ApproveAssignment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ApproveAssignment] -> ShowS
$cshowList :: [ApproveAssignment] -> ShowS
show :: ApproveAssignment -> String
$cshow :: ApproveAssignment -> String
showsPrec :: Int -> ApproveAssignment -> ShowS
$cshowsPrec :: Int -> ApproveAssignment -> ShowS
Prelude.Show, (forall x. ApproveAssignment -> Rep ApproveAssignment x)
-> (forall x. Rep ApproveAssignment x -> ApproveAssignment)
-> Generic ApproveAssignment
forall x. Rep ApproveAssignment x -> ApproveAssignment
forall x. ApproveAssignment -> Rep ApproveAssignment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ApproveAssignment x -> ApproveAssignment
$cfrom :: forall x. ApproveAssignment -> Rep ApproveAssignment x
Prelude.Generic)
newApproveAssignment ::
Prelude.Text ->
ApproveAssignment
newApproveAssignment :: Text -> ApproveAssignment
newApproveAssignment Text
pAssignmentId_ =
ApproveAssignment' :: Maybe Bool -> Maybe Text -> Text -> ApproveAssignment
ApproveAssignment'
{ $sel:overrideRejection:ApproveAssignment' :: Maybe Bool
overrideRejection =
Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:requesterFeedback:ApproveAssignment' :: Maybe Text
requesterFeedback = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:assignmentId:ApproveAssignment' :: Text
assignmentId = Text
pAssignmentId_
}
approveAssignment_overrideRejection :: Lens.Lens' ApproveAssignment (Prelude.Maybe Prelude.Bool)
approveAssignment_overrideRejection :: (Maybe Bool -> f (Maybe Bool))
-> ApproveAssignment -> f ApproveAssignment
approveAssignment_overrideRejection = (ApproveAssignment -> Maybe Bool)
-> (ApproveAssignment -> Maybe Bool -> ApproveAssignment)
-> Lens
ApproveAssignment ApproveAssignment (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApproveAssignment' {Maybe Bool
overrideRejection :: Maybe Bool
$sel:overrideRejection:ApproveAssignment' :: ApproveAssignment -> Maybe Bool
overrideRejection} -> Maybe Bool
overrideRejection) (\s :: ApproveAssignment
s@ApproveAssignment' {} Maybe Bool
a -> ApproveAssignment
s {$sel:overrideRejection:ApproveAssignment' :: Maybe Bool
overrideRejection = Maybe Bool
a} :: ApproveAssignment)
approveAssignment_requesterFeedback :: Lens.Lens' ApproveAssignment (Prelude.Maybe Prelude.Text)
approveAssignment_requesterFeedback :: (Maybe Text -> f (Maybe Text))
-> ApproveAssignment -> f ApproveAssignment
approveAssignment_requesterFeedback = (ApproveAssignment -> Maybe Text)
-> (ApproveAssignment -> Maybe Text -> ApproveAssignment)
-> Lens
ApproveAssignment ApproveAssignment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApproveAssignment' {Maybe Text
requesterFeedback :: Maybe Text
$sel:requesterFeedback:ApproveAssignment' :: ApproveAssignment -> Maybe Text
requesterFeedback} -> Maybe Text
requesterFeedback) (\s :: ApproveAssignment
s@ApproveAssignment' {} Maybe Text
a -> ApproveAssignment
s {$sel:requesterFeedback:ApproveAssignment' :: Maybe Text
requesterFeedback = Maybe Text
a} :: ApproveAssignment)
approveAssignment_assignmentId :: Lens.Lens' ApproveAssignment Prelude.Text
approveAssignment_assignmentId :: (Text -> f Text) -> ApproveAssignment -> f ApproveAssignment
approveAssignment_assignmentId = (ApproveAssignment -> Text)
-> (ApproveAssignment -> Text -> ApproveAssignment)
-> Lens ApproveAssignment ApproveAssignment Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApproveAssignment' {Text
assignmentId :: Text
$sel:assignmentId:ApproveAssignment' :: ApproveAssignment -> Text
assignmentId} -> Text
assignmentId) (\s :: ApproveAssignment
s@ApproveAssignment' {} Text
a -> ApproveAssignment
s {$sel:assignmentId:ApproveAssignment' :: Text
assignmentId = Text
a} :: ApproveAssignment)
instance Core.AWSRequest ApproveAssignment where
type
AWSResponse ApproveAssignment =
ApproveAssignmentResponse
request :: ApproveAssignment -> Request ApproveAssignment
request = Service -> ApproveAssignment -> Request ApproveAssignment
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ApproveAssignment
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ApproveAssignment)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse ApproveAssignment))
-> Logger
-> Service
-> Proxy ApproveAssignment
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ApproveAssignment)))
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 -> ApproveAssignmentResponse
ApproveAssignmentResponse'
(Int -> ApproveAssignmentResponse)
-> Either String Int -> Either String ApproveAssignmentResponse
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 ApproveAssignment
instance Prelude.NFData ApproveAssignment
instance Core.ToHeaders ApproveAssignment where
toHeaders :: ApproveAssignment -> ResponseHeaders
toHeaders =
ResponseHeaders -> ApproveAssignment -> 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.ApproveAssignment" ::
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 ApproveAssignment where
toJSON :: ApproveAssignment -> Value
toJSON ApproveAssignment' {Maybe Bool
Maybe Text
Text
assignmentId :: Text
requesterFeedback :: Maybe Text
overrideRejection :: Maybe Bool
$sel:assignmentId:ApproveAssignment' :: ApproveAssignment -> Text
$sel:requesterFeedback:ApproveAssignment' :: ApproveAssignment -> Maybe Text
$sel:overrideRejection:ApproveAssignment' :: ApproveAssignment -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"OverrideRejection" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
overrideRejection,
(Text
"RequesterFeedback" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
requesterFeedback,
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)
]
)
instance Core.ToPath ApproveAssignment where
toPath :: ApproveAssignment -> ByteString
toPath = ByteString -> ApproveAssignment -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ApproveAssignment where
toQuery :: ApproveAssignment -> QueryString
toQuery = QueryString -> ApproveAssignment -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ApproveAssignmentResponse = ApproveAssignmentResponse'
{
ApproveAssignmentResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ApproveAssignmentResponse -> ApproveAssignmentResponse -> Bool
(ApproveAssignmentResponse -> ApproveAssignmentResponse -> Bool)
-> (ApproveAssignmentResponse -> ApproveAssignmentResponse -> Bool)
-> Eq ApproveAssignmentResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ApproveAssignmentResponse -> ApproveAssignmentResponse -> Bool
$c/= :: ApproveAssignmentResponse -> ApproveAssignmentResponse -> Bool
== :: ApproveAssignmentResponse -> ApproveAssignmentResponse -> Bool
$c== :: ApproveAssignmentResponse -> ApproveAssignmentResponse -> Bool
Prelude.Eq, ReadPrec [ApproveAssignmentResponse]
ReadPrec ApproveAssignmentResponse
Int -> ReadS ApproveAssignmentResponse
ReadS [ApproveAssignmentResponse]
(Int -> ReadS ApproveAssignmentResponse)
-> ReadS [ApproveAssignmentResponse]
-> ReadPrec ApproveAssignmentResponse
-> ReadPrec [ApproveAssignmentResponse]
-> Read ApproveAssignmentResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ApproveAssignmentResponse]
$creadListPrec :: ReadPrec [ApproveAssignmentResponse]
readPrec :: ReadPrec ApproveAssignmentResponse
$creadPrec :: ReadPrec ApproveAssignmentResponse
readList :: ReadS [ApproveAssignmentResponse]
$creadList :: ReadS [ApproveAssignmentResponse]
readsPrec :: Int -> ReadS ApproveAssignmentResponse
$creadsPrec :: Int -> ReadS ApproveAssignmentResponse
Prelude.Read, Int -> ApproveAssignmentResponse -> ShowS
[ApproveAssignmentResponse] -> ShowS
ApproveAssignmentResponse -> String
(Int -> ApproveAssignmentResponse -> ShowS)
-> (ApproveAssignmentResponse -> String)
-> ([ApproveAssignmentResponse] -> ShowS)
-> Show ApproveAssignmentResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ApproveAssignmentResponse] -> ShowS
$cshowList :: [ApproveAssignmentResponse] -> ShowS
show :: ApproveAssignmentResponse -> String
$cshow :: ApproveAssignmentResponse -> String
showsPrec :: Int -> ApproveAssignmentResponse -> ShowS
$cshowsPrec :: Int -> ApproveAssignmentResponse -> ShowS
Prelude.Show, (forall x.
ApproveAssignmentResponse -> Rep ApproveAssignmentResponse x)
-> (forall x.
Rep ApproveAssignmentResponse x -> ApproveAssignmentResponse)
-> Generic ApproveAssignmentResponse
forall x.
Rep ApproveAssignmentResponse x -> ApproveAssignmentResponse
forall x.
ApproveAssignmentResponse -> Rep ApproveAssignmentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ApproveAssignmentResponse x -> ApproveAssignmentResponse
$cfrom :: forall x.
ApproveAssignmentResponse -> Rep ApproveAssignmentResponse x
Prelude.Generic)
newApproveAssignmentResponse ::
Prelude.Int ->
ApproveAssignmentResponse
newApproveAssignmentResponse :: Int -> ApproveAssignmentResponse
newApproveAssignmentResponse Int
pHttpStatus_ =
ApproveAssignmentResponse' :: Int -> ApproveAssignmentResponse
ApproveAssignmentResponse'
{ $sel:httpStatus:ApproveAssignmentResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
approveAssignmentResponse_httpStatus :: Lens.Lens' ApproveAssignmentResponse Prelude.Int
approveAssignmentResponse_httpStatus :: (Int -> f Int)
-> ApproveAssignmentResponse -> f ApproveAssignmentResponse
approveAssignmentResponse_httpStatus = (ApproveAssignmentResponse -> Int)
-> (ApproveAssignmentResponse -> Int -> ApproveAssignmentResponse)
-> Lens ApproveAssignmentResponse ApproveAssignmentResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApproveAssignmentResponse' {Int
httpStatus :: Int
$sel:httpStatus:ApproveAssignmentResponse' :: ApproveAssignmentResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ApproveAssignmentResponse
s@ApproveAssignmentResponse' {} Int
a -> ApproveAssignmentResponse
s {$sel:httpStatus:ApproveAssignmentResponse' :: Int
httpStatus = Int
a} :: ApproveAssignmentResponse)
instance Prelude.NFData ApproveAssignmentResponse