{-# 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.GetInAppTemplate
(
GetInAppTemplate (..),
newGetInAppTemplate,
getInAppTemplate_version,
getInAppTemplate_templateName,
GetInAppTemplateResponse (..),
newGetInAppTemplateResponse,
getInAppTemplateResponse_httpStatus,
getInAppTemplateResponse_inAppTemplateResponse,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pinpoint.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetInAppTemplate = GetInAppTemplate'
{
GetInAppTemplate -> Maybe Text
version :: Prelude.Maybe Prelude.Text,
GetInAppTemplate -> Text
templateName :: Prelude.Text
}
deriving (GetInAppTemplate -> GetInAppTemplate -> Bool
(GetInAppTemplate -> GetInAppTemplate -> Bool)
-> (GetInAppTemplate -> GetInAppTemplate -> Bool)
-> Eq GetInAppTemplate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetInAppTemplate -> GetInAppTemplate -> Bool
$c/= :: GetInAppTemplate -> GetInAppTemplate -> Bool
== :: GetInAppTemplate -> GetInAppTemplate -> Bool
$c== :: GetInAppTemplate -> GetInAppTemplate -> Bool
Prelude.Eq, ReadPrec [GetInAppTemplate]
ReadPrec GetInAppTemplate
Int -> ReadS GetInAppTemplate
ReadS [GetInAppTemplate]
(Int -> ReadS GetInAppTemplate)
-> ReadS [GetInAppTemplate]
-> ReadPrec GetInAppTemplate
-> ReadPrec [GetInAppTemplate]
-> Read GetInAppTemplate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetInAppTemplate]
$creadListPrec :: ReadPrec [GetInAppTemplate]
readPrec :: ReadPrec GetInAppTemplate
$creadPrec :: ReadPrec GetInAppTemplate
readList :: ReadS [GetInAppTemplate]
$creadList :: ReadS [GetInAppTemplate]
readsPrec :: Int -> ReadS GetInAppTemplate
$creadsPrec :: Int -> ReadS GetInAppTemplate
Prelude.Read, Int -> GetInAppTemplate -> ShowS
[GetInAppTemplate] -> ShowS
GetInAppTemplate -> String
(Int -> GetInAppTemplate -> ShowS)
-> (GetInAppTemplate -> String)
-> ([GetInAppTemplate] -> ShowS)
-> Show GetInAppTemplate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetInAppTemplate] -> ShowS
$cshowList :: [GetInAppTemplate] -> ShowS
show :: GetInAppTemplate -> String
$cshow :: GetInAppTemplate -> String
showsPrec :: Int -> GetInAppTemplate -> ShowS
$cshowsPrec :: Int -> GetInAppTemplate -> ShowS
Prelude.Show, (forall x. GetInAppTemplate -> Rep GetInAppTemplate x)
-> (forall x. Rep GetInAppTemplate x -> GetInAppTemplate)
-> Generic GetInAppTemplate
forall x. Rep GetInAppTemplate x -> GetInAppTemplate
forall x. GetInAppTemplate -> Rep GetInAppTemplate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetInAppTemplate x -> GetInAppTemplate
$cfrom :: forall x. GetInAppTemplate -> Rep GetInAppTemplate x
Prelude.Generic)
newGetInAppTemplate ::
Prelude.Text ->
GetInAppTemplate
newGetInAppTemplate :: Text -> GetInAppTemplate
newGetInAppTemplate Text
pTemplateName_ =
GetInAppTemplate' :: Maybe Text -> Text -> GetInAppTemplate
GetInAppTemplate'
{ $sel:version:GetInAppTemplate' :: Maybe Text
version = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:templateName:GetInAppTemplate' :: Text
templateName = Text
pTemplateName_
}
getInAppTemplate_version :: Lens.Lens' GetInAppTemplate (Prelude.Maybe Prelude.Text)
getInAppTemplate_version :: (Maybe Text -> f (Maybe Text))
-> GetInAppTemplate -> f GetInAppTemplate
getInAppTemplate_version = (GetInAppTemplate -> Maybe Text)
-> (GetInAppTemplate -> Maybe Text -> GetInAppTemplate)
-> Lens GetInAppTemplate GetInAppTemplate (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInAppTemplate' {Maybe Text
version :: Maybe Text
$sel:version:GetInAppTemplate' :: GetInAppTemplate -> Maybe Text
version} -> Maybe Text
version) (\s :: GetInAppTemplate
s@GetInAppTemplate' {} Maybe Text
a -> GetInAppTemplate
s {$sel:version:GetInAppTemplate' :: Maybe Text
version = Maybe Text
a} :: GetInAppTemplate)
getInAppTemplate_templateName :: Lens.Lens' GetInAppTemplate Prelude.Text
getInAppTemplate_templateName :: (Text -> f Text) -> GetInAppTemplate -> f GetInAppTemplate
getInAppTemplate_templateName = (GetInAppTemplate -> Text)
-> (GetInAppTemplate -> Text -> GetInAppTemplate)
-> Lens GetInAppTemplate GetInAppTemplate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInAppTemplate' {Text
templateName :: Text
$sel:templateName:GetInAppTemplate' :: GetInAppTemplate -> Text
templateName} -> Text
templateName) (\s :: GetInAppTemplate
s@GetInAppTemplate' {} Text
a -> GetInAppTemplate
s {$sel:templateName:GetInAppTemplate' :: Text
templateName = Text
a} :: GetInAppTemplate)
instance Core.AWSRequest GetInAppTemplate where
type
AWSResponse GetInAppTemplate =
GetInAppTemplateResponse
request :: GetInAppTemplate -> Request GetInAppTemplate
request = Service -> GetInAppTemplate -> Request GetInAppTemplate
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetInAppTemplate
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetInAppTemplate)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetInAppTemplate))
-> Logger
-> Service
-> Proxy GetInAppTemplate
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetInAppTemplate)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Int -> InAppTemplateResponse -> GetInAppTemplateResponse
GetInAppTemplateResponse'
(Int -> InAppTemplateResponse -> GetInAppTemplateResponse)
-> Either String Int
-> Either
String (InAppTemplateResponse -> GetInAppTemplateResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
Either String (InAppTemplateResponse -> GetInAppTemplateResponse)
-> Either String InAppTemplateResponse
-> Either String GetInAppTemplateResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object -> Either String InAppTemplateResponse
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
)
instance Prelude.Hashable GetInAppTemplate
instance Prelude.NFData GetInAppTemplate
instance Core.ToHeaders GetInAppTemplate where
toHeaders :: GetInAppTemplate -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetInAppTemplate -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToPath GetInAppTemplate where
toPath :: GetInAppTemplate -> ByteString
toPath GetInAppTemplate' {Maybe Text
Text
templateName :: Text
version :: Maybe Text
$sel:templateName:GetInAppTemplate' :: GetInAppTemplate -> Text
$sel:version:GetInAppTemplate' :: GetInAppTemplate -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/v1/templates/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
templateName, ByteString
"/inapp"]
instance Core.ToQuery GetInAppTemplate where
toQuery :: GetInAppTemplate -> QueryString
toQuery GetInAppTemplate' {Maybe Text
Text
templateName :: Text
version :: Maybe Text
$sel:templateName:GetInAppTemplate' :: GetInAppTemplate -> Text
$sel:version:GetInAppTemplate' :: GetInAppTemplate -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"version" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
version]
data GetInAppTemplateResponse = GetInAppTemplateResponse'
{
GetInAppTemplateResponse -> Int
httpStatus :: Prelude.Int,
GetInAppTemplateResponse -> InAppTemplateResponse
inAppTemplateResponse :: InAppTemplateResponse
}
deriving (GetInAppTemplateResponse -> GetInAppTemplateResponse -> Bool
(GetInAppTemplateResponse -> GetInAppTemplateResponse -> Bool)
-> (GetInAppTemplateResponse -> GetInAppTemplateResponse -> Bool)
-> Eq GetInAppTemplateResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetInAppTemplateResponse -> GetInAppTemplateResponse -> Bool
$c/= :: GetInAppTemplateResponse -> GetInAppTemplateResponse -> Bool
== :: GetInAppTemplateResponse -> GetInAppTemplateResponse -> Bool
$c== :: GetInAppTemplateResponse -> GetInAppTemplateResponse -> Bool
Prelude.Eq, ReadPrec [GetInAppTemplateResponse]
ReadPrec GetInAppTemplateResponse
Int -> ReadS GetInAppTemplateResponse
ReadS [GetInAppTemplateResponse]
(Int -> ReadS GetInAppTemplateResponse)
-> ReadS [GetInAppTemplateResponse]
-> ReadPrec GetInAppTemplateResponse
-> ReadPrec [GetInAppTemplateResponse]
-> Read GetInAppTemplateResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetInAppTemplateResponse]
$creadListPrec :: ReadPrec [GetInAppTemplateResponse]
readPrec :: ReadPrec GetInAppTemplateResponse
$creadPrec :: ReadPrec GetInAppTemplateResponse
readList :: ReadS [GetInAppTemplateResponse]
$creadList :: ReadS [GetInAppTemplateResponse]
readsPrec :: Int -> ReadS GetInAppTemplateResponse
$creadsPrec :: Int -> ReadS GetInAppTemplateResponse
Prelude.Read, Int -> GetInAppTemplateResponse -> ShowS
[GetInAppTemplateResponse] -> ShowS
GetInAppTemplateResponse -> String
(Int -> GetInAppTemplateResponse -> ShowS)
-> (GetInAppTemplateResponse -> String)
-> ([GetInAppTemplateResponse] -> ShowS)
-> Show GetInAppTemplateResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetInAppTemplateResponse] -> ShowS
$cshowList :: [GetInAppTemplateResponse] -> ShowS
show :: GetInAppTemplateResponse -> String
$cshow :: GetInAppTemplateResponse -> String
showsPrec :: Int -> GetInAppTemplateResponse -> ShowS
$cshowsPrec :: Int -> GetInAppTemplateResponse -> ShowS
Prelude.Show, (forall x.
GetInAppTemplateResponse -> Rep GetInAppTemplateResponse x)
-> (forall x.
Rep GetInAppTemplateResponse x -> GetInAppTemplateResponse)
-> Generic GetInAppTemplateResponse
forall x.
Rep GetInAppTemplateResponse x -> GetInAppTemplateResponse
forall x.
GetInAppTemplateResponse -> Rep GetInAppTemplateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetInAppTemplateResponse x -> GetInAppTemplateResponse
$cfrom :: forall x.
GetInAppTemplateResponse -> Rep GetInAppTemplateResponse x
Prelude.Generic)
newGetInAppTemplateResponse ::
Prelude.Int ->
InAppTemplateResponse ->
GetInAppTemplateResponse
newGetInAppTemplateResponse :: Int -> InAppTemplateResponse -> GetInAppTemplateResponse
newGetInAppTemplateResponse
Int
pHttpStatus_
InAppTemplateResponse
pInAppTemplateResponse_ =
GetInAppTemplateResponse' :: Int -> InAppTemplateResponse -> GetInAppTemplateResponse
GetInAppTemplateResponse'
{ $sel:httpStatus:GetInAppTemplateResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:inAppTemplateResponse:GetInAppTemplateResponse' :: InAppTemplateResponse
inAppTemplateResponse = InAppTemplateResponse
pInAppTemplateResponse_
}
getInAppTemplateResponse_httpStatus :: Lens.Lens' GetInAppTemplateResponse Prelude.Int
getInAppTemplateResponse_httpStatus :: (Int -> f Int)
-> GetInAppTemplateResponse -> f GetInAppTemplateResponse
getInAppTemplateResponse_httpStatus = (GetInAppTemplateResponse -> Int)
-> (GetInAppTemplateResponse -> Int -> GetInAppTemplateResponse)
-> Lens GetInAppTemplateResponse GetInAppTemplateResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInAppTemplateResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetInAppTemplateResponse' :: GetInAppTemplateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetInAppTemplateResponse
s@GetInAppTemplateResponse' {} Int
a -> GetInAppTemplateResponse
s {$sel:httpStatus:GetInAppTemplateResponse' :: Int
httpStatus = Int
a} :: GetInAppTemplateResponse)
getInAppTemplateResponse_inAppTemplateResponse :: Lens.Lens' GetInAppTemplateResponse InAppTemplateResponse
getInAppTemplateResponse_inAppTemplateResponse :: (InAppTemplateResponse -> f InAppTemplateResponse)
-> GetInAppTemplateResponse -> f GetInAppTemplateResponse
getInAppTemplateResponse_inAppTemplateResponse = (GetInAppTemplateResponse -> InAppTemplateResponse)
-> (GetInAppTemplateResponse
-> InAppTemplateResponse -> GetInAppTemplateResponse)
-> Lens
GetInAppTemplateResponse
GetInAppTemplateResponse
InAppTemplateResponse
InAppTemplateResponse
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInAppTemplateResponse' {InAppTemplateResponse
inAppTemplateResponse :: InAppTemplateResponse
$sel:inAppTemplateResponse:GetInAppTemplateResponse' :: GetInAppTemplateResponse -> InAppTemplateResponse
inAppTemplateResponse} -> InAppTemplateResponse
inAppTemplateResponse) (\s :: GetInAppTemplateResponse
s@GetInAppTemplateResponse' {} InAppTemplateResponse
a -> GetInAppTemplateResponse
s {$sel:inAppTemplateResponse:GetInAppTemplateResponse' :: InAppTemplateResponse
inAppTemplateResponse = InAppTemplateResponse
a} :: GetInAppTemplateResponse)
instance Prelude.NFData GetInAppTemplateResponse