{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.MechanicalTurk.ListWorkersWithQualificationType
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- The @ListWorkersWithQualificationType@ operation returns all of the
-- Workers that have been associated with a given Qualification type.
--
-- This operation returns paginated results.
module Amazonka.MechanicalTurk.ListWorkersWithQualificationType
  ( -- * Creating a Request
    ListWorkersWithQualificationType (..),
    newListWorkersWithQualificationType,

    -- * Request Lenses
    listWorkersWithQualificationType_status,
    listWorkersWithQualificationType_nextToken,
    listWorkersWithQualificationType_maxResults,
    listWorkersWithQualificationType_qualificationTypeId,

    -- * Destructuring the Response
    ListWorkersWithQualificationTypeResponse (..),
    newListWorkersWithQualificationTypeResponse,

    -- * Response Lenses
    listWorkersWithQualificationTypeResponse_nextToken,
    listWorkersWithQualificationTypeResponse_numResults,
    listWorkersWithQualificationTypeResponse_qualifications,
    listWorkersWithQualificationTypeResponse_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

-- | /See:/ 'newListWorkersWithQualificationType' smart constructor.
data ListWorkersWithQualificationType = ListWorkersWithQualificationType'
  { -- | The status of the Qualifications to return. Can be @Granted | Revoked@.
    ListWorkersWithQualificationType -> Maybe QualificationStatus
status :: Prelude.Maybe QualificationStatus,
    -- | Pagination Token
    ListWorkersWithQualificationType -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Limit the number of results returned.
    ListWorkersWithQualificationType -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The ID of the Qualification type of the Qualifications to return.
    ListWorkersWithQualificationType -> Text
qualificationTypeId :: Prelude.Text
  }
  deriving (ListWorkersWithQualificationType
-> ListWorkersWithQualificationType -> Bool
(ListWorkersWithQualificationType
 -> ListWorkersWithQualificationType -> Bool)
-> (ListWorkersWithQualificationType
    -> ListWorkersWithQualificationType -> Bool)
-> Eq ListWorkersWithQualificationType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListWorkersWithQualificationType
-> ListWorkersWithQualificationType -> Bool
$c/= :: ListWorkersWithQualificationType
-> ListWorkersWithQualificationType -> Bool
== :: ListWorkersWithQualificationType
-> ListWorkersWithQualificationType -> Bool
$c== :: ListWorkersWithQualificationType
-> ListWorkersWithQualificationType -> Bool
Prelude.Eq, ReadPrec [ListWorkersWithQualificationType]
ReadPrec ListWorkersWithQualificationType
Int -> ReadS ListWorkersWithQualificationType
ReadS [ListWorkersWithQualificationType]
(Int -> ReadS ListWorkersWithQualificationType)
-> ReadS [ListWorkersWithQualificationType]
-> ReadPrec ListWorkersWithQualificationType
-> ReadPrec [ListWorkersWithQualificationType]
-> Read ListWorkersWithQualificationType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListWorkersWithQualificationType]
$creadListPrec :: ReadPrec [ListWorkersWithQualificationType]
readPrec :: ReadPrec ListWorkersWithQualificationType
$creadPrec :: ReadPrec ListWorkersWithQualificationType
readList :: ReadS [ListWorkersWithQualificationType]
$creadList :: ReadS [ListWorkersWithQualificationType]
readsPrec :: Int -> ReadS ListWorkersWithQualificationType
$creadsPrec :: Int -> ReadS ListWorkersWithQualificationType
Prelude.Read, Int -> ListWorkersWithQualificationType -> ShowS
[ListWorkersWithQualificationType] -> ShowS
ListWorkersWithQualificationType -> String
(Int -> ListWorkersWithQualificationType -> ShowS)
-> (ListWorkersWithQualificationType -> String)
-> ([ListWorkersWithQualificationType] -> ShowS)
-> Show ListWorkersWithQualificationType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListWorkersWithQualificationType] -> ShowS
$cshowList :: [ListWorkersWithQualificationType] -> ShowS
show :: ListWorkersWithQualificationType -> String
$cshow :: ListWorkersWithQualificationType -> String
showsPrec :: Int -> ListWorkersWithQualificationType -> ShowS
$cshowsPrec :: Int -> ListWorkersWithQualificationType -> ShowS
Prelude.Show, (forall x.
 ListWorkersWithQualificationType
 -> Rep ListWorkersWithQualificationType x)
-> (forall x.
    Rep ListWorkersWithQualificationType x
    -> ListWorkersWithQualificationType)
-> Generic ListWorkersWithQualificationType
forall x.
Rep ListWorkersWithQualificationType x
-> ListWorkersWithQualificationType
forall x.
ListWorkersWithQualificationType
-> Rep ListWorkersWithQualificationType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListWorkersWithQualificationType x
-> ListWorkersWithQualificationType
$cfrom :: forall x.
ListWorkersWithQualificationType
-> Rep ListWorkersWithQualificationType x
Prelude.Generic)

