{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.PinpointSmsVoiceV2.SendTextMessage
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a new text message and sends it to a recipient\'s phone number.
--
-- SMS throughput limits are measured in Message Parts per Second (MPS).
-- Your MPS limit depends on the destination country of your messages, as
-- well as the type of phone number (origination number) that you use to
-- send the message. For more information, see
-- <https://docs.aws.amazon.com/pinpoint/latest/userguide/channels-sms-limitations-mps.html Message Parts per Second (MPS) limits>
-- in the /Amazon Pinpoint User Guide/.
module Amazonka.PinpointSmsVoiceV2.SendTextMessage
  ( -- * Creating a Request
    SendTextMessage (..),
    newSendTextMessage,

    -- * Request Lenses
    sendTextMessage_configurationSetName,
    sendTextMessage_context,
    sendTextMessage_destinationCountryParameters,
    sendTextMessage_dryRun,
    sendTextMessage_keyword,
    sendTextMessage_maxPrice,
    sendTextMessage_messageBody,
    sendTextMessage_messageType,
    sendTextMessage_originationIdentity,
    sendTextMessage_timeToLive,
    sendTextMessage_destinationPhoneNumber,

    -- * Destructuring the Response
    SendTextMessageResponse (..),
    newSendTextMessageResponse,

    -- * Response Lenses
    sendTextMessageResponse_messageId,
    sendTextMessageResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.PinpointSmsVoiceV2.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newSendTextMessage' smart constructor.
data SendTextMessage = SendTextMessage'
  { -- | The name of the configuration set to use. This can be either the
    -- ConfigurationSetName or ConfigurationSetArn.
    SendTextMessage -> Maybe Text
configurationSetName :: Prelude.Maybe Prelude.Text,
    -- | You can specify custom data in this field. If you do, that data is
    -- logged to the event destination.
    SendTextMessage -> Maybe (HashMap Text Text)
context :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | This field is used for any country-specific registration requirements.
    -- Currently, this setting is only used when you send messages to
    -- recipients in India using a sender ID. For more information see
    -- <https://docs.aws.amazon.com/pinpoint/latest/userguide/channels-sms-senderid-india.html Special requirements for sending SMS messages to recipients in India>.
    SendTextMessage
-> Maybe (HashMap DestinationCountryParameterKey Text)
destinationCountryParameters :: Prelude.Maybe (Prelude.HashMap DestinationCountryParameterKey Prelude.Text),
    -- | When set to true, the message is checked and validated, but isn\'t sent
    -- to the end recipient.
    SendTextMessage -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
    -- | When you register a short code in the US, you must specify a program
    -- name. If you don’t have a US short code, omit this attribute.
    SendTextMessage -> Maybe Text
keyword :: Prelude.Maybe Prelude.Text,
    -- | The maximum amount that you want to spend, in US dollars, per each text
    -- message part. A text message can contain multiple parts.
    SendTextMessage -> Maybe Text
maxPrice :: Prelude.Maybe Prelude.Text,
    -- | The body of the text message.
    SendTextMessage -> Maybe Text
messageBody :: Prelude.Maybe Prelude.Text,
    -- | The type of message. Valid values are TRANSACTIONAL for messages that
    -- are critical or time-sensitive and PROMOTIONAL for messages that aren\'t
    -- critical or time-sensitive.
    SendTextMessage -> Maybe MessageType
messageType :: Prelude.Maybe MessageType,
    -- | The origination identity of the message. This can be either the
    -- PhoneNumber, PhoneNumberId, PhoneNumberArn, SenderId, SenderIdArn,
    -- PoolId, or PoolArn.
    SendTextMessage -> Maybe Text
originationIdentity :: Prelude.Maybe Prelude.Text,
    -- | How long the text message is valid for. By default this is 72 hours.
    SendTextMessage -> Maybe Natural
timeToLive :: Prelude.Maybe Prelude.Natural,
    -- | The destination phone number in E.164 format.
    SendTextMessage -> Text
destinationPhoneNumber :: Prelude.Text
  }
  deriving (SendTextMessage -> SendTextMessage -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SendTextMessage -> SendTextMessage -> Bool
$c/= :: SendTextMessage -> SendTextMessage -> Bool
== :: SendTextMessage -> SendTextMessage -> Bool
$c== :: SendTextMessage -> SendTextMessage -> Bool
Prelude.Eq, ReadPrec [SendTextMessage]
ReadPrec SendTextMessage
Int -> ReadS SendTextMessage
ReadS [SendTextMessage]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SendTextMessage]
$creadListPrec :: ReadPrec [SendTextMessage]
readPrec :: ReadPrec SendTextMessage
$creadPrec :: ReadPrec SendTextMessage
readList :: ReadS [SendTextMessage]
$creadList :: ReadS [SendTextMessage]
readsPrec :: Int -> ReadS SendTextMessage
$creadsPrec :: Int -> ReadS SendTextMessage
Prelude.Read, Int -> SendTextMessage -> ShowS
[SendTextMessage] -> ShowS
SendTextMessage -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SendTextMessage] -> ShowS
$cshowList :: [SendTextMessage] -> ShowS
show :: SendTextMessage -> String
$cshow :: SendTextMessage -> String
showsPrec :: Int -> SendTextMessage -> ShowS
$cshowsPrec :: Int -> SendTextMessage -> ShowS
Prelude.Show, forall x. Rep SendTextMessage x -> SendTextMessage
forall x. SendTextMessage -> Rep SendTextMessage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SendTextMessage x -> SendTextMessage
$cfrom :: forall x. SendTextMessage -> Rep SendTextMessage x
Prelude.Generic)

