{-# 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-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 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_variables,
    getScreenData_nextToken,
    getScreenData_maxResults,
    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 Amazonka.HoneyCode.Types
import qualified Amazonka.Lens as Lens
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'
  { -- | 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 (Core.Sensitive (Prelude.HashMap Prelude.Text (Core.Sensitive VariableValue))),
    -- | 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,
    -- | 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,
    -- | The ID of the workbook that contains the screen.
    GetScreenData -> Text
workbookId :: Prelude.Text,
    -- | The ID of the app that contains the screem.
    GetScreenData -> Text
appId :: Prelude.Text,
    -- | The ID of the screen.
    GetScreenData -> Text
screenId :: Prelude.Text
  }
  deriving (GetScreenData -> GetScreenData -> Bool
(GetScreenData -> GetScreenData -> Bool)
-> (GetScreenData -> GetScreenData -> Bool) -> Eq GetScreenData
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
(Int -> GetScreenData -> ShowS)
-> (GetScreenData -> String)
-> ([GetScreenData] -> ShowS)
-> Show GetScreenData
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. GetScreenData -> Rep GetScreenData x)
-> (forall x. Rep GetScreenData x -> GetScreenData)
-> Generic GetScreenData
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:
--
-- '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.
--
-- '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.
--
-- '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.
--
-- 'workbookId', 'getScreenData_workbookId' - The ID of the workbook that contains the screen.
--
-- 'appId', 'getScreenData_appId' - The ID of the app that contains the screem.
--
-- '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' :: Maybe (Sensitive (HashMap Text (Sensitive VariableValue)))
-> Maybe Text
-> Maybe Natural
-> Text
-> Text
-> Text
-> GetScreenData
GetScreenData'
    { $sel:variables:GetScreenData' :: Maybe (Sensitive (HashMap Text (Sensitive VariableValue)))
variables = Maybe (Sensitive (HashMap Text (Sensitive VariableValue)))
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetScreenData' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:GetScreenData' :: Maybe Natural
maxResults = Maybe Natural
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_
    }

-- | 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 :: (Maybe (HashMap Text VariableValue)
 -> f (Maybe (HashMap Text VariableValue)))
-> GetScreenData -> f GetScreenData
getScreenData_variables = (GetScreenData
 -> Maybe (Sensitive (HashMap Text (Sensitive VariableValue))))
-> (GetScreenData
    -> Maybe (Sensitive (HashMap Text (Sensitive VariableValue)))
    -> GetScreenData)
-> Lens
     GetScreenData
     GetScreenData
     (Maybe (Sensitive (HashMap Text (Sensitive VariableValue))))
     (Maybe (Sensitive (HashMap Text (Sensitive VariableValue))))
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) ((Maybe (Sensitive (HashMap Text (Sensitive VariableValue)))
  -> f (Maybe (Sensitive (HashMap Text (Sensitive VariableValue)))))
 -> GetScreenData -> f GetScreenData)
-> ((Maybe (HashMap Text VariableValue)
     -> f (Maybe (HashMap Text VariableValue)))
    -> Maybe (Sensitive (HashMap Text (Sensitive VariableValue)))
    -> f (Maybe (Sensitive (HashMap Text (Sensitive VariableValue)))))
-> (Maybe (HashMap Text VariableValue)
    -> f (Maybe (HashMap Text VariableValue)))
-> GetScreenData
-> f GetScreenData
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (Sensitive (HashMap Text (Sensitive VariableValue)))
  (Sensitive (HashMap Text (Sensitive VariableValue)))
  (HashMap Text VariableValue)
  (HashMap Text VariableValue)
-> Iso
     (Maybe (Sensitive (HashMap Text (Sensitive VariableValue))))
     (Maybe (Sensitive (HashMap Text (Sensitive VariableValue))))
     (Maybe (HashMap Text VariableValue))
     (Maybe (HashMap Text VariableValue))
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 (Exchange
  (HashMap Text VariableValue)
  (HashMap Text VariableValue)
  (HashMap Text (Sensitive VariableValue))
  (Identity (HashMap Text (Sensitive VariableValue)))
-> Exchange
     (HashMap Text VariableValue)
     (HashMap Text VariableValue)
     (Sensitive (HashMap Text (Sensitive VariableValue)))
     (Identity (Sensitive (HashMap Text (Sensitive VariableValue))))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Exchange
   (HashMap Text VariableValue)
   (HashMap Text VariableValue)
   (HashMap Text (Sensitive VariableValue))
   (Identity (HashMap Text (Sensitive VariableValue)))
 -> Exchange
      (HashMap Text VariableValue)
      (HashMap Text VariableValue)
      (Sensitive (HashMap Text (Sensitive VariableValue)))
      (Identity (Sensitive (HashMap Text (Sensitive VariableValue)))))
