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