{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.Pinpoint.GetPushTemplate
(
GetPushTemplate (..),
newGetPushTemplate,
getPushTemplate_version,
getPushTemplate_templateName,
GetPushTemplateResponse (..),
newGetPushTemplateResponse,
getPushTemplateResponse_httpStatus,
getPushTemplateResponse_pushNotificationTemplateResponse,
)
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
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetPushTemplate = GetPushTemplate'
{
GetPushTemplate -> Maybe Text
version :: Prelude.Maybe Prelude.Text,
GetPushTemplate -> Text
templateName :: Prelude.Text
}
deriving (GetPushTemplate -> GetPushTemplate -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetPushTemplate -> GetPushTemplate -> Bool
$c/= :: GetPushTemplate -> GetPushTemplate -> Bool
== :: GetPushTemplate -> GetPushTemplate -> Bool
$c== :: GetPushTemplate -> GetPushTemplate -> Bool
Prelude.Eq, ReadPrec [GetPushTemplate]
ReadPrec GetPushTemplate
Int -> ReadS GetPushTemplate
ReadS [GetPushTemplate]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetPushTemplate]
$creadListPrec :: ReadPrec [GetPushTemplate]
readPrec :: ReadPrec GetPushTemplate
$creadPrec :: ReadPrec GetPushTemplate
readList :: ReadS [GetPushTemplate]
$creadList :: ReadS [GetPushTemplate]
readsPrec :: Int -> ReadS GetPushTemplate
$creadsPrec :: Int -> ReadS GetPushTemplate
Prelude.Read, Int -> GetPushTemplate -> ShowS
[GetPushTemplate] -> ShowS
GetPushTemplate -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetPushTemplate] -> ShowS
$cshowList :: [GetPushTemplate] -> ShowS
show :: GetPushTemplate -> String
$cshow :: GetPushTemplate -> String
showsPrec :: Int -> GetPushTemplate -> ShowS
$cshowsPrec :: Int -> GetPushTemplate -> ShowS
Prelude.Show, forall x. Rep GetPushTemplate x -> GetPushTemplate
forall x. GetPushTemplate -> Rep GetPushTemplate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetPushTemplate x -> GetPushTemplate
$cfrom :: forall x. GetPushTemplate -> Rep GetPushTemplate x
Prelude.Generic)
newGetPushTemplate ::
Prelude.Text ->
GetPushTemplate
newGetPushTemplate :: Text -> GetPushTemplate
newGetPushTemplate Text
pTemplateName_ =
GetPushTemplate'
{ $sel:version:GetPushTemplate' :: Maybe Text
version = forall a. Maybe a
Prelude.Nothing,
$sel:templateName:GetPushTemplate' :: Text
templateName = Text
pTemplateName_
}
getPushTemplate_version :: Lens.Lens' GetPushTemplate (Prelude.Maybe Prelude.Text)
getPushTemplate_version :: Lens' GetPushTemplate (Maybe Text)
getPushTemplate_version = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPushTemplate' {Maybe Text
version :: Maybe Text
$sel:version:GetPushTemplate' :: GetPushTemplate -> Maybe Text
version} -> Maybe Text
version) (\s :: GetPushTemplate
s@GetPushTemplate' {} Maybe Text
a -> GetPushTemplate
s {$sel:version:GetPushTemplate' :: Maybe Text
version = Maybe Text
a} :: GetPushTemplate)
getPushTemplate_templateName :: Lens.Lens' GetPushTemplate Prelude.Text
getPushTemplate_templateName :: Lens' GetPushTemplate Text
getPushTemplate_templateName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPushTemplate' {Text
templateName :: Text
$sel:templateName:GetPushTemplate' :: GetPushTemplate -> Text
templateName} -> Text
templateName) (\s :: GetPushTemplate
s@GetPushTemplate' {} Text
a -> GetPushTemplate
s {$sel:templateName:GetPushTemplate' :: Text
templateName = Text
a} :: GetPushTemplate)
instance Core.AWSRequest GetPushTemplate where
type
AWSResponse GetPushTemplate =
GetPushTemplateResponse
request :: (Service -> Service) -> GetPushTemplate -> Request GetPushTemplate
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetPushTemplate
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetPushTemplate)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Int -> PushNotificationTemplateResponse -> GetPushTemplateResponse
GetPushTemplateResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall a. FromJSON a => Object -> Either String a
Data.eitherParseJSON Object
x)
)
instance Prelude.Hashable GetPushTemplate where
hashWithSalt :: Int -> GetPushTemplate -> Int
hashWithSalt Int
_salt GetPushTemplate' {Maybe Text
Text
templateName :: Text
version :: Maybe Text
$sel:templateName:GetPushTemplate' :: GetPushTemplate -> Text
$sel:version:GetPushTemplate' :: GetPushTemplate -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
version
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
templateName
instance Prelude.NFData GetPushTemplate where
rnf :: GetPushTemplate -> ()
rnf GetPushTemplate' {Maybe Text
Text
templateName :: Text
version :: Maybe Text
$sel:templateName:GetPushTemplate' :: GetPushTemplate -> Text
$sel:version:GetPushTemplate' :: GetPushTemplate -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
version
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
templateName
instance Data.ToHeaders GetPushTemplate where
toHeaders :: GetPushTemplate -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToPath GetPushTemplate where
toPath :: GetPushTemplate -> ByteString
toPath GetPushTemplate' {Maybe Text
Text
templateName :: Text
version :: Maybe Text
$sel:templateName:GetPushTemplate' :: GetPushTemplate -> Text
$sel:version:GetPushTemplate' :: GetPushTemplate -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/v1/templates/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
templateName, ByteString
"/push"]
instance Data.ToQuery GetPushTemplate where
toQuery :: GetPushTemplate -> QueryString
toQuery GetPushTemplate' {Maybe Text
Text
templateName :: Text
version :: Maybe Text
$sel:templateName:GetPushTemplate' :: GetPushTemplate -> Text
$sel:version:GetPushTemplate' :: GetPushTemplate -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"version" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
version]
data GetPushTemplateResponse = GetPushTemplateResponse'
{
GetPushTemplateResponse -> Int
httpStatus :: Prelude.Int,
GetPushTemplateResponse -> PushNotificationTemplateResponse
pushNotificationTemplateResponse :: PushNotificationTemplateResponse
}
deriving (GetPushTemplateResponse -> GetPushTemplateResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetPushTemplateResponse -> GetPushTemplateResponse -> Bool
$c/= :: GetPushTemplateResponse -> GetPushTemplateResponse -> Bool
== :: GetPushTemplateResponse -> GetPushTemplateResponse -> Bool
$c== :: GetPushTemplateResponse -> GetPushTemplateResponse -> Bool
Prelude.Eq, ReadPrec [GetPushTemplateResponse]
ReadPrec GetPushTemplateResponse
Int -> ReadS GetPushTemplateResponse
ReadS [GetPushTemplateResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetPushTemplateResponse]
$creadListPrec :: ReadPrec [GetPushTemplateResponse]
readPrec :: ReadPrec GetPushTemplateResponse
$creadPrec :: ReadPrec GetPushTemplateResponse
readList :: ReadS [GetPushTemplateResponse]
$creadList :: ReadS [GetPushTemplateResponse]
readsPrec :: Int -> ReadS GetPushTemplateResponse
$creadsPrec :: Int -> ReadS GetPushTemplateResponse
Prelude.Read, Int -> GetPushTemplateResponse -> ShowS
[GetPushTemplateResponse] -> ShowS
GetPushTemplateResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetPushTemplateResponse] -> ShowS
$cshowList :: [GetPushTemplateResponse] -> ShowS
show :: GetPushTemplateResponse -> String
$cshow :: GetPushTemplateResponse -> String
showsPrec :: Int -> GetPushTemplateResponse -> ShowS
$cshowsPrec :: Int -> GetPushTemplateResponse -> ShowS
Prelude.Show, forall x. Rep GetPushTemplateResponse x -> GetPushTemplateResponse
forall x. GetPushTemplateResponse -> Rep GetPushTemplateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetPushTemplateResponse x -> GetPushTemplateResponse
$cfrom :: forall x. GetPushTemplateResponse -> Rep GetPushTemplateResponse x
Prelude.Generic)
newGetPushTemplateResponse ::
Prelude.Int ->
PushNotificationTemplateResponse ->
GetPushTemplateResponse
newGetPushTemplateResponse :: Int -> PushNotificationTemplateResponse -> GetPushTemplateResponse
newGetPushTemplateResponse
Int
pHttpStatus_
PushNotificationTemplateResponse
pPushNotificationTemplateResponse_ =
GetPushTemplateResponse'
{ $sel:httpStatus:GetPushTemplateResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:pushNotificationTemplateResponse:GetPushTemplateResponse' :: PushNotificationTemplateResponse
pushNotificationTemplateResponse =
PushNotificationTemplateResponse
pPushNotificationTemplateResponse_
}
getPushTemplateResponse_httpStatus :: Lens.Lens' GetPushTemplateResponse Prelude.Int
getPushTemplateResponse_httpStatus :: Lens' GetPushTemplateResponse Int
getPushTemplateResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPushTemplateResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetPushTemplateResponse' :: GetPushTemplateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetPushTemplateResponse
s@GetPushTemplateResponse' {} Int
a -> GetPushTemplateResponse
s {$sel:httpStatus:GetPushTemplateResponse' :: Int
httpStatus = Int
a} :: GetPushTemplateResponse)
getPushTemplateResponse_pushNotificationTemplateResponse :: Lens.Lens' GetPushTemplateResponse PushNotificationTemplateResponse
getPushTemplateResponse_pushNotificationTemplateResponse :: Lens' GetPushTemplateResponse PushNotificationTemplateResponse
getPushTemplateResponse_pushNotificationTemplateResponse = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPushTemplateResponse' {PushNotificationTemplateResponse
pushNotificationTemplateResponse :: PushNotificationTemplateResponse
$sel:pushNotificationTemplateResponse:GetPushTemplateResponse' :: GetPushTemplateResponse -> PushNotificationTemplateResponse
pushNotificationTemplateResponse} -> PushNotificationTemplateResponse
pushNotificationTemplateResponse) (\s :: GetPushTemplateResponse
s@GetPushTemplateResponse' {} PushNotificationTemplateResponse
a -> GetPushTemplateResponse
s {$sel:pushNotificationTemplateResponse:GetPushTemplateResponse' :: PushNotificationTemplateResponse
pushNotificationTemplateResponse = PushNotificationTemplateResponse
a} :: GetPushTemplateResponse)
instance Prelude.NFData GetPushTemplateResponse where
rnf :: GetPushTemplateResponse -> ()
rnf GetPushTemplateResponse' {Int
PushNotificationTemplateResponse
pushNotificationTemplateResponse :: PushNotificationTemplateResponse
httpStatus :: Int
$sel:pushNotificationTemplateResponse:GetPushTemplateResponse' :: GetPushTemplateResponse -> PushNotificationTemplateResponse
$sel:httpStatus:GetPushTemplateResponse' :: GetPushTemplateResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf PushNotificationTemplateResponse
pushNotificationTemplateResponse