-> (Exchange
      (HashMap Text VariableValue)
      (HashMap Text VariableValue)
      (HashMap Text VariableValue)
      (Identity (HashMap Text VariableValue))
    -> Exchange
         (HashMap Text VariableValue)
         (HashMap Text VariableValue)
         (HashMap Text (Sensitive VariableValue))
         (Identity (HashMap Text (Sensitive VariableValue))))
-> AnIso
     (Sensitive (HashMap Text (Sensitive VariableValue)))
     (Sensitive (HashMap Text (Sensitive VariableValue)))
     (HashMap Text VariableValue)
     (HashMap Text VariableValue)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Exchange
  (HashMap Text VariableValue)
  (HashMap Text VariableValue)
  (HashMap Text VariableValue)
  (Identity (HashMap Text VariableValue))
-> Exchange
     (HashMap Text VariableValue)
     (HashMap Text VariableValue)
     (HashMap Text (Sensitive VariableValue))
     (Identity (HashMap Text (Sensitive VariableValue)))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced)

-- | 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 :: (Maybe Text -> f (Maybe Text)) -> GetScreenData -> f GetScreenData
getScreenData_nextToken = (GetScreenData -> Maybe Text)
-> (GetScreenData -> Maybe Text -> GetScreenData)
-> Lens GetScreenData GetScreenData (Maybe Text) (Maybe Text)
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)

-- | 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 :: (Maybe Natural -> f (Maybe Natural))
-> GetScreenData -> f GetScreenData
getScreenData_maxResults = (GetScreenData -> Maybe Natural)
-> (GetScreenData -> Maybe Natural -> GetScreenData)
-> Lens GetScreenData GetScreenData (Maybe Natural) (Maybe Natural)
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)

-- | The ID of the workbook that contains the screen.
getScreenData_workbookId :: Lens.Lens' GetScreenData Prelude.Text
getScreenData_workbookId :: (Text -> f Text) -> GetScreenData -> f GetScreenData
getScreenData_workbookId = (GetScreenData -> Text)
-> (GetScreenData -> Text -> GetScreenData)
-> Lens GetScreenData GetScreenData Text Text
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 screem.
getScreenData_appId :: Lens.Lens' GetScreenData Prelude.Text
getScreenData_appId :: (Text -> f Text) -> GetScreenData -> f GetScreenData
getScreenData_appId = (GetScreenData -> Text)
-> (GetScreenData -> Text -> GetScreenData)
-> Lens GetScreenData GetScreenData Text Text
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 :: (Text -> f Text) -> GetScreenData -> f GetScreenData
getScreenData_screenId = (GetScreenData -> Text)
-> (GetScreenData -> Text -> GetScreenData)
-> Lens GetScreenData GetScreenData Text Text
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 :: GetScreenData -> Request GetScreenData
request = Service -> GetScreenData -> Request GetScreenData
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetScreenData
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetScreenData)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetScreenData))
-> Logger
-> Service
-> Proxy GetScreenData
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetScreenData)))
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
-> Int
-> HashMap Text ResultSet
-> Integer
-> GetScreenDataResponse
GetScreenDataResponse'
            (Maybe Text
 -> Int
 -> HashMap Text ResultSet
 -> Integer
 -> GetScreenDataResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Int -> HashMap Text ResultSet -> Integer -> GetScreenDataResponse)
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
  (Int -> HashMap Text ResultSet -> Integer -> GetScreenDataResponse)
-> Either String Int
-> Either
     String (HashMap Text ResultSet -> Integer -> GetScreenDataResponse)
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))
            Either
  String (HashMap Text ResultSet -> Integer -> GetScreenDataResponse)
-> Either String (HashMap Text ResultSet)
-> Either String (Integer -> GetScreenDataResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (HashMap Text ResultSet))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"results" Either String (Maybe (HashMap Text ResultSet))
-> HashMap Text ResultSet -> Either String (HashMap Text ResultSet)
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ HashMap Text ResultSet
forall a. Monoid a => a
Prelude.mempty)
            Either String (Integer -> GetScreenDataResponse)
-> Either String Integer -> Either String GetScreenDataResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Integer
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"workbookCursor")
      )

instance Prelude.Hashable GetScreenData

instance Prelude.NFData GetScreenData

instance Core.ToHeaders GetScreenData where
  toHeaders :: GetScreenData -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetScreenData -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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 GetScreenData where
  toJSON :: GetScreenData -> Value
