{-# 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.Pinpoint.Types.CampaignEmailMessage where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data CampaignEmailMessage = CampaignEmailMessage'
{
CampaignEmailMessage -> Maybe Text
body :: Prelude.Maybe Prelude.Text,
CampaignEmailMessage -> Maybe Text
fromAddress :: Prelude.Maybe Prelude.Text,
CampaignEmailMessage -> Maybe Text
htmlBody :: Prelude.Maybe Prelude.Text,
CampaignEmailMessage -> Maybe Text
title :: Prelude.Maybe Prelude.Text
}
deriving (CampaignEmailMessage -> CampaignEmailMessage -> Bool
(CampaignEmailMessage -> CampaignEmailMessage -> Bool)
-> (CampaignEmailMessage -> CampaignEmailMessage -> Bool)
-> Eq CampaignEmailMessage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CampaignEmailMessage -> CampaignEmailMessage -> Bool
$c/= :: CampaignEmailMessage -> CampaignEmailMessage -> Bool
== :: CampaignEmailMessage -> CampaignEmailMessage -> Bool
$c== :: CampaignEmailMessage -> CampaignEmailMessage -> Bool
Prelude.Eq, ReadPrec [CampaignEmailMessage]
ReadPrec CampaignEmailMessage
Int -> ReadS CampaignEmailMessage
ReadS [CampaignEmailMessage]
(Int -> ReadS CampaignEmailMessage)
-> ReadS [CampaignEmailMessage]
-> ReadPrec CampaignEmailMessage
-> ReadPrec [CampaignEmailMessage]
-> Read CampaignEmailMessage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CampaignEmailMessage]
$creadListPrec :: ReadPrec [CampaignEmailMessage]
readPrec :: ReadPrec CampaignEmailMessage
$creadPrec :: ReadPrec CampaignEmailMessage
readList :: ReadS [CampaignEmailMessage]
$creadList :: ReadS [CampaignEmailMessage]
readsPrec :: Int -> ReadS CampaignEmailMessage
$creadsPrec :: Int -> ReadS CampaignEmailMessage
Prelude.Read, Int -> CampaignEmailMessage -> ShowS
[CampaignEmailMessage] -> ShowS
CampaignEmailMessage -> String
(Int -> CampaignEmailMessage -> ShowS)
-> (CampaignEmailMessage -> String)
-> ([CampaignEmailMessage] -> ShowS)
-> Show CampaignEmailMessage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CampaignEmailMessage] -> ShowS
$cshowList :: [CampaignEmailMessage] -> ShowS
show :: CampaignEmailMessage -> String
$cshow :: CampaignEmailMessage -> String
showsPrec :: Int -> CampaignEmailMessage -> ShowS
$cshowsPrec :: Int -> CampaignEmailMessage -> ShowS
Prelude.Show, (forall x. CampaignEmailMessage -> Rep CampaignEmailMessage x)
-> (forall x. Rep CampaignEmailMessage x -> CampaignEmailMessage)
-> Generic CampaignEmailMessage
forall x. Rep CampaignEmailMessage x -> CampaignEmailMessage
forall x. CampaignEmailMessage -> Rep CampaignEmailMessage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CampaignEmailMessage x -> CampaignEmailMessage
$cfrom :: forall x. CampaignEmailMessage -> Rep CampaignEmailMessage x
Prelude.Generic)
newCampaignEmailMessage ::
CampaignEmailMessage
newCampaignEmailMessage :: CampaignEmailMessage
newCampaignEmailMessage =
CampaignEmailMessage' :: Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> CampaignEmailMessage
CampaignEmailMessage'
{ $sel:body:CampaignEmailMessage' :: Maybe Text
body = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:fromAddress:CampaignEmailMessage' :: Maybe Text
fromAddress = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:htmlBody:CampaignEmailMessage' :: Maybe Text
htmlBody = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:title:CampaignEmailMessage' :: Maybe Text
title = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
campaignEmailMessage_body :: Lens.Lens' CampaignEmailMessage (Prelude.Maybe Prelude.Text)
campaignEmailMessage_body :: (Maybe Text -> f (Maybe Text))
-> CampaignEmailMessage -> f CampaignEmailMessage
campaignEmailMessage_body = (CampaignEmailMessage -> Maybe Text)
-> (CampaignEmailMessage -> Maybe Text -> CampaignEmailMessage)
-> Lens
CampaignEmailMessage CampaignEmailMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CampaignEmailMessage' {Maybe Text
body :: Maybe Text
$sel:body:CampaignEmailMessage' :: CampaignEmailMessage -> Maybe Text
body} -> Maybe Text
body) (\s :: CampaignEmailMessage
s@CampaignEmailMessage' {} Maybe Text
a -> CampaignEmailMessage
s {$sel:body:CampaignEmailMessage' :: Maybe Text
body = Maybe Text
a} :: CampaignEmailMessage)
campaignEmailMessage_fromAddress :: Lens.Lens' CampaignEmailMessage (Prelude.Maybe Prelude.Text)
campaignEmailMessage_fromAddress :: (Maybe Text -> f (Maybe Text))
-> CampaignEmailMessage -> f CampaignEmailMessage
campaignEmailMessage_fromAddress = (CampaignEmailMessage -> Maybe Text)
-> (CampaignEmailMessage -> Maybe Text -> CampaignEmailMessage)
-> Lens
CampaignEmailMessage CampaignEmailMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CampaignEmailMessage' {Maybe Text
fromAddress :: Maybe Text
$sel:fromAddress:CampaignEmailMessage' :: CampaignEmailMessage -> Maybe Text
fromAddress} -> Maybe Text
fromAddress) (\s :: CampaignEmailMessage
s@CampaignEmailMessage' {} Maybe Text
a -> CampaignEmailMessage
s {$sel:fromAddress:CampaignEmailMessage' :: Maybe Text
fromAddress = Maybe Text
a} :: CampaignEmailMessage)
campaignEmailMessage_htmlBody :: Lens.Lens' CampaignEmailMessage (Prelude.Maybe Prelude.Text)
campaignEmailMessage_htmlBody :: (Maybe Text -> f (Maybe Text))
-> CampaignEmailMessage -> f CampaignEmailMessage
campaignEmailMessage_htmlBody = (CampaignEmailMessage -> Maybe Text)
-> (CampaignEmailMessage -> Maybe Text -> CampaignEmailMessage)
-> Lens
CampaignEmailMessage CampaignEmailMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CampaignEmailMessage' {Maybe Text
htmlBody :: Maybe Text
$sel:htmlBody:CampaignEmailMessage' :: CampaignEmailMessage -> Maybe Text
htmlBody} -> Maybe Text
htmlBody) (\s :: CampaignEmailMessage
s@CampaignEmailMessage' {} Maybe Text
a -> CampaignEmailMessage
s {$sel:htmlBody:CampaignEmailMessage' :: Maybe Text
htmlBody = Maybe Text
a} :: CampaignEmailMessage)
campaignEmailMessage_title :: Lens.Lens' CampaignEmailMessage (Prelude.Maybe Prelude.Text)
campaignEmailMessage_title :: (Maybe Text -> f (Maybe Text))
-> CampaignEmailMessage -> f CampaignEmailMessage
campaignEmailMessage_title = (CampaignEmailMessage -> Maybe Text)
-> (CampaignEmailMessage -> Maybe Text -> CampaignEmailMessage)
-> Lens
CampaignEmailMessage CampaignEmailMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CampaignEmailMessage' {Maybe Text
title :: Maybe Text
$sel:title:CampaignEmailMessage' :: CampaignEmailMessage -> Maybe Text
title} -> Maybe Text
title) (\s :: CampaignEmailMessage
s@CampaignEmailMessage' {} Maybe Text
a -> CampaignEmailMessage
s {$sel:title:CampaignEmailMessage' :: Maybe Text
title = Maybe Text
a} :: CampaignEmailMessage)
instance Core.FromJSON CampaignEmailMessage where
parseJSON :: Value -> Parser CampaignEmailMessage
parseJSON =
String
-> (Object -> Parser CampaignEmailMessage)
-> Value
-> Parser CampaignEmailMessage
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"CampaignEmailMessage"
( \Object
x ->
Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> CampaignEmailMessage
CampaignEmailMessage'
(Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> CampaignEmailMessage)
-> Parser (Maybe Text)
-> Parser
(Maybe Text -> Maybe Text -> Maybe Text -> CampaignEmailMessage)
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
"Body")
Parser
(Maybe Text -> Maybe Text -> Maybe Text -> CampaignEmailMessage)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> CampaignEmailMessage)
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
"FromAddress")
Parser (Maybe Text -> Maybe Text -> CampaignEmailMessage)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> CampaignEmailMessage)
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
"HtmlBody")
Parser (Maybe Text -> CampaignEmailMessage)
-> Parser (Maybe Text) -> Parser CampaignEmailMessage
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
"Title")
)
instance Prelude.Hashable CampaignEmailMessage
instance Prelude.NFData CampaignEmailMessage
instance Core.ToJSON CampaignEmailMessage where
toJSON :: CampaignEmailMessage -> Value
toJSON CampaignEmailMessage' {Maybe Text
title :: Maybe Text
htmlBody :: Maybe Text
fromAddress :: Maybe Text
body :: Maybe Text
$sel:title:CampaignEmailMessage' :: CampaignEmailMessage -> Maybe Text
$sel:htmlBody:CampaignEmailMessage' :: CampaignEmailMessage -> Maybe Text
$sel:fromAddress:CampaignEmailMessage' :: CampaignEmailMessage -> Maybe Text
$sel:body:CampaignEmailMessage' :: CampaignEmailMessage -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Body" 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
body,
(Text
"FromAddress" 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
fromAddress,
(Text
"HtmlBody" 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
htmlBody,
(Text
"Title" 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
title
]
)