{-# 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.BatchUpdateTableRows
-- 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 BatchUpdateTableRows API allows you to update one or more rows in a
-- table in a workbook.
--
-- You can specify the values to set in some or all of the columns in the
-- table for the specified rows. If a column is not explicitly specified in
-- a particular row, then that column will not be updated for that row. To
-- clear out the data in a specific cell, you need to set the value as an
-- empty string (\"\").
module Amazonka.HoneyCode.BatchUpdateTableRows
  ( -- * Creating a Request
    BatchUpdateTableRows (..),
    newBatchUpdateTableRows,

    -- * Request Lenses
    batchUpdateTableRows_clientRequestToken,
    batchUpdateTableRows_workbookId,
    batchUpdateTableRows_tableId,
    batchUpdateTableRows_rowsToUpdate,

    -- * Destructuring the Response
    BatchUpdateTableRowsResponse (..),
    newBatchUpdateTableRowsResponse,

    -- * Response Lenses
    batchUpdateTableRowsResponse_failedBatchItems,
    batchUpdateTableRowsResponse_httpStatus,
    batchUpdateTableRowsResponse_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:/ 'newBatchUpdateTableRows' smart constructor.
data BatchUpdateTableRows = BatchUpdateTableRows'
  { -- | The request token for performing the update action. Request tokens help
    -- to identify duplicate requests. If a call times out or fails due to a
    -- transient error like a failed network connection, you can retry the call
    -- with the same request token. The service ensures that if the first call
    -- using that request token is successfully performed, the second call will
    -- not perform the action again.
    --
    -- Note that request tokens are valid only for a few minutes. You cannot
    -- use request tokens to dedupe requests spanning hours or days.
    BatchUpdateTableRows -> Maybe Text
clientRequestToken :: Prelude.Maybe Prelude.Text,
    -- | The ID of the workbook where the rows are being updated.
    --
    -- If a workbook with the specified id could not be found, this API throws
    -- ResourceNotFoundException.
    BatchUpdateTableRows -> Text
workbookId :: Prelude.Text,
    -- | The ID of the table where the rows are being updated.
    --
    -- If a table with the specified id could not be found, this API throws
    -- ResourceNotFoundException.
    BatchUpdateTableRows -> Text
tableId :: Prelude.Text,
    -- | The list of rows to update in the table. Each item in this list needs to
    -- contain the row id to update along with the map of column id to cell
    -- values for each column in that row that needs to be updated. You need to
    -- specify at least one row in this list, and for each row, you need to
    -- specify at least one column to update.
    --
    -- Note that if one of the row or column ids in the request does not exist
    -- in the table, then the request fails and no updates are made to the
    -- table.
    BatchUpdateTableRows -> NonEmpty UpdateRowData
rowsToUpdate :: Prelude.NonEmpty UpdateRowData
  }
  deriving (BatchUpdateTableRows -> BatchUpdateTableRows -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchUpdateTableRows -> BatchUpdateTableRows -> Bool
$c/= :: BatchUpdateTableRows -> BatchUpdateTableRows -> Bool
== :: BatchUpdateTableRows -> BatchUpdateTableRows -> Bool
$c== :: BatchUpdateTableRows -> BatchUpdateTableRows -> Bool
Prelude.Eq, Int -> BatchUpdateTableRows -> ShowS
[BatchUpdateTableRows] -> ShowS
BatchUpdateTableRows -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchUpdateTableRows] -> ShowS
$cshowList :: [BatchUpdateTableRows] -> ShowS
show :: BatchUpdateTableRows -> String
$cshow :: BatchUpdateTableRows -> String
showsPrec :: Int -> BatchUpdateTableRows -> ShowS
$cshowsPrec :: Int -> BatchUpdateTableRows -> ShowS
Prelude.Show, forall x. Rep BatchUpdateTableRows x -> BatchUpdateTableRows
forall x. BatchUpdateTableRows -> Rep BatchUpdateTableRows x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchUpdateTableRows x -> BatchUpdateTableRows
$cfrom :: forall x. BatchUpdateTableRows -> Rep BatchUpdateTableRows x
Prelude.Generic)

-- |
-- Create a value of 'BatchUpdateTableRows' 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:
--
-- 'clientRequestToken', 'batchUpdateTableRows_clientRequestToken' - The request token for performing the update action. Request tokens help
-- to identify duplicate requests. If a call times out or fails due to a
-- transient error like a failed network connection, you can retry the call
-- with the same request token. The service ensures that if the first call
-- using that request token is successfully performed, the second call will
-- not perform the action again.
--
-- Note that request tokens are valid only for a few minutes. You cannot
-- use request tokens to dedupe requests spanning hours or days.
--
-- 'workbookId', 'batchUpdateTableRows_workbookId' - The ID of the workbook where the rows are being updated.
--
-- If a workbook with the specified id could not be found, this API throws
-- ResourceNotFoundException.
--
-- 'tableId', 'batchUpdateTableRows_tableId' - The ID of the table where the rows are being updated.
--
-- If a table with the specified id could not be found, this API throws
-- ResourceNotFoundException.
--
-- 'rowsToUpdate', 'batchUpdateTableRows_rowsToUpdate' - The list of rows to update in the table. Each item in this list needs to
-- contain the row id to update along with the map of column id to cell
-- values for each column in that row that needs to be updated. You need to
-- specify at least one row in this list, and for each row, you need to
-- specify at least one column to update.
--
-- Note that if one of the row or column ids in the request does not exist
-- in the table, then the request fails and no updates are made to the
-- table.
newBatchUpdateTableRows ::
  -- | 'workbookId'
  Prelude.Text ->
  -- | 'tableId'
  Prelude.Text ->
  -- | 'rowsToUpdate'
  Prelude.NonEmpty UpdateRowData ->
  BatchUpdateTableRows
newBatchUpdateTableRows :: Text -> Text -> NonEmpty UpdateRowData -> BatchUpdateTableRows
newBatchUpdateTableRows
  Text
pWorkbookId_
  Text
pTableId_
  NonEmpty UpdateRowData
pRowsToUpdate_ =
    BatchUpdateTableRows'
      { $sel:clientRequestToken:BatchUpdateTableRows' :: Maybe Text
clientRequestToken =
          forall a. Maybe a
Prelude.Nothing,
        $sel:workbookId:BatchUpdateTableRows' :: Text
workbookId = Text
pWorkbookId_,
        $sel:tableId:BatchUpdateTableRows' :: Text
tableId = Text
pTableId_,
        $sel:rowsToUpdate:BatchUpdateTableRows' :: NonEmpty UpdateRowData
rowsToUpdate = forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty UpdateRowData
pRowsToUpdate_
      }

-- | The request token for performing the update action. Request tokens help
-- to identify duplicate requests. If a call times out or fails due to a
-- transient error like a failed network connection, you can retry the call
-- with the same request token. The service ensures that if the first call
-- using that request token is successfully performed, the second call will
-- not perform the action again.
--
-- Note that request tokens are valid only for a few minutes. You cannot
-- use request tokens to dedupe requests spanning hours or days.
batchUpdateTableRows_clientRequestToken :: Lens.Lens' BatchUpdateTableRows (Prelude.Maybe Prelude.Text)
batchUpdateTableRows_clientRequestToken :: Lens' BatchUpdateTableRows (Maybe Text)
batchUpdateTableRows_clientRequestToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUpdateTableRows' {Maybe Text
clientRequestToken :: Maybe Text
$sel:clientRequestToken:BatchUpdateTableRows' :: BatchUpdateTableRows -> Maybe Text
clientRequestToken} -> Maybe Text
clientRequestToken) (\s :: BatchUpdateTableRows
s@BatchUpdateTableRows' {} Maybe Text
a -> BatchUpdateTableRows
s {$sel:clientRequestToken:BatchUpdateTableRows' :: Maybe Text
clientRequestToken = Maybe Text
a} :: BatchUpdateTableRows)