toJSON GetScreenData' {Maybe Natural
Maybe Text
Maybe (Sensitive (HashMap Text (Sensitive VariableValue)))
Text
screenId :: Text
appId :: Text
workbookId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
variables :: Maybe (Sensitive (HashMap Text (Sensitive VariableValue)))
$sel:screenId:GetScreenData' :: GetScreenData -> Text
$sel:appId:GetScreenData' :: GetScreenData -> Text
$sel:workbookId:GetScreenData' :: GetScreenData -> Text
$sel:maxResults:GetScreenData' :: GetScreenData -> Maybe Natural
$sel:nextToken:GetScreenData' :: GetScreenData -> Maybe Text
$sel:variables:GetScreenData' :: GetScreenData
-> Maybe (Sensitive (HashMap Text (Sensitive VariableValue)))
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"variables" Text -> Sensitive (HashMap Text (Sensitive VariableValue)) -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive (HashMap Text (Sensitive VariableValue)) -> Pair)
-> Maybe (Sensitive (HashMap Text (Sensitive VariableValue)))
-> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive (HashMap Text (Sensitive VariableValue)))
variables,
            (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
"workbookId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
workbookId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"appId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
appId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"screenId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
screenId)
          ]
      )

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

instance Core.ToQuery GetScreenData where
  toQuery :: GetScreenData -> QueryString
toQuery = QueryString -> GetScreenData -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(GetScreenDataResponse -> GetScreenDataResponse -> Bool)
-> (GetScreenDataResponse -> GetScreenDataResponse -> Bool)
-> Eq GetScreenDataResponse
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
(Int -> GetScreenDataResponse -> ShowS)
-> (GetScreenDataResponse -> String)
-> ([GetScreenDataResponse] -> ShowS)
-> Show GetScreenDataResponse
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. GetScreenDataResponse -> Rep GetScreenDataResponse x)
-> (forall x. Rep GetScreenDataResponse x -> GetScreenDataResponse)
-> Generic GetScreenDataResponse
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' :: Maybe Text
-> Int
-> HashMap Text ResultSet
-> Integer
-> GetScreenDataResponse
GetScreenDataResponse'
      { $sel:nextToken:GetScreenDataResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:GetScreenDataResponse' :: Int
httpStatus = Int
pHttpStatus_,
        $sel:results:GetScreenDataResponse' :: HashMap Text ResultSet
results = HashMap Text ResultSet
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 :: (Maybe Text -> f (Maybe Text))
-> GetScreenDataResponse -> f GetScreenDataResponse
getScreenDataResponse_nextToken = (GetScreenDataResponse -> Maybe Text)
-> (GetScreenDataResponse -> Maybe Text -> GetScreenDataResponse)
-> Lens
     GetScreenDataResponse
     GetScreenDataResponse
     (Maybe Text)
     (Maybe Text)
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 :: (Int -> f Int) -> GetScreenDataResponse -> f GetScreenDataResponse
getScreenDataResponse_httpStatus = (GetScreenDataResponse -> Int)
-> (GetScreenDataResponse -> Int -> GetScreenDataResponse)
-> Lens GetScreenDataResponse GetScreenDataResponse Int Int
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 :: (HashMap Text ResultSet -> f (HashMap Text ResultSet))
-> GetScreenDataResponse -> f GetScreenDataResponse
getScreenDataResponse_results = (GetScreenDataResponse -> HashMap Text ResultSet)
-> (GetScreenDataResponse
    -> HashMap Text ResultSet -> GetScreenDataResponse)
-> Lens
     GetScreenDataResponse
     GetScreenDataResponse
     (HashMap Text ResultSet)
     (HashMap Text ResultSet)
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) ((HashMap Text ResultSet -> f (HashMap Text ResultSet))
 -> GetScreenDataResponse -> f GetScreenDataResponse)
-> ((HashMap Text ResultSet -> f (HashMap Text ResultSet))
    -> HashMap Text ResultSet -> f (HashMap Text ResultSet))
-> (HashMap Text ResultSet -> f (HashMap Text ResultSet))
-> GetScreenDataResponse
-> f GetScreenDataResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (HashMap Text ResultSet -> f (HashMap Text ResultSet))
-> HashMap Text ResultSet -> f (HashMap Text ResultSet)
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 :: (Integer -> f Integer)
-> GetScreenDataResponse -> f GetScreenDataResponse
getScreenDataResponse_workbookCursor = (GetScreenDataResponse -> Integer)
-> (GetScreenDataResponse -> Integer -> GetScreenDataResponse)
-> Lens GetScreenDataResponse GetScreenDataResponse Integer Integer
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