{-# 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.HoneyCode.GetScreenData
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- The GetScreenData API allows retrieval of data from a screen in a
-- Honeycode app. The API allows setting local variables in the screen to
-- filter, sort or otherwise affect what will be displayed on the screen.
module Amazonka.HoneyCode.GetScreenData
  ( -- * Creating a Request
    GetScreenData (..),
    newGetScreenData,

    -- * Request Lenses
    getScreenData_maxResults,
    getScreenData_nextToken,
    getScreenData_variables,
    getScreenData_workbookId,
    getScreenData_appId,
    getScreenData_screenId,

    -- * Destructuring the Response
    GetScreenDataResponse (..),
    newGetScreenDataResponse,

    -- * Response Lenses
    getScreenDataResponse_nextToken,
    getScreenDataResponse_httpStatus,
    getScreenDataResponse_results,
    getScreenDataResponse_workbookCursor,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.HoneyCode.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newGetScreenData' smart constructor.
data GetScreenData = GetScreenData'
  { -- | The number of results to be returned on a single page. Specify a number
    -- between 1 and 100. The maximum value is 100.
    --
    -- This parameter is optional. If you don\'t specify this parameter, the
    -- default page size is 100.
    GetScreenData -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | This parameter is optional. If a nextToken is not specified, the API
    -- returns the first page of data.
    --
    -- Pagination tokens expire after 1 hour. If you use a token that was
    -- returned more than an hour back, the API will throw ValidationException.
    GetScreenData -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Variables are optional and are needed only if the screen requires them
    -- to render correctly. Variables are specified as a map where the key is
    -- the name of the variable as defined on the screen. The value is an
    -- object which currently has only one property, rawValue, which holds the
    -- value of the variable to be passed to the screen.
    GetScreenData
-> Maybe (Sensitive (HashMap Text (Sensitive VariableValue)))
variables :: Prelude.Maybe (Data.Sensitive (Prelude.HashMap Prelude.Text (Data.Sensitive VariableValue))),
    -- | The ID of the workbook that contains the screen.
    GetScreenData -> Text
workbookId :: Prelude.Text,
    -- | The ID of the app that contains the screen.
    GetScreenData -> Text
appId :: Prelude.Text,
    -- | The ID of the screen.
    GetScreenData -> Text
screenId :: Prelude.Text
  }
  deriving (GetScreenData -> GetScreenData -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetScreenData -> GetScreenData -> Bool
$c/= :: GetScreenData -> GetScreenData -> Bool
== :: GetScreenData -> GetScreenData -> Bool
$c== :: GetScreenData -> GetScreenData -> Bool
Prelude.Eq, Int -> GetScreenData -> ShowS
[GetScreenData] -> ShowS
GetScreenData -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetScreenData] -> ShowS
$cshowList :: [GetScreenData] -> ShowS
show :: GetScreenData -> String
$cshow :: GetScreenData -> String
showsPrec :: Int -> GetScreenData -> ShowS
$cshowsPrec :: Int -> GetScreenData -> ShowS
Prelude.Show, forall x. Rep GetScreenData x -> GetScreenData
forall x. GetScreenData -> Rep GetScreenData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetScreenData x -> GetScreenData
$cfrom :: forall x. GetScreenData -> Rep GetScreenData x
Prelude.Generic)

-- |
-- Create a value of 'GetScreenData' 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:
--
-- 'maxResults', 'getScreenData_maxResults' - The number of results to be returned on a single page. Specify a number
-- between 1 and 100. The maximum value is 100.
--
-- This parameter is optional. If you don\'t specify this parameter, the
-- default page size is 100.
--
-- 'nextToken', 'getScreenData_nextToken' - This parameter is optional. If a nextToken is not specified, the API
-- returns the first page of data.
--
-- Pagination tokens expire after 1 hour. If you use a token that was
-- returned more than an hour back, the API will throw ValidationException.
--
-- 'variables', 'getScreenData_variables' - Variables are optional and are needed only if the screen requires them
-- to render correctly. Variables are specified as a map where the key is
-- the name of the variable as defined on the screen. The value is an
-- object which currently has only one property, rawValue, which holds the
-- value of the variable to be passed to the screen.
--
-- 'workbookId', 'getScreenData_workbookId' - The ID of the workbook that contains the screen.
--
-- 'appId', 'getScreenData_appId' - The ID of the app that contains the screen.
--
-- 'screenId', 'getScreenData_screenId' - The ID of the screen.
newGetScreenData ::
  -- | 'workbookId'
  Prelude.Text ->
  -- | 'appId'
  Prelude.Text ->
  -- | 'screenId'
  Prelude.Text ->
  GetScreenData
newGetScreenData :: Text -> Text -> Text -> GetScreenData
newGetScreenData Text
pWorkbookId_ Text
pAppId_ Text
pScreenId_ =
  GetScreenData'
    { $sel:maxResults:GetScreenData' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetScreenData' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:variables:GetScreenData' :: Maybe (Sensitive (HashMap Text (Sensitive VariableValue)))
variables = forall a. Maybe a
Prelude.Nothing,
      $sel:workbookId:GetScreenData' :: Text
workbookId = Text
pWorkbookId_,
      $sel:appId:GetScreenData' :: Text
appId = Text
pAppId_,
      $sel:screenId:GetScreenData' :: Text
screenId = Text
pScreenId_
    }

-- | The number of results to be returned on a single page. Specify a number
-- between 1 and 100. The maximum value is 100.
--
-- This parameter is optional. If you don\'t specify this parameter, the
-- default page size is 100.
getScreenData_maxResults :: Lens.Lens' GetScreenData (Prelude.Maybe Prelude.Natural)
getScreenData_maxResults :: Lens' GetScreenData (Maybe Natural)
getScreenData_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetScreenData' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetScreenData' :: GetScreenData -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetScreenData
s@GetScreenData' {} Maybe Natural
a -> GetScreenData
s {$sel:maxResults:GetScreenData' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetScreenData)

-- | This parameter is optional. If a nextToken is not specified, the API
-- returns the first page of data.
--
-- Pagination tokens expire after 1 hour. If you use a token that was
-- returned more than an hour back, the API will throw ValidationException.
getScreenData_nextToken :: Lens.Lens' GetScreenData (Prelude.Maybe Prelude.Text)
getScreenData_nextToken :: Lens' GetScreenData (Maybe Text)
getScreenData_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetScreenData' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetScreenData' :: GetScreenData -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetScreenData
s@GetScreenData' {} Maybe Text
a -> GetScreenData
s {$sel:nextToken:GetScreenData' :: Maybe Text
nextToken = Maybe Text
a} :: GetScreenData)

-- | Variables are optional and are needed only if the screen requires them
-- to render correctly. Variables are specified as a map where the key is
-- the name of the variable as defined on the screen. The value is an
-- object which currently has only one property, rawValue, which holds the
-- value of the variable to be passed to the screen.
getScreenData_variables :: Lens.Lens' GetScreenData (Prelude.Maybe (Prelude.HashMap Prelude.Text VariableValue))
getScreenData_variables :: Lens' GetScreenData (Maybe (HashMap Text VariableValue))
getScreenData_variables = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetScreenData' {Maybe (Sensitive (HashMap Text (Sensitive VariableValue)))
variables :: Maybe (Sensitive (HashMap Text (Sensitive VariableValue)))
$sel:variables:GetScreenData' :: GetScreenData
-> Maybe (Sensitive (HashMap Text (Sensitive VariableValue)))
variables} -> Maybe (Sensitive (HashMap Text (Sensitive VariableValue)))
variables) (\s :: GetScreenData
s@GetScreenData' {} Maybe (Sensitive (HashMap Text (Sensitive VariableValue)))
a -> GetScreenData
s {$sel:variables:GetScreenData' :: Maybe (Sensitive (HashMap Text (Sensitive VariableValue)))
variables = Maybe (Sensitive (HashMap Text (Sensitive VariableValue)))
a} :: GetScreenData) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 (forall a. Iso' (Sensitive a) a
Data._Sensitive forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced)

