{-# 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 #-}
module Amazonka.PinpointEmail.Types.Content where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Content = Content'
{
Content -> Maybe Text
charset :: Prelude.Maybe Prelude.Text,
Content -> Text
data' :: Prelude.Text
}
deriving (Content -> Content -> Bool
(Content -> Content -> Bool)
-> (Content -> Content -> Bool) -> Eq Content
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Content -> Content -> Bool
$c/= :: Content -> Content -> Bool
== :: Content -> Content -> Bool
$c== :: Content -> Content -> Bool
Prelude.Eq, ReadPrec [Content]
ReadPrec Content
Int -> ReadS Content
ReadS [Content]
(Int -> ReadS Content)
-> ReadS [Content]
-> ReadPrec Content
-> ReadPrec [Content]
-> Read Content
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Content]
$creadListPrec :: ReadPrec [Content]
readPrec :: ReadPrec Content
$creadPrec :: ReadPrec Content
readList :: ReadS [Content]
$creadList :: ReadS [Content]
readsPrec :: Int -> ReadS Content
$creadsPrec :: Int -> ReadS Content
Prelude.Read, Int -> Content -> ShowS
[Content] -> ShowS
Content -> String
(Int -> Content -> ShowS)
-> (Content -> String) -> ([Content] -> ShowS) -> Show Content
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Content] -> ShowS
$cshowList :: [Content] -> ShowS
show :: Content -> String
$cshow :: Content -> String
showsPrec :: Int -> Content -> ShowS
$cshowsPrec :: Int -> Content -> ShowS
Prelude.Show, (forall x. Content -> Rep Content x)
-> (forall x. Rep Content x -> Content) -> Generic Content
forall x. Rep Content x -> Content
forall x. Content -> Rep Content x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Content x -> Content
$cfrom :: forall x. Content -> Rep Content x
Prelude.Generic)
newContent ::
Prelude.Text ->
Content
newContent :: Text -> Content
newContent Text
pData_ =
Content' :: Maybe Text -> Text -> Content
Content' {$sel:charset:Content' :: Maybe Text
charset = Maybe Text
forall a. Maybe a
Prelude.Nothing, $sel:data':Content' :: Text
data' = Text
pData_}
content_charset :: Lens.Lens' Content (Prelude.Maybe Prelude.Text)
content_charset :: (Maybe Text -> f (Maybe Text)) -> Content -> f Content
content_charset = (Content -> Maybe Text)
-> (Content -> Maybe Text -> Content)
-> Lens Content Content (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Content' {Maybe Text
charset :: Maybe Text
$sel:charset:Content' :: Content -> Maybe Text
charset} -> Maybe Text
charset) (\s :: Content
s@Content' {} Maybe Text
a -> Content
s {$sel:charset:Content' :: Maybe Text
charset = Maybe Text
a} :: Content)
content_data :: Lens.Lens' Content Prelude.Text
content_data :: (Text -> f Text) -> Content -> f Content
content_data = (Content -> Text)
-> (Content -> Text -> Content) -> Lens Content Content Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Content' {Text
data' :: Text
$sel:data':Content' :: Content -> Text
data'} -> Text
data') (\s :: Content
s@Content' {} Text
a -> Content
s {$sel:data':Content' :: Text
data' = Text
a} :: Content)
instance Prelude.Hashable Content
instance Prelude.NFData Content
instance Core.ToJSON Content where
toJSON :: Content -> Value
toJSON Content' {Maybe Text
Text
data' :: Text
charset :: Maybe Text
$sel:data':Content' :: Content -> Text
$sel:charset:Content' :: Content -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Charset" 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
charset,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Data" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
data')
]
)