{-# 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.ListBonusPayments
-- 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 @ListBonusPayments@ operation retrieves the amounts of bonuses you
-- have paid to Workers for a given HIT or assignment.
--
-- This operation returns paginated results.
module Amazonka.MechanicalTurk.ListBonusPayments
  ( -- * Creating a Request
    ListBonusPayments (..),
    newListBonusPayments,

    -- * Request Lenses
    listBonusPayments_nextToken,
    listBonusPayments_hITId,
    listBonusPayments_assignmentId,
    listBonusPayments_maxResults,

    -- * Destructuring the Response
    ListBonusPaymentsResponse (..),
    newListBonusPaymentsResponse,

    -- * Response Lenses
    listBonusPaymentsResponse_bonusPayments,
    listBonusPaymentsResponse_nextToken,
    listBonusPaymentsResponse_numResults,
    listBonusPaymentsResponse_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:/ 'newListBonusPayments' smart constructor.
data ListBonusPayments = ListBonusPayments'
  { -- | Pagination token
    ListBonusPayments -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The ID of the HIT associated with the bonus payments to retrieve. If not
    -- specified, all bonus payments for all assignments for the given HIT are
    -- returned. Either the HITId parameter or the AssignmentId parameter must
    -- be specified
    ListBonusPayments -> Maybe Text
hITId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the assignment associated with the bonus payments to retrieve.
    -- If specified, only bonus payments for the given assignment are returned.
    -- Either the HITId parameter or the AssignmentId parameter must be
    -- specified
    ListBonusPayments -> Maybe Text
assignmentId :: Prelude.Maybe Prelude.Text,
    ListBonusPayments -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListBonusPayments -> ListBonusPayments -> Bool
(ListBonusPayments -> ListBonusPayments -> Bool)
-> (ListBonusPayments -> ListBonusPayments -> Bool)
-> Eq ListBonusPayments
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListBonusPayments -> ListBonusPayments -> Bool
$c/= :: ListBonusPayments -> ListBonusPayments -> Bool
== :: ListBonusPayments -> ListBonusPayments -> Bool
$c== :: ListBonusPayments -> ListBonusPayments -> Bool
Prelude.Eq, ReadPrec [ListBonusPayments]
ReadPrec ListBonusPayments
Int -> ReadS ListBonusPayments
ReadS [ListBonusPayments]
(Int -> ReadS ListBonusPayments)
-> ReadS [ListBonusPayments]
-> ReadPrec ListBonusPayments
-> ReadPrec [ListBonusPayments]
-> Read ListBonusPayments
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListBonusPayments]
$creadListPrec :: ReadPrec [ListBonusPayments]
readPrec :: ReadPrec ListBonusPayments
$creadPrec :: ReadPrec ListBonusPayments
readList :: ReadS [ListBonusPayments]
$creadList :: ReadS [ListBonusPayments]
readsPrec :: Int -> ReadS ListBonusPayments
$creadsPrec :: Int -> ReadS ListBonusPayments
Prelude.Read, Int -> ListBonusPayments -> ShowS
[ListBonusPayments] -> ShowS
ListBonusPayments -> String
(Int -> ListBonusPayments -> ShowS)
-> (ListBonusPayments -> String)
-> ([ListBonusPayments] -> ShowS)
-> Show ListBonusPayments
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListBonusPayments] -> ShowS
$cshowList :: [ListBonusPayments] -> ShowS
show :: ListBonusPayments -> String
$cshow :: ListBonusPayments -> String
showsPrec :: Int -> ListBonusPayments -> ShowS
$cshowsPrec :: Int -> ListBonusPayments -> ShowS
Prelude.Show, (forall x. ListBonusPayments -> Rep ListBonusPayments x)
-> (forall x. Rep ListBonusPayments x -> ListBonusPayments)
-> Generic ListBonusPayments
forall x. Rep ListBonusPayments x -> ListBonusPayments
forall x. ListBonusPayments -> Rep ListBonusPayments x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListBonusPayments x -> ListBonusPayments
$cfrom :: forall x. ListBonusPayments -> Rep ListBonusPayments x
Prelude.Generic)

-- |
-- Create a value of 'ListBonusPayments' 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', 'listBonusPayments_nextToken' - Pagination token
--
-- 'hITId', 'listBonusPayments_hITId' - The ID of the HIT associated with the bonus payments to retrieve. If not
-- specified, all bonus payments for all assignments for the given HIT are
-- returned. Either the HITId parameter or the AssignmentId parameter must
-- be specified
--
-- 'assignmentId', 'listBonusPayments_assignmentId' - The ID of the assignment associated with the bonus payments to retrieve.
-- If specified, only bonus payments for the given assignment are returned.
-- Either the HITId parameter or the AssignmentId parameter must be
-- specified
--
-- 'maxResults', 'listBonusPayments_maxResults' - Undocumented member.
newListBonusPayments ::
  ListBonusPayments
