{-# 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.APNSPushNotificationTemplate 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 APNSPushNotificationTemplate = APNSPushNotificationTemplate'
{
APNSPushNotificationTemplate -> Maybe Text
rawContent :: Prelude.Maybe Prelude.Text,
APNSPushNotificationTemplate -> Maybe Text
body :: Prelude.Maybe Prelude.Text,
APNSPushNotificationTemplate -> Maybe Text
url :: Prelude.Maybe Prelude.Text,
APNSPushNotificationTemplate -> Maybe Text
sound :: Prelude.Maybe Prelude.Text,
APNSPushNotificationTemplate -> Maybe Action
action :: Prelude.Maybe Action,
APNSPushNotificationTemplate -> Maybe Text
mediaUrl :: Prelude.Maybe Prelude.Text,
APNSPushNotificationTemplate -> Maybe Text
title :: Prelude.Maybe Prelude.Text
}
deriving (APNSPushNotificationTemplate
-> APNSPushNotificationTemplate -> Bool
(APNSPushNotificationTemplate
-> APNSPushNotificationTemplate -> Bool)
-> (APNSPushNotificationTemplate
-> APNSPushNotificationTemplate -> Bool)
-> Eq APNSPushNotificationTemplate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: APNSPushNotificationTemplate
-> APNSPushNotificationTemplate -> Bool
$c/= :: APNSPushNotificationTemplate
-> APNSPushNotificationTemplate -> Bool
== :: APNSPushNotificationTemplate
-> APNSPushNotificationTemplate -> Bool
$c== :: APNSPushNotificationTemplate
-> APNSPushNotificationTemplate -> Bool
Prelude.Eq, ReadPrec [APNSPushNotificationTemplate]
ReadPrec APNSPushNotificationTemplate
Int -> ReadS APNSPushNotificationTemplate
ReadS [APNSPushNotificationTemplate]
(Int -> ReadS APNSPushNotificationTemplate)
-> ReadS [APNSPushNotificationTemplate]
-> ReadPrec APNSPushNotificationTemplate
-> ReadPrec [APNSPushNotificationTemplate]
-> Read APNSPushNotificationTemplate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [APNSPushNotificationTemplate]
$creadListPrec :: ReadPrec [APNSPushNotificationTemplate]
readPrec :: ReadPrec APNSPushNotificationTemplate
$creadPrec :: ReadPrec APNSPushNotificationTemplate
readList :: ReadS [APNSPushNotificationTemplate]
$creadList :: ReadS [APNSPushNotificationTemplate]
readsPrec :: Int -> ReadS APNSPushNotificationTemplate
$creadsPrec :: Int -> ReadS APNSPushNotificationTemplate
Prelude.Read, Int -> APNSPushNotificationTemplate -> ShowS
[APNSPushNotificationTemplate] -> ShowS
APNSPushNotificationTemplate -> String
(Int -> APNSPushNotificationTemplate -> ShowS)
-> (APNSPushNotificationTemplate -> String)
-> ([APNSPushNotificationTemplate] -> ShowS)
-> Show APNSPushNotificationTemplate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [APNSPushNotificationTemplate] -> ShowS
$cshowList :: [APNSPushNotificationTemplate] -> ShowS
show :: APNSPushNotificationTemplate -> String
$cshow :: APNSPushNotificationTemplate -> String
showsPrec :: Int -> APNSPushNotificationTemplate -> ShowS
$cshowsPrec :: Int -> APNSPushNotificationTemplate -> ShowS
Prelude.Show, (forall x.
APNSPushNotificationTemplate -> Rep APNSPushNotificationTemplate x)
-> (forall x.
Rep APNSPushNotificationTemplate x -> APNSPushNotificationTemplate)
-> Generic APNSPushNotificationTemplate
forall x.
Rep APNSPushNotificationTemplate x -> APNSPushNotificationTemplate
forall x.
APNSPushNotificationTemplate -> Rep APNSPushNotificationTemplate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep APNSPushNotificationTemplate x -> APNSPushNotificationTemplate
$cfrom :: forall x.
APNSPushNotificationTemplate -> Rep APNSPushNotificationTemplate x
Prelude.Generic)
newAPNSPushNotificationTemplate ::
APNSPushNotificationTemplate
newAPNSPushNotificationTemplate :: APNSPushNotificationTemplate
newAPNSPushNotificationTemplate =
APNSPushNotificationTemplate' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Action
-> Maybe Text
-> Maybe Text
-> APNSPushNotificationTemplate
APNSPushNotificationTemplate'
{ $sel:rawContent:APNSPushNotificationTemplate' :: Maybe Text
rawContent =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:body:APNSPushNotificationTemplate' :: Maybe Text
body = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:url:APNSPushNotificationTemplate' :: Maybe Text
url = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:sound:APNSPushNotificationTemplate' :: Maybe Text
sound = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:action:APNSPushNotificationTemplate' :: Maybe Action
action = Maybe Action
forall a. Maybe a
Prelude.Nothing,
$sel:mediaUrl:APNSPushNotificationTemplate' :: Maybe Text
mediaUrl = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:title:APNSPushNotificationTemplate' :: Maybe Text
title = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
aPNSPushNotificationTemplate_rawContent :: Lens.Lens' APNSPushNotificationTemplate (Prelude.Maybe Prelude.Text)
aPNSPushNotificationTemplate_rawContent :: (Maybe Text -> f (Maybe Text))
-> APNSPushNotificationTemplate -> f APNSPushNotificationTemplate
aPNSPushNotificationTemplate_rawContent = (APNSPushNotificationTemplate -> Maybe Text)
-> (APNSPushNotificationTemplate
-> Maybe Text -> APNSPushNotificationTemplate)
-> Lens
APNSPushNotificationTemplate
APNSPushNotificationTemplate
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\APNSPushNotificationTemplate' {Maybe Text
rawContent :: Maybe Text
$sel:rawContent:APNSPushNotificationTemplate' :: APNSPushNotificationTemplate -> Maybe Text
rawContent} -> Maybe Text
rawContent) (\s :: APNSPushNotificationTemplate
s@APNSPushNotificationTemplate' {} Maybe Text
a -> APNSPushNotificationTemplate
s {$sel:rawContent:APNSPushNotificationTemplate' :: Maybe Text
rawContent = Maybe Text
a} :: APNSPushNotificationTemplate)
aPNSPushNotificationTemplate_body :: Lens.Lens' APNSPushNotificationTemplate (Prelude.Maybe Prelude.Text)
aPNSPushNotificationTemplate_body :: (Maybe Text -> f (Maybe Text))
-> APNSPushNotificationTemplate -> f APNSPushNotificationTemplate
aPNSPushNotificationTemplate_body = (APNSPushNotificationTemplate -> Maybe Text)
-> (APNSPushNotificationTemplate
-> Maybe Text -> APNSPushNotificationTemplate)
-> Lens
APNSPushNotificationTemplate
APNSPushNotificationTemplate
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\APNSPushNotificationTemplate' {Maybe Text
body :: Maybe Text
$sel:body:APNSPushNotificationTemplate' :: APNSPushNotificationTemplate -> Maybe Text
body} -> Maybe Text
body) (\s :: APNSPushNotificationTemplate
s@APNSPushNotificationTemplate' {} Maybe Text
a -> APNSPushNotificationTemplate
s {$sel:body:APNSPushNotificationTemplate' :: Maybe Text
body = Maybe Text
a} :: APNSPushNotificationTemplate)
aPNSPushNotificationTemplate_url :: Lens.Lens' APNSPushNotificationTemplate (Prelude.Maybe Prelude.Text)
aPNSPushNotificationTemplate_url :: (Maybe Text -> f (Maybe Text))
-> APNSPushNotificationTemplate -> f APNSPushNotificationTemplate
aPNSPushNotificationTemplate_url = (APNSPushNotificationTemplate -> Maybe Text)
-> (APNSPushNotificationTemplate
-> Maybe Text -> APNSPushNotificationTemplate)
-> Lens
APNSPushNotificationTemplate
APNSPushNotificationTemplate
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\APNSPushNotificationTemplate' {Maybe Text
url :: Maybe Text
$sel:url:APNSPushNotificationTemplate' :: APNSPushNotificationTemplate -> Maybe Text
url} -> Maybe Text
url) (\s :: APNSPushNotificationTemplate
s@APNSPushNotificationTemplate' {} Maybe Text
a -> APNSPushNotificationTemplate
s {$sel:url:APNSPushNotificationTemplate' :: Maybe Text
url = Maybe Text
a} :: APNSPushNotificationTemplate)
aPNSPushNotificationTemplate_sound :: Lens.Lens' APNSPushNotificationTemplate (Prelude.Maybe Prelude.Text)
aPNSPushNotificationTemplate_sound :: (Maybe Text -> f (Maybe Text))
-> APNSPushNotificationTemplate -> f APNSPushNotificationTemplate
aPNSPushNotificationTemplate_sound = (APNSPushNotificationTemplate -> Maybe Text)
-> (APNSPushNotificationTemplate
-> Maybe Text -> APNSPushNotificationTemplate)
-> Lens
APNSPushNotificationTemplate
APNSPushNotificationTemplate
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\APNSPushNotificationTemplate' {Maybe Text
sound :: Maybe Text
$sel:sound:APNSPushNotificationTemplate' :: APNSPushNotificationTemplate -> Maybe Text
sound} -> Maybe Text
sound) (\s :: APNSPushNotificationTemplate
s@APNSPushNotificationTemplate' {} Maybe Text
a -> APNSPushNotificationTemplate
s {$sel:sound:APNSPushNotificationTemplate' :: Maybe Text
sound = Maybe Text
a} :: APNSPushNotificationTemplate)
aPNSPushNotificationTemplate_action :: Lens.Lens' APNSPushNotificationTemplate (Prelude.Maybe Action)
aPNSPushNotificationTemplate_action :: (Maybe Action -> f (Maybe Action))
-> APNSPushNotificationTemplate -> f APNSPushNotificationTemplate
aPNSPushNotificationTemplate_action = (APNSPushNotificationTemplate -> Maybe Action)
-> (APNSPushNotificationTemplate
-> Maybe Action -> APNSPushNotificationTemplate)
-> Lens
APNSPushNotificationTemplate
APNSPushNotificationTemplate
(Maybe Action)
(Maybe Action)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\APNSPushNotificationTemplate' {Maybe Action
action :: Maybe Action
$sel:action:APNSPushNotificationTemplate' :: APNSPushNotificationTemplate -> Maybe Action
action} -> Maybe Action
action) (\s :: APNSPushNotificationTemplate
s@APNSPushNotificationTemplate' {} Maybe Action
a -> APNSPushNotificationTemplate
s {$sel:action:APNSPushNotificationTemplate' :: Maybe Action
action = Maybe Action
a} :: APNSPushNotificationTemplate)
aPNSPushNotificationTemplate_mediaUrl :: Lens.Lens' APNSPushNotificationTemplate (Prelude.Maybe Prelude.Text)
aPNSPushNotificationTemplate_mediaUrl :: (Maybe Text -> f (Maybe Text))
-> APNSPushNotificationTemplate -> f APNSPushNotificationTemplate
aPNSPushNotificationTemplate_mediaUrl = (APNSPushNotificationTemplate -> Maybe Text)
-> (APNSPushNotificationTemplate
-> Maybe Text -> APNSPushNotificationTemplate)
-> Lens
APNSPushNotificationTemplate
APNSPushNotificationTemplate
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\APNSPushNotificationTemplate' {Maybe Text
mediaUrl :: Maybe Text
$sel:mediaUrl:APNSPushNotificationTemplate' :: APNSPushNotificationTemplate -> Maybe Text
mediaUrl} -> Maybe Text
mediaUrl) (\s :: APNSPushNotificationTemplate
s@APNSPushNotificationTemplate' {} Maybe Text
a -> APNSPushNotificationTemplate
s {$sel:mediaUrl:APNSPushNotificationTemplate' :: Maybe Text
mediaUrl = Maybe Text
a} :: APNSPushNotificationTemplate)
aPNSPushNotificationTemplate_title :: Lens.Lens' APNSPushNotificationTemplate (Prelude.Maybe Prelude.Text)
aPNSPushNotificationTemplate_title :: (Maybe Text -> f (Maybe Text))
-> APNSPushNotificationTemplate -> f APNSPushNotificationTemplate
aPNSPushNotificationTemplate_title = (APNSPushNotificationTemplate -> Maybe Text)
-> (APNSPushNotificationTemplate
-> Maybe Text -> APNSPushNotificationTemplate)
-> Lens
APNSPushNotificationTemplate
APNSPushNotificationTemplate
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\APNSPushNotificationTemplate' {Maybe Text
title :: Maybe Text
$sel:title:APNSPushNotificationTemplate' :: APNSPushNotificationTemplate -> Maybe Text
title} -> Maybe Text
title) (\s :: APNSPushNotificationTemplate
s@APNSPushNotificationTemplate' {} Maybe Text
a -> APNSPushNotificationTemplate
s {$sel:title:APNSPushNotificationTemplate' :: Maybe Text
title = Maybe Text
a} :: APNSPushNotificationTemplate)
instance Core.FromJSON APNSPushNotificationTemplate where
parseJSON :: Value -> Parser APNSPushNotificationTemplate
parseJSON =
String
-> (Object -> Parser APNSPushNotificationTemplate)
-> Value
-> Parser APNSPushNotificationTemplate
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"APNSPushNotificationTemplate"
( \Object
x ->
Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Action
-> Maybe Text
-> Maybe Text
-> APNSPushNotificationTemplate
APNSPushNotificationTemplate'
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Action
-> Maybe Text
-> Maybe Text
-> APNSPushNotificationTemplate)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Action
-> Maybe Text
-> Maybe Text
-> APNSPushNotificationTemplate)
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
"RawContent")
Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Action
-> Maybe Text
-> Maybe Text
-> APNSPushNotificationTemplate)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe Action
-> Maybe Text
-> Maybe Text
-> APNSPushNotificationTemplate)
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 Text
-> Maybe Text
-> Maybe Action
-> Maybe Text
-> Maybe Text
-> APNSPushNotificationTemplate)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe Action
-> Maybe Text
-> Maybe Text
-> APNSPushNotificationTemplate)
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
-> Maybe Text
-> APNSPushNotificationTemplate)
-> Parser (Maybe Text)
-> Parser
(Maybe Action
-> Maybe Text -> Maybe Text -> APNSPushNotificationTemplate)
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 -> Maybe Text -> APNSPushNotificationTemplate)
-> Parser (Maybe Action)
-> Parser
(Maybe Text -> Maybe Text -> APNSPushNotificationTemplate)
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 -> Maybe Text -> APNSPushNotificationTemplate)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> APNSPushNotificationTemplate)
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
"MediaUrl")
Parser (Maybe Text -> APNSPushNotificationTemplate)
-> Parser (Maybe Text) -> Parser APNSPushNotificationTemplate
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
APNSPushNotificationTemplate
instance Prelude.NFData APNSPushNotificationTemplate
instance Core.ToJSON APNSPushNotificationTemplate where
toJSON :: APNSPushNotificationTemplate -> Value
toJSON APNSPushNotificationTemplate' {Maybe Text
Maybe Action
title :: Maybe Text
mediaUrl :: Maybe Text
action :: Maybe Action
sound :: Maybe Text
url :: Maybe Text
body :: Maybe Text
rawContent :: Maybe Text
$sel:title:APNSPushNotificationTemplate' :: APNSPushNotificationTemplate -> Maybe Text
$sel:mediaUrl:APNSPushNotificationTemplate' :: APNSPushNotificationTemplate -> Maybe Text
$sel:action:APNSPushNotificationTemplate' :: APNSPushNotificationTemplate -> Maybe Action
$sel:sound:APNSPushNotificationTemplate' :: APNSPushNotificationTemplate -> Maybe Text
$sel:url:APNSPushNotificationTemplate' :: APNSPushNotificationTemplate -> Maybe Text
$sel:body:APNSPushNotificationTemplate' :: APNSPushNotificationTemplate -> Maybe Text
$sel:rawContent:APNSPushNotificationTemplate' :: APNSPushNotificationTemplate -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"RawContent" 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
rawContent,
(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
"MediaUrl" 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
mediaUrl,
(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
]
)