-- |
-- Create a value of 'ListWorkersWithQualificationType' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'status', 'listWorkersWithQualificationType_status' - The status of the Qualifications to return. Can be @Granted | Revoked@.
--
-- 'nextToken', 'listWorkersWithQualificationType_nextToken' - Pagination Token
--
-- 'maxResults', 'listWorkersWithQualificationType_maxResults' - Limit the number of results returned.
--
-- 'qualificationTypeId', 'listWorkersWithQualificationType_qualificationTypeId' - The ID of the Qualification type of the Qualifications to return.
newListWorkersWithQualificationType ::
  -- | 'qualificationTypeId'
  Prelude.Text ->
  ListWorkersWithQualificationType
newListWorkersWithQualificationType :: Text -> ListWorkersWithQualificationType
newListWorkersWithQualificationType
  Text
pQualificationTypeId_ =
    ListWorkersWithQualificationType' :: Maybe QualificationStatus
-> Maybe Text
-> Maybe Natural
-> Text
-> ListWorkersWithQualificationType
ListWorkersWithQualificationType'
      { $sel:status:ListWorkersWithQualificationType' :: Maybe QualificationStatus
status =
          Maybe QualificationStatus
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:ListWorkersWithQualificationType' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:maxResults:ListWorkersWithQualificationType' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:qualificationTypeId:ListWorkersWithQualificationType' :: Text
qualificationTypeId =
          Text
pQualificationTypeId_
      }

-- | The status of the Qualifications to return. Can be @Granted | Revoked@.
listWorkersWithQualificationType_status :: Lens.Lens' ListWorkersWithQualificationType (Prelude.Maybe QualificationStatus)
listWorkersWithQualificationType_status :: (Maybe QualificationStatus -> f (Maybe QualificationStatus))
-> ListWorkersWithQualificationType
-> f ListWorkersWithQualificationType
listWorkersWithQualificationType_status = (ListWorkersWithQualificationType -> Maybe QualificationStatus)
-> (ListWorkersWithQualificationType
    -> Maybe QualificationStatus -> ListWorkersWithQualificationType)
-> Lens
     ListWorkersWithQualificationType
     ListWorkersWithQualificationType
     (Maybe QualificationStatus)
     (Maybe QualificationStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWorkersWithQualificationType' {Maybe QualificationStatus
status :: Maybe QualificationStatus
$sel:status:ListWorkersWithQualificationType' :: ListWorkersWithQualificationType -> Maybe QualificationStatus
status} -> Maybe QualificationStatus
status) (\s :: ListWorkersWithQualificationType
s@ListWorkersWithQualificationType' {} Maybe QualificationStatus
a -> ListWorkersWithQualificationType
s {$sel:status:ListWorkersWithQualificationType' :: Maybe QualificationStatus
status = Maybe QualificationStatus
a} :: ListWorkersWithQualificationType)

