{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Pinpoint.Types.Action
import qualified Amazonka.Prelude as Prelude
data DefaultPushNotificationTemplate = DefaultPushNotificationTemplate'
{
DefaultPushNotificationTemplate -> Maybe Action
action :: Prelude.Maybe Action,
DefaultPushNotificationTemplate -> Maybe Text
body :: Prelude.Maybe Prelude.Text,
DefaultPushNotificationTemplate -> Maybe Text
sound :: Prelude.Maybe Prelude.Text,
DefaultPushNotificationTemplate -> Maybe Text
title :: Prelude.Maybe Prelude.Text,
DefaultPushNotificationTemplate -> Maybe Text
url :: Prelude.Maybe Prelude.Text
}
deriving (DefaultPushNotificationTemplate
-> DefaultPushNotificationTemplate -> Bool
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]
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
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.
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'
{ $sel:action:DefaultPushNotificationTemplate' :: Maybe Action
action =
forall a. Maybe a
Prelude.Nothing,
$sel:body:DefaultPushNotificationTemplate' :: Maybe Text
body = forall a. Maybe a
Prelude.Nothing,
$sel:sound:DefaultPushNotificationTemplate' :: Maybe Text
sound = forall a. Maybe a
Prelude.Nothing,
$sel:title:DefaultPushNotificationTemplate' :: Maybe Text
title = forall a. Maybe a
Prelude.Nothing,
$sel:url:DefaultPushNotificationTemplate' :: Maybe Text
url = forall a. Maybe a
Prelude.Nothing
}
defaultPushNotificationTemplate_action :: Lens.Lens' DefaultPushNotificationTemplate (Prelude.Maybe Action)
defaultPushNotificationTemplate_action :: Lens' DefaultPushNotificationTemplate (Maybe Action)
defaultPushNotificationTemplate_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_body :: Lens.Lens' DefaultPushNotificationTemplate (Prelude.Maybe Prelude.Text)
defaultPushNotificationTemplate_body :: Lens' DefaultPushNotificationTemplate (Maybe Text)
defaultPushNotificationTemplate_body = 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_sound :: Lens.Lens' DefaultPushNotificationTemplate (Prelude.Maybe Prelude.Text)
defaultPushNotificationTemplate_sound :: Lens' DefaultPushNotificationTemplate (Maybe Text)
defaultPushNotificationTemplate_sound = 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_title :: Lens.Lens' DefaultPushNotificationTemplate (Prelude.Maybe Prelude.Text)
defaultPushNotificationTemplate_title :: Lens' DefaultPushNotificationTemplate (Maybe Text)
defaultPushNotificationTemplate_title = 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)
defaultPushNotificationTemplate_url :: Lens.Lens' DefaultPushNotificationTemplate (Prelude.Maybe Prelude.Text)
defaultPushNotificationTemplate_url :: Lens' DefaultPushNotificationTemplate (Maybe Text)
defaultPushNotificationTemplate_url = 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)
instance
Data.FromJSON
DefaultPushNotificationTemplate
where
parseJSON :: Value -> Parser DefaultPushNotificationTemplate
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"DefaultPushNotificationTemplate"
( \Object
x ->
Maybe Action
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> DefaultPushNotificationTemplate
DefaultPushNotificationTemplate'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Action")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Body")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Sound")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Title")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Url")
)
instance
Prelude.Hashable
DefaultPushNotificationTemplate
where
hashWithSalt :: Int -> DefaultPushNotificationTemplate -> Int
hashWithSalt
Int
_salt
DefaultPushNotificationTemplate' {Maybe Text
Maybe Action
url :: Maybe Text
title :: Maybe Text
sound :: Maybe Text
body :: Maybe Text
action :: Maybe Action
$sel:url:DefaultPushNotificationTemplate' :: DefaultPushNotificationTemplate -> Maybe Text
$sel:title:DefaultPushNotificationTemplate' :: DefaultPushNotificationTemplate -> Maybe Text
$sel:sound:DefaultPushNotificationTemplate' :: DefaultPushNotificationTemplate -> Maybe Text
$sel:body:DefaultPushNotificationTemplate' :: DefaultPushNotificationTemplate -> Maybe Text
$sel:action:DefaultPushNotificationTemplate' :: DefaultPushNotificationTemplate -> Maybe Action
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Action
action
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
body
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sound
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
title
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
url
instance
Prelude.NFData
DefaultPushNotificationTemplate
where
rnf :: DefaultPushNotificationTemplate -> ()
rnf DefaultPushNotificationTemplate' {Maybe Text
Maybe Action
url :: Maybe Text
title :: Maybe Text
sound :: Maybe Text
body :: Maybe Text
action :: Maybe Action
$sel:url:DefaultPushNotificationTemplate' :: DefaultPushNotificationTemplate -> Maybe Text
$sel:title:DefaultPushNotificationTemplate' :: DefaultPushNotificationTemplate -> Maybe Text
$sel:sound:DefaultPushNotificationTemplate' :: DefaultPushNotificationTemplate -> Maybe Text
$sel:body:DefaultPushNotificationTemplate' :: DefaultPushNotificationTemplate -> Maybe Text
$sel:action:DefaultPushNotificationTemplate' :: DefaultPushNotificationTemplate -> Maybe Action
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Action
action
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
body
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sound
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
title
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
url
instance Data.ToJSON DefaultPushNotificationTemplate where
toJSON :: DefaultPushNotificationTemplate -> Value
toJSON DefaultPushNotificationTemplate' {Maybe Text
Maybe Action
url :: Maybe Text
title :: Maybe Text
sound :: Maybe Text
body :: Maybe Text
action :: Maybe Action
$sel:url:DefaultPushNotificationTemplate' :: DefaultPushNotificationTemplate -> Maybe Text
$sel:title:DefaultPushNotificationTemplate' :: DefaultPushNotificationTemplate -> Maybe Text
$sel:sound:DefaultPushNotificationTemplate' :: DefaultPushNotificationTemplate -> Maybe Text
$sel:body:DefaultPushNotificationTemplate' :: DefaultPushNotificationTemplate -> Maybe Text
$sel:action:DefaultPushNotificationTemplate' :: DefaultPushNotificationTemplate -> Maybe Action
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Action" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Action
action,
(Key
"Body" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
body,
(Key
"Sound" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
sound,
(Key
"Title" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
title,
(Key
"Url" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
url
]
)