newListBonusPayments :: ListBonusPayments
newListBonusPayments =
  ListBonusPayments' :: Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Natural -> ListBonusPayments
ListBonusPayments'
    { $sel:nextToken:ListBonusPayments' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:hITId:ListBonusPayments' :: Maybe Text
hITId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:assignmentId:ListBonusPayments' :: Maybe Text
assignmentId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListBonusPayments' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

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

-- | The ID of the HIT associated with the bonus payments to retrieve. If not
-- specified, all bonus payments for all assignments for the given HIT are
-- returned. Either the HITId parameter or the AssignmentId parameter must
-- be specified
listBonusPayments_hITId :: Lens.Lens' ListBonusPayments (Prelude.Maybe Prelude.Text)
listBonusPayments_hITId :: (Maybe Text -> f (Maybe Text))
-> ListBonusPayments -> f ListBonusPayments
listBonusPayments_hITId = (ListBonusPayments -> Maybe Text)
-> (ListBonusPayments -> Maybe Text -> ListBonusPayments)
-> Lens
     ListBonusPayments ListBonusPayments (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBonusPayments' {Maybe Text
hITId :: Maybe Text
$sel:hITId:ListBonusPayments' :: ListBonusPayments -> Maybe Text
hITId} -> Maybe Text
hITId) (\s :: ListBonusPayments
s@ListBonusPayments' {} Maybe Text
a -> ListBonusPayments
s {$sel:hITId:ListBonusPayments' :: Maybe Text
hITId = Maybe Text
a} :: ListBonusPayments)

-- | The ID of the assignment associated with the bonus payments to retrieve.
-- If specified, only bonus payments for the given assignment are returned.
-- Either the HITId parameter or the AssignmentId parameter must be
-- specified
listBonusPayments_assignmentId :: Lens.Lens' ListBonusPayments (Prelude.Maybe Prelude.Text)
listBonusPayments_assignmentId :: (Maybe Text -> f (Maybe Text))
-> ListBonusPayments -> f ListBonusPayments
listBonusPayments_assignmentId = (ListBonusPayments -> Maybe Text)
-> (ListBonusPayments -> Maybe Text -> ListBonusPayments)
-> Lens
     ListBonusPayments ListBonusPayments (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBonusPayments' {Maybe Text
assignmentId :: Maybe Text
$sel:assignmentId:ListBonusPayments' :: ListBonusPayments -> Maybe Text
assignmentId} -> Maybe Text
assignmentId) (\s :: ListBonusPayments
s@ListBonusPayments' {} Maybe Text
a -> ListBonusPayments
s {$sel:assignmentId:ListBonusPayments' :: Maybe Text
assignmentId = Maybe Text
a} :: ListBonusPayments)

