{-# 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.EmailTemplateContent where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data EmailTemplateContent = EmailTemplateContent'
{
EmailTemplateContent -> Maybe Text
subject :: Prelude.Maybe Prelude.Text,
EmailTemplateContent -> Maybe Text
text :: Prelude.Maybe Prelude.Text,
EmailTemplateContent -> Maybe Text
html :: Prelude.Maybe Prelude.Text
}
deriving (EmailTemplateContent -> EmailTemplateContent -> Bool
(EmailTemplateContent -> EmailTemplateContent -> Bool)
-> (EmailTemplateContent -> EmailTemplateContent -> Bool)
-> Eq EmailTemplateContent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EmailTemplateContent -> EmailTemplateContent -> Bool
$c/= :: EmailTemplateContent -> EmailTemplateContent -> Bool
== :: EmailTemplateContent -> EmailTemplateContent -> Bool
$c== :: EmailTemplateContent -> EmailTemplateContent -> Bool
Prelude.Eq, ReadPrec [EmailTemplateContent]
ReadPrec EmailTemplateContent
Int -> ReadS EmailTemplateContent
ReadS [EmailTemplateContent]
(Int -> ReadS EmailTemplateContent)
-> ReadS [EmailTemplateContent]
-> ReadPrec EmailTemplateContent
-> ReadPrec [EmailTemplateContent]
-> Read EmailTemplateContent
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EmailTemplateContent]
$creadListPrec :: ReadPrec [EmailTemplateContent]
readPrec :: ReadPrec EmailTemplateContent
$creadPrec :: ReadPrec EmailTemplateContent
readList :: ReadS [EmailTemplateContent]
$creadList :: ReadS [EmailTemplateContent]
readsPrec :: Int -> ReadS EmailTemplateContent
$creadsPrec :: Int -> ReadS EmailTemplateContent
Prelude.Read, Int -> EmailTemplateContent -> ShowS
[EmailTemplateContent] -> ShowS
EmailTemplateContent -> String
(Int -> EmailTemplateContent -> ShowS)
-> (EmailTemplateContent -> String)
-> ([EmailTemplateContent] -> ShowS)
-> Show EmailTemplateContent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EmailTemplateContent] -> ShowS
$cshowList :: [EmailTemplateContent] -> ShowS
show :: EmailTemplateContent -> String
$cshow :: EmailTemplateContent -> String
showsPrec :: Int -> EmailTemplateContent -> ShowS
$cshowsPrec :: Int -> EmailTemplateContent -> ShowS
Prelude.Show, (forall x. EmailTemplateContent -> Rep EmailTemplateContent x)
-> (forall x. Rep EmailTemplateContent x -> EmailTemplateContent)
-> Generic EmailTemplateContent
forall x. Rep EmailTemplateContent x -> EmailTemplateContent
forall x. EmailTemplateContent -> Rep EmailTemplateContent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EmailTemplateContent x -> EmailTemplateContent
$cfrom :: forall x. EmailTemplateContent -> Rep EmailTemplateContent x
Prelude.Generic)
newEmailTemplateContent ::
EmailTemplateContent
newEmailTemplateContent :: EmailTemplateContent
newEmailTemplateContent =
EmailTemplateContent' :: Maybe Text -> Maybe Text -> Maybe Text -> EmailTemplateContent
EmailTemplateContent'
{ $sel:subject:EmailTemplateContent' :: Maybe Text
subject = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:text:EmailTemplateContent' :: Maybe Text
text = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:html:EmailTemplateContent' :: Maybe Text
html = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
emailTemplateContent_subject :: Lens.Lens' EmailTemplateContent (Prelude.Maybe Prelude.Text)
emailTemplateContent_subject :: (Maybe Text -> f (Maybe Text))
-> EmailTemplateContent -> f EmailTemplateContent
emailTemplateContent_subject = (EmailTemplateContent -> Maybe Text)
-> (EmailTemplateContent -> Maybe Text -> EmailTemplateContent)
-> Lens
EmailTemplateContent EmailTemplateContent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EmailTemplateContent' {Maybe Text
subject :: Maybe Text
$sel:subject:EmailTemplateContent' :: EmailTemplateContent -> Maybe Text
subject} -> Maybe Text
subject) (\s :: EmailTemplateContent
s@EmailTemplateContent' {} Maybe Text
a -> EmailTemplateContent
s {$sel:subject:EmailTemplateContent' :: Maybe Text
subject = Maybe Text
a} :: EmailTemplateContent)
emailTemplateContent_text :: Lens.Lens' EmailTemplateContent (Prelude.Maybe Prelude.Text)
emailTemplateContent_text :: (Maybe Text -> f (Maybe Text))
-> EmailTemplateContent -> f EmailTemplateContent
emailTemplateContent_text = (EmailTemplateContent -> Maybe Text)
-> (EmailTemplateContent -> Maybe Text -> EmailTemplateContent)
-> Lens
EmailTemplateContent EmailTemplateContent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EmailTemplateContent' {Maybe Text
text :: Maybe Text
$sel:text:EmailTemplateContent' :: EmailTemplateContent -> Maybe Text
text} -> Maybe Text
text) (\s :: EmailTemplateContent
s@EmailTemplateContent' {} Maybe Text
a -> EmailTemplateContent
s {$sel:text:EmailTemplateContent' :: Maybe Text
text = Maybe Text
a} :: EmailTemplateContent)
emailTemplateContent_html :: Lens.Lens' EmailTemplateContent (Prelude.Maybe Prelude.Text)
emailTemplateContent_html :: (Maybe Text -> f (Maybe Text))
-> EmailTemplateContent -> f EmailTemplateContent
emailTemplateContent_html = (EmailTemplateContent -> Maybe Text)
-> (EmailTemplateContent -> Maybe Text -> EmailTemplateContent)
-> Lens
EmailTemplateContent EmailTemplateContent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EmailTemplateContent' {Maybe Text
html :: Maybe Text
$sel:html:EmailTemplateContent' :: EmailTemplateContent -> Maybe Text
html} -> Maybe Text
html) (\s :: EmailTemplateContent
s@EmailTemplateContent' {} Maybe Text
a -> EmailTemplateContent
s {$sel:html:EmailTemplateContent' :: Maybe Text
html = Maybe Text
a} :: EmailTemplateContent)
instance Core.FromJSON EmailTemplateContent where
parseJSON :: Value -> Parser EmailTemplateContent
parseJSON =
String
-> (Object -> Parser EmailTemplateContent)
-> Value
-> Parser EmailTemplateContent
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"EmailTemplateContent"
( \Object
x ->
Maybe Text -> Maybe Text -> Maybe Text -> EmailTemplateContent
EmailTemplateContent'
(Maybe Text -> Maybe Text -> Maybe Text -> EmailTemplateContent)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> EmailTemplateContent)
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
"Subject")
Parser (Maybe Text -> Maybe Text -> EmailTemplateContent)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> EmailTemplateContent)
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
"Text")
Parser (Maybe Text -> EmailTemplateContent)
-> Parser (Maybe Text) -> Parser EmailTemplateContent
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
"Html")
)
instance Prelude.Hashable EmailTemplateContent
instance Prelude.NFData EmailTemplateContent
instance Core.ToJSON EmailTemplateContent where
toJSON :: EmailTemplateContent -> Value
toJSON EmailTemplateContent' {Maybe Text
html :: Maybe Text
text :: Maybe Text
subject :: Maybe Text
$sel:html:EmailTemplateContent' :: EmailTemplateContent -> Maybe Text
$sel:text:EmailTemplateContent' :: EmailTemplateContent -> Maybe Text
$sel:subject:EmailTemplateContent' :: EmailTemplateContent -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Subject" 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
subject,
(Text
"Text" 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
text,
(Text
"Html" 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
html
]
)