-- |
-- Create a value of 'SendTextMessage' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'configurationSetName', 'sendTextMessage_configurationSetName' - The name of the configuration set to use. This can be either the
-- ConfigurationSetName or ConfigurationSetArn.
--
-- 'context', 'sendTextMessage_context' - You can specify custom data in this field. If you do, that data is
-- logged to the event destination.
--
-- 'destinationCountryParameters', 'sendTextMessage_destinationCountryParameters' - This field is used for any country-specific registration requirements.
-- Currently, this setting is only used when you send messages to
-- recipients in India using a sender ID. For more information see
-- <https://docs.aws.amazon.com/pinpoint/latest/userguide/channels-sms-senderid-india.html Special requirements for sending SMS messages to recipients in India>.
--
-- 'dryRun', 'sendTextMessage_dryRun' - When set to true, the message is checked and validated, but isn\'t sent
-- to the end recipient.
--
-- 'keyword', 'sendTextMessage_keyword' - When you register a short code in the US, you must specify a program
-- name. If you don’t have a US short code, omit this attribute.
--
-- 'maxPrice', 'sendTextMessage_maxPrice' - The maximum amount that you want to spend, in US dollars, per each text
-- message part. A text message can contain multiple parts.
--
-- 'messageBody', 'sendTextMessage_messageBody' - The body of the text message.
--
-- 'messageType', 'sendTextMessage_messageType' - The type of message. Valid values are TRANSACTIONAL for messages that
-- are critical or time-sensitive and PROMOTIONAL for messages that aren\'t
-- critical or time-sensitive.
--
-- 'originationIdentity', 'sendTextMessage_originationIdentity' - The origination identity of the message. This can be either the
-- PhoneNumber, PhoneNumberId, PhoneNumberArn, SenderId, SenderIdArn,
-- PoolId, or PoolArn.
--
-- 'timeToLive', 'sendTextMessage_timeToLive' - How long the text message is valid for. By default this is 72 hours.
--
-- 'destinationPhoneNumber', 'sendTextMessage_destinationPhoneNumber' - The destination phone number in E.164 format.
newSendTextMessage ::
  -- | 'destinationPhoneNumber'
  Prelude.Text ->
  SendTextMessage