-- | The ID of the workbook where the rows are being updated.
--
-- If a workbook with the specified id could not be found, this API throws
-- ResourceNotFoundException.
batchUpdateTableRows_workbookId :: Lens.Lens' BatchUpdateTableRows Prelude.Text
batchUpdateTableRows_workbookId :: Lens' BatchUpdateTableRows Text
batchUpdateTableRows_workbookId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUpdateTableRows' {Text
workbookId :: Text
$sel:workbookId:BatchUpdateTableRows' :: BatchUpdateTableRows -> Text
workbookId} -> Text
workbookId) (\s :: BatchUpdateTableRows
s@BatchUpdateTableRows' {} Text
a -> BatchUpdateTableRows
s {$sel:workbookId:BatchUpdateTableRows' :: Text
workbookId = Text
a} :: BatchUpdateTableRows)

-- | The ID of the table where the rows are being updated.
--
-- If a table with the specified id could not be found, this API throws
-- ResourceNotFoundException.
batchUpdateTableRows_tableId :: Lens.Lens' BatchUpdateTableRows Prelude.Text
batchUpdateTableRows_tableId :: Lens' BatchUpdateTableRows Text
batchUpdateTableRows_tableId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUpdateTableRows' {Text
tableId :: Text
$sel:tableId:BatchUpdateTableRows' :: BatchUpdateTableRows -> Text
tableId} -> Text
tableId) (\s :: BatchUpdateTableRows
s@BatchUpdateTableRows' {} Text
a -> BatchUpdateTableRows
s {$sel:tableId:BatchUpdateTableRows' :: Text
tableId = Text
a} :: BatchUpdateTableRows)