-- | Undocumented member.
listBonusPayments_maxResults :: Lens.Lens' ListBonusPayments (Prelude.Maybe Prelude.Natural)
listBonusPayments_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListBonusPayments -> f ListBonusPayments
listBonusPayments_maxResults = (ListBonusPayments -> Maybe Natural)
-> (ListBonusPayments -> Maybe Natural -> ListBonusPayments)
-> Lens
     ListBonusPayments ListBonusPayments (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBonusPayments' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListBonusPayments' :: ListBonusPayments -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListBonusPayments
s@ListBonusPayments' {} Maybe Natural
a -> ListBonusPayments
s {$sel:maxResults:ListBonusPayments' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListBonusPayments)

instance Core.AWSPager ListBonusPayments where
  page :: ListBonusPayments
-> AWSResponse ListBonusPayments -> Maybe ListBonusPayments
page ListBonusPayments
rq AWSResponse ListBonusPayments
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListBonusPayments
ListBonusPaymentsResponse
rs
            ListBonusPaymentsResponse
-> Getting (First Text) ListBonusPaymentsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListBonusPaymentsResponse
-> Const (First Text) ListBonusPaymentsResponse
Lens' ListBonusPaymentsResponse (Maybe Text)
listBonusPaymentsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListBonusPaymentsResponse
 -> Const (First Text) ListBonusPaymentsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListBonusPaymentsResponse 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 ListBonusPayments
forall a. Maybe a
Prelude.Nothing
    | Maybe [BonusPayment] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListBonusPayments
ListBonusPaymentsResponse
rs
            ListBonusPaymentsResponse
-> Getting
     (First [BonusPayment]) ListBonusPaymentsResponse [BonusPayment]
-> Maybe [BonusPayment]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [BonusPayment]
 -> Const (First [BonusPayment]) (Maybe [BonusPayment]))
-> ListBonusPaymentsResponse
-> Const (First [BonusPayment]) ListBonusPaymentsResponse
Lens' ListBonusPaymentsResponse (Maybe [BonusPayment])
listBonusPaymentsResponse_bonusPayments
              ((Maybe [BonusPayment]
  -> Const (First [BonusPayment]) (Maybe [BonusPayment]))
 -> ListBonusPaymentsResponse
 -> Const (First [BonusPayment]) ListBonusPaymentsResponse)
-> (([BonusPayment] -> Const (First [BonusPayment]) [BonusPayment])
    -> Maybe [BonusPayment]
    -> Const (First [BonusPayment]) (Maybe [BonusPayment]))
-> Getting
     (First [BonusPayment]) ListBonusPaymentsResponse [BonusPayment]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([BonusPayment] -> Const (First [BonusPayment]) [BonusPayment])
-> Maybe [BonusPayment]
-> Const (First [BonusPayment]) (Maybe [BonusPayment])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListBonusPayments
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListBonusPayments -> Maybe ListBonusPayments
forall a. a -> Maybe a
Prelude.Just (ListBonusPayments -> Maybe ListBonusPayments)
-> ListBonusPayments -> Maybe ListBonusPayments
forall a b. (a -> b) -> a -> b
Prelude.$
        ListBonusPayments
rq
          ListBonusPayments
-> (ListBonusPayments -> ListBonusPayments) -> ListBonusPayments
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListBonusPayments -> Identity ListBonusPayments
Lens ListBonusPayments ListBonusPayments (Maybe Text) (Maybe Text)
listBonusPayments_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListBonusPayments -> Identity ListBonusPayments)
-> Maybe Text -> ListBonusPayments -> ListBonusPayments
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListBonusPayments
ListBonusPaymentsResponse
rs
          ListBonusPaymentsResponse
-> Getting (First Text) ListBonusPaymentsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListBonusPaymentsResponse
-> Const (First Text) ListBonusPaymentsResponse
Lens' ListBonusPaymentsResponse (Maybe Text)
listBonusPaymentsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListBonusPaymentsResponse
 -> Const (First Text) ListBonusPaymentsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListBonusPaymentsResponse 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 ListBonusPayments where
  type
    AWSResponse ListBonusPayments =
      ListBonusPaymentsResponse
  request :: ListBonusPayments -> Request ListBonusPayments
request = Service -> ListBonusPayments -> Request ListBonusPayments
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListBonusPayments
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListBonusPayments)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListBonusPayments))
-> Logger
-> Service
-> Proxy ListBonusPayments
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListBonusPayments)))
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 [BonusPayment]
-> Maybe Text -> Maybe Int -> Int -> ListBonusPaymentsResponse
ListBonusPaymentsResponse'
            (Maybe [BonusPayment]
 -> Maybe Text -> Maybe Int -> Int -> ListBonusPaymentsResponse)
-> Either String (Maybe [BonusPayment])
-> Either
     String
     (Maybe Text -> Maybe Int -> Int -> ListBonusPaymentsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [BonusPayment]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"BonusPayments" Either String (Maybe (Maybe [BonusPayment]))
-> Maybe [BonusPayment] -> Either String (Maybe [BonusPayment])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [BonusPayment]
forall a. Monoid a => a
Prelude.mempty)
            Either
  String
  (Maybe Text -> Maybe Int -> Int -> ListBonusPaymentsResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Int -> Int -> ListBonusPaymentsResponse)
forall (f :: * -> *) a b. Applicative f => 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 -> Int -> ListBonusPaymentsResponse)
-> Either String (Maybe Int)
-> Either String (Int -> ListBonusPaymentsResponse)
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 (Int -> ListBonusPaymentsResponse)
-> Either String Int -> Either String ListBonusPaymentsResponse
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 ListBonusPayments

instance Prelude.NFData ListBonusPayments

instance Core.ToHeaders ListBonusPayments where
  toHeaders :: ListBonusPayments -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListBonusPayments -> 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.ListBonusPayments" ::
                          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 ListBonusPayments where
  toJSON :: ListBonusPayments -> Value
