{-# 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-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 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 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:/ '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
(BatchUpdateTableRows -> BatchUpdateTableRows -> Bool)
-> (BatchUpdateTableRows -> BatchUpdateTableRows -> Bool)
-> Eq BatchUpdateTableRows
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
(Int -> BatchUpdateTableRows -> ShowS)
-> (BatchUpdateTableRows -> String)
-> ([BatchUpdateTableRows] -> ShowS)
-> Show BatchUpdateTableRows
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. BatchUpdateTableRows -> Rep BatchUpdateTableRows x)
-> (forall x. Rep BatchUpdateTableRows x -> BatchUpdateTableRows)
-> Generic BatchUpdateTableRows
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' :: Maybe Text
-> Text -> Text -> NonEmpty UpdateRowData -> BatchUpdateTableRows
BatchUpdateTableRows'
      { $sel:clientRequestToken:BatchUpdateTableRows' :: Maybe Text
clientRequestToken =
          Maybe Text
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 = Tagged (NonEmpty UpdateRowData) (Identity (NonEmpty UpdateRowData))
-> Tagged
     (NonEmpty UpdateRowData) (Identity (NonEmpty UpdateRowData))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged
   (NonEmpty UpdateRowData) (Identity (NonEmpty UpdateRowData))
 -> Tagged
      (NonEmpty UpdateRowData) (Identity (NonEmpty UpdateRowData)))
-> NonEmpty UpdateRowData -> NonEmpty UpdateRowData
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 :: (Maybe Text -> f (Maybe Text))
-> BatchUpdateTableRows -> f BatchUpdateTableRows
batchUpdateTableRows_clientRequestToken = (BatchUpdateTableRows -> Maybe Text)
-> (BatchUpdateTableRows -> Maybe Text -> BatchUpdateTableRows)
-> Lens
     BatchUpdateTableRows BatchUpdateTableRows (Maybe Text) (Maybe Text)
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 :: (Text -> f Text) -> BatchUpdateTableRows -> f BatchUpdateTableRows
batchUpdateTableRows_workbookId = (BatchUpdateTableRows -> Text)
-> (BatchUpdateTableRows -> Text -> BatchUpdateTableRows)
-> Lens BatchUpdateTableRows BatchUpdateTableRows Text Text
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 :: (Text -> f Text) -> BatchUpdateTableRows -> f BatchUpdateTableRows
batchUpdateTableRows_tableId = (BatchUpdateTableRows -> Text)
-> (BatchUpdateTableRows -> Text -> BatchUpdateTableRows)
-> Lens BatchUpdateTableRows BatchUpdateTableRows Text Text
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 :: (NonEmpty UpdateRowData -> f (NonEmpty UpdateRowData))
-> BatchUpdateTableRows -> f BatchUpdateTableRows
batchUpdateTableRows_rowsToUpdate = (BatchUpdateTableRows -> NonEmpty UpdateRowData)
-> (BatchUpdateTableRows
    -> NonEmpty UpdateRowData -> BatchUpdateTableRows)
-> Lens
     BatchUpdateTableRows
     BatchUpdateTableRows
     (NonEmpty UpdateRowData)
     (NonEmpty UpdateRowData)
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) ((NonEmpty UpdateRowData -> f (NonEmpty UpdateRowData))
 -> BatchUpdateTableRows -> f BatchUpdateTableRows)
-> ((NonEmpty UpdateRowData -> f (NonEmpty UpdateRowData))
    -> NonEmpty UpdateRowData -> f (NonEmpty UpdateRowData))
-> (NonEmpty UpdateRowData -> f (NonEmpty UpdateRowData))
-> BatchUpdateTableRows
-> f BatchUpdateTableRows
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty UpdateRowData -> f (NonEmpty UpdateRowData))
-> NonEmpty UpdateRowData -> f (NonEmpty UpdateRowData)
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 :: BatchUpdateTableRows -> Request BatchUpdateTableRows
request = Service -> BatchUpdateTableRows -> Request BatchUpdateTableRows
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy BatchUpdateTableRows
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse BatchUpdateTableRows)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse BatchUpdateTableRows))
-> Logger
-> Service
-> Proxy BatchUpdateTableRows
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse BatchUpdateTableRows)))
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 [FailedBatchItem]
-> Int -> Integer -> BatchUpdateTableRowsResponse
BatchUpdateTableRowsResponse'
            (Maybe [FailedBatchItem]
 -> Int -> Integer -> BatchUpdateTableRowsResponse)