newSendTextMessage :: Text -> SendTextMessage
newSendTextMessage Text
pDestinationPhoneNumber_ =
  SendTextMessage'
    { $sel:configurationSetName:SendTextMessage' :: Maybe Text
configurationSetName =
        forall a. Maybe a
Prelude.Nothing,
      $sel:context:SendTextMessage' :: Maybe (HashMap Text Text)
context = forall a. Maybe a
Prelude.Nothing,
      $sel:destinationCountryParameters:SendTextMessage' :: Maybe (HashMap DestinationCountryParameterKey Text)
destinationCountryParameters = forall a. Maybe a
Prelude.Nothing,
      $sel:dryRun:SendTextMessage' :: Maybe Bool
dryRun = forall a. Maybe a
Prelude.Nothing,
      $sel:keyword:SendTextMessage' :: Maybe Text
keyword = forall a. Maybe a
Prelude.Nothing,
      $sel:maxPrice:SendTextMessage' :: Maybe Text
maxPrice = forall a. Maybe a
Prelude.Nothing,
      $sel:messageBody:SendTextMessage' :: Maybe Text
messageBody = forall a. Maybe a
Prelude.Nothing,
      $sel:messageType:SendTextMessage' :: Maybe MessageType
messageType = forall a. Maybe a
Prelude.Nothing,
      $sel:originationIdentity:SendTextMessage' :: Maybe Text
originationIdentity = forall a. Maybe a
Prelude.Nothing,
      $sel:timeToLive:SendTextMessage' :: Maybe Natural
timeToLive = forall a. Maybe a
Prelude.Nothing,
      $sel:destinationPhoneNumber:SendTextMessage' :: Text
destinationPhoneNumber = Text
pDestinationPhoneNumber_
    }

-- | The name of the configuration set to use. This can be either the
-- ConfigurationSetName or ConfigurationSetArn.
sendTextMessage_configurationSetName :: Lens.Lens' SendTextMessage (Prelude.Maybe Prelude.Text)
sendTextMessage_configurationSetName :: Lens' SendTextMessage (Maybe Text)
sendTextMessage_configurationSetName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendTextMessage' {Maybe Text
configurationSetName :: Maybe Text
$sel:configurationSetName:SendTextMessage' :: SendTextMessage -> Maybe Text
configurationSetName} -> Maybe Text
configurationSetName) (\s :: SendTextMessage
s@SendTextMessage' {} Maybe Text
a -> SendTextMessage
s {$sel:configurationSetName:SendTextMessage' :: Maybe Text
configurationSetName = Maybe Text
a} :: SendTextMessage)

-- | You can specify custom data in this field. If you do, that data is
-- logged to the event destination.
sendTextMessage_context :: Lens.Lens' SendTextMessage (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
sendTextMessage_context :: Lens' SendTextMessage (Maybe (HashMap Text Text))
sendTextMessage_context = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendTextMessage' {Maybe (HashMap Text Text)
context :: Maybe (HashMap Text Text)
$sel:context:SendTextMessage' :: SendTextMessage -> Maybe (HashMap Text Text)
context} -> Maybe (HashMap Text Text)
context) (\s :: SendTextMessage
s@SendTextMessage' {} Maybe (HashMap Text Text)
a -> SendTextMessage
s {$sel:context:SendTextMessage' :: Maybe (HashMap Text Text)
context = Maybe (HashMap Text Text)
a} :: SendTextMessage) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | This field is used for any country-specific registration requirements.
-- Currently, this setting is only used when you send messages to
-- recipients in India using a sender ID. For more information see
-- <https://docs.aws.amazon.com/pinpoint/latest/userguide/channels-sms-senderid-india.html Special requirements for sending SMS messages to recipients in India>.
sendTextMessage_destinationCountryParameters :: Lens.Lens' SendTextMessage (Prelude.Maybe (Prelude.HashMap DestinationCountryParameterKey Prelude.Text))
sendTextMessage_destinationCountryParameters :: Lens'
  SendTextMessage
  (Maybe (HashMap DestinationCountryParameterKey Text))
