{-# 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.NotifyWorkers
(
NotifyWorkers (..),
newNotifyWorkers,
notifyWorkers_subject,
notifyWorkers_messageText,
notifyWorkers_workerIds,
NotifyWorkersResponse (..),
newNotifyWorkersResponse,
notifyWorkersResponse_notifyWorkersFailureStatuses,
notifyWorkersResponse_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 NotifyWorkers = NotifyWorkers'
{
NotifyWorkers -> Text
subject :: Prelude.Text,
NotifyWorkers -> Text
messageText :: Prelude.Text,
NotifyWorkers -> [Text]
workerIds :: [Prelude.Text]
}
deriving (NotifyWorkers -> NotifyWorkers -> Bool
(NotifyWorkers -> NotifyWorkers -> Bool)
-> (NotifyWorkers -> NotifyWorkers -> Bool) -> Eq NotifyWorkers
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NotifyWorkers -> NotifyWorkers -> Bool
$c/= :: NotifyWorkers -> NotifyWorkers -> Bool
== :: NotifyWorkers -> NotifyWorkers -> Bool
$c== :: NotifyWorkers -> NotifyWorkers -> Bool
Prelude.Eq, ReadPrec [NotifyWorkers]
ReadPrec NotifyWorkers
Int -> ReadS NotifyWorkers
ReadS [NotifyWorkers]
(Int -> ReadS NotifyWorkers)
-> ReadS [NotifyWorkers]
-> ReadPrec NotifyWorkers
-> ReadPrec [NotifyWorkers]
-> Read NotifyWorkers
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NotifyWorkers]
$creadListPrec :: ReadPrec [NotifyWorkers]
readPrec :: ReadPrec NotifyWorkers
$creadPrec :: ReadPrec NotifyWorkers
readList :: ReadS [NotifyWorkers]
$creadList :: ReadS [NotifyWorkers]
readsPrec :: Int -> ReadS NotifyWorkers
$creadsPrec :: Int -> ReadS NotifyWorkers
Prelude.Read, Int -> NotifyWorkers -> ShowS
[NotifyWorkers] -> ShowS
NotifyWorkers -> String
(Int -> NotifyWorkers -> ShowS)
-> (NotifyWorkers -> String)
-> ([NotifyWorkers] -> ShowS)
-> Show NotifyWorkers
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NotifyWorkers] -> ShowS
$cshowList :: [NotifyWorkers] -> ShowS
show :: NotifyWorkers -> String
$cshow :: NotifyWorkers -> String
showsPrec :: Int -> NotifyWorkers -> ShowS
$cshowsPrec :: Int -> NotifyWorkers -> ShowS
Prelude.Show, (forall x. NotifyWorkers -> Rep NotifyWorkers x)
-> (forall x. Rep NotifyWorkers x -> NotifyWorkers)
-> Generic NotifyWorkers
forall x. Rep NotifyWorkers x -> NotifyWorkers
forall x. NotifyWorkers -> Rep NotifyWorkers x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NotifyWorkers x -> NotifyWorkers
$cfrom :: forall x. NotifyWorkers -> Rep NotifyWorkers x
Prelude.Generic)
newNotifyWorkers ::
Prelude.Text ->
Prelude.Text ->
NotifyWorkers
newNotifyWorkers :: Text -> Text -> NotifyWorkers
newNotifyWorkers Text
pSubject_ Text
pMessageText_ =
NotifyWorkers' :: Text -> Text -> [Text] -> NotifyWorkers
NotifyWorkers'
{ $sel:subject:NotifyWorkers' :: Text
subject = Text
pSubject_,
$sel:messageText:NotifyWorkers' :: Text
messageText = Text
pMessageText_,
$sel:workerIds:NotifyWorkers' :: [Text]
workerIds = [Text]
forall a. Monoid a => a
Prelude.mempty
}
notifyWorkers_subject :: Lens.Lens' NotifyWorkers Prelude.Text
notifyWorkers_subject :: (Text -> f Text) -> NotifyWorkers -> f NotifyWorkers
notifyWorkers_subject = (NotifyWorkers -> Text)
-> (NotifyWorkers -> Text -> NotifyWorkers)
-> Lens NotifyWorkers NotifyWorkers Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotifyWorkers' {Text
subject :: Text
$sel:subject:NotifyWorkers' :: NotifyWorkers -> Text
subject} -> Text
subject) (\s :: NotifyWorkers
s@NotifyWorkers' {} Text
a -> NotifyWorkers
s {$sel:subject:NotifyWorkers' :: Text
subject = Text
a} :: NotifyWorkers)
notifyWorkers_messageText :: Lens.Lens' NotifyWorkers Prelude.Text
notifyWorkers_messageText :: (Text -> f Text) -> NotifyWorkers -> f NotifyWorkers
notifyWorkers_messageText = (NotifyWorkers -> Text)
-> (NotifyWorkers -> Text -> NotifyWorkers)
-> Lens NotifyWorkers NotifyWorkers Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotifyWorkers' {Text
messageText :: Text
$sel:messageText:NotifyWorkers' :: NotifyWorkers -> Text
messageText} -> Text
messageText) (\s :: NotifyWorkers
s@NotifyWorkers' {} Text
a -> NotifyWorkers
s {$sel:messageText:NotifyWorkers' :: Text
messageText = Text
a} :: NotifyWorkers)
notifyWorkers_workerIds :: Lens.Lens' NotifyWorkers [Prelude.Text]
notifyWorkers_workerIds :: ([Text] -> f [Text]) -> NotifyWorkers -> f NotifyWorkers
notifyWorkers_workerIds = (NotifyWorkers -> [Text])
-> (NotifyWorkers -> [Text] -> NotifyWorkers)
-> Lens NotifyWorkers NotifyWorkers [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotifyWorkers' {[Text]
workerIds :: [Text]
$sel:workerIds:NotifyWorkers' :: NotifyWorkers -> [Text]
workerIds} -> [Text]
workerIds) (\s :: NotifyWorkers
s@NotifyWorkers' {} [Text]
a -> NotifyWorkers
s {$sel:workerIds:NotifyWorkers' :: [Text]
workerIds = [Text]
a} :: NotifyWorkers) (([Text] -> f [Text]) -> NotifyWorkers -> f NotifyWorkers)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> NotifyWorkers
-> f NotifyWorkers
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest NotifyWorkers where
type
AWSResponse NotifyWorkers =
NotifyWorkersResponse
request :: NotifyWorkers -> Request NotifyWorkers
request = Service -> NotifyWorkers -> Request NotifyWorkers
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy NotifyWorkers
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse NotifyWorkers)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse NotifyWorkers))
-> Logger
-> Service
-> Proxy NotifyWorkers
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse NotifyWorkers)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [NotifyWorkersFailureStatus] -> Int -> NotifyWorkersResponse
NotifyWorkersResponse'
(Maybe [NotifyWorkersFailureStatus]
-> Int -> NotifyWorkersResponse)
-> Either String (Maybe [NotifyWorkersFailureStatus])
-> Either String (Int -> NotifyWorkersResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object
-> Text
-> Either String (Maybe (Maybe [NotifyWorkersFailureStatus]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NotifyWorkersFailureStatuses"
Either String (Maybe (Maybe [NotifyWorkersFailureStatus]))
-> Maybe [NotifyWorkersFailureStatus]
-> Either String (Maybe [NotifyWorkersFailureStatus])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [NotifyWorkersFailureStatus]
forall a. Monoid a => a
Prelude.mempty
)
Either String (Int -> NotifyWorkersResponse)
-> Either String Int -> Either String NotifyWorkersResponse
forall (f :: * -> *) a b. Applicative f => 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 NotifyWorkers
instance Prelude.NFData NotifyWorkers
instance Core.ToHeaders NotifyWorkers where
toHeaders :: NotifyWorkers -> ResponseHeaders
toHeaders =
ResponseHeaders -> NotifyWorkers -> 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.NotifyWorkers" ::
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 NotifyWorkers where
toJSON :: NotifyWorkers -> Value
toJSON NotifyWorkers' {[Text]
Text
workerIds :: [Text]
messageText :: Text
subject :: Text
$sel:workerIds:NotifyWorkers' :: NotifyWorkers -> [Text]
$sel:messageText:NotifyWorkers' :: NotifyWorkers -> Text
$sel:subject:NotifyWorkers' :: NotifyWorkers -> 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
"Subject" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
subject),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"MessageText" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
messageText),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"WorkerIds" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
workerIds)
]
)
instance Core.ToPath NotifyWorkers where
toPath :: NotifyWorkers -> ByteString
toPath = ByteString -> NotifyWorkers -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery NotifyWorkers where
toQuery :: NotifyWorkers -> QueryString
toQuery = QueryString -> NotifyWorkers -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data NotifyWorkersResponse = NotifyWorkersResponse'
{
NotifyWorkersResponse -> Maybe [NotifyWorkersFailureStatus]
notifyWorkersFailureStatuses :: Prelude.Maybe [NotifyWorkersFailureStatus],
NotifyWorkersResponse -> Int
httpStatus :: Prelude.Int
}
deriving (NotifyWorkersResponse -> NotifyWorkersResponse -> Bool
(NotifyWorkersResponse -> NotifyWorkersResponse -> Bool)
-> (NotifyWorkersResponse -> NotifyWorkersResponse -> Bool)
-> Eq NotifyWorkersResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NotifyWorkersResponse -> NotifyWorkersResponse -> Bool
$c/= :: NotifyWorkersResponse -> NotifyWorkersResponse -> Bool
== :: NotifyWorkersResponse -> NotifyWorkersResponse -> Bool
$c== :: NotifyWorkersResponse -> NotifyWorkersResponse -> Bool
Prelude.Eq, ReadPrec [NotifyWorkersResponse]
ReadPrec NotifyWorkersResponse
Int -> ReadS NotifyWorkersResponse
ReadS [NotifyWorkersResponse]
(Int -> ReadS NotifyWorkersResponse)
-> ReadS [NotifyWorkersResponse]
-> ReadPrec NotifyWorkersResponse
-> ReadPrec [NotifyWorkersResponse]
-> Read NotifyWorkersResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NotifyWorkersResponse]
$creadListPrec :: ReadPrec [NotifyWorkersResponse]
readPrec :: ReadPrec NotifyWorkersResponse
$creadPrec :: ReadPrec NotifyWorkersResponse
readList :: ReadS [NotifyWorkersResponse]
$creadList :: ReadS [NotifyWorkersResponse]
readsPrec :: Int -> ReadS NotifyWorkersResponse
$creadsPrec :: Int -> ReadS NotifyWorkersResponse
Prelude.Read, Int -> NotifyWorkersResponse -> ShowS
[NotifyWorkersResponse] -> ShowS
NotifyWorkersResponse -> String
(Int -> NotifyWorkersResponse -> ShowS)
-> (NotifyWorkersResponse -> String)
-> ([NotifyWorkersResponse] -> ShowS)
-> Show NotifyWorkersResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NotifyWorkersResponse] -> ShowS
$cshowList :: [NotifyWorkersResponse] -> ShowS
show :: NotifyWorkersResponse -> String
$cshow :: NotifyWorkersResponse -> String
showsPrec :: Int -> NotifyWorkersResponse -> ShowS
$cshowsPrec :: Int -> NotifyWorkersResponse -> ShowS
Prelude.Show, (forall x. NotifyWorkersResponse -> Rep NotifyWorkersResponse x)
-> (forall x. Rep NotifyWorkersResponse x -> NotifyWorkersResponse)
-> Generic NotifyWorkersResponse
forall x. Rep NotifyWorkersResponse x -> NotifyWorkersResponse
forall x. NotifyWorkersResponse -> Rep NotifyWorkersResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NotifyWorkersResponse x -> NotifyWorkersResponse
$cfrom :: forall x. NotifyWorkersResponse -> Rep NotifyWorkersResponse x
Prelude.Generic)
newNotifyWorkersResponse ::
Prelude.Int ->
NotifyWorkersResponse
newNotifyWorkersResponse :: Int -> NotifyWorkersResponse
newNotifyWorkersResponse Int
pHttpStatus_ =
NotifyWorkersResponse' :: Maybe [NotifyWorkersFailureStatus] -> Int -> NotifyWorkersResponse
NotifyWorkersResponse'
{ $sel:notifyWorkersFailureStatuses:NotifyWorkersResponse' :: Maybe [NotifyWorkersFailureStatus]
notifyWorkersFailureStatuses =
Maybe [NotifyWorkersFailureStatus]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:NotifyWorkersResponse' :: Int
httpStatus = Int
pHttpStatus_
}
notifyWorkersResponse_notifyWorkersFailureStatuses :: Lens.Lens' NotifyWorkersResponse (Prelude.Maybe [NotifyWorkersFailureStatus])
notifyWorkersResponse_notifyWorkersFailureStatuses :: (Maybe [NotifyWorkersFailureStatus]
-> f (Maybe [NotifyWorkersFailureStatus]))
-> NotifyWorkersResponse -> f NotifyWorkersResponse
notifyWorkersResponse_notifyWorkersFailureStatuses = (NotifyWorkersResponse -> Maybe [NotifyWorkersFailureStatus])
-> (NotifyWorkersResponse
-> Maybe [NotifyWorkersFailureStatus] -> NotifyWorkersResponse)
-> Lens
NotifyWorkersResponse
NotifyWorkersResponse
(Maybe [NotifyWorkersFailureStatus])
(Maybe [NotifyWorkersFailureStatus])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotifyWorkersResponse' {Maybe [NotifyWorkersFailureStatus]
notifyWorkersFailureStatuses :: Maybe [NotifyWorkersFailureStatus]
$sel:notifyWorkersFailureStatuses:NotifyWorkersResponse' :: NotifyWorkersResponse -> Maybe [NotifyWorkersFailureStatus]
notifyWorkersFailureStatuses} -> Maybe [NotifyWorkersFailureStatus]
notifyWorkersFailureStatuses) (\s :: NotifyWorkersResponse
s@NotifyWorkersResponse' {} Maybe [NotifyWorkersFailureStatus]
a -> NotifyWorkersResponse
s {$sel:notifyWorkersFailureStatuses:NotifyWorkersResponse' :: Maybe [NotifyWorkersFailureStatus]
notifyWorkersFailureStatuses = Maybe [NotifyWorkersFailureStatus]
a} :: NotifyWorkersResponse) ((Maybe [NotifyWorkersFailureStatus]
-> f (Maybe [NotifyWorkersFailureStatus]))
-> NotifyWorkersResponse -> f NotifyWorkersResponse)
-> ((Maybe [NotifyWorkersFailureStatus]
-> f (Maybe [NotifyWorkersFailureStatus]))
-> Maybe [NotifyWorkersFailureStatus]
-> f (Maybe [NotifyWorkersFailureStatus]))
-> (Maybe [NotifyWorkersFailureStatus]
-> f (Maybe [NotifyWorkersFailureStatus]))
-> NotifyWorkersResponse
-> f NotifyWorkersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[NotifyWorkersFailureStatus]
[NotifyWorkersFailureStatus]
[NotifyWorkersFailureStatus]
[NotifyWorkersFailureStatus]
-> Iso
(Maybe [NotifyWorkersFailureStatus])
(Maybe [NotifyWorkersFailureStatus])
(Maybe [NotifyWorkersFailureStatus])
(Maybe [NotifyWorkersFailureStatus])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[NotifyWorkersFailureStatus]
[NotifyWorkersFailureStatus]
[NotifyWorkersFailureStatus]
[NotifyWorkersFailureStatus]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
notifyWorkersResponse_httpStatus :: Lens.Lens' NotifyWorkersResponse Prelude.Int
notifyWorkersResponse_httpStatus :: (Int -> f Int) -> NotifyWorkersResponse -> f NotifyWorkersResponse
notifyWorkersResponse_httpStatus = (NotifyWorkersResponse -> Int)
-> (NotifyWorkersResponse -> Int -> NotifyWorkersResponse)
-> Lens NotifyWorkersResponse NotifyWorkersResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotifyWorkersResponse' {Int
httpStatus :: Int
$sel:httpStatus:NotifyWorkersResponse' :: NotifyWorkersResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: NotifyWorkersResponse
s@NotifyWorkersResponse' {} Int
a -> NotifyWorkersResponse
s {$sel:httpStatus:NotifyWorkersResponse' :: Int
httpStatus = Int
a} :: NotifyWorkersResponse)
instance Prelude.NFData NotifyWorkersResponse