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