sendTextMessage_destinationCountryParameters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendTextMessage' {Maybe (HashMap DestinationCountryParameterKey Text)
destinationCountryParameters :: Maybe (HashMap DestinationCountryParameterKey Text)
$sel:destinationCountryParameters:SendTextMessage' :: SendTextMessage
-> Maybe (HashMap DestinationCountryParameterKey Text)
destinationCountryParameters} -> Maybe (HashMap DestinationCountryParameterKey Text)
destinationCountryParameters) (\s :: SendTextMessage
s@SendTextMessage' {} Maybe (HashMap DestinationCountryParameterKey Text)
a -> SendTextMessage
s {$sel:destinationCountryParameters:SendTextMessage' :: Maybe (HashMap DestinationCountryParameterKey Text)
destinationCountryParameters = Maybe (HashMap DestinationCountryParameterKey Text)
a} :: SendTextMessage) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | When set to true, the message is checked and validated, but isn\'t sent
-- to the end recipient.
sendTextMessage_dryRun :: Lens.Lens' SendTextMessage (Prelude.Maybe Prelude.Bool)
sendTextMessage_dryRun :: Lens' SendTextMessage (Maybe Bool)
sendTextMessage_dryRun = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendTextMessage' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:SendTextMessage' :: SendTextMessage -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: SendTextMessage
s@SendTextMessage' {} Maybe Bool
a -> SendTextMessage
s {$sel:dryRun:SendTextMessage' :: Maybe Bool
dryRun = Maybe Bool
a} :: SendTextMessage)

-- | When you register a short code in the US, you must specify a program
-- name. If you don’t have a US short code, omit this attribute.
sendTextMessage_keyword :: Lens.Lens' SendTextMessage (Prelude.Maybe Prelude.Text)
sendTextMessage_keyword :: Lens' SendTextMessage (Maybe Text)
sendTextMessage_keyword = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendTextMessage' {Maybe Text
keyword :: Maybe Text
$sel:keyword:SendTextMessage' :: SendTextMessage -> Maybe Text
keyword} -> Maybe Text
keyword) (\s :: SendTextMessage
s@SendTextMessage' {} Maybe Text
a -> SendTextMessage
s {$sel:keyword:SendTextMessage' :: Maybe Text
keyword = Maybe Text
a} :: SendTextMessage)

-- | The maximum amount that you want to spend, in US dollars, per each text
-- message part. A text message can contain multiple parts.
sendTextMessage_maxPrice :: Lens.Lens' SendTextMessage (Prelude.Maybe Prelude.Text)
sendTextMessage_maxPrice :: Lens' SendTextMessage (Maybe Text)
sendTextMessage_maxPrice = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendTextMessage' {Maybe Text
maxPrice :: Maybe Text
$sel:maxPrice:SendTextMessage' :: SendTextMessage -> Maybe Text
maxPrice} -> Maybe Text
maxPrice) (\s :: SendTextMessage
s@SendTextMessage' {} Maybe Text
a -> SendTextMessage
s {$sel:maxPrice:SendTextMessage' :: Maybe Text
maxPrice = Maybe Text
a} :: SendTextMessage)

-- | The body of the text message.
sendTextMessage_messageBody :: Lens.Lens' SendTextMessage (Prelude.Maybe Prelude.Text)
sendTextMessage_messageBody :: Lens' SendTextMessage (Maybe Text)
sendTextMessage_messageBody = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendTextMessage' {Maybe Text
messageBody :: Maybe Text
$sel:messageBody:SendTextMessage' :: SendTextMessage -> Maybe Text
messageBody} -> Maybe Text
messageBody) (\s :: SendTextMessage
s@SendTextMessage' {} Maybe Text
a -> SendTextMessage
s {$sel:messageBody:SendTextMessage' :: Maybe Text
messageBody = Maybe Text
a} :: SendTextMessage)

