{-# 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.GetQualificationScore
(
GetQualificationScore (..),
newGetQualificationScore,
getQualificationScore_qualificationTypeId,
getQualificationScore_workerId,
GetQualificationScoreResponse (..),
newGetQualificationScoreResponse,
getQualificationScoreResponse_qualification,
getQualificationScoreResponse_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 GetQualificationScore = GetQualificationScore'
{
GetQualificationScore -> Text
qualificationTypeId :: Prelude.Text,
GetQualificationScore -> Text
workerId :: Prelude.Text
}
deriving (GetQualificationScore -> GetQualificationScore -> Bool
(GetQualificationScore -> GetQualificationScore -> Bool)
-> (GetQualificationScore -> GetQualificationScore -> Bool)
-> Eq GetQualificationScore
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetQualificationScore -> GetQualificationScore -> Bool
$c/= :: GetQualificationScore -> GetQualificationScore -> Bool
== :: GetQualificationScore -> GetQualificationScore -> Bool
$c== :: GetQualificationScore -> GetQualificationScore -> Bool
Prelude.Eq, ReadPrec [GetQualificationScore]
ReadPrec GetQualificationScore
Int -> ReadS GetQualificationScore
ReadS [GetQualificationScore]
(Int -> ReadS GetQualificationScore)
-> ReadS [GetQualificationScore]
-> ReadPrec GetQualificationScore
-> ReadPrec [GetQualificationScore]
-> Read GetQualificationScore
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetQualificationScore]
$creadListPrec :: ReadPrec [GetQualificationScore]
readPrec :: ReadPrec GetQualificationScore
$creadPrec :: ReadPrec GetQualificationScore
readList :: ReadS [GetQualificationScore]
$creadList :: ReadS [GetQualificationScore]
readsPrec :: Int -> ReadS GetQualificationScore
$creadsPrec :: Int -> ReadS GetQualificationScore
Prelude.Read, Int -> GetQualificationScore -> ShowS
[GetQualificationScore] -> ShowS
GetQualificationScore -> String
(Int -> GetQualificationScore -> ShowS)
-> (GetQualificationScore -> String)
-> ([GetQualificationScore] -> ShowS)
-> Show GetQualificationScore
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetQualificationScore] -> ShowS
$cshowList :: [GetQualificationScore] -> ShowS
show :: GetQualificationScore -> String
$cshow :: GetQualificationScore -> String
showsPrec :: Int -> GetQualificationScore -> ShowS
$cshowsPrec :: Int -> GetQualificationScore -> ShowS
Prelude.Show, (forall x. GetQualificationScore -> Rep GetQualificationScore x)
-> (forall x. Rep GetQualificationScore x -> GetQualificationScore)
-> Generic GetQualificationScore
forall x. Rep GetQualificationScore x -> GetQualificationScore
forall x. GetQualificationScore -> Rep GetQualificationScore x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetQualificationScore x -> GetQualificationScore
$cfrom :: forall x. GetQualificationScore -> Rep GetQualificationScore x
Prelude.Generic)
newGetQualificationScore ::
Prelude.Text ->
Prelude.Text ->
GetQualificationScore
newGetQualificationScore :: Text -> Text -> GetQualificationScore
newGetQualificationScore
Text
pQualificationTypeId_
Text
pWorkerId_ =
GetQualificationScore' :: Text -> Text -> GetQualificationScore
GetQualificationScore'
{ $sel:qualificationTypeId:GetQualificationScore' :: Text
qualificationTypeId =
Text
pQualificationTypeId_,
$sel:workerId:GetQualificationScore' :: Text
workerId = Text
pWorkerId_
}
getQualificationScore_qualificationTypeId :: Lens.Lens' GetQualificationScore Prelude.Text
getQualificationScore_qualificationTypeId :: (Text -> f Text)
-> GetQualificationScore -> f GetQualificationScore
getQualificationScore_qualificationTypeId = (GetQualificationScore -> Text)
-> (GetQualificationScore -> Text -> GetQualificationScore)
-> Lens GetQualificationScore GetQualificationScore Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetQualificationScore' {Text
qualificationTypeId :: Text
$sel:qualificationTypeId:GetQualificationScore' :: GetQualificationScore -> Text
qualificationTypeId} -> Text
qualificationTypeId) (\s :: GetQualificationScore
s@GetQualificationScore' {} Text
a -> GetQualificationScore
s {$sel:qualificationTypeId:GetQualificationScore' :: Text
qualificationTypeId = Text
a} :: GetQualificationScore)
getQualificationScore_workerId :: Lens.Lens' GetQualificationScore Prelude.Text
getQualificationScore_workerId :: (Text -> f Text)
-> GetQualificationScore -> f GetQualificationScore
getQualificationScore_workerId = (GetQualificationScore -> Text)
-> (GetQualificationScore -> Text -> GetQualificationScore)
-> Lens GetQualificationScore GetQualificationScore Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetQualificationScore' {Text
workerId :: Text
$sel:workerId:GetQualificationScore' :: GetQualificationScore -> Text
workerId} -> Text
workerId) (\s :: GetQualificationScore
s@GetQualificationScore' {} Text
a -> GetQualificationScore
s {$sel:workerId:GetQualificationScore' :: Text
workerId = Text
a} :: GetQualificationScore)
instance Core.AWSRequest GetQualificationScore where
type
AWSResponse GetQualificationScore =
GetQualificationScoreResponse
request :: GetQualificationScore -> Request GetQualificationScore
request = Service -> GetQualificationScore -> Request GetQualificationScore
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetQualificationScore
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetQualificationScore)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetQualificationScore))
-> Logger
-> Service
-> Proxy GetQualificationScore
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetQualificationScore)))
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 Qualification -> Int -> GetQualificationScoreResponse
GetQualificationScoreResponse'
(Maybe Qualification -> Int -> GetQualificationScoreResponse)
-> Either String (Maybe Qualification)
-> Either String (Int -> GetQualificationScoreResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Qualification)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Qualification")
Either String (Int -> GetQualificationScoreResponse)
-> Either String Int -> Either String GetQualificationScoreResponse
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 GetQualificationScore
instance Prelude.NFData GetQualificationScore
instance Core.ToHeaders GetQualificationScore where
toHeaders :: GetQualificationScore -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetQualificationScore -> 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.GetQualificationScore" ::
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 GetQualificationScore where
toJSON :: GetQualificationScore -> Value
toJSON GetQualificationScore' {Text
workerId :: Text
qualificationTypeId :: Text
$sel:workerId:GetQualificationScore' :: GetQualificationScore -> Text
$sel:qualificationTypeId:GetQualificationScore' :: GetQualificationScore -> 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
"QualificationTypeId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
qualificationTypeId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"WorkerId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
workerId)
]
)
instance Core.ToPath GetQualificationScore where
toPath :: GetQualificationScore -> ByteString
toPath = ByteString -> GetQualificationScore -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetQualificationScore where
toQuery :: GetQualificationScore -> QueryString
toQuery = QueryString -> GetQualificationScore -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetQualificationScoreResponse = GetQualificationScoreResponse'
{
GetQualificationScoreResponse -> Maybe Qualification
qualification :: Prelude.Maybe Qualification,
GetQualificationScoreResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetQualificationScoreResponse
-> GetQualificationScoreResponse -> Bool
(GetQualificationScoreResponse
-> GetQualificationScoreResponse -> Bool)
-> (GetQualificationScoreResponse
-> GetQualificationScoreResponse -> Bool)
-> Eq GetQualificationScoreResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetQualificationScoreResponse
-> GetQualificationScoreResponse -> Bool
$c/= :: GetQualificationScoreResponse
-> GetQualificationScoreResponse -> Bool
== :: GetQualificationScoreResponse
-> GetQualificationScoreResponse -> Bool
$c== :: GetQualificationScoreResponse
-> GetQualificationScoreResponse -> Bool
Prelude.Eq, ReadPrec [GetQualificationScoreResponse]
ReadPrec GetQualificationScoreResponse
Int -> ReadS GetQualificationScoreResponse
ReadS [GetQualificationScoreResponse]
(Int -> ReadS GetQualificationScoreResponse)
-> ReadS [GetQualificationScoreResponse]
-> ReadPrec GetQualificationScoreResponse
-> ReadPrec [GetQualificationScoreResponse]
-> Read GetQualificationScoreResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetQualificationScoreResponse]
$creadListPrec :: ReadPrec [GetQualificationScoreResponse]
readPrec :: ReadPrec GetQualificationScoreResponse
$creadPrec :: ReadPrec GetQualificationScoreResponse
readList :: ReadS [GetQualificationScoreResponse]
$creadList :: ReadS [GetQualificationScoreResponse]
readsPrec :: Int -> ReadS GetQualificationScoreResponse
$creadsPrec :: Int -> ReadS GetQualificationScoreResponse
Prelude.Read, Int -> GetQualificationScoreResponse -> ShowS
[GetQualificationScoreResponse] -> ShowS
GetQualificationScoreResponse -> String
(Int -> GetQualificationScoreResponse -> ShowS)
-> (GetQualificationScoreResponse -> String)
-> ([GetQualificationScoreResponse] -> ShowS)
-> Show GetQualificationScoreResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetQualificationScoreResponse] -> ShowS
$cshowList :: [GetQualificationScoreResponse] -> ShowS
show :: GetQualificationScoreResponse -> String
$cshow :: GetQualificationScoreResponse -> String
showsPrec :: Int -> GetQualificationScoreResponse -> ShowS
$cshowsPrec :: Int -> GetQualificationScoreResponse -> ShowS
Prelude.Show, (forall x.
GetQualificationScoreResponse
-> Rep GetQualificationScoreResponse x)
-> (forall x.
Rep GetQualificationScoreResponse x
-> GetQualificationScoreResponse)
-> Generic GetQualificationScoreResponse
forall x.
Rep GetQualificationScoreResponse x
-> GetQualificationScoreResponse
forall x.
GetQualificationScoreResponse
-> Rep GetQualificationScoreResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetQualificationScoreResponse x
-> GetQualificationScoreResponse
$cfrom :: forall x.
GetQualificationScoreResponse
-> Rep GetQualificationScoreResponse x
Prelude.Generic)
newGetQualificationScoreResponse ::
Prelude.Int ->
GetQualificationScoreResponse
newGetQualificationScoreResponse :: Int -> GetQualificationScoreResponse
newGetQualificationScoreResponse Int
pHttpStatus_ =
GetQualificationScoreResponse' :: Maybe Qualification -> Int -> GetQualificationScoreResponse
GetQualificationScoreResponse'
{ $sel:qualification:GetQualificationScoreResponse' :: Maybe Qualification
qualification =
Maybe Qualification
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetQualificationScoreResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getQualificationScoreResponse_qualification :: Lens.Lens' GetQualificationScoreResponse (Prelude.Maybe Qualification)
getQualificationScoreResponse_qualification :: (Maybe Qualification -> f (Maybe Qualification))
-> GetQualificationScoreResponse -> f GetQualificationScoreResponse
getQualificationScoreResponse_qualification = (GetQualificationScoreResponse -> Maybe Qualification)
-> (GetQualificationScoreResponse
-> Maybe Qualification -> GetQualificationScoreResponse)
-> Lens
GetQualificationScoreResponse
GetQualificationScoreResponse
(Maybe Qualification)
(Maybe Qualification)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetQualificationScoreResponse' {Maybe Qualification
qualification :: Maybe Qualification
$sel:qualification:GetQualificationScoreResponse' :: GetQualificationScoreResponse -> Maybe Qualification
qualification} -> Maybe Qualification
qualification) (\s :: GetQualificationScoreResponse
s@GetQualificationScoreResponse' {} Maybe Qualification
a -> GetQualificationScoreResponse
s {$sel:qualification:GetQualificationScoreResponse' :: Maybe Qualification
qualification = Maybe Qualification
a} :: GetQualificationScoreResponse)
getQualificationScoreResponse_httpStatus :: Lens.Lens' GetQualificationScoreResponse Prelude.Int
getQualificationScoreResponse_httpStatus :: (Int -> f Int)
-> GetQualificationScoreResponse -> f GetQualificationScoreResponse
getQualificationScoreResponse_httpStatus = (GetQualificationScoreResponse -> Int)
-> (GetQualificationScoreResponse
-> Int -> GetQualificationScoreResponse)
-> Lens
GetQualificationScoreResponse GetQualificationScoreResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetQualificationScoreResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetQualificationScoreResponse' :: GetQualificationScoreResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetQualificationScoreResponse
s@GetQualificationScoreResponse' {} Int
a -> GetQualificationScoreResponse
s {$sel:httpStatus:GetQualificationScoreResponse' :: Int
httpStatus = Int
a} :: GetQualificationScoreResponse)
instance Prelude.NFData GetQualificationScoreResponse