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