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