toJSON ListBonusPayments' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
assignmentId :: Maybe Text
hITId :: Maybe Text
nextToken :: Maybe Text
$sel:maxResults:ListBonusPayments' :: ListBonusPayments -> Maybe Natural
$sel:assignmentId:ListBonusPayments' :: ListBonusPayments -> Maybe Text
$sel:hITId:ListBonusPayments' :: ListBonusPayments -> Maybe Text
$sel:nextToken:ListBonusPayments' :: ListBonusPayments -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (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
"HITId" 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
hITId,
            (Text
"AssignmentId" 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
assignmentId,
            (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
          ]
      )

instance Core.ToPath ListBonusPayments where
  toPath :: ListBonusPayments -> ByteString
toPath = ByteString -> ListBonusPayments -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

-- |
-- Create a value of 'ListBonusPaymentsResponse' 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:
--
-- 'bonusPayments', 'listBonusPaymentsResponse_bonusPayments' - A successful request to the ListBonusPayments operation returns a list
-- of BonusPayment objects.
--
-- 'nextToken', 'listBonusPaymentsResponse_nextToken' - Undocumented member.
--
-- 'numResults', 'listBonusPaymentsResponse_numResults' - The number of bonus payments on this page in the filtered results list,
-- equivalent to the number of bonus payments being returned by this call.
--
-- 'httpStatus', 'listBonusPaymentsResponse_httpStatus' - The response's http status code.
newListBonusPaymentsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListBonusPaymentsResponse
newListBonusPaymentsResponse :: Int -> ListBonusPaymentsResponse
newListBonusPaymentsResponse Int
pHttpStatus_ =
  ListBonusPaymentsResponse' :: Maybe [BonusPayment]
-> Maybe Text -> Maybe Int -> Int -> ListBonusPaymentsResponse
ListBonusPaymentsResponse'
    { $sel:bonusPayments:ListBonusPaymentsResponse' :: Maybe [BonusPayment]
bonusPayments =
        Maybe [BonusPayment]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListBonusPaymentsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:numResults:ListBonusPaymentsResponse' :: Maybe Int
numResults = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListBonusPaymentsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A successful request to the ListBonusPayments operation returns a list
-- of BonusPayment objects.
listBonusPaymentsResponse_bonusPayments :: Lens.Lens' ListBonusPaymentsResponse (Prelude.Maybe [BonusPayment])
listBonusPaymentsResponse_bonusPayments :: (Maybe [BonusPayment] -> f (Maybe [BonusPayment]))
-> ListBonusPaymentsResponse -> f ListBonusPaymentsResponse
listBonusPaymentsResponse_bonusPayments = (ListBonusPaymentsResponse -> Maybe [BonusPayment])
-> (ListBonusPaymentsResponse
    -> Maybe [BonusPayment] -> ListBonusPaymentsResponse)
-> Lens' ListBonusPaymentsResponse (Maybe [BonusPayment])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBonusPaymentsResponse' {Maybe [BonusPayment]
bonusPayments :: Maybe [BonusPayment]
$sel:bonusPayments:ListBonusPaymentsResponse' :: ListBonusPaymentsResponse -> Maybe [BonusPayment]
bonusPayments} -> Maybe [BonusPayment]
bonusPayments) (\s :: ListBonusPaymentsResponse
s@ListBonusPaymentsResponse' {} Maybe [BonusPayment]
a -> ListBonusPaymentsResponse
s {$sel:bonusPayments:ListBonusPaymentsResponse' :: Maybe [BonusPayment]
bonusPayments = Maybe [BonusPayment]
a} :: ListBonusPaymentsResponse) ((Maybe [BonusPayment] -> f (Maybe [BonusPayment]))
 -> ListBonusPaymentsResponse -> f ListBonusPaymentsResponse)
-> ((Maybe [BonusPayment] -> f (Maybe [BonusPayment]))
    -> Maybe [BonusPayment] -> f (Maybe [BonusPayment]))
-> (Maybe [BonusPayment] -> f (Maybe [BonusPayment]))
-> ListBonusPaymentsResponse
-> f ListBonusPaymentsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [BonusPayment] [BonusPayment] [BonusPayment] [BonusPayment]
-> Iso
     (Maybe [BonusPayment])
     (Maybe [BonusPayment])
     (Maybe [BonusPayment])
     (Maybe [BonusPayment])
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 [BonusPayment] [BonusPayment] [BonusPayment] [BonusPayment]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

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

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

instance Prelude.NFData ListBonusPaymentsResponse