-- | Pagination Token
listWorkersWithQualificationType_nextToken :: Lens.Lens' ListWorkersWithQualificationType (Prelude.Maybe Prelude.Text)
listWorkersWithQualificationType_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListWorkersWithQualificationType
-> f ListWorkersWithQualificationType
listWorkersWithQualificationType_nextToken = (ListWorkersWithQualificationType -> Maybe Text)
-> (ListWorkersWithQualificationType
    -> Maybe Text -> ListWorkersWithQualificationType)
-> Lens
     ListWorkersWithQualificationType
     ListWorkersWithQualificationType
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWorkersWithQualificationType' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListWorkersWithQualificationType' :: ListWorkersWithQualificationType -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListWorkersWithQualificationType
s@ListWorkersWithQualificationType' {} Maybe Text
a -> ListWorkersWithQualificationType
s {$sel:nextToken:ListWorkersWithQualificationType' :: Maybe Text
nextToken = Maybe Text
a} :: ListWorkersWithQualificationType)

-- | Limit the number of results returned.
listWorkersWithQualificationType_maxResults :: Lens.Lens' ListWorkersWithQualificationType (Prelude.Maybe Prelude.Natural)
listWorkersWithQualificationType_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListWorkersWithQualificationType
-> f ListWorkersWithQualificationType
listWorkersWithQualificationType_maxResults = (ListWorkersWithQualificationType -> Maybe Natural)
-> (ListWorkersWithQualificationType
    -> Maybe Natural -> ListWorkersWithQualificationType)
-> Lens
     ListWorkersWithQualificationType
     ListWorkersWithQualificationType
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWorkersWithQualificationType' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListWorkersWithQualificationType' :: ListWorkersWithQualificationType -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListWorkersWithQualificationType
s@ListWorkersWithQualificationType' {} Maybe Natural
a -> ListWorkersWithQualificationType
s {$sel:maxResults:ListWorkersWithQualificationType' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListWorkersWithQualificationType)

-- | The ID of the Qualification type of the Qualifications to return.
listWorkersWithQualificationType_qualificationTypeId :: Lens.Lens' ListWorkersWithQualificationType Prelude.Text
listWorkersWithQualificationType_qualificationTypeId :: (Text -> f Text)
-> ListWorkersWithQualificationType
-> f ListWorkersWithQualificationType
listWorkersWithQualificationType_qualificationTypeId = (ListWorkersWithQualificationType -> Text)
-> (ListWorkersWithQualificationType
    -> Text -> ListWorkersWithQualificationType)
-> Lens
     ListWorkersWithQualificationType
     ListWorkersWithQualificationType
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWorkersWithQualificationType' {Text
qualificationTypeId :: Text
$sel:qualificationTypeId:ListWorkersWithQualificationType' :: ListWorkersWithQualificationType -> Text
qualificationTypeId} -> Text
qualificationTypeId) (\s :: ListWorkersWithQualificationType
s@ListWorkersWithQualificationType' {} Text
a -> ListWorkersWithQualificationType
s {$sel:qualificationTypeId:ListWorkersWithQualificationType' :: Text
qualificationTypeId = Text
a} :: ListWorkersWithQualificationType)

instance
  Core.AWSPager
    ListWorkersWithQualificationType
  where
  page :: ListWorkersWithQualificationType
-> AWSResponse ListWorkersWithQualificationType
-> Maybe ListWorkersWithQualificationType
page ListWorkersWithQualificationType
rq AWSResponse ListWorkersWithQualificationType
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListWorkersWithQualificationType
ListWorkersWithQualificationTypeResponse
rs
            ListWorkersWithQualificationTypeResponse
-> Getting
     (First Text) ListWorkersWithQualificationTypeResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListWorkersWithQualificationTypeResponse
-> Const (First Text) ListWorkersWithQualificationTypeResponse
Lens' ListWorkersWithQualificationTypeResponse (Maybe Text)
listWorkersWithQualificationTypeResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListWorkersWithQualificationTypeResponse
 -> Const (First Text) ListWorkersWithQualificationTypeResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) ListWorkersWithQualificationTypeResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListWorkersWithQualificationType
forall a. Maybe a
Prelude.Nothing
    | Maybe [Qualification] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListWorkersWithQualificationType
ListWorkersWithQualificationTypeResponse
rs
            ListWorkersWithQualificationTypeResponse
-> Getting
     (First [Qualification])
     ListWorkersWithQualificationTypeResponse
     [Qualification]
-> Maybe [Qualification]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [Qualification]
 -> Const (First [Qualification]) (Maybe [Qualification]))
-> ListWorkersWithQualificationTypeResponse
-> Const
     (First [Qualification]) ListWorkersWithQualificationTypeResponse
Lens'
  ListWorkersWithQualificationTypeResponse (Maybe [Qualification])
listWorkersWithQualificationTypeResponse_qualifications
              ((Maybe [Qualification]
  -> Const (First [Qualification]) (Maybe [Qualification]))
 -> ListWorkersWithQualificationTypeResponse
 -> Const
      (First [Qualification]) ListWorkersWithQualificationTypeResponse)
-> (([Qualification]
     -> Const (First [Qualification]) [Qualification])
    -> Maybe [Qualification]
    -> Const (First [Qualification]) (Maybe [Qualification]))
-> Getting
     (First [Qualification])
     ListWorkersWithQualificationTypeResponse
     [Qualification]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Qualification] -> Const (First [Qualification]) [Qualification])
-> Maybe [Qualification]
-> Const (First [Qualification]) (Maybe [Qualification])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListWorkersWithQualificationType
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListWorkersWithQualificationType
-> Maybe ListWorkersWithQualificationType
forall a. a -> Maybe a
Prelude.Just (ListWorkersWithQualificationType
 -> Maybe ListWorkersWithQualificationType)
-> ListWorkersWithQualificationType
-> Maybe ListWorkersWithQualificationType
forall a b. (a -> b) -> a -> b
Prelude.$
        ListWorkersWithQualificationType
rq
          ListWorkersWithQualificationType
-> (ListWorkersWithQualificationType
    -> ListWorkersWithQualificationType)
-> ListWorkersWithQualificationType
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListWorkersWithQualificationType
-> Identity ListWorkersWithQualificationType
Lens
  ListWorkersWithQualificationType
  ListWorkersWithQualificationType
  (Maybe Text)
  (Maybe Text)
listWorkersWithQualificationType_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListWorkersWithQualificationType
 -> Identity ListWorkersWithQualificationType)
-> Maybe Text
-> ListWorkersWithQualificationType
-> ListWorkersWithQualificationType
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListWorkersWithQualificationType
ListWorkersWithQualificationTypeResponse
rs
          ListWorkersWithQualificationTypeResponse
-> Getting
     (First Text) ListWorkersWithQualificationTypeResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListWorkersWithQualificationTypeResponse
-> Const (First Text) ListWorkersWithQualificationTypeResponse
Lens' ListWorkersWithQualificationTypeResponse (Maybe Text)
listWorkersWithQualificationTypeResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListWorkersWithQualificationTypeResponse
 -> Const (First Text) ListWorkersWithQualificationTypeResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) ListWorkersWithQualificationTypeResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance
  Core.AWSRequest
    ListWorkersWithQualificationType
  where
  type
    AWSResponse ListWorkersWithQualificationType =
      ListWorkersWithQualificationTypeResponse
  request :: ListWorkersWithQualificationType
