{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

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

-- |
-- Module      : Amazonka.QLDBSession.Types.FetchPageRequest
-- 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)
module Amazonka.QLDBSession.Types.FetchPageRequest where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Specifies the details of the page to be fetched.
--
-- /See:/ 'newFetchPageRequest' smart constructor.
data FetchPageRequest = FetchPageRequest'
  { -- | Specifies the transaction ID of the page to be fetched.
    FetchPageRequest -> Text
transactionId :: Prelude.Text,
    -- | Specifies the next page token of the page to be fetched.
    FetchPageRequest -> Text
nextPageToken :: Prelude.Text
  }
  deriving (FetchPageRequest -> FetchPageRequest -> Bool
(FetchPageRequest -> FetchPageRequest -> Bool)
-> (FetchPageRequest -> FetchPageRequest -> Bool)
-> Eq FetchPageRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FetchPageRequest -> FetchPageRequest -> Bool
$c/= :: FetchPageRequest -> FetchPageRequest -> Bool
== :: FetchPageRequest -> FetchPageRequest -> Bool
$c== :: FetchPageRequest -> FetchPageRequest -> Bool
Prelude.Eq, ReadPrec [FetchPageRequest]
ReadPrec FetchPageRequest
Int -> ReadS FetchPageRequest
ReadS [FetchPageRequest]
(Int -> ReadS FetchPageRequest)
-> ReadS [FetchPageRequest]
-> ReadPrec FetchPageRequest
-> ReadPrec [FetchPageRequest]
-> Read FetchPageRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FetchPageRequest]
$creadListPrec :: ReadPrec [FetchPageRequest]
readPrec :: ReadPrec FetchPageRequest
$creadPrec :: ReadPrec FetchPageRequest
readList :: ReadS [FetchPageRequest]
$creadList :: ReadS [FetchPageRequest]
readsPrec :: Int -> ReadS FetchPageRequest
$creadsPrec :: Int -> ReadS FetchPageRequest
Prelude.Read, Int -> FetchPageRequest -> ShowS
[FetchPageRequest] -> ShowS
FetchPageRequest -> String
(Int -> FetchPageRequest -> ShowS)
-> (FetchPageRequest -> String)
-> ([FetchPageRequest] -> ShowS)
-> Show FetchPageRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FetchPageRequest] -> ShowS
$cshowList :: [FetchPageRequest] -> ShowS
show :: FetchPageRequest -> String
$cshow :: FetchPageRequest -> String
showsPrec :: Int -> FetchPageRequest -> ShowS
$cshowsPrec :: Int -> FetchPageRequest -> ShowS
Prelude.Show, (forall x. FetchPageRequest -> Rep FetchPageRequest x)
-> (forall x. Rep FetchPageRequest x -> FetchPageRequest)
-> Generic FetchPageRequest
forall x. Rep FetchPageRequest x -> FetchPageRequest
forall x. FetchPageRequest -> Rep FetchPageRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FetchPageRequest x -> FetchPageRequest
$cfrom :: forall x. FetchPageRequest -> Rep FetchPageRequest x
Prelude.Generic)

-- |
-- Create a value of 'FetchPageRequest' 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:
--
-- 'transactionId', 'fetchPageRequest_transactionId' - Specifies the transaction ID of the page to be fetched.
--
-- 'nextPageToken', 'fetchPageRequest_nextPageToken' - Specifies the next page token of the page to be fetched.
newFetchPageRequest ::
  -- | 'transactionId'
  Prelude.Text ->
  -- | 'nextPageToken'
  Prelude.Text ->
  FetchPageRequest
newFetchPageRequest :: Text -> Text -> FetchPageRequest
newFetchPageRequest Text
pTransactionId_ Text
pNextPageToken_ =
  FetchPageRequest' :: Text -> Text -> FetchPageRequest
FetchPageRequest'
    { $sel:transactionId:FetchPageRequest' :: Text
transactionId = Text
pTransactionId_,
      $sel:nextPageToken:FetchPageRequest' :: Text
nextPageToken = Text
pNextPageToken_
    }

-- | Specifies the transaction ID of the page to be fetched.
fetchPageRequest_transactionId :: Lens.Lens' FetchPageRequest Prelude.Text
fetchPageRequest_transactionId :: (Text -> f Text) -> FetchPageRequest -> f FetchPageRequest
fetchPageRequest_transactionId = (FetchPageRequest -> Text)
-> (FetchPageRequest -> Text -> FetchPageRequest)
-> Lens FetchPageRequest FetchPageRequest Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FetchPageRequest' {Text
transactionId :: Text
$sel:transactionId:FetchPageRequest' :: FetchPageRequest -> Text
transactionId} -> Text
transactionId) (\s :: FetchPageRequest
s@FetchPageRequest' {} Text
a -> FetchPageRequest
s {$sel:transactionId:FetchPageRequest' :: Text
transactionId = Text
a} :: FetchPageRequest)

-- | Specifies the next page token of the page to be fetched.
fetchPageRequest_nextPageToken :: Lens.Lens' FetchPageRequest Prelude.Text
fetchPageRequest_nextPageToken :: (Text -> f Text) -> FetchPageRequest -> f FetchPageRequest
fetchPageRequest_nextPageToken = (FetchPageRequest -> Text)
-> (FetchPageRequest -> Text -> FetchPageRequest)
-> Lens FetchPageRequest FetchPageRequest Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FetchPageRequest' {Text
nextPageToken :: Text
$sel:nextPageToken:FetchPageRequest' :: FetchPageRequest -> Text
nextPageToken} -> Text
nextPageToken) (\s :: FetchPageRequest
s@FetchPageRequest' {} Text
a -> FetchPageRequest
s {$sel:nextPageToken:FetchPageRequest' :: Text
nextPageToken = Text
a} :: FetchPageRequest)

instance Prelude.Hashable FetchPageRequest

instance Prelude.NFData FetchPageRequest

instance Core.ToJSON FetchPageRequest where
  toJSON :: FetchPageRequest -> Value
toJSON FetchPageRequest' {Text
nextPageToken :: Text
transactionId :: Text
$sel:nextPageToken:FetchPageRequest' :: FetchPageRequest -> Text
$sel:transactionId:FetchPageRequest' :: FetchPageRequest -> 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
"TransactionId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
transactionId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"NextPageToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
nextPageToken)
          ]
      )