{-# 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.SNS.OptInPhoneNumber
(
OptInPhoneNumber (..),
newOptInPhoneNumber,
optInPhoneNumber_phoneNumber,
OptInPhoneNumberResponse (..),
newOptInPhoneNumberResponse,
optInPhoneNumberResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SNS.Types
data OptInPhoneNumber = OptInPhoneNumber'
{
OptInPhoneNumber -> Text
phoneNumber :: Prelude.Text
}
deriving (OptInPhoneNumber -> OptInPhoneNumber -> Bool
(OptInPhoneNumber -> OptInPhoneNumber -> Bool)
-> (OptInPhoneNumber -> OptInPhoneNumber -> Bool)
-> Eq OptInPhoneNumber
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OptInPhoneNumber -> OptInPhoneNumber -> Bool
$c/= :: OptInPhoneNumber -> OptInPhoneNumber -> Bool
== :: OptInPhoneNumber -> OptInPhoneNumber -> Bool
$c== :: OptInPhoneNumber -> OptInPhoneNumber -> Bool
Prelude.Eq, ReadPrec [OptInPhoneNumber]
ReadPrec OptInPhoneNumber
Int -> ReadS OptInPhoneNumber
ReadS [OptInPhoneNumber]
(Int -> ReadS OptInPhoneNumber)
-> ReadS [OptInPhoneNumber]
-> ReadPrec OptInPhoneNumber
-> ReadPrec [OptInPhoneNumber]
-> Read OptInPhoneNumber
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OptInPhoneNumber]
$creadListPrec :: ReadPrec [OptInPhoneNumber]
readPrec :: ReadPrec OptInPhoneNumber
$creadPrec :: ReadPrec OptInPhoneNumber
readList :: ReadS [OptInPhoneNumber]
$creadList :: ReadS [OptInPhoneNumber]
readsPrec :: Int -> ReadS OptInPhoneNumber
$creadsPrec :: Int -> ReadS OptInPhoneNumber
Prelude.Read, Int -> OptInPhoneNumber -> ShowS
[OptInPhoneNumber] -> ShowS
OptInPhoneNumber -> String
(Int -> OptInPhoneNumber -> ShowS)
-> (OptInPhoneNumber -> String)
-> ([OptInPhoneNumber] -> ShowS)
-> Show OptInPhoneNumber
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OptInPhoneNumber] -> ShowS
$cshowList :: [OptInPhoneNumber] -> ShowS
show :: OptInPhoneNumber -> String
$cshow :: OptInPhoneNumber -> String
showsPrec :: Int -> OptInPhoneNumber -> ShowS
$cshowsPrec :: Int -> OptInPhoneNumber -> ShowS
Prelude.Show, (forall x. OptInPhoneNumber -> Rep OptInPhoneNumber x)
-> (forall x. Rep OptInPhoneNumber x -> OptInPhoneNumber)
-> Generic OptInPhoneNumber
forall x. Rep OptInPhoneNumber x -> OptInPhoneNumber
forall x. OptInPhoneNumber -> Rep OptInPhoneNumber x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OptInPhoneNumber x -> OptInPhoneNumber
$cfrom :: forall x. OptInPhoneNumber -> Rep OptInPhoneNumber x
Prelude.Generic)
newOptInPhoneNumber ::
Prelude.Text ->
OptInPhoneNumber
newOptInPhoneNumber :: Text -> OptInPhoneNumber
newOptInPhoneNumber Text
pPhoneNumber_ =
OptInPhoneNumber' :: Text -> OptInPhoneNumber
OptInPhoneNumber' {$sel:phoneNumber:OptInPhoneNumber' :: Text
phoneNumber = Text
pPhoneNumber_}
optInPhoneNumber_phoneNumber :: Lens.Lens' OptInPhoneNumber Prelude.Text
optInPhoneNumber_phoneNumber :: (Text -> f Text) -> OptInPhoneNumber -> f OptInPhoneNumber
optInPhoneNumber_phoneNumber = (OptInPhoneNumber -> Text)
-> (OptInPhoneNumber -> Text -> OptInPhoneNumber)
-> Lens OptInPhoneNumber OptInPhoneNumber Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OptInPhoneNumber' {Text
phoneNumber :: Text
$sel:phoneNumber:OptInPhoneNumber' :: OptInPhoneNumber -> Text
phoneNumber} -> Text
phoneNumber) (\s :: OptInPhoneNumber
s@OptInPhoneNumber' {} Text
a -> OptInPhoneNumber
s {$sel:phoneNumber:OptInPhoneNumber' :: Text
phoneNumber = Text
a} :: OptInPhoneNumber)
instance Core.AWSRequest OptInPhoneNumber where
type
AWSResponse OptInPhoneNumber =
OptInPhoneNumberResponse
request :: OptInPhoneNumber -> Request OptInPhoneNumber
request = Service -> OptInPhoneNumber -> Request OptInPhoneNumber
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy OptInPhoneNumber
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse OptInPhoneNumber)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse OptInPhoneNumber))
-> Logger
-> Service
-> Proxy OptInPhoneNumber
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse OptInPhoneNumber)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"OptInPhoneNumberResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Int -> OptInPhoneNumberResponse
OptInPhoneNumberResponse'
(Int -> OptInPhoneNumberResponse)
-> Either String Int -> Either String OptInPhoneNumberResponse
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))
)
instance Prelude.Hashable OptInPhoneNumber
instance Prelude.NFData OptInPhoneNumber
instance Core.ToHeaders OptInPhoneNumber where
toHeaders :: OptInPhoneNumber -> ResponseHeaders
toHeaders = ResponseHeaders -> OptInPhoneNumber -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath OptInPhoneNumber where
toPath :: OptInPhoneNumber -> ByteString
toPath = ByteString -> OptInPhoneNumber -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery OptInPhoneNumber where
toQuery :: OptInPhoneNumber -> QueryString
toQuery OptInPhoneNumber' {Text
phoneNumber :: Text
$sel:phoneNumber:OptInPhoneNumber' :: OptInPhoneNumber -> Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"OptInPhoneNumber" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-03-31" :: Prelude.ByteString),
ByteString
"phoneNumber" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
phoneNumber
]
data OptInPhoneNumberResponse = OptInPhoneNumberResponse'
{
OptInPhoneNumberResponse -> Int
httpStatus :: Prelude.Int
}
deriving (OptInPhoneNumberResponse -> OptInPhoneNumberResponse -> Bool
(OptInPhoneNumberResponse -> OptInPhoneNumberResponse -> Bool)
-> (OptInPhoneNumberResponse -> OptInPhoneNumberResponse -> Bool)
-> Eq OptInPhoneNumberResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OptInPhoneNumberResponse -> OptInPhoneNumberResponse -> Bool
$c/= :: OptInPhoneNumberResponse -> OptInPhoneNumberResponse -> Bool
== :: OptInPhoneNumberResponse -> OptInPhoneNumberResponse -> Bool
$c== :: OptInPhoneNumberResponse -> OptInPhoneNumberResponse -> Bool
Prelude.Eq, ReadPrec [OptInPhoneNumberResponse]
ReadPrec OptInPhoneNumberResponse
Int -> ReadS OptInPhoneNumberResponse
ReadS [OptInPhoneNumberResponse]
(Int -> ReadS OptInPhoneNumberResponse)
-> ReadS [OptInPhoneNumberResponse]
-> ReadPrec OptInPhoneNumberResponse
-> ReadPrec [OptInPhoneNumberResponse]
-> Read OptInPhoneNumberResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OptInPhoneNumberResponse]
$creadListPrec :: ReadPrec [OptInPhoneNumberResponse]
readPrec :: ReadPrec OptInPhoneNumberResponse
$creadPrec :: ReadPrec OptInPhoneNumberResponse
readList :: ReadS [OptInPhoneNumberResponse]
$creadList :: ReadS [OptInPhoneNumberResponse]
readsPrec :: Int -> ReadS OptInPhoneNumberResponse
$creadsPrec :: Int -> ReadS OptInPhoneNumberResponse
Prelude.Read, Int -> OptInPhoneNumberResponse -> ShowS
[OptInPhoneNumberResponse] -> ShowS
OptInPhoneNumberResponse -> String
(Int -> OptInPhoneNumberResponse -> ShowS)
-> (OptInPhoneNumberResponse -> String)
-> ([OptInPhoneNumberResponse] -> ShowS)
-> Show OptInPhoneNumberResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OptInPhoneNumberResponse] -> ShowS
$cshowList :: [OptInPhoneNumberResponse] -> ShowS
show :: OptInPhoneNumberResponse -> String
$cshow :: OptInPhoneNumberResponse -> String
showsPrec :: Int -> OptInPhoneNumberResponse -> ShowS
$cshowsPrec :: Int -> OptInPhoneNumberResponse -> ShowS
Prelude.Show, (forall x.
OptInPhoneNumberResponse -> Rep OptInPhoneNumberResponse x)
-> (forall x.
Rep OptInPhoneNumberResponse x -> OptInPhoneNumberResponse)
-> Generic OptInPhoneNumberResponse
forall x.
Rep OptInPhoneNumberResponse x -> OptInPhoneNumberResponse
forall x.
OptInPhoneNumberResponse -> Rep OptInPhoneNumberResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep OptInPhoneNumberResponse x -> OptInPhoneNumberResponse
$cfrom :: forall x.
OptInPhoneNumberResponse -> Rep OptInPhoneNumberResponse x
Prelude.Generic)
newOptInPhoneNumberResponse ::
Prelude.Int ->
OptInPhoneNumberResponse
newOptInPhoneNumberResponse :: Int -> OptInPhoneNumberResponse
newOptInPhoneNumberResponse Int
pHttpStatus_ =
OptInPhoneNumberResponse' :: Int -> OptInPhoneNumberResponse
OptInPhoneNumberResponse'
{ $sel:httpStatus:OptInPhoneNumberResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
optInPhoneNumberResponse_httpStatus :: Lens.Lens' OptInPhoneNumberResponse Prelude.Int
optInPhoneNumberResponse_httpStatus :: (Int -> f Int)
-> OptInPhoneNumberResponse -> f OptInPhoneNumberResponse
optInPhoneNumberResponse_httpStatus = (OptInPhoneNumberResponse -> Int)
-> (OptInPhoneNumberResponse -> Int -> OptInPhoneNumberResponse)
-> Lens OptInPhoneNumberResponse OptInPhoneNumberResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OptInPhoneNumberResponse' {Int
httpStatus :: Int
$sel:httpStatus:OptInPhoneNumberResponse' :: OptInPhoneNumberResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: OptInPhoneNumberResponse
s@OptInPhoneNumberResponse' {} Int
a -> OptInPhoneNumberResponse
s {$sel:httpStatus:OptInPhoneNumberResponse' :: Int
httpStatus = Int
a} :: OptInPhoneNumberResponse)
instance Prelude.NFData OptInPhoneNumberResponse