-> Request ListWorkersWithQualificationType
request = Service
-> ListWorkersWithQualificationType
-> Request ListWorkersWithQualificationType
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListWorkersWithQualificationType
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse ListWorkersWithQualificationType)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListWorkersWithQualificationType))
-> Logger
-> Service
-> Proxy ListWorkersWithQualificationType
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse ListWorkersWithQualificationType)))
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 Text
-> Maybe Int
-> Maybe [Qualification]
-> Int
-> ListWorkersWithQualificationTypeResponse
ListWorkersWithQualificationTypeResponse'
            (Maybe Text
 -> Maybe Int
 -> Maybe [Qualification]
 -> Int
 -> ListWorkersWithQualificationTypeResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Int
      -> Maybe [Qualification]
      -> Int
      -> ListWorkersWithQualificationTypeResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
            Either
  String
  (Maybe Int
   -> Maybe [Qualification]
   -> Int
   -> ListWorkersWithQualificationTypeResponse)
-> Either String (Maybe Int)
-> Either
     String
     (Maybe [Qualification]
      -> Int -> ListWorkersWithQualificationTypeResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Int)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NumResults")
            Either
  String
  (Maybe [Qualification]
   -> Int -> ListWorkersWithQualificationTypeResponse)
-> Either String (Maybe [Qualification])
-> Either String (Int -> ListWorkersWithQualificationTypeResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [Qualification]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Qualifications" Either String (Maybe (Maybe [Qualification]))
-> Maybe [Qualification] -> Either String (Maybe [Qualification])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Qualification]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> ListWorkersWithQualificationTypeResponse)
-> Either String Int
-> Either String ListWorkersWithQualificationTypeResponse
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
    ListWorkersWithQualificationType

instance
  Prelude.NFData
    ListWorkersWithQualificationType

instance
  Core.ToHeaders
    ListWorkersWithQualificationType
  where
  toHeaders :: ListWorkersWithQualificationType -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> ListWorkersWithQualificationType -> 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.ListWorkersWithQualificationType" ::
                          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 ListWorkersWithQualificationType where
  toJSON :: ListWorkersWithQualificationType -> Value