-- | The list of rows to update in the table. Each item in this list needs to
-- contain the row id to update along with the map of column id to cell
-- values for each column in that row that needs to be updated. You need to
-- specify at least one row in this list, and for each row, you need to
-- specify at least one column to update.
--
-- Note that if one of the row or column ids in the request does not exist
-- in the table, then the request fails and no updates are made to the
-- table.
batchUpdateTableRows_rowsToUpdate :: Lens.Lens' BatchUpdateTableRows (Prelude.NonEmpty UpdateRowData)
batchUpdateTableRows_rowsToUpdate :: Lens' BatchUpdateTableRows (NonEmpty UpdateRowData)
batchUpdateTableRows_rowsToUpdate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUpdateTableRows' {NonEmpty UpdateRowData
rowsToUpdate :: NonEmpty UpdateRowData
$sel:rowsToUpdate:BatchUpdateTableRows' :: BatchUpdateTableRows -> NonEmpty UpdateRowData
rowsToUpdate} -> NonEmpty UpdateRowData
rowsToUpdate) (\s :: BatchUpdateTableRows
s@BatchUpdateTableRows' {} NonEmpty UpdateRowData
a -> BatchUpdateTableRows
s {$sel:rowsToUpdate:BatchUpdateTableRows' :: NonEmpty UpdateRowData
rowsToUpdate = NonEmpty UpdateRowData
a} :: BatchUpdateTableRows) 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

instance Core.AWSRequest BatchUpdateTableRows where
  type
    AWSResponse BatchUpdateTableRows =
      BatchUpdateTableRowsResponse
  request :: (Service -> Service)
-> BatchUpdateTableRows -> Request BatchUpdateTableRows
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 BatchUpdateTableRows
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse BatchUpdateTableRows)))
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 [FailedBatchItem]
-> Int -> Integer -> BatchUpdateTableRowsResponse
BatchUpdateTableRowsResponse'
            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
"failedBatchItems"
                            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.<*> (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 a
Data..:> Key
"workbookCursor")
      )

