{-# 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.EmailMessage where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pinpoint.Types.RawEmail
import Amazonka.Pinpoint.Types.SimpleEmail
import qualified Amazonka.Prelude as Prelude
data EmailMessage = EmailMessage'
{
EmailMessage -> Maybe (HashMap Text [Text])
substitutions :: Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]),
EmailMessage -> Maybe Text
body :: Prelude.Maybe Prelude.Text,
EmailMessage -> Maybe Text
fromAddress :: Prelude.Maybe Prelude.Text,
EmailMessage -> Maybe RawEmail
rawEmail :: Prelude.Maybe RawEmail,
EmailMessage -> Maybe Text
feedbackForwardingAddress :: Prelude.Maybe Prelude.Text,
EmailMessage -> Maybe SimpleEmail
simpleEmail :: Prelude.Maybe SimpleEmail,
EmailMessage -> Maybe [Text]
replyToAddresses :: Prelude.Maybe [Prelude.Text]
}
deriving (EmailMessage -> EmailMessage -> Bool
(EmailMessage -> EmailMessage -> Bool)
-> (EmailMessage -> EmailMessage -> Bool) -> Eq EmailMessage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EmailMessage -> EmailMessage -> Bool
$c/= :: EmailMessage -> EmailMessage -> Bool
== :: EmailMessage -> EmailMessage -> Bool
$c== :: EmailMessage -> EmailMessage -> Bool
Prelude.Eq, ReadPrec [EmailMessage]
ReadPrec EmailMessage
Int -> ReadS EmailMessage
ReadS [EmailMessage]
(Int -> ReadS EmailMessage)
-> ReadS [EmailMessage]
-> ReadPrec EmailMessage
-> ReadPrec [EmailMessage]
-> Read EmailMessage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EmailMessage]
$creadListPrec :: ReadPrec [EmailMessage]
readPrec :: ReadPrec EmailMessage
$creadPrec :: ReadPrec EmailMessage
readList :: ReadS [EmailMessage]
$creadList :: ReadS [EmailMessage]
readsPrec :: Int -> ReadS EmailMessage
$creadsPrec :: Int -> ReadS EmailMessage
Prelude.Read, Int -> EmailMessage -> ShowS
[EmailMessage] -> ShowS
EmailMessage -> String
(Int -> EmailMessage -> ShowS)
-> (EmailMessage -> String)
-> ([EmailMessage] -> ShowS)
-> Show EmailMessage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EmailMessage] -> ShowS
$cshowList :: [EmailMessage] -> ShowS
show :: EmailMessage -> String
$cshow :: EmailMessage -> String
showsPrec :: Int -> EmailMessage -> ShowS
$cshowsPrec :: Int -> EmailMessage -> ShowS
Prelude.Show, (forall x. EmailMessage -> Rep EmailMessage x)
-> (forall x. Rep EmailMessage x -> EmailMessage)
-> Generic EmailMessage
forall x. Rep EmailMessage x -> EmailMessage
forall x. EmailMessage -> Rep EmailMessage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EmailMessage x -> EmailMessage
$cfrom :: forall x. EmailMessage -> Rep EmailMessage x
Prelude.Generic)
newEmailMessage ::
EmailMessage
newEmailMessage :: EmailMessage
newEmailMessage =
EmailMessage' :: Maybe (HashMap Text [Text])
-> Maybe Text
-> Maybe Text
-> Maybe RawEmail
-> Maybe Text
-> Maybe SimpleEmail
-> Maybe [Text]
-> EmailMessage
EmailMessage'
{ $sel:substitutions:EmailMessage' :: Maybe (HashMap Text [Text])
substitutions = Maybe (HashMap Text [Text])
forall a. Maybe a
Prelude.Nothing,
$sel:body:EmailMessage' :: Maybe Text
body = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:fromAddress:EmailMessage' :: Maybe Text
fromAddress = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:rawEmail:EmailMessage' :: Maybe RawEmail
rawEmail = Maybe RawEmail
forall a. Maybe a
Prelude.Nothing,
$sel:feedbackForwardingAddress:EmailMessage' :: Maybe Text
feedbackForwardingAddress = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:simpleEmail:EmailMessage' :: Maybe SimpleEmail
simpleEmail = Maybe SimpleEmail
forall a. Maybe a
Prelude.Nothing,
$sel:replyToAddresses:EmailMessage' :: Maybe [Text]
replyToAddresses = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
}
emailMessage_substitutions :: Lens.Lens' EmailMessage (Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]))
emailMessage_substitutions :: (Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> EmailMessage -> f EmailMessage
emailMessage_substitutions = (EmailMessage -> Maybe (HashMap Text [Text]))
-> (EmailMessage -> Maybe (HashMap Text [Text]) -> EmailMessage)
-> Lens
EmailMessage
EmailMessage
(Maybe (HashMap Text [Text]))
(Maybe (HashMap Text [Text]))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EmailMessage' {Maybe (HashMap Text [Text])
substitutions :: Maybe (HashMap Text [Text])
$sel:substitutions:EmailMessage' :: EmailMessage -> Maybe (HashMap Text [Text])
substitutions} -> Maybe (HashMap Text [Text])
substitutions) (\s :: EmailMessage
s@EmailMessage' {} Maybe (HashMap Text [Text])
a -> EmailMessage
s {$sel:substitutions:EmailMessage' :: Maybe (HashMap Text [Text])
substitutions = Maybe (HashMap Text [Text])
a} :: EmailMessage) ((Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> EmailMessage -> f EmailMessage)
-> ((Maybe (HashMap Text [Text])
-> f (Maybe (HashMap Text [Text])))
-> Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> (Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> EmailMessage
-> f EmailMessage
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text [Text])
(HashMap Text [Text])
(HashMap Text [Text])
(HashMap Text [Text])
-> Iso
(Maybe (HashMap Text [Text]))
(Maybe (HashMap Text [Text]))
(Maybe (HashMap Text [Text]))
(Maybe (HashMap Text [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
(HashMap Text [Text])
(HashMap Text [Text])
(HashMap Text [Text])
(HashMap Text [Text])
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
emailMessage_body :: Lens.Lens' EmailMessage (Prelude.Maybe Prelude.Text)
emailMessage_body :: (Maybe Text -> f (Maybe Text)) -> EmailMessage -> f EmailMessage
emailMessage_body = (EmailMessage -> Maybe Text)
-> (EmailMessage -> Maybe Text -> EmailMessage)
-> Lens EmailMessage EmailMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EmailMessage' {Maybe Text
body :: Maybe Text
$sel:body:EmailMessage' :: EmailMessage -> Maybe Text
body} -> Maybe Text
body) (\s :: EmailMessage
s@EmailMessage' {} Maybe Text
a -> EmailMessage
s {$sel:body:EmailMessage' :: Maybe Text
body = Maybe Text
a} :: EmailMessage)
emailMessage_fromAddress :: Lens.Lens' EmailMessage (Prelude.Maybe Prelude.Text)
emailMessage_fromAddress :: (Maybe Text -> f (Maybe Text)) -> EmailMessage -> f EmailMessage
emailMessage_fromAddress = (EmailMessage -> Maybe Text)
-> (EmailMessage -> Maybe Text -> EmailMessage)
-> Lens EmailMessage EmailMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EmailMessage' {Maybe Text
fromAddress :: Maybe Text
$sel:fromAddress:EmailMessage' :: EmailMessage -> Maybe Text
fromAddress} -> Maybe Text
fromAddress) (\s :: EmailMessage
s@EmailMessage' {} Maybe Text
a -> EmailMessage
s {$sel:fromAddress:EmailMessage' :: Maybe Text
fromAddress = Maybe Text
a} :: EmailMessage)
emailMessage_rawEmail :: Lens.Lens' EmailMessage (Prelude.Maybe RawEmail)
emailMessage_rawEmail :: (Maybe RawEmail -> f (Maybe RawEmail))
-> EmailMessage -> f EmailMessage
emailMessage_rawEmail = (EmailMessage -> Maybe RawEmail)
-> (EmailMessage -> Maybe RawEmail -> EmailMessage)
-> Lens EmailMessage EmailMessage (Maybe RawEmail) (Maybe RawEmail)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EmailMessage' {Maybe RawEmail
rawEmail :: Maybe RawEmail
$sel:rawEmail:EmailMessage' :: EmailMessage -> Maybe RawEmail
rawEmail} -> Maybe RawEmail
rawEmail) (\s :: EmailMessage
s@EmailMessage' {} Maybe RawEmail
a -> EmailMessage
s {$sel:rawEmail:EmailMessage' :: Maybe RawEmail
rawEmail = Maybe RawEmail
a} :: EmailMessage)
emailMessage_feedbackForwardingAddress :: Lens.Lens' EmailMessage (Prelude.Maybe Prelude.Text)
emailMessage_feedbackForwardingAddress :: (Maybe Text -> f (Maybe Text)) -> EmailMessage -> f EmailMessage
emailMessage_feedbackForwardingAddress = (EmailMessage -> Maybe Text)
-> (EmailMessage -> Maybe Text -> EmailMessage)
-> Lens EmailMessage EmailMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EmailMessage' {Maybe Text
feedbackForwardingAddress :: Maybe Text
$sel:feedbackForwardingAddress:EmailMessage' :: EmailMessage -> Maybe Text
feedbackForwardingAddress} -> Maybe Text
feedbackForwardingAddress) (\s :: EmailMessage
s@EmailMessage' {} Maybe Text
a -> EmailMessage
s {$sel:feedbackForwardingAddress:EmailMessage' :: Maybe Text
feedbackForwardingAddress = Maybe Text
a} :: EmailMessage)
emailMessage_simpleEmail :: Lens.Lens' EmailMessage (Prelude.Maybe SimpleEmail)
emailMessage_simpleEmail :: (Maybe SimpleEmail -> f (Maybe SimpleEmail))
-> EmailMessage -> f EmailMessage
emailMessage_simpleEmail = (EmailMessage -> Maybe SimpleEmail)
-> (EmailMessage -> Maybe SimpleEmail -> EmailMessage)
-> Lens
EmailMessage EmailMessage (Maybe SimpleEmail) (Maybe SimpleEmail)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EmailMessage' {Maybe SimpleEmail
simpleEmail :: Maybe SimpleEmail
$sel:simpleEmail:EmailMessage' :: EmailMessage -> Maybe SimpleEmail
simpleEmail} -> Maybe SimpleEmail
simpleEmail) (\s :: EmailMessage
s@EmailMessage' {} Maybe SimpleEmail
a -> EmailMessage
s {$sel:simpleEmail:EmailMessage' :: Maybe SimpleEmail
simpleEmail = Maybe SimpleEmail
a} :: EmailMessage)
emailMessage_replyToAddresses :: Lens.Lens' EmailMessage (Prelude.Maybe [Prelude.Text])
emailMessage_replyToAddresses :: (Maybe [Text] -> f (Maybe [Text]))
-> EmailMessage -> f EmailMessage
emailMessage_replyToAddresses = (EmailMessage -> Maybe [Text])
-> (EmailMessage -> Maybe [Text] -> EmailMessage)
-> Lens EmailMessage EmailMessage (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EmailMessage' {Maybe [Text]
replyToAddresses :: Maybe [Text]
$sel:replyToAddresses:EmailMessage' :: EmailMessage -> Maybe [Text]
replyToAddresses} -> Maybe [Text]
replyToAddresses) (\s :: EmailMessage
s@EmailMessage' {} Maybe [Text]
a -> EmailMessage
s {$sel:replyToAddresses:EmailMessage' :: Maybe [Text]
replyToAddresses = Maybe [Text]
a} :: EmailMessage) ((Maybe [Text] -> f (Maybe [Text]))
-> EmailMessage -> f EmailMessage)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> EmailMessage
-> f EmailMessage
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.Hashable EmailMessage
instance Prelude.NFData EmailMessage
instance Core.ToJSON EmailMessage where
toJSON :: EmailMessage -> Value
toJSON EmailMessage' {Maybe [Text]
Maybe Text
Maybe (HashMap Text [Text])
Maybe RawEmail
Maybe SimpleEmail
replyToAddresses :: Maybe [Text]
simpleEmail :: Maybe SimpleEmail
feedbackForwardingAddress :: Maybe Text
rawEmail :: Maybe RawEmail
fromAddress :: Maybe Text
body :: Maybe Text
substitutions :: Maybe (HashMap Text [Text])
$sel:replyToAddresses:EmailMessage' :: EmailMessage -> Maybe [Text]
$sel:simpleEmail:EmailMessage' :: EmailMessage -> Maybe SimpleEmail
$sel:feedbackForwardingAddress:EmailMessage' :: EmailMessage -> Maybe Text
$sel:rawEmail:EmailMessage' :: EmailMessage -> Maybe RawEmail
$sel:fromAddress:EmailMessage' :: EmailMessage -> Maybe Text
$sel:body:EmailMessage' :: EmailMessage -> Maybe Text
$sel:substitutions:EmailMessage' :: EmailMessage -> Maybe (HashMap Text [Text])
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Substitutions" Text -> HashMap Text [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text [Text] -> Pair)
-> Maybe (HashMap Text [Text]) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text [Text])
substitutions,
(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
"RawEmail" Text -> RawEmail -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (RawEmail -> Pair) -> Maybe RawEmail -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RawEmail
rawEmail,
(Text
"FeedbackForwardingAddress" 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
feedbackForwardingAddress,
(Text
"SimpleEmail" Text -> SimpleEmail -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SimpleEmail -> Pair) -> Maybe SimpleEmail -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SimpleEmail
simpleEmail,
(Text
"ReplyToAddresses" 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]
replyToAddresses
]
)