-- | The type of message. Valid values are TRANSACTIONAL for messages that
-- are critical or time-sensitive and PROMOTIONAL for messages that aren\'t
-- critical or time-sensitive.
sendTextMessage_messageType :: Lens.Lens' SendTextMessage (Prelude.Maybe MessageType)
sendTextMessage_messageType :: Lens' SendTextMessage (Maybe MessageType)
sendTextMessage_messageType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendTextMessage' {Maybe MessageType
messageType :: Maybe MessageType
$sel:messageType:SendTextMessage' :: SendTextMessage -> Maybe MessageType
messageType} -> Maybe MessageType
messageType) (\s :: SendTextMessage
s@SendTextMessage' {} Maybe MessageType
a -> SendTextMessage
s {$sel:messageType:SendTextMessage' :: Maybe MessageType
messageType = Maybe MessageType
a} :: SendTextMessage)

-- | The origination identity of the message. This can be either the
-- PhoneNumber, PhoneNumberId, PhoneNumberArn, SenderId, SenderIdArn,
-- PoolId, or PoolArn.
sendTextMessage_originationIdentity :: Lens.Lens' SendTextMessage (Prelude.Maybe Prelude.Text)
sendTextMessage_originationIdentity :: Lens' SendTextMessage (Maybe Text)
sendTextMessage_originationIdentity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendTextMessage' {Maybe Text
originationIdentity :: Maybe Text
$sel:originationIdentity:SendTextMessage' :: SendTextMessage -> Maybe Text
originationIdentity} -> Maybe Text
originationIdentity) (\s :: SendTextMessage
s@SendTextMessage' {} Maybe Text
a -> SendTextMessage
s {$sel:originationIdentity:SendTextMessage' :: Maybe Text
originationIdentity = Maybe Text
a} :: SendTextMessage)

-- | How long the text message is valid for. By default this is 72 hours.
sendTextMessage_timeToLive :: Lens.Lens' SendTextMessage (Prelude.Maybe Prelude.Natural)
sendTextMessage_timeToLive :: Lens' SendTextMessage (Maybe Natural)
sendTextMessage_timeToLive = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendTextMessage' {Maybe Natural
timeToLive :: Maybe Natural
$sel:timeToLive:SendTextMessage' :: SendTextMessage -> Maybe Natural
timeToLive} -> Maybe Natural
timeToLive) (\s :: SendTextMessage
s@SendTextMessage' {} Maybe Natural
a -> SendTextMessage
s {$sel:timeToLive:SendTextMessage' :: Maybe Natural
timeToLive = Maybe Natural
a} :: SendTextMessage)

-- | The destination phone number in E.164 format.
sendTextMessage_destinationPhoneNumber :: Lens.Lens' SendTextMessage Prelude.Text
sendTextMessage_destinationPhoneNumber :: Lens' SendTextMessage Text
sendTextMessage_destinationPhoneNumber = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendTextMessage' {Text
destinationPhoneNumber :: Text
$sel:destinationPhoneNumber:SendTextMessage' :: SendTextMessage -> Text
destinationPhoneNumber} -> Text
destinationPhoneNumber) (\s :: SendTextMessage
s@SendTextMessage' {} Text
a -> SendTextMessage
s {$sel:destinationPhoneNumber:SendTextMessage' :: Text
destinationPhoneNumber = Text
a} :: SendTextMessage)

instance Core.AWSRequest SendTextMessage where
  type
    AWSResponse SendTextMessage =
      SendTextMessageResponse
  request :: (Service -> Service) -> SendTextMessage -> Request SendTextMessage
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 SendTextMessage
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SendTextMessage)))
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 -> SendTextMessageResponse
SendTextMessageResponse'
            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 SendTextMessage where
  hashWithSalt :: Int -> SendTextMessage -> Int