toJSON ListWorkersWithQualificationType' {Maybe Natural
Maybe Text
Maybe QualificationStatus
Text
qualificationTypeId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
status :: Maybe QualificationStatus
$sel:qualificationTypeId:ListWorkersWithQualificationType' :: ListWorkersWithQualificationType -> Text
$sel:maxResults:ListWorkersWithQualificationType' :: ListWorkersWithQualificationType -> Maybe Natural
$sel:nextToken:ListWorkersWithQualificationType' :: ListWorkersWithQualificationType -> Maybe Text
$sel:status:ListWorkersWithQualificationType' :: ListWorkersWithQualificationType -> Maybe QualificationStatus
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Status" Text -> QualificationStatus -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (QualificationStatus -> Pair)
-> Maybe QualificationStatus -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe QualificationStatus
status,
            (Text
"NextToken" 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
nextToken,
            (Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            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 ListWorkersWithQualificationType where
  toPath :: ListWorkersWithQualificationType -> ByteString
toPath = ByteString -> ListWorkersWithQualificationType -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance
  Core.ToQuery
    ListWorkersWithQualificationType
  where
  toQuery :: ListWorkersWithQualificationType -> QueryString
toQuery = QueryString -> ListWorkersWithQualificationType -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newListWorkersWithQualificationTypeResponse' smart constructor.
data ListWorkersWithQualificationTypeResponse = ListWorkersWithQualificationTypeResponse'
  { ListWorkersWithQualificationTypeResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The number of Qualifications on this page in the filtered results list,
    -- equivalent to the number of Qualifications being returned by this call.
    ListWorkersWithQualificationTypeResponse -> Maybe Int
numResults :: Prelude.Maybe Prelude.Int,
    -- | The list of Qualification elements returned by this call.
    ListWorkersWithQualificationTypeResponse -> Maybe [Qualification]
qualifications :: Prelude.Maybe [Qualification],
    -- | The response's http status code.
    ListWorkersWithQualificationTypeResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListWorkersWithQualificationTypeResponse
-> ListWorkersWithQualificationTypeResponse -> Bool
(ListWorkersWithQualificationTypeResponse
 -> ListWorkersWithQualificationTypeResponse -> Bool)
-> (ListWorkersWithQualificationTypeResponse
    -> ListWorkersWithQualificationTypeResponse -> Bool)
-> Eq ListWorkersWithQualificationTypeResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListWorkersWithQualificationTypeResponse
-> ListWorkersWithQualificationTypeResponse -> Bool
$c/= :: ListWorkersWithQualificationTypeResponse
-> ListWorkersWithQualificationTypeResponse -> Bool
== :: ListWorkersWithQualificationTypeResponse
-> ListWorkersWithQualificationTypeResponse -> Bool
$c== :: ListWorkersWithQualificationTypeResponse
-> ListWorkersWithQualificationTypeResponse -> Bool
Prelude.Eq, ReadPrec [ListWorkersWithQualificationTypeResponse]
ReadPrec ListWorkersWithQualificationTypeResponse
Int -> ReadS ListWorkersWithQualificationTypeResponse
ReadS [ListWorkersWithQualificationTypeResponse]
(Int -> ReadS ListWorkersWithQualificationTypeResponse)
-> ReadS [ListWorkersWithQualificationTypeResponse]
-> ReadPrec ListWorkersWithQualificationTypeResponse
-> ReadPrec [ListWorkersWithQualificationTypeResponse]
-> Read ListWorkersWithQualificationTypeResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListWorkersWithQualificationTypeResponse]
$creadListPrec :: ReadPrec [ListWorkersWithQualificationTypeResponse]
readPrec :: ReadPrec ListWorkersWithQualificationTypeResponse
$creadPrec :: ReadPrec ListWorkersWithQualificationTypeResponse
readList :: ReadS [ListWorkersWithQualificationTypeResponse]
$creadList :: ReadS [ListWorkersWithQualificationTypeResponse]
readsPrec :: Int -> ReadS ListWorkersWithQualificationTypeResponse
$creadsPrec :: Int -> ReadS ListWorkersWithQualificationTypeResponse
Prelude.Read, Int -> ListWorkersWithQualificationTypeResponse -> ShowS
[ListWorkersWithQualificationTypeResponse] -> ShowS
ListWorkersWithQualificationTypeResponse -> String
(Int -> ListWorkersWithQualificationTypeResponse -> ShowS)
-> (ListWorkersWithQualificationTypeResponse -> String)
-> ([ListWorkersWithQualificationTypeResponse] -> ShowS)
-> Show ListWorkersWithQualificationTypeResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListWorkersWithQualificationTypeResponse] -> ShowS
$cshowList :: [ListWorkersWithQualificationTypeResponse] -> ShowS
show :: ListWorkersWithQualificationTypeResponse -> String
$cshow :: ListWorkersWithQualificationTypeResponse -> String
showsPrec :: Int -> ListWorkersWithQualificationTypeResponse -> ShowS
$cshowsPrec :: Int -> ListWorkersWithQualificationTypeResponse -> ShowS
Prelude.Show, (forall x.
 ListWorkersWithQualificationTypeResponse
 -> Rep ListWorkersWithQualificationTypeResponse x)
-> (forall x.
    Rep ListWorkersWithQualificationTypeResponse x
    -> ListWorkersWithQualificationTypeResponse)
-> Generic ListWorkersWithQualificationTypeResponse
forall x.
Rep ListWorkersWithQualificationTypeResponse x
-> ListWorkersWithQualificationTypeResponse
forall x.
ListWorkersWithQualificationTypeResponse
-> Rep ListWorkersWithQualificationTypeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListWorkersWithQualificationTypeResponse x
-> ListWorkersWithQualificationTypeResponse
$cfrom :: forall x.
ListWorkersWithQualificationTypeResponse
-> Rep ListWorkersWithQualificationTypeResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListWorkersWithQualificationTypeResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'nextToken', 'listWorkersWithQualificationTypeResponse_nextToken' - Undocumented member.
--
-- 'numResults', 'listWorkersWithQualificationTypeResponse_numResults' - The number of Qualifications on this page in the filtered results list,
-- equivalent to the number of Qualifications being returned by this call.
--
-- 'qualifications', 'listWorkersWithQualificationTypeResponse_qualifications' - The list of Qualification elements returned by this call.
--
-- 'httpStatus', 'listWorkersWithQualificationTypeResponse_httpStatus' - The response's http status code.
newListWorkersWithQualificationTypeResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListWorkersWithQualificationTypeResponse
newListWorkersWithQualificationTypeResponse :: Int -> ListWorkersWithQualificationTypeResponse
newListWorkersWithQualificationTypeResponse
  Int
pHttpStatus_ =
    ListWorkersWithQualificationTypeResponse' :: Maybe Text
-> Maybe Int
-> Maybe [Qualification]
-> Int
-> ListWorkersWithQualificationTypeResponse
ListWorkersWithQualificationTypeResponse'
      { $sel:nextToken:ListWorkersWithQualificationTypeResponse' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:numResults:ListWorkersWithQualificationTypeResponse' :: Maybe Int
numResults = Maybe Int
forall a. Maybe a
Prelude.Nothing,
        $sel:qualifications:ListWorkersWithQualificationTypeResponse' :: Maybe [Qualification]
qualifications = Maybe [Qualification]
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:ListWorkersWithQualificationTypeResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | Undocumented member.
listWorkersWithQualificationTypeResponse_nextToken :: Lens.Lens' ListWorkersWithQualificationTypeResponse (Prelude.Maybe Prelude.Text)
listWorkersWithQualificationTypeResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListWorkersWithQualificationTypeResponse
-> f ListWorkersWithQualificationTypeResponse
listWorkersWithQualificationTypeResponse_nextToken = (ListWorkersWithQualificationTypeResponse -> Maybe Text)
-> (ListWorkersWithQualificationTypeResponse
    -> Maybe Text -> ListWorkersWithQualificationTypeResponse)
-> Lens' ListWorkersWithQualificationTypeResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWorkersWithQualificationTypeResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListWorkersWithQualificationTypeResponse' :: ListWorkersWithQualificationTypeResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListWorkersWithQualificationTypeResponse
s@ListWorkersWithQualificationTypeResponse' {} Maybe Text
a -> ListWorkersWithQualificationTypeResponse
s {$sel:nextToken:ListWorkersWithQualificationTypeResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListWorkersWithQualificationTypeResponse)

-- | The number of Qualifications on this page in the filtered results list,
-- equivalent to the number of Qualifications being returned by this call.
listWorkersWithQualificationTypeResponse_numResults :: Lens.Lens' ListWorkersWithQualificationTypeResponse (Prelude.Maybe Prelude.Int)
listWorkersWithQualificationTypeResponse_numResults :: (Maybe Int -> f (Maybe Int))
-> ListWorkersWithQualificationTypeResponse
-> f ListWorkersWithQualificationTypeResponse
listWorkersWithQualificationTypeResponse_numResults = (ListWorkersWithQualificationTypeResponse -> Maybe Int)
-> (ListWorkersWithQualificationTypeResponse
    -> Maybe Int -> ListWorkersWithQualificationTypeResponse)
-> Lens
     ListWorkersWithQualificationTypeResponse
     ListWorkersWithQualificationTypeResponse
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWorkersWithQualificationTypeResponse' {Maybe Int
numResults :: Maybe Int
$sel:numResults:ListWorkersWithQualificationTypeResponse' :: ListWorkersWithQualificationTypeResponse -> Maybe Int
numResults} -> Maybe Int
numResults) (\s :: ListWorkersWithQualificationTypeResponse
s@ListWorkersWithQualificationTypeResponse' {} Maybe Int
a -> ListWorkersWithQualificationTypeResponse
s {$sel:numResults:ListWorkersWithQualificationTypeResponse' :: Maybe Int
numResults = Maybe Int
a} :: ListWorkersWithQualificationTypeResponse)

