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