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