-- | The ID of the workbook that contains the screen.
getScreenData_workbookId :: Lens.Lens' GetScreenData Prelude.Text
getScreenData_workbookId :: Lens' GetScreenData Text
getScreenData_workbookId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetScreenData' {Text
workbookId :: Text
$sel:workbookId:GetScreenData' :: GetScreenData -> Text
workbookId} -> Text
workbookId) (\s :: GetScreenData
s@GetScreenData' {} Text
a -> GetScreenData
s {$sel:workbookId:GetScreenData' :: Text
workbookId = Text
a} :: GetScreenData)

-- | The ID of the app that contains the screen.
getScreenData_appId :: Lens.Lens' GetScreenData Prelude.Text
getScreenData_appId :: Lens' GetScreenData Text
getScreenData_appId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetScreenData' {Text
appId :: Text
$sel:appId:GetScreenData' :: GetScreenData -> Text
appId} -> Text
appId) (\s :: GetScreenData
s@GetScreenData' {} Text
a -> GetScreenData
s {$sel:appId:GetScreenData' :: Text
appId = Text
a} :: GetScreenData)

-- | The ID of the screen.
getScreenData_screenId :: Lens.Lens' GetScreenData Prelude.Text
getScreenData_screenId :: Lens' GetScreenData Text
getScreenData_screenId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetScreenData' {Text
screenId :: Text
$sel:screenId:GetScreenData' :: GetScreenData -> Text
screenId} -> Text
screenId) (\s :: GetScreenData
s@GetScreenData' {} Text
a -> GetScreenData
s {$sel:screenId:GetScreenData' :: Text
screenId = Text
a} :: GetScreenData)

