{-# 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.DefaultPushNotificationTemplate where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pinpoint.Types.Action
import qualified Amazonka.Prelude as Prelude
data DefaultPushNotificationTemplate = DefaultPushNotificationTemplate'
{
DefaultPushNotificationTemplate -> Maybe Text
body :: Prelude.Maybe Prelude.Text,
DefaultPushNotificationTemplate -> Maybe Text
url :: Prelude.Maybe Prelude.Text,
DefaultPushNotificationTemplate -> Maybe Text
sound :: Prelude.Maybe Prelude.Text,
DefaultPushNotificationTemplate -> Maybe Action
action :: Prelude.Maybe Action,
DefaultPushNotificationTemplate -> Maybe Text
title :: Prelude.Maybe Prelude.Text
}
deriving (DefaultPushNotificationTemplate
-> DefaultPushNotificationTemplate -> Bool
(DefaultPushNotificationTemplate
-> DefaultPushNotificationTemplate -> Bool)
-> (DefaultPushNotificationTemplate
-> DefaultPushNotificationTemplate -> Bool)
-> Eq DefaultPushNotificationTemplate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DefaultPushNotificationTemplate
-> DefaultPushNotificationTemplate -> Bool
$c/= :: DefaultPushNotificationTemplate
-> DefaultPushNotificationTemplate -> Bool
== :: DefaultPushNotificationTemplate
-> DefaultPushNotificationTemplate -> Bool
$c== :: DefaultPushNotificationTemplate
-> DefaultPushNotificationTemplate -> Bool
Prelude.Eq, ReadPrec [DefaultPushNotificationTemplate]
ReadPrec DefaultPushNotificationTemplate
Int -> ReadS DefaultPushNotificationTemplate
ReadS [DefaultPushNotificationTemplate]
(Int -> ReadS DefaultPushNotificationTemplate)
-> ReadS [DefaultPushNotificationTemplate]
-> ReadPrec DefaultPushNotificationTemplate
-> ReadPrec [DefaultPushNotificationTemplate]
-> Read DefaultPushNotificationTemplate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DefaultPushNotificationTemplate]
$creadListPrec :: ReadPrec [DefaultPushNotificationTemplate]
readPrec :: ReadPrec DefaultPushNotificationTemplate
$creadPrec :: ReadPrec DefaultPushNotificationTemplate
readList :: ReadS [DefaultPushNotificationTemplate]
$creadList :: ReadS [DefaultPushNotificationTemplate]
readsPrec :: Int -> ReadS DefaultPushNotificationTemplate
$creadsPrec :: Int -> ReadS DefaultPushNotificationTemplate
Prelude.Read, Int -> DefaultPushNotificationTemplate -> ShowS
[DefaultPushNotificationTemplate] -> ShowS
DefaultPushNotificationTemplate -> String
(Int -> DefaultPushNotificationTemplate -> ShowS)
-> (DefaultPushNotificationTemplate -> String)
-> ([DefaultPushNotificationTemplate] -> ShowS)
-> Show DefaultPushNotificationTemplate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DefaultPushNotificationTemplate] -> ShowS
$cshowList :: [DefaultPushNotificationTemplate] -> ShowS
show :: DefaultPushNotificationTemplate -> String
$cshow :: DefaultPushNotificationTemplate -> String
showsPrec :: Int -> DefaultPushNotificationTemplate -> ShowS
$cshowsPrec :: Int -> DefaultPushNotificationTemplate -> ShowS
Prelude.Show, (forall x.
DefaultPushNotificationTemplate
-> Rep DefaultPushNotificationTemplate x)
-> (forall x.
Rep DefaultPushNotificationTemplate x
-> DefaultPushNotificationTemplate)
-> Generic DefaultPushNotificationTemplate
forall x.
Rep DefaultPushNotificationTemplate x
-> DefaultPushNotificationTemplate
forall x.
DefaultPushNotificationTemplate
-> Rep DefaultPushNotificationTemplate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DefaultPushNotificationTemplate x
-> DefaultPushNotificationTemplate
$cfrom :: forall x.
DefaultPushNotificationTemplate
-> Rep DefaultPushNotificationTemplate x
Prelude.Generic)
newDefaultPushNotificationTemplate ::
DefaultPushNotificationTemplate
newDefaultPushNotificationTemplate :: DefaultPushNotificationTemplate
newDefaultPushNotificationTemplate =
DefaultPushNotificationTemplate' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Action
-> Maybe Text
-> DefaultPushNotificationTemplate
DefaultPushNotificationTemplate'
{ $sel:body:DefaultPushNotificationTemplate' :: Maybe Text
body =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:url:DefaultPushNotificationTemplate' :: Maybe Text
url = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:sound:DefaultPushNotificationTemplate' :: Maybe Text
sound = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:action:DefaultPushNotificationTemplate' :: Maybe Action
action = Maybe Action
forall a. Maybe a
Prelude.Nothing,
$sel:title:DefaultPushNotificationTemplate' :: Maybe Text
title = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
defaultPushNotificationTemplate_body :: Lens.Lens' DefaultPushNotificationTemplate (Prelude.Maybe Prelude.Text)
defaultPushNotificationTemplate_body :: (Maybe Text -> f (Maybe Text))
-> DefaultPushNotificationTemplate
-> f DefaultPushNotificationTemplate
defaultPushNotificationTemplate_body = (DefaultPushNotificationTemplate -> Maybe Text)
-> (DefaultPushNotificationTemplate
-> Maybe Text -> DefaultPushNotificationTemplate)
-> Lens
DefaultPushNotificationTemplate
DefaultPushNotificationTemplate
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefaultPushNotificationTemplate' {Maybe Text
body :: Maybe Text
$sel:body:DefaultPushNotificationTemplate' :: DefaultPushNotificationTemplate -> Maybe Text
body} -> Maybe Text
body) (\s :: DefaultPushNotificationTemplate
s@DefaultPushNotificationTemplate' {} Maybe Text
a -> DefaultPushNotificationTemplate
s {$sel:body:DefaultPushNotificationTemplate' :: Maybe Text
body = Maybe Text
a} :: DefaultPushNotificationTemplate)
defaultPushNotificationTemplate_url :: Lens.Lens' DefaultPushNotificationTemplate (Prelude.Maybe Prelude.Text)
defaultPushNotificationTemplate_url :: (Maybe Text -> f (Maybe Text))
-> DefaultPushNotificationTemplate
-> f DefaultPushNotificationTemplate
defaultPushNotificationTemplate_url = (DefaultPushNotificationTemplate -> Maybe Text)
-> (DefaultPushNotificationTemplate
-> Maybe Text -> DefaultPushNotificationTemplate)
-> Lens
DefaultPushNotificationTemplate
DefaultPushNotificationTemplate
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefaultPushNotificationTemplate' {Maybe Text
url :: Maybe Text
$sel:url:DefaultPushNotificationTemplate' :: DefaultPushNotificationTemplate -> Maybe Text
url} -> Maybe Text
url) (\s :: DefaultPushNotificationTemplate
s@DefaultPushNotificationTemplate' {} Maybe Text
a -> DefaultPushNotificationTemplate
s {$sel:url:DefaultPushNotificationTemplate' :: Maybe Text
url = Maybe Text
a} :: DefaultPushNotificationTemplate)
defaultPushNotificationTemplate_sound :: Lens.Lens' DefaultPushNotificationTemplate (Prelude.Maybe Prelude.Text)
defaultPushNotificationTemplate_sound :: (Maybe Text -> f (Maybe Text))
-> DefaultPushNotificationTemplate
-> f DefaultPushNotificationTemplate
defaultPushNotificationTemplate_sound = (DefaultPushNotificationTemplate -> Maybe Text)
-> (DefaultPushNotificationTemplate
-> Maybe Text -> DefaultPushNotificationTemplate)
-> Lens
DefaultPushNotificationTemplate
DefaultPushNotificationTemplate
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefaultPushNotificationTemplate' {Maybe Text
sound :: Maybe Text
$sel:sound:DefaultPushNotificationTemplate' :: DefaultPushNotificationTemplate -> Maybe Text
sound} -> Maybe Text
sound) (\s :: DefaultPushNotificationTemplate
s@DefaultPushNotificationTemplate' {} Maybe Text
a -> DefaultPushNotificationTemplate
s {$sel:sound:DefaultPushNotificationTemplate' :: Maybe Text
sound = Maybe Text
a} :: DefaultPushNotificationTemplate)
defaultPushNotificationTemplate_action :: Lens.Lens' DefaultPushNotificationTemplate (Prelude.Maybe Action)
defaultPushNotificationTemplate_action :: (Maybe Action -> f (Maybe Action))
-> DefaultPushNotificationTemplate
-> f DefaultPushNotificationTemplate
defaultPushNotificationTemplate_action = (DefaultPushNotificationTemplate -> Maybe Action)
-> (DefaultPushNotificationTemplate
-> Maybe Action -> DefaultPushNotificationTemplate)
-> Lens
DefaultPushNotificationTemplate
DefaultPushNotificationTemplate
(Maybe Action)
(Maybe Action)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefaultPushNotificationTemplate' {Maybe Action
action :: Maybe Action
$sel:action:DefaultPushNotificationTemplate' :: DefaultPushNotificationTemplate -> Maybe Action
action} -> Maybe Action
action) (\s :: DefaultPushNotificationTemplate
s@DefaultPushNotificationTemplate' {} Maybe Action
a -> DefaultPushNotificationTemplate
s {$sel:action:DefaultPushNotificationTemplate' :: Maybe Action
action = Maybe Action
a} :: DefaultPushNotificationTemplate)
defaultPushNotificationTemplate_title :: Lens.Lens' DefaultPushNotificationTemplate (Prelude.Maybe Prelude.Text)
defaultPushNotificationTemplate_title :: (Maybe Text -> f (Maybe Text))
-> DefaultPushNotificationTemplate
-> f DefaultPushNotificationTemplate
defaultPushNotificationTemplate_title = (DefaultPushNotificationTemplate -> Maybe Text)
-> (DefaultPushNotificationTemplate
-> Maybe Text -> DefaultPushNotificationTemplate)
-> Lens
DefaultPushNotificationTemplate
DefaultPushNotificationTemplate
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefaultPushNotificationTemplate' {Maybe Text
title :: Maybe Text
$sel:title:DefaultPushNotificationTemplate' :: DefaultPushNotificationTemplate -> Maybe Text
title} -> Maybe Text
title) (\s :: DefaultPushNotificationTemplate
s@DefaultPushNotificationTemplate' {} Maybe Text
a -> DefaultPushNotificationTemplate
s {$sel:title:DefaultPushNotificationTemplate' :: Maybe Text
title = Maybe Text
a} :: DefaultPushNotificationTemplate)
instance
Core.FromJSON
DefaultPushNotificationTemplate
where
parseJSON :: Value -> Parser DefaultPushNotificationTemplate
parseJSON =
String
-> (Object -> Parser DefaultPushNotificationTemplate)
-> Value
-> Parser DefaultPushNotificationTemplate
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"DefaultPushNotificationTemplate"
( \Object
x ->
Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Action
-> Maybe Text
-> DefaultPushNotificationTemplate
DefaultPushNotificationTemplate'
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Action
-> Maybe Text
-> DefaultPushNotificationTemplate)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe Action
-> Maybe Text
-> DefaultPushNotificationTemplate)
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
"Body")
Parser
(Maybe Text
-> Maybe Text
-> Maybe Action
-> Maybe Text
-> DefaultPushNotificationTemplate)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe Action -> Maybe Text -> DefaultPushNotificationTemplate)
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
"Url")
Parser
(Maybe Text
-> Maybe Action -> Maybe Text -> DefaultPushNotificationTemplate)
-> Parser (Maybe Text)
-> Parser
(Maybe Action -> Maybe Text -> DefaultPushNotificationTemplate)
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
"Sound")
Parser
(Maybe Action -> Maybe Text -> DefaultPushNotificationTemplate)
-> Parser (Maybe Action)
-> Parser (Maybe Text -> DefaultPushNotificationTemplate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Action)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Action")
Parser (Maybe Text -> DefaultPushNotificationTemplate)
-> Parser (Maybe Text) -> Parser DefaultPushNotificationTemplate
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
"Title")
)
instance
Prelude.Hashable
DefaultPushNotificationTemplate
instance
Prelude.NFData
DefaultPushNotificationTemplate
instance Core.ToJSON DefaultPushNotificationTemplate where
toJSON :: DefaultPushNotificationTemplate -> Value
toJSON DefaultPushNotificationTemplate' {Maybe Text
Maybe Action
title :: Maybe Text
action :: Maybe Action
sound :: Maybe Text
url :: Maybe Text
body :: Maybe Text
$sel:title:DefaultPushNotificationTemplate' :: DefaultPushNotificationTemplate -> Maybe Text
$sel:action:DefaultPushNotificationTemplate' :: DefaultPushNotificationTemplate -> Maybe Action
$sel:sound:DefaultPushNotificationTemplate' :: DefaultPushNotificationTemplate -> Maybe Text
$sel:url:DefaultPushNotificationTemplate' :: DefaultPushNotificationTemplate -> Maybe Text
$sel:body:DefaultPushNotificationTemplate' :: DefaultPushNotificationTemplate -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (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
"Url" 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
url,
(Text
"Sound" 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
sound,
(Text
"Action" Text -> Action -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Action -> Pair) -> Maybe Action -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Action
action,
(Text
"Title" 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
title
]
)