-- | The list of Qualification elements returned by this call.
listWorkersWithQualificationTypeResponse_qualifications :: Lens.Lens' ListWorkersWithQualificationTypeResponse (Prelude.Maybe [Qualification])
listWorkersWithQualificationTypeResponse_qualifications :: (Maybe [Qualification] -> f (Maybe [Qualification]))
-> ListWorkersWithQualificationTypeResponse
-> f ListWorkersWithQualificationTypeResponse
listWorkersWithQualificationTypeResponse_qualifications = (ListWorkersWithQualificationTypeResponse -> Maybe [Qualification])
-> (ListWorkersWithQualificationTypeResponse
    -> Maybe [Qualification]
    -> ListWorkersWithQualificationTypeResponse)
-> Lens'
     ListWorkersWithQualificationTypeResponse (Maybe [Qualification])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWorkersWithQualificationTypeResponse' {Maybe [Qualification]
qualifications :: Maybe [Qualification]
$sel:qualifications:ListWorkersWithQualificationTypeResponse' :: ListWorkersWithQualificationTypeResponse -> Maybe [Qualification]
qualifications} -> Maybe [Qualification]
qualifications) (\s :: ListWorkersWithQualificationTypeResponse
s@ListWorkersWithQualificationTypeResponse' {} Maybe [Qualification]
a -> ListWorkersWithQualificationTypeResponse
s {$sel:qualifications:ListWorkersWithQualificationTypeResponse' :: Maybe [Qualification]
qualifications = Maybe [Qualification]
a} :: ListWorkersWithQualificationTypeResponse) ((Maybe [Qualification] -> f (Maybe [Qualification]))
 -> ListWorkersWithQualificationTypeResponse
 -> f ListWorkersWithQualificationTypeResponse)