instance Prelude.Hashable BatchUpdateTableRows where
  hashWithSalt :: Int -> BatchUpdateTableRows -> Int
hashWithSalt Int
_salt BatchUpdateTableRows' {Maybe Text
NonEmpty UpdateRowData
Text
rowsToUpdate :: NonEmpty UpdateRowData
tableId :: Text
workbookId :: Text
clientRequestToken :: Maybe Text
$sel:rowsToUpdate:BatchUpdateTableRows' :: BatchUpdateTableRows -> NonEmpty UpdateRowData
$sel:tableId:BatchUpdateTableRows' :: BatchUpdateTableRows -> Text
$sel:workbookId:BatchUpdateTableRows' :: BatchUpdateTableRows -> Text
$sel:clientRequestToken:BatchUpdateTableRows' :: BatchUpdateTableRows -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clientRequestToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
workbookId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
tableId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty UpdateRowData
rowsToUpdate

instance Prelude.NFData BatchUpdateTableRows where
  rnf :: BatchUpdateTableRows -> ()
rnf BatchUpdateTableRows' {Maybe Text
NonEmpty UpdateRowData
Text
rowsToUpdate :: NonEmpty UpdateRowData
tableId :: Text
workbookId :: Text
clientRequestToken :: Maybe Text
$sel:rowsToUpdate:BatchUpdateTableRows' :: BatchUpdateTableRows -> NonEmpty UpdateRowData
$sel:tableId:BatchUpdateTableRows' :: BatchUpdateTableRows -> Text
$sel:workbookId:BatchUpdateTableRows' :: BatchUpdateTableRows -> Text
$sel:clientRequestToken:BatchUpdateTableRows' :: BatchUpdateTableRows -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clientRequestToken
      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
tableId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty UpdateRowData
rowsToUpdate

instance Data.ToHeaders BatchUpdateTableRows where
  toHeaders :: BatchUpdateTableRows -> 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 BatchUpdateTableRows where
  toJSON :: BatchUpdateTableRows -> Value
toJSON BatchUpdateTableRows' {Maybe Text
NonEmpty UpdateRowData
Text
rowsToUpdate :: NonEmpty UpdateRowData
tableId :: Text
workbookId :: Text
clientRequestToken :: Maybe Text
$sel:rowsToUpdate:BatchUpdateTableRows' :: BatchUpdateTableRows -> NonEmpty UpdateRowData
$sel:tableId:BatchUpdateTableRows' :: BatchUpdateTableRows -> Text
$sel:workbookId:BatchUpdateTableRows' :: BatchUpdateTableRows -> Text
$sel:clientRequestToken:BatchUpdateTableRows' :: BatchUpdateTableRows -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"clientRequestToken" 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
clientRequestToken,
            forall a. a -> Maybe a
Prelude.Just (Key
"rowsToUpdate" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty UpdateRowData
rowsToUpdate)
          ]
      )

instance Data.ToPath BatchUpdateTableRows where
  toPath :: BatchUpdateTableRows -> ByteString
toPath BatchUpdateTableRows' {Maybe Text
NonEmpty UpdateRowData
Text
rowsToUpdate :: NonEmpty UpdateRowData
tableId :: Text
workbookId :: Text
clientRequestToken :: Maybe Text
$sel:rowsToUpdate:BatchUpdateTableRows' :: BatchUpdateTableRows -> NonEmpty UpdateRowData
$sel:tableId:BatchUpdateTableRows' :: BatchUpdateTableRows -> Text
$sel:workbookId:BatchUpdateTableRows' :: BatchUpdateTableRows -> Text
$sel:clientRequestToken:BatchUpdateTableRows' :: BatchUpdateTableRows -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/workbooks/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
workbookId,
        ByteString
"/tables/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
tableId,
        ByteString
"/rows/batchupdate"
      ]

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