-> Either String (Maybe [FailedBatchItem])
-> Either String (Int -> Integer -> BatchUpdateTableRowsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Either String (Maybe (Maybe [FailedBatchItem]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"failedBatchItems"
                            Either String (Maybe (Maybe [FailedBatchItem]))
-> Maybe [FailedBatchItem]
-> Either String (Maybe [FailedBatchItem])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [FailedBatchItem]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either String (Int -> Integer -> BatchUpdateTableRowsResponse)
-> Either String Int
-> Either String (Integer -> BatchUpdateTableRowsResponse)
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 (Integer -> BatchUpdateTableRowsResponse)
-> Either String Integer
-> Either String BatchUpdateTableRowsResponse
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 BatchUpdateTableRows

instance Prelude.NFData BatchUpdateTableRows

instance Core.ToHeaders BatchUpdateTableRows where
  toHeaders :: BatchUpdateTableRows -> ResponseHeaders
toHeaders =
    ResponseHeaders -> BatchUpdateTableRows -> 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 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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"clientRequestToken" 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
clientRequestToken,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"rowsToUpdate" Text -> NonEmpty UpdateRowData -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty UpdateRowData
rowsToUpdate)
          ]
      )

instance Core.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
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/workbooks/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
workbookId,
        ByteString
"/tables/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
tableId,
        ByteString
"/rows/batchupdate"
      ]

instance Core.ToQuery BatchUpdateTableRows where
  toQuery :: BatchUpdateTableRows -> QueryString
toQuery = QueryString -> BatchUpdateTableRows -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(BatchUpdateTableRowsResponse
 -> BatchUpdateTableRowsResponse -> Bool)
-> (BatchUpdateTableRowsResponse
    -> BatchUpdateTableRowsResponse -> Bool)
-> Eq BatchUpdateTableRowsResponse
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]
(Int -> ReadS BatchUpdateTableRowsResponse)
-> ReadS [BatchUpdateTableRowsResponse]
-> ReadPrec BatchUpdateTableRowsResponse
-> ReadPrec [BatchUpdateTableRowsResponse]
-> Read 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
(Int -> BatchUpdateTableRowsResponse -> ShowS)
-> (BatchUpdateTableRowsResponse -> String)
-> ([BatchUpdateTableRowsResponse] -> ShowS)
-> Show BatchUpdateTableRowsResponse
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.
 BatchUpdateTableRowsResponse -> Rep BatchUpdateTableRowsResponse x)
-> (forall x.
    Rep BatchUpdateTableRowsResponse x -> BatchUpdateTableRowsResponse)
-> Generic BatchUpdateTableRowsResponse
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' :: Maybe [FailedBatchItem]
-> Int -> Integer -> BatchUpdateTableRowsResponse
BatchUpdateTableRowsResponse'
      { $sel:failedBatchItems:BatchUpdateTableRowsResponse' :: Maybe [FailedBatchItem]
failedBatchItems =
          Maybe [FailedBatchItem]
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 :: (Maybe [FailedBatchItem] -> f (Maybe [FailedBatchItem]))
-> BatchUpdateTableRowsResponse -> f BatchUpdateTableRowsResponse
batchUpdateTableRowsResponse_failedBatchItems = (BatchUpdateTableRowsResponse -> Maybe [FailedBatchItem])
-> (BatchUpdateTableRowsResponse
    -> Maybe [FailedBatchItem] -> BatchUpdateTableRowsResponse)
-> Lens
     BatchUpdateTableRowsResponse
     BatchUpdateTableRowsResponse
     (Maybe [FailedBatchItem])
     (Maybe [FailedBatchItem])
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) ((Maybe [FailedBatchItem] -> f (Maybe [FailedBatchItem]))
 -> BatchUpdateTableRowsResponse -> f BatchUpdateTableRowsResponse)
-> ((Maybe [FailedBatchItem] -> f (Maybe [FailedBatchItem]))
    -> Maybe [FailedBatchItem] -> f (Maybe [FailedBatchItem]))
-> (Maybe [FailedBatchItem] -> f (Maybe [FailedBatchItem]))
-> BatchUpdateTableRowsResponse
-> f BatchUpdateTableRowsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [FailedBatchItem]
  [FailedBatchItem]
  [FailedBatchItem]
  [FailedBatchItem]
-> Iso
     (Maybe [FailedBatchItem])
     (Maybe [FailedBatchItem])
     (Maybe [FailedBatchItem])
     (Maybe [FailedBatchItem])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [FailedBatchItem]
  [FailedBatchItem]
  [FailedBatchItem]
  [FailedBatchItem]
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 :: (Int -> f Int)
-> BatchUpdateTableRowsResponse -> f BatchUpdateTableRowsResponse
batchUpdateTableRowsResponse_httpStatus = (BatchUpdateTableRowsResponse -> Int)
-> (BatchUpdateTableRowsResponse
    -> Int -> BatchUpdateTableRowsResponse)
-> Lens
     BatchUpdateTableRowsResponse BatchUpdateTableRowsResponse Int Int
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 :: (Integer -> f Integer)
-> BatchUpdateTableRowsResponse -> f BatchUpdateTableRowsResponse
batchUpdateTableRowsResponse_workbookCursor = (BatchUpdateTableRowsResponse -> Integer)
-> (BatchUpdateTableRowsResponse
    -> Integer -> BatchUpdateTableRowsResponse)
-> Lens
     BatchUpdateTableRowsResponse
     BatchUpdateTableRowsResponse
     Integer
     Integer
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