{-# 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.GetSmsTemplate
(
GetSmsTemplate (..),
newGetSmsTemplate,
getSmsTemplate_version,
getSmsTemplate_templateName,
GetSmsTemplateResponse (..),
newGetSmsTemplateResponse,
getSmsTemplateResponse_httpStatus,
getSmsTemplateResponse_sMSTemplateResponse,
)
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 GetSmsTemplate = GetSmsTemplate'
{
GetSmsTemplate -> Maybe Text
version :: Prelude.Maybe Prelude.Text,
GetSmsTemplate -> Text
templateName :: Prelude.Text
}
deriving (GetSmsTemplate -> GetSmsTemplate -> Bool
(GetSmsTemplate -> GetSmsTemplate -> Bool)
-> (GetSmsTemplate -> GetSmsTemplate -> Bool) -> Eq GetSmsTemplate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSmsTemplate -> GetSmsTemplate -> Bool
$c/= :: GetSmsTemplate -> GetSmsTemplate -> Bool
== :: GetSmsTemplate -> GetSmsTemplate -> Bool
$c== :: GetSmsTemplate -> GetSmsTemplate -> Bool
Prelude.Eq, ReadPrec [GetSmsTemplate]
ReadPrec GetSmsTemplate
Int -> ReadS GetSmsTemplate
ReadS [GetSmsTemplate]
(Int -> ReadS GetSmsTemplate)
-> ReadS [GetSmsTemplate]
-> ReadPrec GetSmsTemplate
-> ReadPrec [GetSmsTemplate]
-> Read GetSmsTemplate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSmsTemplate]
$creadListPrec :: ReadPrec [GetSmsTemplate]
readPrec :: ReadPrec GetSmsTemplate
$creadPrec :: ReadPrec GetSmsTemplate
readList :: ReadS [GetSmsTemplate]
$creadList :: ReadS [GetSmsTemplate]
readsPrec :: Int -> ReadS GetSmsTemplate
$creadsPrec :: Int -> ReadS GetSmsTemplate
Prelude.Read, Int -> GetSmsTemplate -> ShowS
[GetSmsTemplate] -> ShowS
GetSmsTemplate -> String
(Int -> GetSmsTemplate -> ShowS)
-> (GetSmsTemplate -> String)
-> ([GetSmsTemplate] -> ShowS)
-> Show GetSmsTemplate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSmsTemplate] -> ShowS
$cshowList :: [GetSmsTemplate] -> ShowS
show :: GetSmsTemplate -> String
$cshow :: GetSmsTemplate -> String
showsPrec :: Int -> GetSmsTemplate -> ShowS
$cshowsPrec :: Int -> GetSmsTemplate -> ShowS
Prelude.Show, (forall x. GetSmsTemplate -> Rep GetSmsTemplate x)
-> (forall x. Rep GetSmsTemplate x -> GetSmsTemplate)
-> Generic GetSmsTemplate
forall x. Rep GetSmsTemplate x -> GetSmsTemplate
forall x. GetSmsTemplate -> Rep GetSmsTemplate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetSmsTemplate x -> GetSmsTemplate
$cfrom :: forall x. GetSmsTemplate -> Rep GetSmsTemplate x
Prelude.Generic)
newGetSmsTemplate ::
Prelude.Text ->
GetSmsTemplate
newGetSmsTemplate :: Text -> GetSmsTemplate
newGetSmsTemplate Text
pTemplateName_ =
GetSmsTemplate' :: Maybe Text -> Text -> GetSmsTemplate
GetSmsTemplate'
{ $sel:version:GetSmsTemplate' :: Maybe Text
version = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:templateName:GetSmsTemplate' :: Text
templateName = Text
pTemplateName_
}
getSmsTemplate_version :: Lens.Lens' GetSmsTemplate (Prelude.Maybe Prelude.Text)
getSmsTemplate_version :: (Maybe Text -> f (Maybe Text))
-> GetSmsTemplate -> f GetSmsTemplate
getSmsTemplate_version = (GetSmsTemplate -> Maybe Text)
-> (GetSmsTemplate -> Maybe Text -> GetSmsTemplate)
-> Lens GetSmsTemplate GetSmsTemplate (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSmsTemplate' {Maybe Text
version :: Maybe Text
$sel:version:GetSmsTemplate' :: GetSmsTemplate -> Maybe Text
version} -> Maybe Text
version) (\s :: GetSmsTemplate
s@GetSmsTemplate' {} Maybe Text
a -> GetSmsTemplate
s {$sel:version:GetSmsTemplate' :: Maybe Text
version = Maybe Text
a} :: GetSmsTemplate)
getSmsTemplate_templateName :: Lens.Lens' GetSmsTemplate Prelude.Text
getSmsTemplate_templateName :: (Text -> f Text) -> GetSmsTemplate -> f GetSmsTemplate
getSmsTemplate_templateName = (GetSmsTemplate -> Text)
-> (GetSmsTemplate -> Text -> GetSmsTemplate)
-> Lens GetSmsTemplate GetSmsTemplate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSmsTemplate' {Text
templateName :: Text
$sel:templateName:GetSmsTemplate' :: GetSmsTemplate -> Text
templateName} -> Text
templateName) (\s :: GetSmsTemplate
s@GetSmsTemplate' {} Text
a -> GetSmsTemplate
s {$sel:templateName:GetSmsTemplate' :: Text
templateName = Text
a} :: GetSmsTemplate)
instance Core.AWSRequest GetSmsTemplate where
type
AWSResponse GetSmsTemplate =
GetSmsTemplateResponse
request :: GetSmsTemplate -> Request GetSmsTemplate
request = Service -> GetSmsTemplate -> Request GetSmsTemplate
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetSmsTemplate
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetSmsTemplate)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetSmsTemplate))
-> Logger
-> Service
-> Proxy GetSmsTemplate
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetSmsTemplate)))
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 -> SMSTemplateResponse -> GetSmsTemplateResponse
GetSmsTemplateResponse'
(Int -> SMSTemplateResponse -> GetSmsTemplateResponse)
-> Either String Int
-> Either String (SMSTemplateResponse -> GetSmsTemplateResponse)
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 (SMSTemplateResponse -> GetSmsTemplateResponse)
-> Either String SMSTemplateResponse
-> Either String GetSmsTemplateResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object -> Either String SMSTemplateResponse
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
)
instance Prelude.Hashable GetSmsTemplate
instance Prelude.NFData GetSmsTemplate
instance Core.ToHeaders GetSmsTemplate where
toHeaders :: GetSmsTemplate -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetSmsTemplate -> 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 GetSmsTemplate where
toPath :: GetSmsTemplate -> ByteString
toPath GetSmsTemplate' {Maybe Text
Text
templateName :: Text
version :: Maybe Text
$sel:templateName:GetSmsTemplate' :: GetSmsTemplate -> Text
$sel:version:GetSmsTemplate' :: GetSmsTemplate -> 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
"/sms"]
instance Core.ToQuery GetSmsTemplate where
toQuery :: GetSmsTemplate -> QueryString
toQuery GetSmsTemplate' {Maybe Text
Text
templateName :: Text
version :: Maybe Text
$sel:templateName:GetSmsTemplate' :: GetSmsTemplate -> Text
$sel:version:GetSmsTemplate' :: GetSmsTemplate -> 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 GetSmsTemplateResponse = GetSmsTemplateResponse'
{
GetSmsTemplateResponse -> Int
httpStatus :: Prelude.Int,
GetSmsTemplateResponse -> SMSTemplateResponse
sMSTemplateResponse :: SMSTemplateResponse
}
deriving (GetSmsTemplateResponse -> GetSmsTemplateResponse -> Bool
(GetSmsTemplateResponse -> GetSmsTemplateResponse -> Bool)
-> (GetSmsTemplateResponse -> GetSmsTemplateResponse -> Bool)
-> Eq GetSmsTemplateResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSmsTemplateResponse -> GetSmsTemplateResponse -> Bool
$c/= :: GetSmsTemplateResponse -> GetSmsTemplateResponse -> Bool
== :: GetSmsTemplateResponse -> GetSmsTemplateResponse -> Bool
$c== :: GetSmsTemplateResponse -> GetSmsTemplateResponse -> Bool
Prelude.Eq, ReadPrec [GetSmsTemplateResponse]
ReadPrec GetSmsTemplateResponse
Int -> ReadS GetSmsTemplateResponse
ReadS [GetSmsTemplateResponse]
(Int -> ReadS GetSmsTemplateResponse)
-> ReadS [GetSmsTemplateResponse]
-> ReadPrec GetSmsTemplateResponse
-> ReadPrec [GetSmsTemplateResponse]
-> Read GetSmsTemplateResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSmsTemplateResponse]
$creadListPrec :: ReadPrec [GetSmsTemplateResponse]
readPrec :: ReadPrec GetSmsTemplateResponse
$creadPrec :: ReadPrec GetSmsTemplateResponse
readList :: ReadS [GetSmsTemplateResponse]
$creadList :: ReadS [GetSmsTemplateResponse]
readsPrec :: Int -> ReadS GetSmsTemplateResponse
$creadsPrec :: Int -> ReadS GetSmsTemplateResponse
Prelude.Read, Int -> GetSmsTemplateResponse -> ShowS
[GetSmsTemplateResponse] -> ShowS
GetSmsTemplateResponse -> String
(Int -> GetSmsTemplateResponse -> ShowS)
-> (GetSmsTemplateResponse -> String)
-> ([GetSmsTemplateResponse] -> ShowS)
-> Show GetSmsTemplateResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSmsTemplateResponse] -> ShowS
$cshowList :: [GetSmsTemplateResponse] -> ShowS
show :: GetSmsTemplateResponse -> String
$cshow :: GetSmsTemplateResponse -> String
showsPrec :: Int -> GetSmsTemplateResponse -> ShowS
$cshowsPrec :: Int -> GetSmsTemplateResponse -> ShowS
Prelude.Show, (forall x. GetSmsTemplateResponse -> Rep GetSmsTemplateResponse x)
-> (forall x.
Rep GetSmsTemplateResponse x -> GetSmsTemplateResponse)
-> Generic GetSmsTemplateResponse
forall x. Rep GetSmsTemplateResponse x -> GetSmsTemplateResponse
forall x. GetSmsTemplateResponse -> Rep GetSmsTemplateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetSmsTemplateResponse x -> GetSmsTemplateResponse
$cfrom :: forall x. GetSmsTemplateResponse -> Rep GetSmsTemplateResponse x
Prelude.Generic)
newGetSmsTemplateResponse ::
Prelude.Int ->
SMSTemplateResponse ->
GetSmsTemplateResponse
newGetSmsTemplateResponse :: Int -> SMSTemplateResponse -> GetSmsTemplateResponse
newGetSmsTemplateResponse
Int
pHttpStatus_
SMSTemplateResponse
pSMSTemplateResponse_ =
GetSmsTemplateResponse' :: Int -> SMSTemplateResponse -> GetSmsTemplateResponse
GetSmsTemplateResponse'
{ $sel:httpStatus:GetSmsTemplateResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:sMSTemplateResponse:GetSmsTemplateResponse' :: SMSTemplateResponse
sMSTemplateResponse = SMSTemplateResponse
pSMSTemplateResponse_
}
getSmsTemplateResponse_httpStatus :: Lens.Lens' GetSmsTemplateResponse Prelude.Int
getSmsTemplateResponse_httpStatus :: (Int -> f Int)
-> GetSmsTemplateResponse -> f GetSmsTemplateResponse
getSmsTemplateResponse_httpStatus = (GetSmsTemplateResponse -> Int)
-> (GetSmsTemplateResponse -> Int -> GetSmsTemplateResponse)
-> Lens GetSmsTemplateResponse GetSmsTemplateResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSmsTemplateResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetSmsTemplateResponse' :: GetSmsTemplateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetSmsTemplateResponse
s@GetSmsTemplateResponse' {} Int
a -> GetSmsTemplateResponse
s {$sel:httpStatus:GetSmsTemplateResponse' :: Int
httpStatus = Int
a} :: GetSmsTemplateResponse)
getSmsTemplateResponse_sMSTemplateResponse :: Lens.Lens' GetSmsTemplateResponse SMSTemplateResponse
getSmsTemplateResponse_sMSTemplateResponse :: (SMSTemplateResponse -> f SMSTemplateResponse)
-> GetSmsTemplateResponse -> f GetSmsTemplateResponse
getSmsTemplateResponse_sMSTemplateResponse = (GetSmsTemplateResponse -> SMSTemplateResponse)
-> (GetSmsTemplateResponse
-> SMSTemplateResponse -> GetSmsTemplateResponse)
-> Lens
GetSmsTemplateResponse
GetSmsTemplateResponse
SMSTemplateResponse
SMSTemplateResponse
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSmsTemplateResponse' {SMSTemplateResponse
sMSTemplateResponse :: SMSTemplateResponse
$sel:sMSTemplateResponse:GetSmsTemplateResponse' :: GetSmsTemplateResponse -> SMSTemplateResponse
sMSTemplateResponse} -> SMSTemplateResponse
sMSTemplateResponse) (\s :: GetSmsTemplateResponse
s@GetSmsTemplateResponse' {} SMSTemplateResponse
a -> GetSmsTemplateResponse
s {$sel:sMSTemplateResponse:GetSmsTemplateResponse' :: SMSTemplateResponse
sMSTemplateResponse = SMSTemplateResponse
a} :: GetSmsTemplateResponse)
instance Prelude.NFData GetSmsTemplateResponse