{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE StrictData #-} {-# LANGUAGE NoImplicitPrelude #-} {-# OPTIONS_GHC -fno-warn-unused-imports #-} {-# OPTIONS_GHC -fno-warn-unused-matches #-} -- Derived from AWS service descriptions, licensed under Apache 2.0. -- | -- Module : Amazonka.HoneyCode.Types.Cell -- Copyright : (c) 2013-2021 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com> -- Stability : auto-generated -- Portability : non-portable (GHC extensions) module Amazonka.HoneyCode.Types.Cell where import qualified Amazonka.Core as Core import Amazonka.HoneyCode.Types.Format import qualified Amazonka.Lens as Lens import qualified Amazonka.Prelude as Prelude -- | An object that represents a single cell in a table. -- -- /See:/ 'newCell' smart constructor. data Cell = Cell' { -- | The raw value of the data contained in the cell. The raw value depends -- on the format of the data in the cell. However the attribute in the API -- return value is always a string containing the raw value. -- -- Cells with format DATE, DATE_TIME or TIME have the raw value as a -- floating point number where the whole number represents the number of -- days since 1\/1\/1900 and the fractional part represents the fraction of -- the day since midnight. For example, a cell with date 11\/3\/2020 has -- the raw value \"44138\". A cell with the time 9:00 AM has the raw value -- \"0.375\" and a cell with date\/time value of 11\/3\/2020 9:00 AM has -- the raw value \"44138.375\". Notice that even though the raw value is a -- number in all three cases, it is still represented as a string. -- -- Cells with format NUMBER, CURRENCY, PERCENTAGE and ACCOUNTING have the -- raw value of the data as the number representing the data being -- displayed. For example, the number 1.325 with two decimal places in the -- format will have it\'s raw value as \"1.325\" and formatted value as -- \"1.33\". A currency value for $10 will have the raw value as \"10\" and -- formatted value as \"$10.00\". A value representing 20% with two decimal -- places in the format will have its raw value as \"0.2\" and the -- formatted value as \"20.00%\". An accounting value of -$25 will have -- \"-25\" as the raw value and \"$ (25.00)\" as the formatted value. -- -- Cells with format TEXT will have the raw text as the raw value. For -- example, a cell with text \"John Smith\" will have \"John Smith\" as -- both the raw value and the formatted value. -- -- Cells with format CONTACT will have the name of the contact as a -- formatted value and the email address of the contact as the raw value. -- For example, a contact for John Smith will have \"John Smith\" as the -- formatted value and \"john.smith\@example.com\" as the raw value. -- -- Cells with format ROWLINK (aka picklist) will have the first column of -- the linked row as the formatted value and the row id of the linked row -- as the raw value. For example, a cell containing a picklist to a table -- that displays task status might have \"Completed\" as the formatted -- value and -- \"row:dfcefaee-5b37-4355-8f28-40c3e4ff5dd4\/ca432b2f-b8eb-431d-9fb5-cbe0342f9f03\" -- as the raw value. -- -- Cells with format AUTO or cells without any format that are -- auto-detected as one of the formats above will contain the raw and -- formatted values as mentioned above, based on the auto-detected formats. -- If there is no auto-detected format, the raw and formatted values will -- be the same as the data in the cell. Cell -> Maybe Text rawValue :: Prelude.Maybe Prelude.Text, -- | The format of the cell. If this field is empty, then the format is -- either not specified in the workbook or the format is set to AUTO. Cell -> Maybe Format format :: Prelude.Maybe Format, -- | The formula contained in the cell. This field is empty if a cell does -- not have a formula. Cell -> Maybe (Sensitive Text) formula :: Prelude.Maybe (Core.Sensitive Prelude.Text), -- | The formatted value of the cell. This is the value that you see -- displayed in the cell in the UI. -- -- Note that the formatted value of a cell is always represented as a -- string irrespective of the data that is stored in the cell. For example, -- if a cell contains a date, the formatted value of the cell is the string -- representation of the formatted date being shown in the cell in the UI. -- See details in the rawValue field below for how cells of different -- formats will have different raw and formatted values. Cell -> Maybe Text formattedValue :: Prelude.Maybe Prelude.Text } deriving (Cell -> Cell -> Bool (Cell -> Cell -> Bool) -> (Cell -> Cell -> Bool) -> Eq Cell forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a /= :: Cell -> Cell -> Bool $c/= :: Cell -> Cell -> Bool == :: Cell -> Cell -> Bool $c== :: Cell -> Cell -> Bool Prelude.Eq, Int -> Cell -> ShowS [Cell] -> ShowS Cell -> String (Int -> Cell -> ShowS) -> (Cell -> String) -> ([Cell] -> ShowS) -> Show Cell forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a showList :: [Cell] -> ShowS $cshowList :: [Cell] -> ShowS show :: Cell -> String $cshow :: Cell -> String showsPrec :: Int -> Cell -> ShowS $cshowsPrec :: Int -> Cell -> ShowS Prelude.Show, (forall x. Cell -> Rep Cell x) -> (forall x. Rep Cell x -> Cell) -> Generic Cell forall x. Rep Cell x -> Cell forall x. Cell -> Rep Cell x forall a. (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a $cto :: forall x. Rep Cell x -> Cell $cfrom :: forall x. Cell -> Rep Cell x Prelude.Generic) -- | -- Create a value of 'Cell' 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: -- -- 'rawValue', 'cell_rawValue' - The raw value of the data contained in the cell. The raw value depends -- on the format of the data in the cell. However the attribute in the API -- return value is always a string containing the raw value. -- -- Cells with format DATE, DATE_TIME or TIME have the raw value as a -- floating point number where the whole number represents the number of -- days since 1\/1\/1900 and the fractional part represents the fraction of -- the day since midnight. For example, a cell with date 11\/3\/2020 has -- the raw value \"44138\". A cell with the time 9:00 AM has the raw value -- \"0.375\" and a cell with date\/time value of 11\/3\/2020 9:00 AM has -- the raw value \"44138.375\". Notice that even though the raw value is a -- number in all three cases, it is still represented as a string. -- -- Cells with format NUMBER, CURRENCY, PERCENTAGE and ACCOUNTING have the -- raw value of the data as the number representing the data being -- displayed. For example, the number 1.325 with two decimal places in the -- format will have it\'s raw value as \"1.325\" and formatted value as -- \"1.33\". A currency value for $10 will have the raw value as \"10\" and -- formatted value as \"$10.00\". A value representing 20% with two decimal -- places in the format will have its raw value as \"0.2\" and the -- formatted value as \"20.00%\". An accounting value of -$25 will have -- \"-25\" as the raw value and \"$ (25.00)\" as the formatted value. -- -- Cells with format TEXT will have the raw text as the raw value. For -- example, a cell with text \"John Smith\" will have \"John Smith\" as -- both the raw value and the formatted value. -- -- Cells with format CONTACT will have the name of the contact as a -- formatted value and the email address of the contact as the raw value. -- For example, a contact for John Smith will have \"John Smith\" as the -- formatted value and \"john.smith\@example.com\" as the raw value. -- -- Cells with format ROWLINK (aka picklist) will have the first column of -- the linked row as the formatted value and the row id of the linked row -- as the raw value. For example, a cell containing a picklist to a table -- that displays task status might have \"Completed\" as the formatted -- value and -- \"row:dfcefaee-5b37-4355-8f28-40c3e4ff5dd4\/ca432b2f-b8eb-431d-9fb5-cbe0342f9f03\" -- as the raw value. -- -- Cells with format AUTO or cells without any format that are -- auto-detected as one of the formats above will contain the raw and -- formatted values as mentioned above, based on the auto-detected formats. -- If there is no auto-detected format, the raw and formatted values will -- be the same as the data in the cell. -- -- 'format', 'cell_format' - The format of the cell. If this field is empty, then the format is -- either not specified in the workbook or the format is set to AUTO. -- -- 'formula', 'cell_formula' - The formula contained in the cell. This field is empty if a cell does -- not have a formula. -- -- 'formattedValue', 'cell_formattedValue' - The formatted value of the cell. This is the value that you see -- displayed in the cell in the UI. -- -- Note that the formatted value of a cell is always represented as a -- string irrespective of the data that is stored in the cell. For example, -- if a cell contains a date, the formatted value of the cell is the string -- representation of the formatted date being shown in the cell in the UI. -- See details in the rawValue field below for how cells of different -- formats will have different raw and formatted values. newCell :: Cell newCell :: Cell newCell = Cell' :: Maybe Text -> Maybe Format -> Maybe (Sensitive Text) -> Maybe Text -> Cell Cell' { $sel:rawValue:Cell' :: Maybe Text rawValue = Maybe Text forall a. Maybe a Prelude.Nothing, $sel:format:Cell' :: Maybe Format format = Maybe Format forall a. Maybe a Prelude.Nothing, $sel:formula:Cell' :: Maybe (Sensitive Text) formula = Maybe (Sensitive Text) forall a. Maybe a Prelude.Nothing, $sel:formattedValue:Cell' :: Maybe Text formattedValue = Maybe Text forall a. Maybe a Prelude.Nothing } -- | The raw value of the data contained in the cell. The raw value depends -- on the format of the data in the cell. However the attribute in the API -- return value is always a string containing the raw value. -- -- Cells with format DATE, DATE_TIME or TIME have the raw value as a -- floating point number where the whole number represents the number of -- days since 1\/1\/1900 and the fractional part represents the fraction of -- the day since midnight. For example, a cell with date 11\/3\/2020 has -- the raw value \"44138\". A cell with the time 9:00 AM has the raw value -- \"0.375\" and a cell with date\/time value of 11\/3\/2020 9:00 AM has -- the raw value \"44138.375\". Notice that even though the raw value is a -- number in all three cases, it is still represented as a string. -- -- Cells with format NUMBER, CURRENCY, PERCENTAGE and ACCOUNTING have the -- raw value of the data as the number representing the data being -- displayed. For example, the number 1.325 with two decimal places in the -- format will have it\'s raw value as \"1.325\" and formatted value as -- \"1.33\". A currency value for $10 will have the raw value as \"10\" and -- formatted value as \"$10.00\". A value representing 20% with two decimal -- places in the format will have its raw value as \"0.2\" and the -- formatted value as \"20.00%\". An accounting value of -$25 will have -- \"-25\" as the raw value and \"$ (25.00)\" as the formatted value. -- -- Cells with format TEXT will have the raw text as the raw value. For -- example, a cell with text \"John Smith\" will have \"John Smith\" as -- both the raw value and the formatted value. -- -- Cells with format CONTACT will have the name of the contact as a -- formatted value and the email address of the contact as the raw value. -- For example, a contact for John Smith will have \"John Smith\" as the -- formatted value and \"john.smith\@example.com\" as the raw value. -- -- Cells with format ROWLINK (aka picklist) will have the first column of -- the linked row as the formatted value and the row id of the linked row -- as the raw value. For example, a cell containing a picklist to a table -- that displays task status might have \"Completed\" as the formatted -- value and -- \"row:dfcefaee-5b37-4355-8f28-40c3e4ff5dd4\/ca432b2f-b8eb-431d-9fb5-cbe0342f9f03\" -- as the raw value. -- -- Cells with format AUTO or cells without any format that are -- auto-detected as one of the formats above will contain the raw and -- formatted values as mentioned above, based on the auto-detected formats. -- If there is no auto-detected format, the raw and formatted values will -- be the same as the data in the cell. cell_rawValue :: Lens.Lens' Cell (Prelude.Maybe Prelude.Text) cell_rawValue :: (Maybe Text -> f (Maybe Text)) -> Cell -> f Cell cell_rawValue = (Cell -> Maybe Text) -> (Cell -> Maybe Text -> Cell) -> Lens Cell Cell (Maybe Text) (Maybe Text) forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b Lens.lens (\Cell' {Maybe Text rawValue :: Maybe Text $sel:rawValue:Cell' :: Cell -> Maybe Text rawValue} -> Maybe Text rawValue) (\s :: Cell s@Cell' {} Maybe Text a -> Cell s {$sel:rawValue:Cell' :: Maybe Text rawValue = Maybe Text a} :: Cell) -- | The format of the cell. If this field is empty, then the format is -- either not specified in the workbook or the format is set to AUTO. cell_format :: Lens.Lens' Cell (Prelude.Maybe Format) cell_format :: (Maybe Format -> f (Maybe Format)) -> Cell -> f Cell cell_format = (Cell -> Maybe Format) -> (Cell -> Maybe Format -> Cell) -> Lens Cell Cell (Maybe Format) (Maybe Format) forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b Lens.lens (\Cell' {Maybe Format format :: Maybe Format $sel:format:Cell' :: Cell -> Maybe Format format} -> Maybe Format format) (\s :: Cell s@Cell' {} Maybe Format a -> Cell s {$sel:format:Cell' :: Maybe Format format = Maybe Format a} :: Cell) -- | The formula contained in the cell. This field is empty if a cell does -- not have a formula. cell_formula :: Lens.Lens' Cell (Prelude.Maybe Prelude.Text) cell_formula :: (Maybe Text -> f (Maybe Text)) -> Cell -> f Cell cell_formula = (Cell -> Maybe (Sensitive Text)) -> (Cell -> Maybe (Sensitive Text) -> Cell) -> Lens Cell Cell (Maybe (Sensitive Text)) (Maybe (Sensitive Text)) forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b Lens.lens (\Cell' {Maybe (Sensitive Text) formula :: Maybe (Sensitive Text) $sel:formula:Cell' :: Cell -> Maybe (Sensitive Text) formula} -> Maybe (Sensitive Text) formula) (\s :: Cell s@Cell' {} Maybe (Sensitive Text) a -> Cell s {$sel:formula:Cell' :: Maybe (Sensitive Text) formula = Maybe (Sensitive Text) a} :: Cell) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text))) -> Cell -> f Cell) -> ((Maybe Text -> f (Maybe Text)) -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text))) -> (Maybe Text -> f (Maybe Text)) -> Cell -> f Cell forall b c a. (b -> c) -> (a -> b) -> a -> c Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text -> Iso (Maybe (Sensitive Text)) (Maybe (Sensitive Text)) (Maybe Text) (Maybe Text) 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 (Sensitive Text) (Sensitive Text) Text Text forall a. Iso' (Sensitive a) a Core._Sensitive -- | The formatted value of the cell. This is the value that you see -- displayed in the cell in the UI. -- -- Note that the formatted value of a cell is always represented as a -- string irrespective of the data that is stored in the cell. For example, -- if a cell contains a date, the formatted value of the cell is the string -- representation of the formatted date being shown in the cell in the UI. -- See details in the rawValue field below for how cells of different -- formats will have different raw and formatted values. cell_formattedValue :: Lens.Lens' Cell (Prelude.Maybe Prelude.Text) cell_formattedValue :: (Maybe Text -> f (Maybe Text)) -> Cell -> f Cell cell_formattedValue = (Cell -> Maybe Text) -> (Cell -> Maybe Text -> Cell) -> Lens Cell Cell (Maybe Text) (Maybe Text) forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b Lens.lens (\Cell' {Maybe Text formattedValue :: Maybe Text $sel:formattedValue:Cell' :: Cell -> Maybe Text formattedValue} -> Maybe Text formattedValue) (\s :: Cell s@Cell' {} Maybe Text a -> Cell s {$sel:formattedValue:Cell' :: Maybe Text formattedValue = Maybe Text a} :: Cell) instance Core.FromJSON Cell where parseJSON :: Value -> Parser Cell parseJSON = String -> (Object -> Parser Cell) -> Value -> Parser Cell forall a. String -> (Object -> Parser a) -> Value -> Parser a Core.withObject String "Cell" ( \Object x -> Maybe Text -> Maybe Format -> Maybe (Sensitive Text) -> Maybe Text -> Cell Cell' (Maybe Text -> Maybe Format -> Maybe (Sensitive Text) -> Maybe Text -> Cell) -> Parser (Maybe Text) -> Parser (Maybe Format -> Maybe (Sensitive Text) -> Maybe Text -> Cell) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b Prelude.<$> (Object x Object -> Text -> Parser (Maybe Text) forall a. FromJSON a => Object -> Text -> Parser (Maybe a) Core..:? Text "rawValue") Parser (Maybe Format -> Maybe (Sensitive Text) -> Maybe Text -> Cell) -> Parser (Maybe Format) -> Parser (Maybe (Sensitive Text) -> Maybe Text -> Cell) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b Prelude.<*> (Object x Object -> Text -> Parser (Maybe Format) forall a. FromJSON a => Object -> Text -> Parser (Maybe a) Core..:? Text "format") Parser (Maybe (Sensitive Text) -> Maybe Text -> Cell) -> Parser (Maybe (Sensitive Text)) -> Parser (Maybe Text -> Cell) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b Prelude.<*> (Object x Object -> Text -> Parser (Maybe (Sensitive Text)) forall a. FromJSON a => Object -> Text -> Parser (Maybe a) Core..:? Text "formula") Parser (Maybe Text -> Cell) -> Parser (Maybe Text) -> Parser Cell forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b Prelude.<*> (Object x Object -> Text -> Parser (Maybe Text) forall a. FromJSON a => Object -> Text -> Parser (Maybe a) Core..:? Text "formattedValue") ) instance Prelude.Hashable Cell instance Prelude.NFData Cell