hashWithSalt Int
_salt SendTextMessage' {Maybe Bool
Maybe Natural
Maybe Text
Maybe (HashMap Text Text)
Maybe (HashMap DestinationCountryParameterKey Text)
Maybe MessageType
Text
destinationPhoneNumber :: Text
timeToLive :: Maybe Natural
originationIdentity :: Maybe Text
messageType :: Maybe MessageType
messageBody :: Maybe Text
maxPrice :: Maybe Text
keyword :: Maybe Text
dryRun :: Maybe Bool
destinationCountryParameters :: Maybe (HashMap DestinationCountryParameterKey Text)
context :: Maybe (HashMap Text Text)
configurationSetName :: Maybe Text
$sel:destinationPhoneNumber:SendTextMessage' :: SendTextMessage -> Text
$sel:timeToLive:SendTextMessage' :: SendTextMessage -> Maybe Natural
$sel:originationIdentity:SendTextMessage' :: SendTextMessage -> Maybe Text
$sel:messageType:SendTextMessage' :: SendTextMessage -> Maybe MessageType
$sel:messageBody:SendTextMessage' :: SendTextMessage -> Maybe Text
$sel:maxPrice:SendTextMessage' :: SendTextMessage -> Maybe Text
$sel:keyword:SendTextMessage' :: SendTextMessage -> Maybe Text
$sel:dryRun:SendTextMessage' :: SendTextMessage -> Maybe Bool
$sel:destinationCountryParameters:SendTextMessage' :: SendTextMessage
-> Maybe (HashMap DestinationCountryParameterKey Text)
$sel:context:SendTextMessage' :: SendTextMessage -> Maybe (HashMap Text Text)
$sel:configurationSetName:SendTextMessage' :: SendTextMessage -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
configurationSetName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
context
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap DestinationCountryParameterKey Text)
destinationCountryParameters
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
dryRun
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
keyword
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
maxPrice
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
messageBody
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MessageType
messageType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
originationIdentity
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
timeToLive
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
destinationPhoneNumber

instance Prelude.NFData SendTextMessage where
  rnf :: SendTextMessage -> ()
rnf SendTextMessage' {Maybe Bool
Maybe Natural
Maybe Text
Maybe (HashMap Text Text)
Maybe (HashMap DestinationCountryParameterKey Text)
Maybe MessageType
Text
destinationPhoneNumber :: Text
timeToLive :: Maybe Natural
originationIdentity :: Maybe Text
messageType :: Maybe MessageType
messageBody :: Maybe Text
maxPrice :: Maybe Text
keyword :: Maybe Text
dryRun :: Maybe Bool
destinationCountryParameters :: Maybe (HashMap DestinationCountryParameterKey Text)
context :: Maybe (HashMap Text Text)
configurationSetName :: Maybe Text
$sel:destinationPhoneNumber:SendTextMessage' :: SendTextMessage -> Text
$sel:timeToLive:SendTextMessage' :: SendTextMessage -> Maybe Natural
$sel:originationIdentity:SendTextMessage' :: SendTextMessage -> Maybe Text
$sel:messageType:SendTextMessage' :: SendTextMessage -> Maybe MessageType
$sel:messageBody:SendTextMessage' :: SendTextMessage -> Maybe Text
$sel:maxPrice:SendTextMessage' :: SendTextMessage -> Maybe Text
$sel:keyword:SendTextMessage' :: SendTextMessage -> Maybe Text
$sel:dryRun:SendTextMessage' :: SendTextMessage -> Maybe Bool
$sel:destinationCountryParameters:SendTextMessage' :: SendTextMessage
-> Maybe (HashMap DestinationCountryParameterKey Text)
$sel:context:SendTextMessage' :: SendTextMessage -> Maybe (HashMap Text Text)
$sel:configurationSetName:SendTextMessage' :: SendTextMessage -> Maybe Text
..} =
    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 (HashMap Text Text)