-- | /See:/ 'newBatchUpdateTableRowsResponse' smart constructor.
data BatchUpdateTableRowsResponse = BatchUpdateTableRowsResponse'
  { -- | The list of batch items in the request that could not be updated in the
    -- table. Each element in this list contains one item from the request that
    -- could not be updated in the table along with the reason why that item
    -- could not be updated.
    BatchUpdateTableRowsResponse -> Maybe [FailedBatchItem]
failedBatchItems :: Prelude.Maybe [FailedBatchItem],
    -- | The response's http status code.
    BatchUpdateTableRowsResponse -> Int
httpStatus :: Prelude.Int,
    -- | The updated workbook cursor after adding the new rows at the end of the
    -- table.
    BatchUpdateTableRowsResponse -> Integer
workbookCursor :: Prelude.Integer
  }
  deriving (BatchUpdateTableRowsResponse
-> BatchUpdateTableRowsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchUpdateTableRowsResponse
-> BatchUpdateTableRowsResponse -> Bool
$c/= :: BatchUpdateTableRowsResponse
-> BatchUpdateTableRowsResponse -> Bool
== :: BatchUpdateTableRowsResponse
-> BatchUpdateTableRowsResponse -> Bool
$c== :: BatchUpdateTableRowsResponse
-> BatchUpdateTableRowsResponse -> Bool
Prelude.Eq, ReadPrec [BatchUpdateTableRowsResponse]
ReadPrec BatchUpdateTableRowsResponse
Int -> ReadS BatchUpdateTableRowsResponse
ReadS [BatchUpdateTableRowsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchUpdateTableRowsResponse]
$creadListPrec :: ReadPrec [BatchUpdateTableRowsResponse]
readPrec :: ReadPrec BatchUpdateTableRowsResponse
$creadPrec :: ReadPrec BatchUpdateTableRowsResponse
readList :: ReadS [BatchUpdateTableRowsResponse]
$creadList :: ReadS [BatchUpdateTableRowsResponse]
readsPrec :: Int -> ReadS BatchUpdateTableRowsResponse
$creadsPrec :: Int -> ReadS BatchUpdateTableRowsResponse
Prelude.Read, Int -> BatchUpdateTableRowsResponse -> ShowS
[BatchUpdateTableRowsResponse] -> ShowS
BatchUpdateTableRowsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchUpdateTableRowsResponse] -> ShowS
$cshowList :: [BatchUpdateTableRowsResponse] -> ShowS
show :: BatchUpdateTableRowsResponse -> String
$cshow :: BatchUpdateTableRowsResponse -> String
showsPrec :: Int -> BatchUpdateTableRowsResponse -> ShowS
$cshowsPrec :: Int -> BatchUpdateTableRowsResponse -> ShowS
Prelude.Show, forall x.
Rep BatchUpdateTableRowsResponse x -> BatchUpdateTableRowsResponse
forall x.
BatchUpdateTableRowsResponse -> Rep BatchUpdateTableRowsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchUpdateTableRowsResponse x -> BatchUpdateTableRowsResponse
$cfrom :: forall x.
BatchUpdateTableRowsResponse -> Rep BatchUpdateTableRowsResponse x
Prelude.Generic)

-- |
-- Create a value of 'BatchUpdateTableRowsResponse' 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:
--
-- 'failedBatchItems', 'batchUpdateTableRowsResponse_failedBatchItems' - The list of batch items in the request that could not be updated in the
-- table. Each element in this list contains one item from the request that
-- could not be updated in the table along with the reason why that item
-- could not be updated.
--
-- 'httpStatus', 'batchUpdateTableRowsResponse_httpStatus' - The response's http status code.
--
-- 'workbookCursor', 'batchUpdateTableRowsResponse_workbookCursor' - The updated workbook cursor after adding the new rows at the end of the
-- table.
newBatchUpdateTableRowsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'workbookCursor'
  Prelude.Integer ->
  BatchUpdateTableRowsResponse