-> ((Maybe [Qualification] -> f (Maybe [Qualification]))
    -> Maybe [Qualification] -> f (Maybe [Qualification]))
-> (Maybe [Qualification] -> f (Maybe [Qualification]))
-> ListWorkersWithQualificationTypeResponse
-> f ListWorkersWithQualificationTypeResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [Qualification] [Qualification] [Qualification] [Qualification]
-> Iso
     (Maybe [Qualification])
     (Maybe [Qualification])
     (Maybe [Qualification])
     (Maybe [Qualification])
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
  [Qualification] [Qualification] [Qualification] [Qualification]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The response's http status code.
listWorkersWithQualificationTypeResponse_httpStatus :: Lens.Lens' ListWorkersWithQualificationTypeResponse Prelude.Int
listWorkersWithQualificationTypeResponse_httpStatus :: (Int -> f Int)
-> ListWorkersWithQualificationTypeResponse
-> f ListWorkersWithQualificationTypeResponse
listWorkersWithQualificationTypeResponse_httpStatus = (ListWorkersWithQualificationTypeResponse -> Int)
-> (ListWorkersWithQualificationTypeResponse
    -> Int -> ListWorkersWithQualificationTypeResponse)
-> Lens
     ListWorkersWithQualificationTypeResponse
     ListWorkersWithQualificationTypeResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWorkersWithQualificationTypeResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListWorkersWithQualificationTypeResponse' :: ListWorkersWithQualificationTypeResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListWorkersWithQualificationTypeResponse
s@ListWorkersWithQualificationTypeResponse' {} Int
a -> ListWorkersWithQualificationTypeResponse
s {$sel:httpStatus:ListWorkersWithQualificationTypeResponse' :: Int
httpStatus = Int
a} :: ListWorkersWithQualificationTypeResponse)

instance
  Prelude.NFData
    ListWorkersWithQualificationTypeResponse