{-# 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.UpdateGcmChannel
(
UpdateGcmChannel (..),
newUpdateGcmChannel,
updateGcmChannel_applicationId,
updateGcmChannel_gCMChannelRequest,
UpdateGcmChannelResponse (..),
newUpdateGcmChannelResponse,
updateGcmChannelResponse_httpStatus,
updateGcmChannelResponse_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 UpdateGcmChannel = UpdateGcmChannel'
{
UpdateGcmChannel -> Text
applicationId :: Prelude.Text,
UpdateGcmChannel -> GCMChannelRequest
gCMChannelRequest :: GCMChannelRequest
}
deriving (UpdateGcmChannel -> UpdateGcmChannel -> Bool
(UpdateGcmChannel -> UpdateGcmChannel -> Bool)
-> (UpdateGcmChannel -> UpdateGcmChannel -> Bool)
-> Eq UpdateGcmChannel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateGcmChannel -> UpdateGcmChannel -> Bool
$c/= :: UpdateGcmChannel -> UpdateGcmChannel -> Bool
== :: UpdateGcmChannel -> UpdateGcmChannel -> Bool
$c== :: UpdateGcmChannel -> UpdateGcmChannel -> Bool
Prelude.Eq, ReadPrec [UpdateGcmChannel]
ReadPrec UpdateGcmChannel
Int -> ReadS UpdateGcmChannel
ReadS [UpdateGcmChannel]
(Int -> ReadS UpdateGcmChannel)
-> ReadS [UpdateGcmChannel]
-> ReadPrec UpdateGcmChannel
-> ReadPrec [UpdateGcmChannel]
-> Read UpdateGcmChannel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateGcmChannel]
$creadListPrec :: ReadPrec [UpdateGcmChannel]
readPrec :: ReadPrec UpdateGcmChannel
$creadPrec :: ReadPrec UpdateGcmChannel
readList :: ReadS [UpdateGcmChannel]
$creadList :: ReadS [UpdateGcmChannel]
readsPrec :: Int -> ReadS UpdateGcmChannel
$creadsPrec :: Int -> ReadS UpdateGcmChannel
Prelude.Read, Int -> UpdateGcmChannel -> ShowS
[UpdateGcmChannel] -> ShowS
UpdateGcmChannel -> String
(Int -> UpdateGcmChannel -> ShowS)
-> (UpdateGcmChannel -> String)
-> ([UpdateGcmChannel] -> ShowS)
-> Show UpdateGcmChannel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateGcmChannel] -> ShowS
$cshowList :: [UpdateGcmChannel] -> ShowS
show :: UpdateGcmChannel -> String
$cshow :: UpdateGcmChannel -> String
showsPrec :: Int -> UpdateGcmChannel -> ShowS
$cshowsPrec :: Int -> UpdateGcmChannel -> ShowS
Prelude.Show, (forall x. UpdateGcmChannel -> Rep UpdateGcmChannel x)
-> (forall x. Rep UpdateGcmChannel x -> UpdateGcmChannel)
-> Generic UpdateGcmChannel
forall x. Rep UpdateGcmChannel x -> UpdateGcmChannel
forall x. UpdateGcmChannel -> Rep UpdateGcmChannel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateGcmChannel x -> UpdateGcmChannel
$cfrom :: forall x. UpdateGcmChannel -> Rep UpdateGcmChannel x
Prelude.Generic)
newUpdateGcmChannel ::
Prelude.Text ->
GCMChannelRequest ->
UpdateGcmChannel
newUpdateGcmChannel :: Text -> GCMChannelRequest -> UpdateGcmChannel
newUpdateGcmChannel
Text
pApplicationId_
GCMChannelRequest
pGCMChannelRequest_ =
UpdateGcmChannel' :: Text -> GCMChannelRequest -> UpdateGcmChannel
UpdateGcmChannel'
{ $sel:applicationId:UpdateGcmChannel' :: Text
applicationId = Text
pApplicationId_,
$sel:gCMChannelRequest:UpdateGcmChannel' :: GCMChannelRequest
gCMChannelRequest = GCMChannelRequest
pGCMChannelRequest_
}
updateGcmChannel_applicationId :: Lens.Lens' UpdateGcmChannel Prelude.Text
updateGcmChannel_applicationId :: (Text -> f Text) -> UpdateGcmChannel -> f UpdateGcmChannel
updateGcmChannel_applicationId = (UpdateGcmChannel -> Text)
-> (UpdateGcmChannel -> Text -> UpdateGcmChannel)
-> Lens UpdateGcmChannel UpdateGcmChannel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGcmChannel' {Text
applicationId :: Text
$sel:applicationId:UpdateGcmChannel' :: UpdateGcmChannel -> Text
applicationId} -> Text
applicationId) (\s :: UpdateGcmChannel
s@UpdateGcmChannel' {} Text
a -> UpdateGcmChannel
s {$sel:applicationId:UpdateGcmChannel' :: Text
applicationId = Text
a} :: UpdateGcmChannel)
updateGcmChannel_gCMChannelRequest :: Lens.Lens' UpdateGcmChannel GCMChannelRequest
updateGcmChannel_gCMChannelRequest :: (GCMChannelRequest -> f GCMChannelRequest)
-> UpdateGcmChannel -> f UpdateGcmChannel
updateGcmChannel_gCMChannelRequest = (UpdateGcmChannel -> GCMChannelRequest)
-> (UpdateGcmChannel -> GCMChannelRequest -> UpdateGcmChannel)
-> Lens
UpdateGcmChannel
UpdateGcmChannel
GCMChannelRequest
GCMChannelRequest
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGcmChannel' {GCMChannelRequest
gCMChannelRequest :: GCMChannelRequest
$sel:gCMChannelRequest:UpdateGcmChannel' :: UpdateGcmChannel -> GCMChannelRequest
gCMChannelRequest} -> GCMChannelRequest
gCMChannelRequest) (\s :: UpdateGcmChannel
s@UpdateGcmChannel' {} GCMChannelRequest
a -> UpdateGcmChannel
s {$sel:gCMChannelRequest:UpdateGcmChannel' :: GCMChannelRequest
gCMChannelRequest = GCMChannelRequest
a} :: UpdateGcmChannel)
instance Core.AWSRequest UpdateGcmChannel where
type
AWSResponse UpdateGcmChannel =
UpdateGcmChannelResponse
request :: UpdateGcmChannel -> Request UpdateGcmChannel
request = Service -> UpdateGcmChannel -> Request UpdateGcmChannel
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateGcmChannel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateGcmChannel)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateGcmChannel))
-> Logger
-> Service
-> Proxy UpdateGcmChannel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateGcmChannel)))
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 -> UpdateGcmChannelResponse
UpdateGcmChannelResponse'
(Int -> GCMChannelResponse -> UpdateGcmChannelResponse)
-> Either String Int
-> Either String (GCMChannelResponse -> UpdateGcmChannelResponse)
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 -> UpdateGcmChannelResponse)
-> Either String GCMChannelResponse
-> Either String UpdateGcmChannelResponse
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 UpdateGcmChannel
instance Prelude.NFData UpdateGcmChannel
instance Core.ToHeaders UpdateGcmChannel where
toHeaders :: UpdateGcmChannel -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateGcmChannel -> 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.ToJSON UpdateGcmChannel where
toJSON :: UpdateGcmChannel -> Value
toJSON UpdateGcmChannel' {Text
GCMChannelRequest
gCMChannelRequest :: GCMChannelRequest
applicationId :: Text
$sel:gCMChannelRequest:UpdateGcmChannel' :: UpdateGcmChannel -> GCMChannelRequest
$sel:applicationId:UpdateGcmChannel' :: UpdateGcmChannel -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"GCMChannelRequest" Text -> GCMChannelRequest -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= GCMChannelRequest
gCMChannelRequest)
]
)
instance Core.ToPath UpdateGcmChannel where
toPath :: UpdateGcmChannel -> ByteString
toPath UpdateGcmChannel' {Text
GCMChannelRequest
gCMChannelRequest :: GCMChannelRequest
applicationId :: Text
$sel:gCMChannelRequest:UpdateGcmChannel' :: UpdateGcmChannel -> GCMChannelRequest
$sel:applicationId:UpdateGcmChannel' :: UpdateGcmChannel -> 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 UpdateGcmChannel where
toQuery :: UpdateGcmChannel -> QueryString
toQuery = QueryString -> UpdateGcmChannel -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateGcmChannelResponse = UpdateGcmChannelResponse'
{
UpdateGcmChannelResponse -> Int
httpStatus :: Prelude.Int,
UpdateGcmChannelResponse -> GCMChannelResponse
gCMChannelResponse :: GCMChannelResponse
}
deriving (UpdateGcmChannelResponse -> UpdateGcmChannelResponse -> Bool
(UpdateGcmChannelResponse -> UpdateGcmChannelResponse -> Bool)
-> (UpdateGcmChannelResponse -> UpdateGcmChannelResponse -> Bool)
-> Eq UpdateGcmChannelResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateGcmChannelResponse -> UpdateGcmChannelResponse -> Bool
$c/= :: UpdateGcmChannelResponse -> UpdateGcmChannelResponse -> Bool
== :: UpdateGcmChannelResponse -> UpdateGcmChannelResponse -> Bool
$c== :: UpdateGcmChannelResponse -> UpdateGcmChannelResponse -> Bool
Prelude.Eq, ReadPrec [UpdateGcmChannelResponse]
ReadPrec UpdateGcmChannelResponse
Int -> ReadS UpdateGcmChannelResponse
ReadS [UpdateGcmChannelResponse]
(Int -> ReadS UpdateGcmChannelResponse)
-> ReadS [UpdateGcmChannelResponse]
-> ReadPrec UpdateGcmChannelResponse
-> ReadPrec [UpdateGcmChannelResponse]
-> Read UpdateGcmChannelResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateGcmChannelResponse]
$creadListPrec :: ReadPrec [UpdateGcmChannelResponse]
readPrec :: ReadPrec UpdateGcmChannelResponse
$creadPrec :: ReadPrec UpdateGcmChannelResponse
readList :: ReadS [UpdateGcmChannelResponse]
$creadList :: ReadS [UpdateGcmChannelResponse]
readsPrec :: Int -> ReadS UpdateGcmChannelResponse
$creadsPrec :: Int -> ReadS UpdateGcmChannelResponse
Prelude.Read, Int -> UpdateGcmChannelResponse -> ShowS
[UpdateGcmChannelResponse] -> ShowS
UpdateGcmChannelResponse -> String
(Int -> UpdateGcmChannelResponse -> ShowS)
-> (UpdateGcmChannelResponse -> String)
-> ([UpdateGcmChannelResponse] -> ShowS)
-> Show UpdateGcmChannelResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateGcmChannelResponse] -> ShowS
$cshowList :: [UpdateGcmChannelResponse] -> ShowS
show :: UpdateGcmChannelResponse -> String
$cshow :: UpdateGcmChannelResponse -> String
showsPrec :: Int -> UpdateGcmChannelResponse -> ShowS
$cshowsPrec :: Int -> UpdateGcmChannelResponse -> ShowS
Prelude.Show, (forall x.
UpdateGcmChannelResponse -> Rep UpdateGcmChannelResponse x)
-> (forall x.
Rep UpdateGcmChannelResponse x -> UpdateGcmChannelResponse)
-> Generic UpdateGcmChannelResponse
forall x.
Rep UpdateGcmChannelResponse x -> UpdateGcmChannelResponse
forall x.
UpdateGcmChannelResponse -> Rep UpdateGcmChannelResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateGcmChannelResponse x -> UpdateGcmChannelResponse
$cfrom :: forall x.
UpdateGcmChannelResponse -> Rep UpdateGcmChannelResponse x
Prelude.Generic)
newUpdateGcmChannelResponse ::
Prelude.Int ->
GCMChannelResponse ->
UpdateGcmChannelResponse
newUpdateGcmChannelResponse :: Int -> GCMChannelResponse -> UpdateGcmChannelResponse
newUpdateGcmChannelResponse
Int
pHttpStatus_
GCMChannelResponse
pGCMChannelResponse_ =
UpdateGcmChannelResponse' :: Int -> GCMChannelResponse -> UpdateGcmChannelResponse
UpdateGcmChannelResponse'
{ $sel:httpStatus:UpdateGcmChannelResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:gCMChannelResponse:UpdateGcmChannelResponse' :: GCMChannelResponse
gCMChannelResponse = GCMChannelResponse
pGCMChannelResponse_
}
updateGcmChannelResponse_httpStatus :: Lens.Lens' UpdateGcmChannelResponse Prelude.Int
updateGcmChannelResponse_httpStatus :: (Int -> f Int)
-> UpdateGcmChannelResponse -> f UpdateGcmChannelResponse
updateGcmChannelResponse_httpStatus = (UpdateGcmChannelResponse -> Int)
-> (UpdateGcmChannelResponse -> Int -> UpdateGcmChannelResponse)
-> Lens UpdateGcmChannelResponse UpdateGcmChannelResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGcmChannelResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateGcmChannelResponse' :: UpdateGcmChannelResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateGcmChannelResponse
s@UpdateGcmChannelResponse' {} Int
a -> UpdateGcmChannelResponse
s {$sel:httpStatus:UpdateGcmChannelResponse' :: Int
httpStatus = Int
a} :: UpdateGcmChannelResponse)
updateGcmChannelResponse_gCMChannelResponse :: Lens.Lens' UpdateGcmChannelResponse GCMChannelResponse
updateGcmChannelResponse_gCMChannelResponse :: (GCMChannelResponse -> f GCMChannelResponse)
-> UpdateGcmChannelResponse -> f UpdateGcmChannelResponse
updateGcmChannelResponse_gCMChannelResponse = (UpdateGcmChannelResponse -> GCMChannelResponse)
-> (UpdateGcmChannelResponse
-> GCMChannelResponse -> UpdateGcmChannelResponse)
-> Lens
UpdateGcmChannelResponse
UpdateGcmChannelResponse
GCMChannelResponse
GCMChannelResponse
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGcmChannelResponse' {GCMChannelResponse
gCMChannelResponse :: GCMChannelResponse
$sel:gCMChannelResponse:UpdateGcmChannelResponse' :: UpdateGcmChannelResponse -> GCMChannelResponse
gCMChannelResponse} -> GCMChannelResponse
gCMChannelResponse) (\s :: UpdateGcmChannelResponse
s@UpdateGcmChannelResponse' {} GCMChannelResponse
a -> UpdateGcmChannelResponse
s {$sel:gCMChannelResponse:UpdateGcmChannelResponse' :: GCMChannelResponse
gCMChannelResponse = GCMChannelResponse
a} :: UpdateGcmChannelResponse)
instance Prelude.NFData UpdateGcmChannelResponse