{-# 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.SmsVoice.SendVoiceMessage
(
SendVoiceMessage (..),
newSendVoiceMessage,
sendVoiceMessage_callerId,
sendVoiceMessage_configurationSetName,
sendVoiceMessage_content,
sendVoiceMessage_destinationPhoneNumber,
sendVoiceMessage_originationPhoneNumber,
SendVoiceMessageResponse (..),
newSendVoiceMessageResponse,
sendVoiceMessageResponse_messageId,
sendVoiceMessageResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SmsVoice.Types
data SendVoiceMessage = SendVoiceMessage'
{
SendVoiceMessage -> Maybe Text
callerId :: Prelude.Maybe Prelude.Text,
SendVoiceMessage -> Maybe Text
configurationSetName :: Prelude.Maybe Prelude.Text,
SendVoiceMessage -> Maybe VoiceMessageContent
content :: Prelude.Maybe VoiceMessageContent,
SendVoiceMessage -> Maybe Text
destinationPhoneNumber :: Prelude.Maybe Prelude.Text,
SendVoiceMessage -> Maybe Text
originationPhoneNumber :: Prelude.Maybe Prelude.Text
}
deriving (SendVoiceMessage -> SendVoiceMessage -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SendVoiceMessage -> SendVoiceMessage -> Bool
$c/= :: SendVoiceMessage -> SendVoiceMessage -> Bool
== :: SendVoiceMessage -> SendVoiceMessage -> Bool
$c== :: SendVoiceMessage -> SendVoiceMessage -> Bool
Prelude.Eq, ReadPrec [SendVoiceMessage]
ReadPrec SendVoiceMessage
Int -> ReadS SendVoiceMessage
ReadS [SendVoiceMessage]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SendVoiceMessage]
$creadListPrec :: ReadPrec [SendVoiceMessage]
readPrec :: ReadPrec SendVoiceMessage
$creadPrec :: ReadPrec SendVoiceMessage
readList :: ReadS [SendVoiceMessage]
$creadList :: ReadS [SendVoiceMessage]
readsPrec :: Int -> ReadS SendVoiceMessage
$creadsPrec :: Int -> ReadS SendVoiceMessage
Prelude.Read, Int -> SendVoiceMessage -> ShowS
[SendVoiceMessage] -> ShowS
SendVoiceMessage -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SendVoiceMessage] -> ShowS
$cshowList :: [SendVoiceMessage] -> ShowS
show :: SendVoiceMessage -> String
$cshow :: SendVoiceMessage -> String
showsPrec :: Int -> SendVoiceMessage -> ShowS
$cshowsPrec :: Int -> SendVoiceMessage -> ShowS
Prelude.Show, forall x. Rep SendVoiceMessage x -> SendVoiceMessage
forall x. SendVoiceMessage -> Rep SendVoiceMessage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SendVoiceMessage x -> SendVoiceMessage
$cfrom :: forall x. SendVoiceMessage -> Rep SendVoiceMessage x
Prelude.Generic)
newSendVoiceMessage ::
SendVoiceMessage
newSendVoiceMessage :: SendVoiceMessage
newSendVoiceMessage =
SendVoiceMessage'
{ $sel:callerId:SendVoiceMessage' :: Maybe Text
callerId = forall a. Maybe a
Prelude.Nothing,
$sel:configurationSetName:SendVoiceMessage' :: Maybe Text
configurationSetName = forall a. Maybe a
Prelude.Nothing,
$sel:content:SendVoiceMessage' :: Maybe VoiceMessageContent
content = forall a. Maybe a
Prelude.Nothing,
$sel:destinationPhoneNumber:SendVoiceMessage' :: Maybe Text
destinationPhoneNumber = forall a. Maybe a
Prelude.Nothing,
$sel:originationPhoneNumber:SendVoiceMessage' :: Maybe Text
originationPhoneNumber = forall a. Maybe a
Prelude.Nothing
}
sendVoiceMessage_callerId :: Lens.Lens' SendVoiceMessage (Prelude.Maybe Prelude.Text)
sendVoiceMessage_callerId :: Lens' SendVoiceMessage (Maybe Text)
sendVoiceMessage_callerId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendVoiceMessage' {Maybe Text
callerId :: Maybe Text
$sel:callerId:SendVoiceMessage' :: SendVoiceMessage -> Maybe Text
callerId} -> Maybe Text
callerId) (\s :: SendVoiceMessage
s@SendVoiceMessage' {} Maybe Text
a -> SendVoiceMessage
s {$sel:callerId:SendVoiceMessage' :: Maybe Text
callerId = Maybe Text
a} :: SendVoiceMessage)
sendVoiceMessage_configurationSetName :: Lens.Lens' SendVoiceMessage (Prelude.Maybe Prelude.Text)
sendVoiceMessage_configurationSetName :: Lens' SendVoiceMessage (Maybe Text)
sendVoiceMessage_configurationSetName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendVoiceMessage' {Maybe Text
configurationSetName :: Maybe Text
$sel:configurationSetName:SendVoiceMessage' :: SendVoiceMessage -> Maybe Text
configurationSetName} -> Maybe Text
configurationSetName) (\s :: SendVoiceMessage
s@SendVoiceMessage' {} Maybe Text
a -> SendVoiceMessage
s {$sel:configurationSetName:SendVoiceMessage' :: Maybe Text
configurationSetName = Maybe Text
a} :: SendVoiceMessage)
sendVoiceMessage_content :: Lens.Lens' SendVoiceMessage (Prelude.Maybe VoiceMessageContent)
sendVoiceMessage_content :: Lens' SendVoiceMessage (Maybe VoiceMessageContent)
sendVoiceMessage_content = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendVoiceMessage' {Maybe VoiceMessageContent
content :: Maybe VoiceMessageContent
$sel:content:SendVoiceMessage' :: SendVoiceMessage -> Maybe VoiceMessageContent
content} -> Maybe VoiceMessageContent
content) (\s :: SendVoiceMessage
s@SendVoiceMessage' {} Maybe VoiceMessageContent
a -> SendVoiceMessage
s {$sel:content:SendVoiceMessage' :: Maybe VoiceMessageContent
content = Maybe VoiceMessageContent
a} :: SendVoiceMessage)
sendVoiceMessage_destinationPhoneNumber :: Lens.Lens' SendVoiceMessage (Prelude.Maybe Prelude.Text)
sendVoiceMessage_destinationPhoneNumber :: Lens' SendVoiceMessage (Maybe Text)
sendVoiceMessage_destinationPhoneNumber = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendVoiceMessage' {Maybe Text
destinationPhoneNumber :: Maybe Text
$sel:destinationPhoneNumber:SendVoiceMessage' :: SendVoiceMessage -> Maybe Text
destinationPhoneNumber} -> Maybe Text
destinationPhoneNumber) (\s :: SendVoiceMessage
s@SendVoiceMessage' {} Maybe Text
a -> SendVoiceMessage
s {$sel:destinationPhoneNumber:SendVoiceMessage' :: Maybe Text
destinationPhoneNumber = Maybe Text
a} :: SendVoiceMessage)
sendVoiceMessage_originationPhoneNumber :: Lens.Lens' SendVoiceMessage (Prelude.Maybe Prelude.Text)
sendVoiceMessage_originationPhoneNumber :: Lens' SendVoiceMessage (Maybe Text)
sendVoiceMessage_originationPhoneNumber = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendVoiceMessage' {Maybe Text
originationPhoneNumber :: Maybe Text
$sel:originationPhoneNumber:SendVoiceMessage' :: SendVoiceMessage -> Maybe Text
originationPhoneNumber} -> Maybe Text
originationPhoneNumber) (\s :: SendVoiceMessage
s@SendVoiceMessage' {} Maybe Text
a -> SendVoiceMessage
s {$sel:originationPhoneNumber:SendVoiceMessage' :: Maybe Text
originationPhoneNumber = Maybe Text
a} :: SendVoiceMessage)
instance Core.AWSRequest SendVoiceMessage where
type
AWSResponse SendVoiceMessage =
SendVoiceMessageResponse
request :: (Service -> Service)
-> SendVoiceMessage -> Request SendVoiceMessage
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy SendVoiceMessage
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SendVoiceMessage)))
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 ->
Maybe Text -> Int -> SendVoiceMessageResponse
SendVoiceMessageResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"MessageId")
forall (f :: * -> *) a b. Applicative f => 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))
)
instance Prelude.Hashable SendVoiceMessage where
hashWithSalt :: Int -> SendVoiceMessage -> Int
hashWithSalt Int
_salt SendVoiceMessage' {Maybe Text
Maybe VoiceMessageContent
originationPhoneNumber :: Maybe Text
destinationPhoneNumber :: Maybe Text
content :: Maybe VoiceMessageContent
configurationSetName :: Maybe Text
callerId :: Maybe Text
$sel:originationPhoneNumber:SendVoiceMessage' :: SendVoiceMessage -> Maybe Text
$sel:destinationPhoneNumber:SendVoiceMessage' :: SendVoiceMessage -> Maybe Text
$sel:content:SendVoiceMessage' :: SendVoiceMessage -> Maybe VoiceMessageContent
$sel:configurationSetName:SendVoiceMessage' :: SendVoiceMessage -> Maybe Text
$sel:callerId:SendVoiceMessage' :: SendVoiceMessage -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
callerId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
configurationSetName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VoiceMessageContent
content
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
destinationPhoneNumber
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
originationPhoneNumber
instance Prelude.NFData SendVoiceMessage where
rnf :: SendVoiceMessage -> ()
rnf SendVoiceMessage' {Maybe Text
Maybe VoiceMessageContent
originationPhoneNumber :: Maybe Text
destinationPhoneNumber :: Maybe Text
content :: Maybe VoiceMessageContent
configurationSetName :: Maybe Text
callerId :: Maybe Text
$sel:originationPhoneNumber:SendVoiceMessage' :: SendVoiceMessage -> Maybe Text
$sel:destinationPhoneNumber:SendVoiceMessage' :: SendVoiceMessage -> Maybe Text
$sel:content:SendVoiceMessage' :: SendVoiceMessage -> Maybe VoiceMessageContent
$sel:configurationSetName:SendVoiceMessage' :: SendVoiceMessage -> Maybe Text
$sel:callerId:SendVoiceMessage' :: SendVoiceMessage -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
callerId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
configurationSetName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VoiceMessageContent
content
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
destinationPhoneNumber
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
originationPhoneNumber
instance Data.ToHeaders SendVoiceMessage where
toHeaders :: SendVoiceMessage -> 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.ToJSON SendVoiceMessage where
toJSON :: SendVoiceMessage -> Value
toJSON SendVoiceMessage' {Maybe Text
Maybe VoiceMessageContent
originationPhoneNumber :: Maybe Text
destinationPhoneNumber :: Maybe Text
content :: Maybe VoiceMessageContent
configurationSetName :: Maybe Text
callerId :: Maybe Text
$sel:originationPhoneNumber:SendVoiceMessage' :: SendVoiceMessage -> Maybe Text
$sel:destinationPhoneNumber:SendVoiceMessage' :: SendVoiceMessage -> Maybe Text
$sel:content:SendVoiceMessage' :: SendVoiceMessage -> Maybe VoiceMessageContent
$sel:configurationSetName:SendVoiceMessage' :: SendVoiceMessage -> Maybe Text
$sel:callerId:SendVoiceMessage' :: SendVoiceMessage -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"CallerId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
callerId,
(Key
"ConfigurationSetName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
configurationSetName,
(Key
"Content" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe VoiceMessageContent
content,
(Key
"DestinationPhoneNumber" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
destinationPhoneNumber,
(Key
"OriginationPhoneNumber" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
originationPhoneNumber
]
)
instance Data.ToPath SendVoiceMessage where
toPath :: SendVoiceMessage -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/v1/sms-voice/voice/message"
instance Data.ToQuery SendVoiceMessage where
toQuery :: SendVoiceMessage -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data SendVoiceMessageResponse = SendVoiceMessageResponse'
{
SendVoiceMessageResponse -> Maybe Text
messageId :: Prelude.Maybe Prelude.Text,
SendVoiceMessageResponse -> Int
httpStatus :: Prelude.Int
}
deriving (SendVoiceMessageResponse -> SendVoiceMessageResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SendVoiceMessageResponse -> SendVoiceMessageResponse -> Bool
$c/= :: SendVoiceMessageResponse -> SendVoiceMessageResponse -> Bool
== :: SendVoiceMessageResponse -> SendVoiceMessageResponse -> Bool
$c== :: SendVoiceMessageResponse -> SendVoiceMessageResponse -> Bool
Prelude.Eq, ReadPrec [SendVoiceMessageResponse]
ReadPrec SendVoiceMessageResponse
Int -> ReadS SendVoiceMessageResponse
ReadS [SendVoiceMessageResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SendVoiceMessageResponse]
$creadListPrec :: ReadPrec [SendVoiceMessageResponse]
readPrec :: ReadPrec SendVoiceMessageResponse
$creadPrec :: ReadPrec SendVoiceMessageResponse
readList :: ReadS [SendVoiceMessageResponse]
$creadList :: ReadS [SendVoiceMessageResponse]
readsPrec :: Int -> ReadS SendVoiceMessageResponse
$creadsPrec :: Int -> ReadS SendVoiceMessageResponse
Prelude.Read, Int -> SendVoiceMessageResponse -> ShowS
[SendVoiceMessageResponse] -> ShowS
SendVoiceMessageResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SendVoiceMessageResponse] -> ShowS
$cshowList :: [SendVoiceMessageResponse] -> ShowS
show :: SendVoiceMessageResponse -> String
$cshow :: SendVoiceMessageResponse -> String
showsPrec :: Int -> SendVoiceMessageResponse -> ShowS
$cshowsPrec :: Int -> SendVoiceMessageResponse -> ShowS
Prelude.Show, forall x.
Rep SendVoiceMessageResponse x -> SendVoiceMessageResponse
forall x.
SendVoiceMessageResponse -> Rep SendVoiceMessageResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SendVoiceMessageResponse x -> SendVoiceMessageResponse
$cfrom :: forall x.
SendVoiceMessageResponse -> Rep SendVoiceMessageResponse x
Prelude.Generic)
newSendVoiceMessageResponse ::
Prelude.Int ->
SendVoiceMessageResponse
newSendVoiceMessageResponse :: Int -> SendVoiceMessageResponse
newSendVoiceMessageResponse Int
pHttpStatus_ =
SendVoiceMessageResponse'
{ $sel:messageId:SendVoiceMessageResponse' :: Maybe Text
messageId =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:SendVoiceMessageResponse' :: Int
httpStatus = Int
pHttpStatus_
}
sendVoiceMessageResponse_messageId :: Lens.Lens' SendVoiceMessageResponse (Prelude.Maybe Prelude.Text)
sendVoiceMessageResponse_messageId :: Lens' SendVoiceMessageResponse (Maybe Text)
sendVoiceMessageResponse_messageId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendVoiceMessageResponse' {Maybe Text
messageId :: Maybe Text
$sel:messageId:SendVoiceMessageResponse' :: SendVoiceMessageResponse -> Maybe Text
messageId} -> Maybe Text
messageId) (\s :: SendVoiceMessageResponse
s@SendVoiceMessageResponse' {} Maybe Text
a -> SendVoiceMessageResponse
s {$sel:messageId:SendVoiceMessageResponse' :: Maybe Text
messageId = Maybe Text
a} :: SendVoiceMessageResponse)
sendVoiceMessageResponse_httpStatus :: Lens.Lens' SendVoiceMessageResponse Prelude.Int
sendVoiceMessageResponse_httpStatus :: Lens' SendVoiceMessageResponse Int
sendVoiceMessageResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendVoiceMessageResponse' {Int
httpStatus :: Int
$sel:httpStatus:SendVoiceMessageResponse' :: SendVoiceMessageResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: SendVoiceMessageResponse
s@SendVoiceMessageResponse' {} Int
a -> SendVoiceMessageResponse
s {$sel:httpStatus:SendVoiceMessageResponse' :: Int
httpStatus = Int
a} :: SendVoiceMessageResponse)
instance Prelude.NFData SendVoiceMessageResponse where
rnf :: SendVoiceMessageResponse -> ()
rnf SendVoiceMessageResponse' {Int
Maybe Text
httpStatus :: Int
messageId :: Maybe Text
$sel:httpStatus:SendVoiceMessageResponse' :: SendVoiceMessageResponse -> Int
$sel:messageId:SendVoiceMessageResponse' :: SendVoiceMessageResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
messageId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus