{-# 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.GetApnsChannel
(
GetApnsChannel (..),
newGetApnsChannel,
getApnsChannel_applicationId,
GetApnsChannelResponse (..),
newGetApnsChannelResponse,
getApnsChannelResponse_httpStatus,
getApnsChannelResponse_aPNSChannelResponse,
)
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 GetApnsChannel = GetApnsChannel'
{
GetApnsChannel -> Text
applicationId :: Prelude.Text
}
deriving (GetApnsChannel -> GetApnsChannel -> Bool
(GetApnsChannel -> GetApnsChannel -> Bool)
-> (GetApnsChannel -> GetApnsChannel -> Bool) -> Eq GetApnsChannel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetApnsChannel -> GetApnsChannel -> Bool
$c/= :: GetApnsChannel -> GetApnsChannel -> Bool
== :: GetApnsChannel -> GetApnsChannel -> Bool
$c== :: GetApnsChannel -> GetApnsChannel -> Bool
Prelude.Eq, ReadPrec [GetApnsChannel]
ReadPrec GetApnsChannel
Int -> ReadS GetApnsChannel
ReadS [GetApnsChannel]
(Int -> ReadS GetApnsChannel)
-> ReadS [GetApnsChannel]
-> ReadPrec GetApnsChannel
-> ReadPrec [GetApnsChannel]
-> Read GetApnsChannel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetApnsChannel]
$creadListPrec :: ReadPrec [GetApnsChannel]
readPrec :: ReadPrec GetApnsChannel
$creadPrec :: ReadPrec GetApnsChannel
readList :: ReadS [GetApnsChannel]
$creadList :: ReadS [GetApnsChannel]
readsPrec :: Int -> ReadS GetApnsChannel
$creadsPrec :: Int -> ReadS GetApnsChannel
Prelude.Read, Int -> GetApnsChannel -> ShowS
[GetApnsChannel] -> ShowS
GetApnsChannel -> String
(Int -> GetApnsChannel -> ShowS)
-> (GetApnsChannel -> String)
-> ([GetApnsChannel] -> ShowS)
-> Show GetApnsChannel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetApnsChannel] -> ShowS
$cshowList :: [GetApnsChannel] -> ShowS
show :: GetApnsChannel -> String
$cshow :: GetApnsChannel -> String
showsPrec :: Int -> GetApnsChannel -> ShowS
$cshowsPrec :: Int -> GetApnsChannel -> ShowS
Prelude.Show, (forall x. GetApnsChannel -> Rep GetApnsChannel x)
-> (forall x. Rep GetApnsChannel x -> GetApnsChannel)
-> Generic GetApnsChannel
forall x. Rep GetApnsChannel x -> GetApnsChannel
forall x. GetApnsChannel -> Rep GetApnsChannel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetApnsChannel x -> GetApnsChannel
$cfrom :: forall x. GetApnsChannel -> Rep GetApnsChannel x
Prelude.Generic)
newGetApnsChannel ::
Prelude.Text ->
GetApnsChannel
newGetApnsChannel :: Text -> GetApnsChannel
newGetApnsChannel Text
pApplicationId_ =
GetApnsChannel' :: Text -> GetApnsChannel
GetApnsChannel' {$sel:applicationId:GetApnsChannel' :: Text
applicationId = Text
pApplicationId_}
getApnsChannel_applicationId :: Lens.Lens' GetApnsChannel Prelude.Text
getApnsChannel_applicationId :: (Text -> f Text) -> GetApnsChannel -> f GetApnsChannel
getApnsChannel_applicationId = (GetApnsChannel -> Text)
-> (GetApnsChannel -> Text -> GetApnsChannel)
-> Lens GetApnsChannel GetApnsChannel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApnsChannel' {Text
applicationId :: Text
$sel:applicationId:GetApnsChannel' :: GetApnsChannel -> Text
applicationId} -> Text
applicationId) (\s :: GetApnsChannel
s@GetApnsChannel' {} Text
a -> GetApnsChannel
s {$sel:applicationId:GetApnsChannel' :: Text
applicationId = Text
a} :: GetApnsChannel)
instance Core.AWSRequest GetApnsChannel where
type
AWSResponse GetApnsChannel =
GetApnsChannelResponse
request :: GetApnsChannel -> Request GetApnsChannel
request = Service -> GetApnsChannel -> Request GetApnsChannel
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetApnsChannel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetApnsChannel)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetApnsChannel))
-> Logger
-> Service
-> Proxy GetApnsChannel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetApnsChannel)))
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 -> APNSChannelResponse -> GetApnsChannelResponse
GetApnsChannelResponse'
(Int -> APNSChannelResponse -> GetApnsChannelResponse)
-> Either String Int
-> Either String (APNSChannelResponse -> GetApnsChannelResponse)
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 (APNSChannelResponse -> GetApnsChannelResponse)
-> Either String APNSChannelResponse
-> Either String GetApnsChannelResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object -> Either String APNSChannelResponse
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
)
instance Prelude.Hashable GetApnsChannel
instance Prelude.NFData GetApnsChannel
instance Core.ToHeaders GetApnsChannel where
toHeaders :: GetApnsChannel -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetApnsChannel -> 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 GetApnsChannel where
toPath :: GetApnsChannel -> ByteString
toPath GetApnsChannel' {Text
applicationId :: Text
$sel:applicationId:GetApnsChannel' :: GetApnsChannel -> 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
"/channels/apns"
]
instance Core.ToQuery GetApnsChannel where
toQuery :: GetApnsChannel -> QueryString
toQuery = QueryString -> GetApnsChannel -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetApnsChannelResponse = GetApnsChannelResponse'
{
GetApnsChannelResponse -> Int
httpStatus :: Prelude.Int,
GetApnsChannelResponse -> APNSChannelResponse
aPNSChannelResponse :: APNSChannelResponse
}
deriving (GetApnsChannelResponse -> GetApnsChannelResponse -> Bool
(GetApnsChannelResponse -> GetApnsChannelResponse -> Bool)
-> (GetApnsChannelResponse -> GetApnsChannelResponse -> Bool)
-> Eq GetApnsChannelResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetApnsChannelResponse -> GetApnsChannelResponse -> Bool
$c/= :: GetApnsChannelResponse -> GetApnsChannelResponse -> Bool
== :: GetApnsChannelResponse -> GetApnsChannelResponse -> Bool
$c== :: GetApnsChannelResponse -> GetApnsChannelResponse -> Bool
Prelude.Eq, ReadPrec [GetApnsChannelResponse]
ReadPrec GetApnsChannelResponse
Int -> ReadS GetApnsChannelResponse
ReadS [GetApnsChannelResponse]
(Int -> ReadS GetApnsChannelResponse)
-> ReadS [GetApnsChannelResponse]
-> ReadPrec GetApnsChannelResponse
-> ReadPrec [GetApnsChannelResponse]
-> Read GetApnsChannelResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetApnsChannelResponse]
$creadListPrec :: ReadPrec [GetApnsChannelResponse]
readPrec :: ReadPrec GetApnsChannelResponse
$creadPrec :: ReadPrec GetApnsChannelResponse
readList :: ReadS [GetApnsChannelResponse]
$creadList :: ReadS [GetApnsChannelResponse]
readsPrec :: Int -> ReadS GetApnsChannelResponse
$creadsPrec :: Int -> ReadS GetApnsChannelResponse
Prelude.Read, Int -> GetApnsChannelResponse -> ShowS
[GetApnsChannelResponse] -> ShowS
GetApnsChannelResponse -> String
(Int -> GetApnsChannelResponse -> ShowS)
-> (GetApnsChannelResponse -> String)
-> ([GetApnsChannelResponse] -> ShowS)
-> Show GetApnsChannelResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetApnsChannelResponse] -> ShowS
$cshowList :: [GetApnsChannelResponse] -> ShowS
show :: GetApnsChannelResponse -> String
$cshow :: GetApnsChannelResponse -> String
showsPrec :: Int -> GetApnsChannelResponse -> ShowS
$cshowsPrec :: Int -> GetApnsChannelResponse -> ShowS
Prelude.Show, (forall x. GetApnsChannelResponse -> Rep GetApnsChannelResponse x)
-> (forall x.
Rep GetApnsChannelResponse x -> GetApnsChannelResponse)
-> Generic GetApnsChannelResponse
forall x. Rep GetApnsChannelResponse x -> GetApnsChannelResponse
forall x. GetApnsChannelResponse -> Rep GetApnsChannelResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetApnsChannelResponse x -> GetApnsChannelResponse
$cfrom :: forall x. GetApnsChannelResponse -> Rep GetApnsChannelResponse x
Prelude.Generic)
newGetApnsChannelResponse ::
Prelude.Int ->
APNSChannelResponse ->
GetApnsChannelResponse
newGetApnsChannelResponse :: Int -> APNSChannelResponse -> GetApnsChannelResponse
newGetApnsChannelResponse
Int
pHttpStatus_
APNSChannelResponse
pAPNSChannelResponse_ =
GetApnsChannelResponse' :: Int -> APNSChannelResponse -> GetApnsChannelResponse
GetApnsChannelResponse'
{ $sel:httpStatus:GetApnsChannelResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:aPNSChannelResponse:GetApnsChannelResponse' :: APNSChannelResponse
aPNSChannelResponse = APNSChannelResponse
pAPNSChannelResponse_
}
getApnsChannelResponse_httpStatus :: Lens.Lens' GetApnsChannelResponse Prelude.Int
getApnsChannelResponse_httpStatus :: (Int -> f Int)
-> GetApnsChannelResponse -> f GetApnsChannelResponse
getApnsChannelResponse_httpStatus = (GetApnsChannelResponse -> Int)
-> (GetApnsChannelResponse -> Int -> GetApnsChannelResponse)
-> Lens GetApnsChannelResponse GetApnsChannelResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApnsChannelResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetApnsChannelResponse' :: GetApnsChannelResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetApnsChannelResponse
s@GetApnsChannelResponse' {} Int
a -> GetApnsChannelResponse
s {$sel:httpStatus:GetApnsChannelResponse' :: Int
httpStatus = Int
a} :: GetApnsChannelResponse)
getApnsChannelResponse_aPNSChannelResponse :: Lens.Lens' GetApnsChannelResponse APNSChannelResponse
getApnsChannelResponse_aPNSChannelResponse :: (APNSChannelResponse -> f APNSChannelResponse)
-> GetApnsChannelResponse -> f GetApnsChannelResponse
getApnsChannelResponse_aPNSChannelResponse = (GetApnsChannelResponse -> APNSChannelResponse)
-> (GetApnsChannelResponse
-> APNSChannelResponse -> GetApnsChannelResponse)
-> Lens
GetApnsChannelResponse
GetApnsChannelResponse
APNSChannelResponse
APNSChannelResponse
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApnsChannelResponse' {APNSChannelResponse
aPNSChannelResponse :: APNSChannelResponse
$sel:aPNSChannelResponse:GetApnsChannelResponse' :: GetApnsChannelResponse -> APNSChannelResponse
aPNSChannelResponse} -> APNSChannelResponse
aPNSChannelResponse) (\s :: GetApnsChannelResponse
s@GetApnsChannelResponse' {} APNSChannelResponse
a -> GetApnsChannelResponse
s {$sel:aPNSChannelResponse:GetApnsChannelResponse' :: APNSChannelResponse
aPNSChannelResponse = APNSChannelResponse
a} :: GetApnsChannelResponse)
instance Prelude.NFData GetApnsChannelResponse