instance Core.AWSRequest GetScreenData where
  type
    AWSResponse GetScreenData =
      GetScreenDataResponse
  request :: (Service -> Service) -> GetScreenData -> Request GetScreenData
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetScreenData
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetScreenData)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Int
-> HashMap Text ResultSet
-> Integer
-> GetScreenDataResponse
GetScreenDataResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"nextToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"results" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"workbookCursor")
      )

instance Prelude.Hashable GetScreenData where
  hashWithSalt :: Int -> GetScreenData -> Int
hashWithSalt Int
_salt GetScreenData' {Maybe Natural
Maybe Text
Maybe (Sensitive (HashMap Text (Sensitive VariableValue)))
Text
screenId :: Text
appId :: Text
workbookId :: Text
variables :: Maybe (Sensitive (HashMap Text (Sensitive VariableValue)))
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:screenId:GetScreenData' :: GetScreenData -> Text
$sel:appId:GetScreenData' :: GetScreenData -> Text
$sel:workbookId:GetScreenData' :: GetScreenData -> Text
$sel:variables:GetScreenData' :: GetScreenData
-> Maybe (Sensitive (HashMap Text (Sensitive VariableValue)))
$sel:nextToken:GetScreenData' :: GetScreenData -> Maybe Text
$sel:maxResults:GetScreenData' :: GetScreenData -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive (HashMap Text (Sensitive VariableValue)))
variables
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
workbookId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
appId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
screenId

instance Prelude.NFData GetScreenData where
  rnf :: GetScreenData -> ()
rnf GetScreenData' {Maybe Natural
Maybe Text
Maybe (Sensitive (HashMap Text (Sensitive VariableValue)))
Text
screenId :: Text
appId :: Text
workbookId :: Text
variables :: Maybe (Sensitive (HashMap Text (Sensitive VariableValue)))
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:screenId:GetScreenData' :: GetScreenData -> Text
$sel:appId:GetScreenData' :: GetScreenData -> Text
$sel:workbookId:GetScreenData' :: GetScreenData -> Text
$sel:variables:GetScreenData' :: GetScreenData
-> Maybe (Sensitive (HashMap Text (Sensitive VariableValue)))
$sel:nextToken:GetScreenData' :: GetScreenData -> Maybe Text
$sel:maxResults:GetScreenData' :: GetScreenData -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive (HashMap Text (Sensitive VariableValue)))
variables
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
workbookId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
appId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
screenId