newBatchUpdateTableRowsResponse :: Int -> Integer -> BatchUpdateTableRowsResponse
newBatchUpdateTableRowsResponse
  Int
pHttpStatus_
  Integer
pWorkbookCursor_ =
    BatchUpdateTableRowsResponse'
      { $sel:failedBatchItems:BatchUpdateTableRowsResponse' :: Maybe [FailedBatchItem]
failedBatchItems =
          forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:BatchUpdateTableRowsResponse' :: Int
httpStatus = Int
pHttpStatus_,
        $sel:workbookCursor:BatchUpdateTableRowsResponse' :: Integer
workbookCursor = Integer
pWorkbookCursor_
      }

-- | The list of batch items in the request that could not be updated in the
-- table. Each element in this list contains one item from the request that
-- could not be updated in the table along with the reason why that item
-- could not be updated.
batchUpdateTableRowsResponse_failedBatchItems :: Lens.Lens' BatchUpdateTableRowsResponse (Prelude.Maybe [FailedBatchItem])
batchUpdateTableRowsResponse_failedBatchItems :: Lens' BatchUpdateTableRowsResponse (Maybe [FailedBatchItem])
batchUpdateTableRowsResponse_failedBatchItems = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUpdateTableRowsResponse' {Maybe [FailedBatchItem]
failedBatchItems :: Maybe [FailedBatchItem]
$sel:failedBatchItems:BatchUpdateTableRowsResponse' :: BatchUpdateTableRowsResponse -> Maybe [FailedBatchItem]
failedBatchItems} -> Maybe [FailedBatchItem]
failedBatchItems) (\s :: BatchUpdateTableRowsResponse
s@BatchUpdateTableRowsResponse' {} Maybe [FailedBatchItem]
a -> BatchUpdateTableRowsResponse
s {$sel:failedBatchItems:BatchUpdateTableRowsResponse' :: Maybe [FailedBatchItem]
failedBatchItems = Maybe [FailedBatchItem]
a} :: BatchUpdateTableRowsResponse) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

-- | The updated workbook cursor after adding the new rows at the end of the
-- table.
batchUpdateTableRowsResponse_workbookCursor :: Lens.Lens' BatchUpdateTableRowsResponse Prelude.Integer
batchUpdateTableRowsResponse_workbookCursor :: Lens' BatchUpdateTableRowsResponse Integer
batchUpdateTableRowsResponse_workbookCursor = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUpdateTableRowsResponse' {Integer
workbookCursor :: Integer
$sel:workbookCursor:BatchUpdateTableRowsResponse' :: BatchUpdateTableRowsResponse -> Integer
workbookCursor} -> Integer
workbookCursor) (\s :: BatchUpdateTableRowsResponse
s@BatchUpdateTableRowsResponse' {} Integer
a -> BatchUpdateTableRowsResponse
s {$sel:workbookCursor:BatchUpdateTableRowsResponse' :: Integer
workbookCursor = Integer
a} :: BatchUpdateTableRowsResponse)

instance Prelude.NFData BatchUpdateTableRowsResponse where
  rnf :: BatchUpdateTableRowsResponse -> ()
rnf BatchUpdateTableRowsResponse' {Int
Integer
Maybe [FailedBatchItem]
workbookCursor :: Integer
httpStatus :: Int
failedBatchItems :: Maybe [FailedBatchItem]
$sel:workbookCursor:BatchUpdateTableRowsResponse' :: BatchUpdateTableRowsResponse -> Integer
$sel:httpStatus:BatchUpdateTableRowsResponse' :: BatchUpdateTableRowsResponse -> Int
$sel:failedBatchItems:BatchUpdateTableRowsResponse' :: BatchUpdateTableRowsResponse -> Maybe [FailedBatchItem]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [FailedBatchItem]
failedBatchItems
      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 Integer
workbookCursor