{-# 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.CampaignSmsMessage where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pinpoint.Types.MessageType
import qualified Amazonka.Prelude as Prelude
data CampaignSmsMessage = CampaignSmsMessage'
{
CampaignSmsMessage -> Maybe Text
originationNumber :: Prelude.Maybe Prelude.Text,
CampaignSmsMessage -> Maybe Text
templateId :: Prelude.Maybe Prelude.Text,
CampaignSmsMessage -> Maybe Text
body :: Prelude.Maybe Prelude.Text,
CampaignSmsMessage -> Maybe MessageType
messageType :: Prelude.Maybe MessageType,
CampaignSmsMessage -> Maybe Text
senderId :: Prelude.Maybe Prelude.Text,
CampaignSmsMessage -> Maybe Text
entityId :: Prelude.Maybe Prelude.Text
}
deriving (CampaignSmsMessage -> CampaignSmsMessage -> Bool
(CampaignSmsMessage -> CampaignSmsMessage -> Bool)
-> (CampaignSmsMessage -> CampaignSmsMessage -> Bool)
-> Eq CampaignSmsMessage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CampaignSmsMessage -> CampaignSmsMessage -> Bool
$c/= :: CampaignSmsMessage -> CampaignSmsMessage -> Bool
== :: CampaignSmsMessage -> CampaignSmsMessage -> Bool
$c== :: CampaignSmsMessage -> CampaignSmsMessage -> Bool
Prelude.Eq, ReadPrec [CampaignSmsMessage]
ReadPrec CampaignSmsMessage
Int -> ReadS CampaignSmsMessage
ReadS [CampaignSmsMessage]
(Int -> ReadS CampaignSmsMessage)
-> ReadS [CampaignSmsMessage]
-> ReadPrec CampaignSmsMessage
-> ReadPrec [CampaignSmsMessage]
-> Read CampaignSmsMessage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CampaignSmsMessage]
$creadListPrec :: ReadPrec [CampaignSmsMessage]
readPrec :: ReadPrec CampaignSmsMessage
$creadPrec :: ReadPrec CampaignSmsMessage
readList :: ReadS [CampaignSmsMessage]
$creadList :: ReadS [CampaignSmsMessage]
readsPrec :: Int -> ReadS CampaignSmsMessage
$creadsPrec :: Int -> ReadS CampaignSmsMessage
Prelude.Read, Int -> CampaignSmsMessage -> ShowS
[CampaignSmsMessage] -> ShowS
CampaignSmsMessage -> String
(Int -> CampaignSmsMessage -> ShowS)
-> (CampaignSmsMessage -> String)
-> ([CampaignSmsMessage] -> ShowS)
-> Show CampaignSmsMessage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CampaignSmsMessage] -> ShowS
$cshowList :: [CampaignSmsMessage] -> ShowS
show :: CampaignSmsMessage -> String
$cshow :: CampaignSmsMessage -> String
showsPrec :: Int -> CampaignSmsMessage -> ShowS
$cshowsPrec :: Int -> CampaignSmsMessage -> ShowS
Prelude.Show, (forall x. CampaignSmsMessage -> Rep CampaignSmsMessage x)
-> (forall x. Rep CampaignSmsMessage x -> CampaignSmsMessage)
-> Generic CampaignSmsMessage
forall x. Rep CampaignSmsMessage x -> CampaignSmsMessage
forall x. CampaignSmsMessage -> Rep CampaignSmsMessage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CampaignSmsMessage x -> CampaignSmsMessage
$cfrom :: forall x. CampaignSmsMessage -> Rep CampaignSmsMessage x
Prelude.Generic)
newCampaignSmsMessage ::
CampaignSmsMessage
newCampaignSmsMessage :: CampaignSmsMessage
newCampaignSmsMessage =
CampaignSmsMessage' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe MessageType
-> Maybe Text
-> Maybe Text
-> CampaignSmsMessage
CampaignSmsMessage'
{ $sel:originationNumber:CampaignSmsMessage' :: Maybe Text
originationNumber =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:templateId:CampaignSmsMessage' :: Maybe Text
templateId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:body:CampaignSmsMessage' :: Maybe Text
body = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:messageType:CampaignSmsMessage' :: Maybe MessageType
messageType = Maybe MessageType
forall a. Maybe a
Prelude.Nothing,
$sel:senderId:CampaignSmsMessage' :: Maybe Text
senderId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:entityId:CampaignSmsMessage' :: Maybe Text
entityId = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
campaignSmsMessage_originationNumber :: Lens.Lens' CampaignSmsMessage (Prelude.Maybe Prelude.Text)
campaignSmsMessage_originationNumber :: (Maybe Text -> f (Maybe Text))
-> CampaignSmsMessage -> f CampaignSmsMessage
campaignSmsMessage_originationNumber = (CampaignSmsMessage -> Maybe Text)
-> (CampaignSmsMessage -> Maybe Text -> CampaignSmsMessage)
-> Lens
CampaignSmsMessage CampaignSmsMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CampaignSmsMessage' {Maybe Text
originationNumber :: Maybe Text
$sel:originationNumber:CampaignSmsMessage' :: CampaignSmsMessage -> Maybe Text
originationNumber} -> Maybe Text
originationNumber) (\s :: CampaignSmsMessage
s@CampaignSmsMessage' {} Maybe Text
a -> CampaignSmsMessage
s {$sel:originationNumber:CampaignSmsMessage' :: Maybe Text
originationNumber = Maybe Text
a} :: CampaignSmsMessage)
campaignSmsMessage_templateId :: Lens.Lens' CampaignSmsMessage (Prelude.Maybe Prelude.Text)
campaignSmsMessage_templateId :: (Maybe Text -> f (Maybe Text))
-> CampaignSmsMessage -> f CampaignSmsMessage
campaignSmsMessage_templateId = (CampaignSmsMessage -> Maybe Text)
-> (CampaignSmsMessage -> Maybe Text -> CampaignSmsMessage)
-> Lens
CampaignSmsMessage CampaignSmsMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CampaignSmsMessage' {Maybe Text
templateId :: Maybe Text
$sel:templateId:CampaignSmsMessage' :: CampaignSmsMessage -> Maybe Text
templateId} -> Maybe Text
templateId) (\s :: CampaignSmsMessage
s@CampaignSmsMessage' {} Maybe Text
a -> CampaignSmsMessage
s {$sel:templateId:CampaignSmsMessage' :: Maybe Text
templateId = Maybe Text
a} :: CampaignSmsMessage)
campaignSmsMessage_body :: Lens.Lens' CampaignSmsMessage (Prelude.Maybe Prelude.Text)
campaignSmsMessage_body :: (Maybe Text -> f (Maybe Text))
-> CampaignSmsMessage -> f CampaignSmsMessage
campaignSmsMessage_body = (CampaignSmsMessage -> Maybe Text)
-> (CampaignSmsMessage -> Maybe Text -> CampaignSmsMessage)
-> Lens
CampaignSmsMessage CampaignSmsMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CampaignSmsMessage' {Maybe Text
body :: Maybe Text
$sel:body:CampaignSmsMessage' :: CampaignSmsMessage -> Maybe Text
body} -> Maybe Text
body) (\s :: CampaignSmsMessage
s@CampaignSmsMessage' {} Maybe Text
a -> CampaignSmsMessage
s {$sel:body:CampaignSmsMessage' :: Maybe Text
body = Maybe Text
a} :: CampaignSmsMessage)
campaignSmsMessage_messageType :: Lens.Lens' CampaignSmsMessage (Prelude.Maybe MessageType)
campaignSmsMessage_messageType :: (Maybe MessageType -> f (Maybe MessageType))
-> CampaignSmsMessage -> f CampaignSmsMessage
campaignSmsMessage_messageType = (CampaignSmsMessage -> Maybe MessageType)
-> (CampaignSmsMessage -> Maybe MessageType -> CampaignSmsMessage)
-> Lens
CampaignSmsMessage
CampaignSmsMessage
(Maybe MessageType)
(Maybe MessageType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CampaignSmsMessage' {Maybe MessageType
messageType :: Maybe MessageType
$sel:messageType:CampaignSmsMessage' :: CampaignSmsMessage -> Maybe MessageType
messageType} -> Maybe MessageType
messageType) (\s :: CampaignSmsMessage
s@CampaignSmsMessage' {} Maybe MessageType
a -> CampaignSmsMessage
s {$sel:messageType:CampaignSmsMessage' :: Maybe MessageType
messageType = Maybe MessageType
a} :: CampaignSmsMessage)
campaignSmsMessage_senderId :: Lens.Lens' CampaignSmsMessage (Prelude.Maybe Prelude.Text)
campaignSmsMessage_senderId :: (Maybe Text -> f (Maybe Text))
-> CampaignSmsMessage -> f CampaignSmsMessage
campaignSmsMessage_senderId = (CampaignSmsMessage -> Maybe Text)
-> (CampaignSmsMessage -> Maybe Text -> CampaignSmsMessage)
-> Lens
CampaignSmsMessage CampaignSmsMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CampaignSmsMessage' {Maybe Text
senderId :: Maybe Text
$sel:senderId:CampaignSmsMessage' :: CampaignSmsMessage -> Maybe Text
senderId} -> Maybe Text
senderId) (\s :: CampaignSmsMessage
s@CampaignSmsMessage' {} Maybe Text
a -> CampaignSmsMessage
s {$sel:senderId:CampaignSmsMessage' :: Maybe Text
senderId = Maybe Text
a} :: CampaignSmsMessage)
campaignSmsMessage_entityId :: Lens.Lens' CampaignSmsMessage (Prelude.Maybe Prelude.Text)
campaignSmsMessage_entityId :: (Maybe Text -> f (Maybe Text))
-> CampaignSmsMessage -> f CampaignSmsMessage
campaignSmsMessage_entityId = (CampaignSmsMessage -> Maybe Text)
-> (CampaignSmsMessage -> Maybe Text -> CampaignSmsMessage)
-> Lens
CampaignSmsMessage CampaignSmsMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CampaignSmsMessage' {Maybe Text
entityId :: Maybe Text
$sel:entityId:CampaignSmsMessage' :: CampaignSmsMessage -> Maybe Text
entityId} -> Maybe Text
entityId) (\s :: CampaignSmsMessage
s@CampaignSmsMessage' {} Maybe Text
a -> CampaignSmsMessage
s {$sel:entityId:CampaignSmsMessage' :: Maybe Text
entityId = Maybe Text
a} :: CampaignSmsMessage)
instance Core.FromJSON CampaignSmsMessage where
parseJSON :: Value -> Parser CampaignSmsMessage
parseJSON =
String
-> (Object -> Parser CampaignSmsMessage)
-> Value
-> Parser CampaignSmsMessage
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"CampaignSmsMessage"
( \Object
x ->
Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe MessageType
-> Maybe Text
-> Maybe Text
-> CampaignSmsMessage
CampaignSmsMessage'
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe MessageType
-> Maybe Text
-> Maybe Text
-> CampaignSmsMessage)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe MessageType
-> Maybe Text
-> Maybe Text
-> CampaignSmsMessage)
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
"OriginationNumber")
Parser
(Maybe Text
-> Maybe Text
-> Maybe MessageType
-> Maybe Text
-> Maybe Text
-> CampaignSmsMessage)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe MessageType
-> Maybe Text
-> Maybe Text
-> CampaignSmsMessage)
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
"TemplateId")
Parser
(Maybe Text
-> Maybe MessageType
-> Maybe Text
-> Maybe Text
-> CampaignSmsMessage)
-> Parser (Maybe Text)
-> Parser
(Maybe MessageType
-> Maybe Text -> Maybe Text -> CampaignSmsMessage)
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
"Body")
Parser
(Maybe MessageType
-> Maybe Text -> Maybe Text -> CampaignSmsMessage)
-> Parser (Maybe MessageType)
-> Parser (Maybe Text -> Maybe Text -> CampaignSmsMessage)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe MessageType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MessageType")
Parser (Maybe Text -> Maybe Text -> CampaignSmsMessage)
-> Parser (Maybe Text) -> Parser (Maybe Text -> CampaignSmsMessage)
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
"SenderId")
Parser (Maybe Text -> CampaignSmsMessage)
-> Parser (Maybe Text) -> Parser CampaignSmsMessage
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
"EntityId")
)
instance Prelude.Hashable CampaignSmsMessage
instance Prelude.NFData CampaignSmsMessage
instance Core.ToJSON CampaignSmsMessage where
toJSON :: CampaignSmsMessage -> Value
toJSON CampaignSmsMessage' {Maybe Text
Maybe MessageType
entityId :: Maybe Text
senderId :: Maybe Text
messageType :: Maybe MessageType
body :: Maybe Text
templateId :: Maybe Text
originationNumber :: Maybe Text
$sel:entityId:CampaignSmsMessage' :: CampaignSmsMessage -> Maybe Text
$sel:senderId:CampaignSmsMessage' :: CampaignSmsMessage -> Maybe Text
$sel:messageType:CampaignSmsMessage' :: CampaignSmsMessage -> Maybe MessageType
$sel:body:CampaignSmsMessage' :: CampaignSmsMessage -> Maybe Text
$sel:templateId:CampaignSmsMessage' :: CampaignSmsMessage -> Maybe Text
$sel:originationNumber:CampaignSmsMessage' :: CampaignSmsMessage -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"OriginationNumber" 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
originationNumber,
(Text
"TemplateId" 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
templateId,
(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
"MessageType" Text -> MessageType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (MessageType -> Pair) -> Maybe MessageType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MessageType
messageType,
(Text
"SenderId" 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
senderId,
(Text
"EntityId" 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
entityId
]
)