instance Data.ToHeaders GetScreenData where
  toHeaders :: GetScreenData -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON GetScreenData where
  toJSON :: GetScreenData -> Value
toJSON GetScreenData' {Maybe Natural
Maybe Text
Maybe (Sensitive (HashMap Text (Sensitive VariableValue)))
Text
screenId :: Text
appId :: Text
workbookId :: Text
variables :: Maybe (Sensitive (HashMap Text (Sensitive VariableValue)))
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:screenId:GetScreenData' :: GetScreenData -> Text
$sel:appId:GetScreenData' :: GetScreenData -> Text
$sel:workbookId:GetScreenData' :: GetScreenData -> Text
$sel:variables:GetScreenData' :: GetScreenData
-> Maybe (Sensitive (HashMap Text (Sensitive VariableValue)))
$sel:nextToken:GetScreenData' :: GetScreenData -> Maybe Text
$sel:maxResults:GetScreenData' :: GetScreenData -> Maybe Natural
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"maxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            (Key
"nextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Key
"variables" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive (HashMap Text (Sensitive VariableValue)))
variables,
            forall a. a -> Maybe a
Prelude.Just (Key
"workbookId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
workbookId),
            forall a. a -> Maybe a
Prelude.Just (Key
"appId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
appId),
            forall a. a -> Maybe a
Prelude.Just (Key
"screenId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
screenId)
          ]
      )

instance Data.ToPath GetScreenData where
  toPath :: GetScreenData -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/screendata"

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

-- | /See:/ 'newGetScreenDataResponse' smart constructor.
data GetScreenDataResponse = GetScreenDataResponse'
  { -- | Provides the pagination token to load the next page if there are more
    -- results matching the request. If a pagination token is not present in
    -- the response, it means that all data matching the query has been loaded.
    GetScreenDataResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetScreenDataResponse -> Int
httpStatus :: Prelude.Int,
    -- | A map of all the rows on the screen keyed by block name.
    GetScreenDataResponse -> HashMap Text ResultSet
results :: Prelude.HashMap Prelude.Text ResultSet,
    -- | Indicates the cursor of the workbook at which the data returned by this
    -- workbook is read. Workbook cursor keeps increasing with every update and
    -- the increments are not sequential.
    GetScreenDataResponse -> Integer
workbookCursor :: Prelude.Integer
  }
  deriving (GetScreenDataResponse -> GetScreenDataResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetScreenDataResponse -> GetScreenDataResponse -> Bool
$c/= :: GetScreenDataResponse -> GetScreenDataResponse -> Bool
== :: GetScreenDataResponse -> GetScreenDataResponse -> Bool
$c== :: GetScreenDataResponse -> GetScreenDataResponse -> Bool
Prelude.Eq, Int -> GetScreenDataResponse -> ShowS
[GetScreenDataResponse] -> ShowS
GetScreenDataResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetScreenDataResponse] -> ShowS
$cshowList :: [GetScreenDataResponse] -> ShowS
show :: GetScreenDataResponse -> String
$cshow :: GetScreenDataResponse -> String
showsPrec :: Int -> GetScreenDataResponse -> ShowS
$cshowsPrec :: Int -> GetScreenDataResponse -> ShowS
Prelude.Show, forall x. Rep GetScreenDataResponse x -> GetScreenDataResponse
forall x. GetScreenDataResponse -> Rep GetScreenDataResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetScreenDataResponse x -> GetScreenDataResponse
$cfrom :: forall x. GetScreenDataResponse -> Rep GetScreenDataResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetScreenDataResponse' 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', 'getScreenDataResponse_nextToken' - Provides the pagination token to load the next page if there are more
-- results matching the request. If a pagination token is not present in
-- the response, it means that all data matching the query has been loaded.
--
-- 'httpStatus', 'getScreenDataResponse_httpStatus' - The response's http status code.
--
-- 'results', 'getScreenDataResponse_results' - A map of all the rows on the screen keyed by block name.
--
-- 'workbookCursor', 'getScreenDataResponse_workbookCursor' - Indicates the cursor of the workbook at which the data returned by this
-- workbook is read. Workbook cursor keeps increasing with every update and
-- the increments are not sequential.
newGetScreenDataResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'workbookCursor'
  Prelude.Integer ->
  GetScreenDataResponse
