{-# 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.GetQualificationType
(
GetQualificationType (..),
newGetQualificationType,
getQualificationType_qualificationTypeId,
GetQualificationTypeResponse (..),
newGetQualificationTypeResponse,
getQualificationTypeResponse_qualificationType,
getQualificationTypeResponse_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 GetQualificationType = GetQualificationType'
{
GetQualificationType -> Text
qualificationTypeId :: Prelude.Text
}
deriving (GetQualificationType -> GetQualificationType -> Bool
(GetQualificationType -> GetQualificationType -> Bool)
-> (GetQualificationType -> GetQualificationType -> Bool)
-> Eq GetQualificationType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetQualificationType -> GetQualificationType -> Bool
$c/= :: GetQualificationType -> GetQualificationType -> Bool
== :: GetQualificationType -> GetQualificationType -> Bool
$c== :: GetQualificationType -> GetQualificationType -> Bool
Prelude.Eq, ReadPrec [GetQualificationType]
ReadPrec GetQualificationType
Int -> ReadS GetQualificationType
ReadS [GetQualificationType]
(Int -> ReadS GetQualificationType)
-> ReadS [GetQualificationType]
-> ReadPrec GetQualificationType
-> ReadPrec [GetQualificationType]
-> Read GetQualificationType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetQualificationType]
$creadListPrec :: ReadPrec [GetQualificationType]
readPrec :: ReadPrec GetQualificationType
$creadPrec :: ReadPrec GetQualificationType
readList :: ReadS [GetQualificationType]
$creadList :: ReadS [GetQualificationType]
readsPrec :: Int -> ReadS GetQualificationType
$creadsPrec :: Int -> ReadS GetQualificationType
Prelude.Read, Int -> GetQualificationType -> ShowS
[GetQualificationType] -> ShowS
GetQualificationType -> String
(Int -> GetQualificationType -> ShowS)
-> (GetQualificationType -> String)
-> ([GetQualificationType] -> ShowS)
-> Show GetQualificationType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetQualificationType] -> ShowS
$cshowList :: [GetQualificationType] -> ShowS
show :: GetQualificationType -> String
$cshow :: GetQualificationType -> String
showsPrec :: Int -> GetQualificationType -> ShowS
$cshowsPrec :: Int -> GetQualificationType -> ShowS
Prelude.Show, (forall x. GetQualificationType -> Rep GetQualificationType x)
-> (forall x. Rep GetQualificationType x -> GetQualificationType)
-> Generic GetQualificationType
forall x. Rep GetQualificationType x -> GetQualificationType
forall x. GetQualificationType -> Rep GetQualificationType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetQualificationType x -> GetQualificationType
$cfrom :: forall x. GetQualificationType -> Rep GetQualificationType x
Prelude.Generic)
newGetQualificationType ::
Prelude.Text ->
GetQualificationType
newGetQualificationType :: Text -> GetQualificationType
newGetQualificationType Text
pQualificationTypeId_ =
GetQualificationType' :: Text -> GetQualificationType
GetQualificationType'
{ $sel:qualificationTypeId:GetQualificationType' :: Text
qualificationTypeId =
Text
pQualificationTypeId_
}
getQualificationType_qualificationTypeId :: Lens.Lens' GetQualificationType Prelude.Text
getQualificationType_qualificationTypeId :: (Text -> f Text) -> GetQualificationType -> f GetQualificationType
getQualificationType_qualificationTypeId = (GetQualificationType -> Text)
-> (GetQualificationType -> Text -> GetQualificationType)
-> Lens GetQualificationType GetQualificationType Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetQualificationType' {Text
qualificationTypeId :: Text
$sel:qualificationTypeId:GetQualificationType' :: GetQualificationType -> Text
qualificationTypeId} -> Text
qualificationTypeId) (\s :: GetQualificationType
s@GetQualificationType' {} Text
a -> GetQualificationType
s {$sel:qualificationTypeId:GetQualificationType' :: Text
qualificationTypeId = Text
a} :: GetQualificationType)
instance Core.AWSRequest GetQualificationType where
type
AWSResponse GetQualificationType =
GetQualificationTypeResponse
request :: GetQualificationType -> Request GetQualificationType
request = Service -> GetQualificationType -> Request GetQualificationType
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetQualificationType
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetQualificationType)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetQualificationType))
-> Logger
-> Service
-> Proxy GetQualificationType
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetQualificationType)))
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 QualificationType -> Int -> GetQualificationTypeResponse
GetQualificationTypeResponse'
(Maybe QualificationType -> Int -> GetQualificationTypeResponse)
-> Either String (Maybe QualificationType)
-> Either String (Int -> GetQualificationTypeResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe QualificationType)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"QualificationType")
Either String (Int -> GetQualificationTypeResponse)
-> Either String Int -> Either String GetQualificationTypeResponse
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 GetQualificationType
instance Prelude.NFData GetQualificationType
instance Core.ToHeaders GetQualificationType where
toHeaders :: GetQualificationType -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetQualificationType -> 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.GetQualificationType" ::
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 GetQualificationType where
toJSON :: GetQualificationType -> Value
toJSON GetQualificationType' {Text
qualificationTypeId :: Text
$sel:qualificationTypeId:GetQualificationType' :: GetQualificationType -> 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)
]
)
instance Core.ToPath GetQualificationType where
toPath :: GetQualificationType -> ByteString
toPath = ByteString -> GetQualificationType -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetQualificationType where
toQuery :: GetQualificationType -> QueryString
toQuery = QueryString -> GetQualificationType -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetQualificationTypeResponse = GetQualificationTypeResponse'
{
GetQualificationTypeResponse -> Maybe QualificationType
qualificationType :: Prelude.Maybe QualificationType,
GetQualificationTypeResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetQualificationTypeResponse
-> GetQualificationTypeResponse -> Bool
(GetQualificationTypeResponse
-> GetQualificationTypeResponse -> Bool)
-> (GetQualificationTypeResponse
-> GetQualificationTypeResponse -> Bool)
-> Eq GetQualificationTypeResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetQualificationTypeResponse
-> GetQualificationTypeResponse -> Bool
$c/= :: GetQualificationTypeResponse
-> GetQualificationTypeResponse -> Bool
== :: GetQualificationTypeResponse
-> GetQualificationTypeResponse -> Bool
$c== :: GetQualificationTypeResponse
-> GetQualificationTypeResponse -> Bool
Prelude.Eq, ReadPrec [GetQualificationTypeResponse]
ReadPrec GetQualificationTypeResponse
Int -> ReadS GetQualificationTypeResponse
ReadS [GetQualificationTypeResponse]
(Int -> ReadS GetQualificationTypeResponse)
-> ReadS [GetQualificationTypeResponse]
-> ReadPrec GetQualificationTypeResponse
-> ReadPrec [GetQualificationTypeResponse]
-> Read GetQualificationTypeResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetQualificationTypeResponse]
$creadListPrec :: ReadPrec [GetQualificationTypeResponse]
readPrec :: ReadPrec GetQualificationTypeResponse
$creadPrec :: ReadPrec GetQualificationTypeResponse
readList :: ReadS [GetQualificationTypeResponse]
$creadList :: ReadS [GetQualificationTypeResponse]
readsPrec :: Int -> ReadS GetQualificationTypeResponse
$creadsPrec :: Int -> ReadS GetQualificationTypeResponse
Prelude.Read, Int -> GetQualificationTypeResponse -> ShowS
[GetQualificationTypeResponse] -> ShowS
GetQualificationTypeResponse -> String
(Int -> GetQualificationTypeResponse -> ShowS)
-> (GetQualificationTypeResponse -> String)
-> ([GetQualificationTypeResponse] -> ShowS)
-> Show GetQualificationTypeResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetQualificationTypeResponse] -> ShowS
$cshowList :: [GetQualificationTypeResponse] -> ShowS
show :: GetQualificationTypeResponse -> String
$cshow :: GetQualificationTypeResponse -> String
showsPrec :: Int -> GetQualificationTypeResponse -> ShowS
$cshowsPrec :: Int -> GetQualificationTypeResponse -> ShowS
Prelude.Show, (forall x.
GetQualificationTypeResponse -> Rep GetQualificationTypeResponse x)
-> (forall x.
Rep GetQualificationTypeResponse x -> GetQualificationTypeResponse)
-> Generic GetQualificationTypeResponse
forall x.
Rep GetQualificationTypeResponse x -> GetQualificationTypeResponse
forall x.
GetQualificationTypeResponse -> Rep GetQualificationTypeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetQualificationTypeResponse x -> GetQualificationTypeResponse
$cfrom :: forall x.
GetQualificationTypeResponse -> Rep GetQualificationTypeResponse x
Prelude.Generic)
newGetQualificationTypeResponse ::
Prelude.Int ->
GetQualificationTypeResponse
newGetQualificationTypeResponse :: Int -> GetQualificationTypeResponse
newGetQualificationTypeResponse Int
pHttpStatus_ =
GetQualificationTypeResponse' :: Maybe QualificationType -> Int -> GetQualificationTypeResponse
GetQualificationTypeResponse'
{ $sel:qualificationType:GetQualificationTypeResponse' :: Maybe QualificationType
qualificationType =
Maybe QualificationType
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetQualificationTypeResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getQualificationTypeResponse_qualificationType :: Lens.Lens' GetQualificationTypeResponse (Prelude.Maybe QualificationType)
getQualificationTypeResponse_qualificationType :: (Maybe QualificationType -> f (Maybe QualificationType))
-> GetQualificationTypeResponse -> f GetQualificationTypeResponse
getQualificationTypeResponse_qualificationType = (GetQualificationTypeResponse -> Maybe QualificationType)
-> (GetQualificationTypeResponse
-> Maybe QualificationType -> GetQualificationTypeResponse)
-> Lens
GetQualificationTypeResponse
GetQualificationTypeResponse
(Maybe QualificationType)
(Maybe QualificationType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetQualificationTypeResponse' {Maybe QualificationType
qualificationType :: Maybe QualificationType
$sel:qualificationType:GetQualificationTypeResponse' :: GetQualificationTypeResponse -> Maybe QualificationType
qualificationType} -> Maybe QualificationType
qualificationType) (\s :: GetQualificationTypeResponse
s@GetQualificationTypeResponse' {} Maybe QualificationType
a -> GetQualificationTypeResponse
s {$sel:qualificationType:GetQualificationTypeResponse' :: Maybe QualificationType
qualificationType = Maybe QualificationType
a} :: GetQualificationTypeResponse)
getQualificationTypeResponse_httpStatus :: Lens.Lens' GetQualificationTypeResponse Prelude.Int
getQualificationTypeResponse_httpStatus :: (Int -> f Int)
-> GetQualificationTypeResponse -> f GetQualificationTypeResponse
getQualificationTypeResponse_httpStatus = (GetQualificationTypeResponse -> Int)
-> (GetQualificationTypeResponse
-> Int -> GetQualificationTypeResponse)
-> Lens
GetQualificationTypeResponse GetQualificationTypeResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetQualificationTypeResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetQualificationTypeResponse' :: GetQualificationTypeResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetQualificationTypeResponse
s@GetQualificationTypeResponse' {} Int
a -> GetQualificationTypeResponse
s {$sel:httpStatus:GetQualificationTypeResponse' :: Int
httpStatus = Int
a} :: GetQualificationTypeResponse)
instance Prelude.NFData GetQualificationTypeResponse