{-# 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.GetVoiceTemplate
(
GetVoiceTemplate (..),
newGetVoiceTemplate,
getVoiceTemplate_version,
getVoiceTemplate_templateName,
GetVoiceTemplateResponse (..),
newGetVoiceTemplateResponse,
getVoiceTemplateResponse_httpStatus,
getVoiceTemplateResponse_voiceTemplateResponse,
)
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 GetVoiceTemplate = GetVoiceTemplate'
{
GetVoiceTemplate -> Maybe Text
version :: Prelude.Maybe Prelude.Text,
GetVoiceTemplate -> Text
templateName :: Prelude.Text
}
deriving (GetVoiceTemplate -> GetVoiceTemplate -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetVoiceTemplate -> GetVoiceTemplate -> Bool
$c/= :: GetVoiceTemplate -> GetVoiceTemplate -> Bool
== :: GetVoiceTemplate -> GetVoiceTemplate -> Bool
$c== :: GetVoiceTemplate -> GetVoiceTemplate -> Bool
Prelude.Eq, ReadPrec [GetVoiceTemplate]
ReadPrec GetVoiceTemplate
Int -> ReadS GetVoiceTemplate
ReadS [GetVoiceTemplate]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetVoiceTemplate]
$creadListPrec :: ReadPrec [GetVoiceTemplate]
readPrec :: ReadPrec GetVoiceTemplate
$creadPrec :: ReadPrec GetVoiceTemplate
readList :: ReadS [GetVoiceTemplate]
$creadList :: ReadS [GetVoiceTemplate]
readsPrec :: Int -> ReadS GetVoiceTemplate
$creadsPrec :: Int -> ReadS GetVoiceTemplate
Prelude.Read, Int -> GetVoiceTemplate -> ShowS
[GetVoiceTemplate] -> ShowS
GetVoiceTemplate -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetVoiceTemplate] -> ShowS
$cshowList :: [GetVoiceTemplate] -> ShowS
show :: GetVoiceTemplate -> String
$cshow :: GetVoiceTemplate -> String
showsPrec :: Int -> GetVoiceTemplate -> ShowS
$cshowsPrec :: Int -> GetVoiceTemplate -> ShowS
Prelude.Show, forall x. Rep GetVoiceTemplate x -> GetVoiceTemplate
forall x. GetVoiceTemplate -> Rep GetVoiceTemplate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetVoiceTemplate x -> GetVoiceTemplate
$cfrom :: forall x. GetVoiceTemplate -> Rep GetVoiceTemplate x
Prelude.Generic)
newGetVoiceTemplate ::
Prelude.Text ->
GetVoiceTemplate
newGetVoiceTemplate :: Text -> GetVoiceTemplate
newGetVoiceTemplate Text
pTemplateName_ =
GetVoiceTemplate'
{ $sel:version:GetVoiceTemplate' :: Maybe Text
version = forall a. Maybe a
Prelude.Nothing,
$sel:templateName:GetVoiceTemplate' :: Text
templateName = Text
pTemplateName_
}
getVoiceTemplate_version :: Lens.Lens' GetVoiceTemplate (Prelude.Maybe Prelude.Text)
getVoiceTemplate_version :: Lens' GetVoiceTemplate (Maybe Text)
getVoiceTemplate_version = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetVoiceTemplate' {Maybe Text
version :: Maybe Text
$sel:version:GetVoiceTemplate' :: GetVoiceTemplate -> Maybe Text
version} -> Maybe Text
version) (\s :: GetVoiceTemplate
s@GetVoiceTemplate' {} Maybe Text
a -> GetVoiceTemplate
s {$sel:version:GetVoiceTemplate' :: Maybe Text
version = Maybe Text
a} :: GetVoiceTemplate)
getVoiceTemplate_templateName :: Lens.Lens' GetVoiceTemplate Prelude.Text
getVoiceTemplate_templateName :: Lens' GetVoiceTemplate Text
getVoiceTemplate_templateName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetVoiceTemplate' {Text
templateName :: Text
$sel:templateName:GetVoiceTemplate' :: GetVoiceTemplate -> Text
templateName} -> Text
templateName) (\s :: GetVoiceTemplate
s@GetVoiceTemplate' {} Text
a -> GetVoiceTemplate
s {$sel:templateName:GetVoiceTemplate' :: Text
templateName = Text
a} :: GetVoiceTemplate)
instance Core.AWSRequest GetVoiceTemplate where
type
AWSResponse GetVoiceTemplate =
GetVoiceTemplateResponse
request :: (Service -> Service)
-> GetVoiceTemplate -> Request GetVoiceTemplate
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 GetVoiceTemplate
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetVoiceTemplate)))
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 -> VoiceTemplateResponse -> GetVoiceTemplateResponse
GetVoiceTemplateResponse'
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 GetVoiceTemplate where
hashWithSalt :: Int -> GetVoiceTemplate -> Int
hashWithSalt Int
_salt GetVoiceTemplate' {Maybe Text
Text
templateName :: Text
version :: Maybe Text
$sel:templateName:GetVoiceTemplate' :: GetVoiceTemplate -> Text
$sel:version:GetVoiceTemplate' :: GetVoiceTemplate -> 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 GetVoiceTemplate where
rnf :: GetVoiceTemplate -> ()
rnf GetVoiceTemplate' {Maybe Text
Text
templateName :: Text
version :: Maybe Text
$sel:templateName:GetVoiceTemplate' :: GetVoiceTemplate -> Text
$sel:version:GetVoiceTemplate' :: GetVoiceTemplate -> 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 GetVoiceTemplate where
toHeaders :: GetVoiceTemplate -> 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 GetVoiceTemplate where
toPath :: GetVoiceTemplate -> ByteString
toPath GetVoiceTemplate' {Maybe Text
Text
templateName :: Text
version :: Maybe Text
$sel:templateName:GetVoiceTemplate' :: GetVoiceTemplate -> Text
$sel:version:GetVoiceTemplate' :: GetVoiceTemplate -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/v1/templates/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
templateName, ByteString
"/voice"]
instance Data.ToQuery GetVoiceTemplate where
toQuery :: GetVoiceTemplate -> QueryString
toQuery GetVoiceTemplate' {Maybe Text
Text
templateName :: Text
version :: Maybe Text
$sel:templateName:GetVoiceTemplate' :: GetVoiceTemplate -> Text
$sel:version:GetVoiceTemplate' :: GetVoiceTemplate -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"version" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
version]
data GetVoiceTemplateResponse = GetVoiceTemplateResponse'
{
GetVoiceTemplateResponse -> Int
httpStatus :: Prelude.Int,
GetVoiceTemplateResponse -> VoiceTemplateResponse
voiceTemplateResponse :: VoiceTemplateResponse
}
deriving (GetVoiceTemplateResponse -> GetVoiceTemplateResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetVoiceTemplateResponse -> GetVoiceTemplateResponse -> Bool
$c/= :: GetVoiceTemplateResponse -> GetVoiceTemplateResponse -> Bool
== :: GetVoiceTemplateResponse -> GetVoiceTemplateResponse -> Bool
$c== :: GetVoiceTemplateResponse -> GetVoiceTemplateResponse -> Bool
Prelude.Eq, ReadPrec [GetVoiceTemplateResponse]
ReadPrec GetVoiceTemplateResponse
Int -> ReadS GetVoiceTemplateResponse
ReadS [GetVoiceTemplateResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetVoiceTemplateResponse]
$creadListPrec :: ReadPrec [GetVoiceTemplateResponse]
readPrec :: ReadPrec GetVoiceTemplateResponse
$creadPrec :: ReadPrec GetVoiceTemplateResponse
readList :: ReadS [GetVoiceTemplateResponse]
$creadList :: ReadS [GetVoiceTemplateResponse]
readsPrec :: Int -> ReadS GetVoiceTemplateResponse
$creadsPrec :: Int -> ReadS GetVoiceTemplateResponse
Prelude.Read, Int -> GetVoiceTemplateResponse -> ShowS
[GetVoiceTemplateResponse] -> ShowS
GetVoiceTemplateResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetVoiceTemplateResponse] -> ShowS
$cshowList :: [GetVoiceTemplateResponse] -> ShowS
show :: GetVoiceTemplateResponse -> String
$cshow :: GetVoiceTemplateResponse -> String
showsPrec :: Int -> GetVoiceTemplateResponse -> ShowS
$cshowsPrec :: Int -> GetVoiceTemplateResponse -> ShowS
Prelude.Show, forall x.
Rep GetVoiceTemplateResponse x -> GetVoiceTemplateResponse
forall x.
GetVoiceTemplateResponse -> Rep GetVoiceTemplateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetVoiceTemplateResponse x -> GetVoiceTemplateResponse
$cfrom :: forall x.
GetVoiceTemplateResponse -> Rep GetVoiceTemplateResponse x
Prelude.Generic)
newGetVoiceTemplateResponse ::
Prelude.Int ->
VoiceTemplateResponse ->
GetVoiceTemplateResponse
newGetVoiceTemplateResponse :: Int -> VoiceTemplateResponse -> GetVoiceTemplateResponse
newGetVoiceTemplateResponse
Int
pHttpStatus_
VoiceTemplateResponse
pVoiceTemplateResponse_ =
GetVoiceTemplateResponse'
{ $sel:httpStatus:GetVoiceTemplateResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:voiceTemplateResponse:GetVoiceTemplateResponse' :: VoiceTemplateResponse
voiceTemplateResponse = VoiceTemplateResponse
pVoiceTemplateResponse_
}
getVoiceTemplateResponse_httpStatus :: Lens.Lens' GetVoiceTemplateResponse Prelude.Int
getVoiceTemplateResponse_httpStatus :: Lens' GetVoiceTemplateResponse Int
getVoiceTemplateResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetVoiceTemplateResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetVoiceTemplateResponse' :: GetVoiceTemplateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetVoiceTemplateResponse
s@GetVoiceTemplateResponse' {} Int
a -> GetVoiceTemplateResponse
s {$sel:httpStatus:GetVoiceTemplateResponse' :: Int
httpStatus = Int
a} :: GetVoiceTemplateResponse)
getVoiceTemplateResponse_voiceTemplateResponse :: Lens.Lens' GetVoiceTemplateResponse VoiceTemplateResponse
getVoiceTemplateResponse_voiceTemplateResponse :: Lens' GetVoiceTemplateResponse VoiceTemplateResponse
getVoiceTemplateResponse_voiceTemplateResponse = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetVoiceTemplateResponse' {VoiceTemplateResponse
voiceTemplateResponse :: VoiceTemplateResponse
$sel:voiceTemplateResponse:GetVoiceTemplateResponse' :: GetVoiceTemplateResponse -> VoiceTemplateResponse
voiceTemplateResponse} -> VoiceTemplateResponse
voiceTemplateResponse) (\s :: GetVoiceTemplateResponse
s@GetVoiceTemplateResponse' {} VoiceTemplateResponse
a -> GetVoiceTemplateResponse
s {$sel:voiceTemplateResponse:GetVoiceTemplateResponse' :: VoiceTemplateResponse
voiceTemplateResponse = VoiceTemplateResponse
a} :: GetVoiceTemplateResponse)
instance Prelude.NFData GetVoiceTemplateResponse where
rnf :: GetVoiceTemplateResponse -> ()
rnf GetVoiceTemplateResponse' {Int
VoiceTemplateResponse
voiceTemplateResponse :: VoiceTemplateResponse
httpStatus :: Int
$sel:voiceTemplateResponse:GetVoiceTemplateResponse' :: GetVoiceTemplateResponse -> VoiceTemplateResponse
$sel:httpStatus:GetVoiceTemplateResponse' :: GetVoiceTemplateResponse -> 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 VoiceTemplateResponse
voiceTemplateResponse