newGetScreenDataResponse :: Int -> Integer -> GetScreenDataResponse
newGetScreenDataResponse
  Int
pHttpStatus_
  Integer
pWorkbookCursor_ =
    GetScreenDataResponse'
      { $sel:nextToken:GetScreenDataResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:GetScreenDataResponse' :: Int
httpStatus = Int
pHttpStatus_,
        $sel:results:GetScreenDataResponse' :: HashMap Text ResultSet
results = forall a. Monoid a => a
Prelude.mempty,
        $sel:workbookCursor:GetScreenDataResponse' :: Integer
workbookCursor = Integer
pWorkbookCursor_
      }

-- | Provides the pagination token to load the next page if there are more
-- results matching the request. If a pagination token is not present in
-- the response, it means that all data matching the query has been loaded.
getScreenDataResponse_nextToken :: Lens.Lens' GetScreenDataResponse (Prelude.Maybe Prelude.Text)
getScreenDataResponse_nextToken :: Lens' GetScreenDataResponse (Maybe Text)
getScreenDataResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetScreenDataResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetScreenDataResponse' :: GetScreenDataResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetScreenDataResponse
s@GetScreenDataResponse' {} Maybe Text
a -> GetScreenDataResponse
s {$sel:nextToken:GetScreenDataResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetScreenDataResponse)

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

-- | A map of all the rows on the screen keyed by block name.
getScreenDataResponse_results :: Lens.Lens' GetScreenDataResponse (Prelude.HashMap Prelude.Text ResultSet)
getScreenDataResponse_results :: Lens' GetScreenDataResponse (HashMap Text ResultSet)
getScreenDataResponse_results = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetScreenDataResponse' {HashMap Text ResultSet
results :: HashMap Text ResultSet
$sel:results:GetScreenDataResponse' :: GetScreenDataResponse -> HashMap Text ResultSet
results} -> HashMap Text ResultSet
results) (\s :: GetScreenDataResponse
s@GetScreenDataResponse' {} HashMap Text ResultSet
a -> GetScreenDataResponse
s {$sel:results:GetScreenDataResponse' :: HashMap Text ResultSet
results = HashMap Text ResultSet
a} :: GetScreenDataResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Indicates the cursor of the workbook at which the data returned by this
-- workbook is read. Workbook cursor keeps increasing with every update and
-- the increments are not sequential.
getScreenDataResponse_workbookCursor :: Lens.Lens' GetScreenDataResponse Prelude.Integer
getScreenDataResponse_workbookCursor :: Lens' GetScreenDataResponse Integer
getScreenDataResponse_workbookCursor = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetScreenDataResponse' {Integer
workbookCursor :: Integer
$sel:workbookCursor:GetScreenDataResponse' :: GetScreenDataResponse -> Integer
workbookCursor} -> Integer
workbookCursor) (\s :: GetScreenDataResponse
s@GetScreenDataResponse' {} Integer
a -> GetScreenDataResponse
s {$sel:workbookCursor:GetScreenDataResponse' :: Integer
workbookCursor = Integer
a} :: GetScreenDataResponse)

instance Prelude.NFData GetScreenDataResponse where
  rnf :: GetScreenDataResponse -> ()
rnf GetScreenDataResponse' {Int
Integer
Maybe Text
HashMap Text ResultSet
workbookCursor :: Integer
results :: HashMap Text ResultSet
httpStatus :: Int
nextToken :: Maybe Text
$sel:workbookCursor:GetScreenDataResponse' :: GetScreenDataResponse -> Integer
$sel:results:GetScreenDataResponse' :: GetScreenDataResponse -> HashMap Text ResultSet
$sel:httpStatus:GetScreenDataResponse' :: GetScreenDataResponse -> Int
$sel:nextToken:GetScreenDataResponse' :: GetScreenDataResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf HashMap Text ResultSet
results
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Integer
workbookCursor