{-# 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.GetInAppMessages
(
GetInAppMessages (..),
newGetInAppMessages,
getInAppMessages_applicationId,
getInAppMessages_endpointId,
GetInAppMessagesResponse (..),
newGetInAppMessagesResponse,
getInAppMessagesResponse_httpStatus,
getInAppMessagesResponse_inAppMessagesResponse,
)
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 GetInAppMessages = GetInAppMessages'
{
GetInAppMessages -> Text
applicationId :: Prelude.Text,
GetInAppMessages -> Text
endpointId :: Prelude.Text
}
deriving (GetInAppMessages -> GetInAppMessages -> Bool
(GetInAppMessages -> GetInAppMessages -> Bool)
-> (GetInAppMessages -> GetInAppMessages -> Bool)
-> Eq GetInAppMessages
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetInAppMessages -> GetInAppMessages -> Bool
$c/= :: GetInAppMessages -> GetInAppMessages -> Bool
== :: GetInAppMessages -> GetInAppMessages -> Bool
$c== :: GetInAppMessages -> GetInAppMessages -> Bool
Prelude.Eq, ReadPrec [GetInAppMessages]
ReadPrec GetInAppMessages
Int -> ReadS GetInAppMessages
ReadS [GetInAppMessages]
(Int -> ReadS GetInAppMessages)
-> ReadS [GetInAppMessages]
-> ReadPrec GetInAppMessages
-> ReadPrec [GetInAppMessages]
-> Read GetInAppMessages
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetInAppMessages]
$creadListPrec :: ReadPrec [GetInAppMessages]
readPrec :: ReadPrec GetInAppMessages
$creadPrec :: ReadPrec GetInAppMessages
readList :: ReadS [GetInAppMessages]
$creadList :: ReadS [GetInAppMessages]
readsPrec :: Int -> ReadS GetInAppMessages
$creadsPrec :: Int -> ReadS GetInAppMessages
Prelude.Read, Int -> GetInAppMessages -> ShowS
[GetInAppMessages] -> ShowS
GetInAppMessages -> String
(Int -> GetInAppMessages -> ShowS)
-> (GetInAppMessages -> String)
-> ([GetInAppMessages] -> ShowS)
-> Show GetInAppMessages
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetInAppMessages] -> ShowS
$cshowList :: [GetInAppMessages] -> ShowS
show :: GetInAppMessages -> String
$cshow :: GetInAppMessages -> String
showsPrec :: Int -> GetInAppMessages -> ShowS
$cshowsPrec :: Int -> GetInAppMessages -> ShowS
Prelude.Show, (forall x. GetInAppMessages -> Rep GetInAppMessages x)
-> (forall x. Rep GetInAppMessages x -> GetInAppMessages)
-> Generic GetInAppMessages
forall x. Rep GetInAppMessages x -> GetInAppMessages
forall x. GetInAppMessages -> Rep GetInAppMessages x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetInAppMessages x -> GetInAppMessages
$cfrom :: forall x. GetInAppMessages -> Rep GetInAppMessages x
Prelude.Generic)
newGetInAppMessages ::
Prelude.Text ->
Prelude.Text ->
GetInAppMessages
newGetInAppMessages :: Text -> Text -> GetInAppMessages
newGetInAppMessages Text
pApplicationId_ Text
pEndpointId_ =
GetInAppMessages' :: Text -> Text -> GetInAppMessages
GetInAppMessages'
{ $sel:applicationId:GetInAppMessages' :: Text
applicationId = Text
pApplicationId_,
$sel:endpointId:GetInAppMessages' :: Text
endpointId = Text
pEndpointId_
}
getInAppMessages_applicationId :: Lens.Lens' GetInAppMessages Prelude.Text
getInAppMessages_applicationId :: (Text -> f Text) -> GetInAppMessages -> f GetInAppMessages
getInAppMessages_applicationId = (GetInAppMessages -> Text)
-> (GetInAppMessages -> Text -> GetInAppMessages)
-> Lens GetInAppMessages GetInAppMessages Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInAppMessages' {Text
applicationId :: Text
$sel:applicationId:GetInAppMessages' :: GetInAppMessages -> Text
applicationId} -> Text
applicationId) (\s :: GetInAppMessages
s@GetInAppMessages' {} Text
a -> GetInAppMessages
s {$sel:applicationId:GetInAppMessages' :: Text
applicationId = Text
a} :: GetInAppMessages)
getInAppMessages_endpointId :: Lens.Lens' GetInAppMessages Prelude.Text
getInAppMessages_endpointId :: (Text -> f Text) -> GetInAppMessages -> f GetInAppMessages
getInAppMessages_endpointId = (GetInAppMessages -> Text)
-> (GetInAppMessages -> Text -> GetInAppMessages)
-> Lens GetInAppMessages GetInAppMessages Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInAppMessages' {Text
endpointId :: Text
$sel:endpointId:GetInAppMessages' :: GetInAppMessages -> Text
endpointId} -> Text
endpointId) (\s :: GetInAppMessages
s@GetInAppMessages' {} Text
a -> GetInAppMessages
s {$sel:endpointId:GetInAppMessages' :: Text
endpointId = Text
a} :: GetInAppMessages)
instance Core.AWSRequest GetInAppMessages where
type
AWSResponse GetInAppMessages =
GetInAppMessagesResponse
request :: GetInAppMessages -> Request GetInAppMessages
request = Service -> GetInAppMessages -> Request GetInAppMessages
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetInAppMessages
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetInAppMessages)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetInAppMessages))
-> Logger
-> Service
-> Proxy GetInAppMessages
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetInAppMessages)))
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 -> InAppMessagesResponse -> GetInAppMessagesResponse
GetInAppMessagesResponse'
(Int -> InAppMessagesResponse -> GetInAppMessagesResponse)
-> Either String Int
-> Either
String (InAppMessagesResponse -> GetInAppMessagesResponse)
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 (InAppMessagesResponse -> GetInAppMessagesResponse)
-> Either String InAppMessagesResponse
-> Either String GetInAppMessagesResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object -> Either String InAppMessagesResponse
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
)
instance Prelude.Hashable GetInAppMessages
instance Prelude.NFData GetInAppMessages
instance Core.ToHeaders GetInAppMessages where
toHeaders :: GetInAppMessages -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetInAppMessages -> 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 GetInAppMessages where
toPath :: GetInAppMessages -> ByteString
toPath GetInAppMessages' {Text
endpointId :: Text
applicationId :: Text
$sel:endpointId:GetInAppMessages' :: GetInAppMessages -> Text
$sel:applicationId:GetInAppMessages' :: GetInAppMessages -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/v1/apps/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
applicationId,
ByteString
"/endpoints/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
endpointId,
ByteString
"/inappmessages"
]
instance Core.ToQuery GetInAppMessages where
toQuery :: GetInAppMessages -> QueryString
toQuery = QueryString -> GetInAppMessages -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetInAppMessagesResponse = GetInAppMessagesResponse'
{
GetInAppMessagesResponse -> Int
httpStatus :: Prelude.Int,
GetInAppMessagesResponse -> InAppMessagesResponse
inAppMessagesResponse :: InAppMessagesResponse
}
deriving (GetInAppMessagesResponse -> GetInAppMessagesResponse -> Bool
(GetInAppMessagesResponse -> GetInAppMessagesResponse -> Bool)
-> (GetInAppMessagesResponse -> GetInAppMessagesResponse -> Bool)
-> Eq GetInAppMessagesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetInAppMessagesResponse -> GetInAppMessagesResponse -> Bool
$c/= :: GetInAppMessagesResponse -> GetInAppMessagesResponse -> Bool
== :: GetInAppMessagesResponse -> GetInAppMessagesResponse -> Bool
$c== :: GetInAppMessagesResponse -> GetInAppMessagesResponse -> Bool
Prelude.Eq, ReadPrec [GetInAppMessagesResponse]
ReadPrec GetInAppMessagesResponse
Int -> ReadS GetInAppMessagesResponse
ReadS [GetInAppMessagesResponse]
(Int -> ReadS GetInAppMessagesResponse)
-> ReadS [GetInAppMessagesResponse]
-> ReadPrec GetInAppMessagesResponse
-> ReadPrec [GetInAppMessagesResponse]
-> Read GetInAppMessagesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetInAppMessagesResponse]
$creadListPrec :: ReadPrec [GetInAppMessagesResponse]
readPrec :: ReadPrec GetInAppMessagesResponse
$creadPrec :: ReadPrec GetInAppMessagesResponse
readList :: ReadS [GetInAppMessagesResponse]
$creadList :: ReadS [GetInAppMessagesResponse]
readsPrec :: Int -> ReadS GetInAppMessagesResponse
$creadsPrec :: Int -> ReadS GetInAppMessagesResponse
Prelude.Read, Int -> GetInAppMessagesResponse -> ShowS
[GetInAppMessagesResponse] -> ShowS
GetInAppMessagesResponse -> String
(Int -> GetInAppMessagesResponse -> ShowS)
-> (GetInAppMessagesResponse -> String)
-> ([GetInAppMessagesResponse] -> ShowS)
-> Show GetInAppMessagesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetInAppMessagesResponse] -> ShowS
$cshowList :: [GetInAppMessagesResponse] -> ShowS
show :: GetInAppMessagesResponse -> String
$cshow :: GetInAppMessagesResponse -> String
showsPrec :: Int -> GetInAppMessagesResponse -> ShowS
$cshowsPrec :: Int -> GetInAppMessagesResponse -> ShowS
Prelude.Show, (forall x.
GetInAppMessagesResponse -> Rep GetInAppMessagesResponse x)
-> (forall x.
Rep GetInAppMessagesResponse x -> GetInAppMessagesResponse)
-> Generic GetInAppMessagesResponse
forall x.
Rep GetInAppMessagesResponse x -> GetInAppMessagesResponse
forall x.
GetInAppMessagesResponse -> Rep GetInAppMessagesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetInAppMessagesResponse x -> GetInAppMessagesResponse
$cfrom :: forall x.
GetInAppMessagesResponse -> Rep GetInAppMessagesResponse x
Prelude.Generic)
newGetInAppMessagesResponse ::
Prelude.Int ->
InAppMessagesResponse ->
GetInAppMessagesResponse
newGetInAppMessagesResponse :: Int -> InAppMessagesResponse -> GetInAppMessagesResponse
newGetInAppMessagesResponse
Int
pHttpStatus_
InAppMessagesResponse
pInAppMessagesResponse_ =
GetInAppMessagesResponse' :: Int -> InAppMessagesResponse -> GetInAppMessagesResponse
GetInAppMessagesResponse'
{ $sel:httpStatus:GetInAppMessagesResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:inAppMessagesResponse:GetInAppMessagesResponse' :: InAppMessagesResponse
inAppMessagesResponse = InAppMessagesResponse
pInAppMessagesResponse_
}
getInAppMessagesResponse_httpStatus :: Lens.Lens' GetInAppMessagesResponse Prelude.Int
getInAppMessagesResponse_httpStatus :: (Int -> f Int)
-> GetInAppMessagesResponse -> f GetInAppMessagesResponse
getInAppMessagesResponse_httpStatus = (GetInAppMessagesResponse -> Int)
-> (GetInAppMessagesResponse -> Int -> GetInAppMessagesResponse)
-> Lens GetInAppMessagesResponse GetInAppMessagesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInAppMessagesResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetInAppMessagesResponse' :: GetInAppMessagesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetInAppMessagesResponse
s@GetInAppMessagesResponse' {} Int
a -> GetInAppMessagesResponse
s {$sel:httpStatus:GetInAppMessagesResponse' :: Int
httpStatus = Int
a} :: GetInAppMessagesResponse)
getInAppMessagesResponse_inAppMessagesResponse :: Lens.Lens' GetInAppMessagesResponse InAppMessagesResponse
getInAppMessagesResponse_inAppMessagesResponse :: (InAppMessagesResponse -> f InAppMessagesResponse)
-> GetInAppMessagesResponse -> f GetInAppMessagesResponse
getInAppMessagesResponse_inAppMessagesResponse = (GetInAppMessagesResponse -> InAppMessagesResponse)
-> (GetInAppMessagesResponse
-> InAppMessagesResponse -> GetInAppMessagesResponse)
-> Lens
GetInAppMessagesResponse
GetInAppMessagesResponse
InAppMessagesResponse
InAppMessagesResponse
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInAppMessagesResponse' {InAppMessagesResponse
inAppMessagesResponse :: InAppMessagesResponse
$sel:inAppMessagesResponse:GetInAppMessagesResponse' :: GetInAppMessagesResponse -> InAppMessagesResponse
inAppMessagesResponse} -> InAppMessagesResponse
inAppMessagesResponse) (\s :: GetInAppMessagesResponse
s@GetInAppMessagesResponse' {} InAppMessagesResponse
a -> GetInAppMessagesResponse
s {$sel:inAppMessagesResponse:GetInAppMessagesResponse' :: InAppMessagesResponse
inAppMessagesResponse = InAppMessagesResponse
a} :: GetInAppMessagesResponse)
instance Prelude.NFData GetInAppMessagesResponse