context
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap DestinationCountryParameterKey Text)
destinationCountryParameters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
dryRun
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
keyword
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
maxPrice
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
messageBody
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe MessageType
messageType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
originationIdentity
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
timeToLive
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
destinationPhoneNumber

instance Data.ToHeaders SendTextMessage where
  toHeaders :: SendTextMessage -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"PinpointSMSVoiceV2.SendTextMessage" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON SendTextMessage where
  toJSON :: SendTextMessage -> Value
toJSON SendTextMessage' {Maybe Bool
Maybe Natural
Maybe Text
Maybe (HashMap Text Text)
Maybe (HashMap DestinationCountryParameterKey Text)
Maybe MessageType
Text
destinationPhoneNumber :: Text
timeToLive :: Maybe Natural
originationIdentity :: Maybe Text
messageType :: Maybe MessageType
messageBody :: Maybe Text
maxPrice :: Maybe Text
keyword :: Maybe Text
dryRun :: Maybe Bool
destinationCountryParameters :: Maybe (HashMap DestinationCountryParameterKey Text)
context :: Maybe (HashMap Text Text)
configurationSetName :: Maybe Text
$sel:destinationPhoneNumber:SendTextMessage' :: SendTextMessage -> Text
$sel:timeToLive:SendTextMessage' :: SendTextMessage -> Maybe Natural
$sel:originationIdentity:SendTextMessage' :: SendTextMessage -> Maybe Text
$sel:messageType:SendTextMessage' :: SendTextMessage -> Maybe MessageType
$sel:messageBody:SendTextMessage' :: SendTextMessage -> Maybe Text
$sel:maxPrice:SendTextMessage' :: SendTextMessage -> Maybe Text
$sel:keyword:SendTextMessage' :: SendTextMessage -> Maybe Text
$sel:dryRun:SendTextMessage' :: SendTextMessage -> Maybe Bool
$sel:destinationCountryParameters:SendTextMessage' :: SendTextMessage
-> Maybe (HashMap DestinationCountryParameterKey Text)
$sel:context:SendTextMessage' :: SendTextMessage -> Maybe (HashMap Text Text)
$sel:configurationSetName:SendTextMessage' :: SendTextMessage -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (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
"Context" 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 (HashMap Text Text)
context,
            (Key
"DestinationCountryParameters" 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 (HashMap DestinationCountryParameterKey Text)
destinationCountryParameters,
            (Key
"DryRun" 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 Bool
dryRun,
            (Key
"Keyword" 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
keyword,
            (Key
"MaxPrice" 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
maxPrice,
            (Key
"MessageBody" 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
messageBody,
            (Key
"MessageType" 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 MessageType
messageType,
            (Key
"OriginationIdentity" 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
originationIdentity,
            (Key
"TimeToLive" 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 Natural
timeToLive,
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"DestinationPhoneNumber"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
destinationPhoneNumber
              )
          ]
      )

instance Data.ToPath SendTextMessage where
  toPath :: SendTextMessage -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery SendTextMessage where
  toQuery :: SendTextMessage -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newSendTextMessageResponse' smart constructor.
data SendTextMessageResponse = SendTextMessageResponse'
  { -- | The unique identifier for the message.
    SendTextMessageResponse -> Maybe Text
messageId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    SendTextMessageResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (SendTextMessageResponse -> SendTextMessageResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SendTextMessageResponse -> SendTextMessageResponse -> Bool
$c/= :: SendTextMessageResponse -> SendTextMessageResponse -> Bool
== :: SendTextMessageResponse -> SendTextMessageResponse -> Bool
$c== :: SendTextMessageResponse -> SendTextMessageResponse -> Bool
Prelude.Eq, ReadPrec [SendTextMessageResponse]
ReadPrec SendTextMessageResponse
Int -> ReadS SendTextMessageResponse
ReadS [SendTextMessageResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SendTextMessageResponse]
$creadListPrec :: ReadPrec [SendTextMessageResponse]
readPrec :: ReadPrec SendTextMessageResponse
$creadPrec :: ReadPrec SendTextMessageResponse
readList :: ReadS [SendTextMessageResponse]
$creadList :: ReadS [SendTextMessageResponse]
readsPrec :: Int -> ReadS SendTextMessageResponse
$creadsPrec :: Int -> ReadS SendTextMessageResponse
Prelude.Read, Int -> SendTextMessageResponse -> ShowS
[SendTextMessageResponse] -> ShowS
SendTextMessageResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SendTextMessageResponse] -> ShowS
$cshowList :: [SendTextMessageResponse] -> ShowS
show :: SendTextMessageResponse -> String
$cshow :: SendTextMessageResponse -> String
showsPrec :: Int -> SendTextMessageResponse -> ShowS
$cshowsPrec :: Int -> SendTextMessageResponse -> ShowS
Prelude.Show, forall x. Rep SendTextMessageResponse x -> SendTextMessageResponse
forall x. SendTextMessageResponse -> Rep SendTextMessageResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SendTextMessageResponse x -> SendTextMessageResponse
$cfrom :: forall x. SendTextMessageResponse -> Rep SendTextMessageResponse x
Prelude.Generic)

-- |
-- Create a value of 'SendTextMessageResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'messageId', 'sendTextMessageResponse_messageId' - The unique identifier for the message.
--
-- 'httpStatus', 'sendTextMessageResponse_httpStatus' - The response's http status code.
newSendTextMessageResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  SendTextMessageResponse
newSendTextMessageResponse :: Int -> SendTextMessageResponse
newSendTextMessageResponse Int
pHttpStatus_ =
  SendTextMessageResponse'
    { $sel:messageId:SendTextMessageResponse' :: Maybe Text
messageId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:SendTextMessageResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The unique identifier for the message.
sendTextMessageResponse_messageId :: Lens.Lens' SendTextMessageResponse (Prelude.Maybe Prelude.Text)
sendTextMessageResponse_messageId :: Lens' SendTextMessageResponse (Maybe Text)
sendTextMessageResponse_messageId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendTextMessageResponse' {Maybe Text
messageId :: Maybe Text
$sel:messageId:SendTextMessageResponse' :: SendTextMessageResponse -> Maybe Text
messageId} -> Maybe Text
messageId) (\s :: SendTextMessageResponse
s@SendTextMessageResponse' {} Maybe Text
a -> SendTextMessageResponse
s {$sel:messageId:SendTextMessageResponse' :: Maybe Text
messageId = Maybe Text
a} :: SendTextMessageResponse)

-- | The response's http status code.
sendTextMessageResponse_httpStatus :: Lens.Lens' SendTextMessageResponse Prelude.Int
sendTextMessageResponse_httpStatus :: Lens' SendTextMessageResponse Int
sendTextMessageResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendTextMessageResponse' {Int
httpStatus :: Int
$sel:httpStatus:SendTextMessageResponse' :: SendTextMessageResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: SendTextMessageResponse
s@SendTextMessageResponse' {} Int
a -> SendTextMessageResponse
s {$sel:httpStatus:SendTextMessageResponse' :: Int
httpStatus = Int
a} :: SendTextMessageResponse)

instance Prelude.NFData SendTextMessageResponse where
  rnf :: SendTextMessageResponse -> ()
rnf SendTextMessageResponse' {Int
Maybe Text
httpStatus :: Int
messageId :: Maybe Text
$sel:httpStatus:SendTextMessageResponse' :: SendTextMessageResponse -> Int
$sel:messageId:SendTextMessageResponse' :: SendTextMessageResponse -> 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