{-# 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.ChimeSDKMessaging.GetChannelMessage
(
GetChannelMessage (..),
newGetChannelMessage,
getChannelMessage_channelArn,
getChannelMessage_messageId,
getChannelMessage_chimeBearer,
GetChannelMessageResponse (..),
newGetChannelMessageResponse,
getChannelMessageResponse_channelMessage,
getChannelMessageResponse_httpStatus,
)
where
import Amazonka.ChimeSDKMessaging.Types
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
data GetChannelMessage = GetChannelMessage'
{
GetChannelMessage -> Text
channelArn :: Prelude.Text,
GetChannelMessage -> Text
messageId :: Prelude.Text,
GetChannelMessage -> Text
chimeBearer :: Prelude.Text
}
deriving (GetChannelMessage -> GetChannelMessage -> Bool
(GetChannelMessage -> GetChannelMessage -> Bool)
-> (GetChannelMessage -> GetChannelMessage -> Bool)
-> Eq GetChannelMessage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetChannelMessage -> GetChannelMessage -> Bool
$c/= :: GetChannelMessage -> GetChannelMessage -> Bool
== :: GetChannelMessage -> GetChannelMessage -> Bool
$c== :: GetChannelMessage -> GetChannelMessage -> Bool
Prelude.Eq, ReadPrec [GetChannelMessage]
ReadPrec GetChannelMessage
Int -> ReadS GetChannelMessage
ReadS [GetChannelMessage]
(Int -> ReadS GetChannelMessage)
-> ReadS [GetChannelMessage]
-> ReadPrec GetChannelMessage
-> ReadPrec [GetChannelMessage]
-> Read GetChannelMessage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetChannelMessage]
$creadListPrec :: ReadPrec [GetChannelMessage]
readPrec :: ReadPrec GetChannelMessage
$creadPrec :: ReadPrec GetChannelMessage
readList :: ReadS [GetChannelMessage]
$creadList :: ReadS [GetChannelMessage]
readsPrec :: Int -> ReadS GetChannelMessage
$creadsPrec :: Int -> ReadS GetChannelMessage
Prelude.Read, Int -> GetChannelMessage -> ShowS
[GetChannelMessage] -> ShowS
GetChannelMessage -> String
(Int -> GetChannelMessage -> ShowS)
-> (GetChannelMessage -> String)
-> ([GetChannelMessage] -> ShowS)
-> Show GetChannelMessage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetChannelMessage] -> ShowS
$cshowList :: [GetChannelMessage] -> ShowS
show :: GetChannelMessage -> String
$cshow :: GetChannelMessage -> String
showsPrec :: Int -> GetChannelMessage -> ShowS
$cshowsPrec :: Int -> GetChannelMessage -> ShowS
Prelude.Show, (forall x. GetChannelMessage -> Rep GetChannelMessage x)
-> (forall x. Rep GetChannelMessage x -> GetChannelMessage)
-> Generic GetChannelMessage
forall x. Rep GetChannelMessage x -> GetChannelMessage
forall x. GetChannelMessage -> Rep GetChannelMessage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetChannelMessage x -> GetChannelMessage
$cfrom :: forall x. GetChannelMessage -> Rep GetChannelMessage x
Prelude.Generic)
newGetChannelMessage ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
GetChannelMessage
newGetChannelMessage :: Text -> Text -> Text -> GetChannelMessage
newGetChannelMessage
Text
pChannelArn_
Text
pMessageId_
Text
pChimeBearer_ =
GetChannelMessage' :: Text -> Text -> Text -> GetChannelMessage
GetChannelMessage'
{ $sel:channelArn:GetChannelMessage' :: Text
channelArn = Text
pChannelArn_,
$sel:messageId:GetChannelMessage' :: Text
messageId = Text
pMessageId_,
$sel:chimeBearer:GetChannelMessage' :: Text
chimeBearer = Text
pChimeBearer_
}
getChannelMessage_channelArn :: Lens.Lens' GetChannelMessage Prelude.Text
getChannelMessage_channelArn :: (Text -> f Text) -> GetChannelMessage -> f GetChannelMessage
getChannelMessage_channelArn = (GetChannelMessage -> Text)
-> (GetChannelMessage -> Text -> GetChannelMessage)
-> Lens GetChannelMessage GetChannelMessage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetChannelMessage' {Text
channelArn :: Text
$sel:channelArn:GetChannelMessage' :: GetChannelMessage -> Text
channelArn} -> Text
channelArn) (\s :: GetChannelMessage
s@GetChannelMessage' {} Text
a -> GetChannelMessage
s {$sel:channelArn:GetChannelMessage' :: Text
channelArn = Text
a} :: GetChannelMessage)
getChannelMessage_messageId :: Lens.Lens' GetChannelMessage Prelude.Text
getChannelMessage_messageId :: (Text -> f Text) -> GetChannelMessage -> f GetChannelMessage
getChannelMessage_messageId = (GetChannelMessage -> Text)
-> (GetChannelMessage -> Text -> GetChannelMessage)
-> Lens GetChannelMessage GetChannelMessage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetChannelMessage' {Text
messageId :: Text
$sel:messageId:GetChannelMessage' :: GetChannelMessage -> Text
messageId} -> Text
messageId) (\s :: GetChannelMessage
s@GetChannelMessage' {} Text
a -> GetChannelMessage
s {$sel:messageId:GetChannelMessage' :: Text
messageId = Text
a} :: GetChannelMessage)
getChannelMessage_chimeBearer :: Lens.Lens' GetChannelMessage Prelude.Text
getChannelMessage_chimeBearer :: (Text -> f Text) -> GetChannelMessage -> f GetChannelMessage
getChannelMessage_chimeBearer = (GetChannelMessage -> Text)
-> (GetChannelMessage -> Text -> GetChannelMessage)
-> Lens GetChannelMessage GetChannelMessage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetChannelMessage' {Text
chimeBearer :: Text
$sel:chimeBearer:GetChannelMessage' :: GetChannelMessage -> Text
chimeBearer} -> Text
chimeBearer) (\s :: GetChannelMessage
s@GetChannelMessage' {} Text
a -> GetChannelMessage
s {$sel:chimeBearer:GetChannelMessage' :: Text
chimeBearer = Text
a} :: GetChannelMessage)
instance Core.AWSRequest GetChannelMessage where
type
AWSResponse GetChannelMessage =
GetChannelMessageResponse
request :: GetChannelMessage -> Request GetChannelMessage
request = Service -> GetChannelMessage -> Request GetChannelMessage
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetChannelMessage
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetChannelMessage)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetChannelMessage))
-> Logger
-> Service
-> Proxy GetChannelMessage
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetChannelMessage)))
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 ->
Maybe ChannelMessage -> Int -> GetChannelMessageResponse
GetChannelMessageResponse'
(Maybe ChannelMessage -> Int -> GetChannelMessageResponse)
-> Either String (Maybe ChannelMessage)
-> Either String (Int -> GetChannelMessageResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ChannelMessage)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ChannelMessage")
Either String (Int -> GetChannelMessageResponse)
-> Either String Int -> Either String GetChannelMessageResponse
forall (f :: * -> *) a b. Applicative f => 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 GetChannelMessage
instance Prelude.NFData GetChannelMessage
instance Core.ToHeaders GetChannelMessage where
toHeaders :: GetChannelMessage -> ResponseHeaders
toHeaders GetChannelMessage' {Text
chimeBearer :: Text
messageId :: Text
channelArn :: Text
$sel:chimeBearer:GetChannelMessage' :: GetChannelMessage -> Text
$sel:messageId:GetChannelMessage' :: GetChannelMessage -> Text
$sel:channelArn:GetChannelMessage' :: GetChannelMessage -> Text
..} =
[ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[HeaderName
"x-amz-chime-bearer" HeaderName -> Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Text
chimeBearer]
instance Core.ToPath GetChannelMessage where
toPath :: GetChannelMessage -> ByteString
toPath GetChannelMessage' {Text
chimeBearer :: Text
messageId :: Text
channelArn :: Text
$sel:chimeBearer:GetChannelMessage' :: GetChannelMessage -> Text
$sel:messageId:GetChannelMessage' :: GetChannelMessage -> Text
$sel:channelArn:GetChannelMessage' :: GetChannelMessage -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/channels/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
channelArn,
ByteString
"/messages/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
messageId
]
instance Core.ToQuery GetChannelMessage where
toQuery :: GetChannelMessage -> QueryString
toQuery = QueryString -> GetChannelMessage -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetChannelMessageResponse = GetChannelMessageResponse'
{
GetChannelMessageResponse -> Maybe ChannelMessage
channelMessage :: Prelude.Maybe ChannelMessage,
GetChannelMessageResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetChannelMessageResponse -> GetChannelMessageResponse -> Bool
(GetChannelMessageResponse -> GetChannelMessageResponse -> Bool)
-> (GetChannelMessageResponse -> GetChannelMessageResponse -> Bool)
-> Eq GetChannelMessageResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetChannelMessageResponse -> GetChannelMessageResponse -> Bool
$c/= :: GetChannelMessageResponse -> GetChannelMessageResponse -> Bool
== :: GetChannelMessageResponse -> GetChannelMessageResponse -> Bool
$c== :: GetChannelMessageResponse -> GetChannelMessageResponse -> Bool
Prelude.Eq, Int -> GetChannelMessageResponse -> ShowS
[GetChannelMessageResponse] -> ShowS
GetChannelMessageResponse -> String
(Int -> GetChannelMessageResponse -> ShowS)
-> (GetChannelMessageResponse -> String)
-> ([GetChannelMessageResponse] -> ShowS)
-> Show GetChannelMessageResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetChannelMessageResponse] -> ShowS
$cshowList :: [GetChannelMessageResponse] -> ShowS
show :: GetChannelMessageResponse -> String
$cshow :: GetChannelMessageResponse -> String
showsPrec :: Int -> GetChannelMessageResponse -> ShowS
$cshowsPrec :: Int -> GetChannelMessageResponse -> ShowS
Prelude.Show, (forall x.
GetChannelMessageResponse -> Rep GetChannelMessageResponse x)
-> (forall x.
Rep GetChannelMessageResponse x -> GetChannelMessageResponse)
-> Generic GetChannelMessageResponse
forall x.
Rep GetChannelMessageResponse x -> GetChannelMessageResponse
forall x.
GetChannelMessageResponse -> Rep GetChannelMessageResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetChannelMessageResponse x -> GetChannelMessageResponse
$cfrom :: forall x.
GetChannelMessageResponse -> Rep GetChannelMessageResponse x
Prelude.Generic)
newGetChannelMessageResponse ::
Prelude.Int ->
GetChannelMessageResponse
newGetChannelMessageResponse :: Int -> GetChannelMessageResponse
newGetChannelMessageResponse Int
pHttpStatus_ =
GetChannelMessageResponse' :: Maybe ChannelMessage -> Int -> GetChannelMessageResponse
GetChannelMessageResponse'
{ $sel:channelMessage:GetChannelMessageResponse' :: Maybe ChannelMessage
channelMessage =
Maybe ChannelMessage
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetChannelMessageResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getChannelMessageResponse_channelMessage :: Lens.Lens' GetChannelMessageResponse (Prelude.Maybe ChannelMessage)
getChannelMessageResponse_channelMessage :: (Maybe ChannelMessage -> f (Maybe ChannelMessage))
-> GetChannelMessageResponse -> f GetChannelMessageResponse
getChannelMessageResponse_channelMessage = (GetChannelMessageResponse -> Maybe ChannelMessage)
-> (GetChannelMessageResponse
-> Maybe ChannelMessage -> GetChannelMessageResponse)
-> Lens
GetChannelMessageResponse
GetChannelMessageResponse
(Maybe ChannelMessage)
(Maybe ChannelMessage)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetChannelMessageResponse' {Maybe ChannelMessage
channelMessage :: Maybe ChannelMessage
$sel:channelMessage:GetChannelMessageResponse' :: GetChannelMessageResponse -> Maybe ChannelMessage
channelMessage} -> Maybe ChannelMessage
channelMessage) (\s :: GetChannelMessageResponse
s@GetChannelMessageResponse' {} Maybe ChannelMessage
a -> GetChannelMessageResponse
s {$sel:channelMessage:GetChannelMessageResponse' :: Maybe ChannelMessage
channelMessage = Maybe ChannelMessage
a} :: GetChannelMessageResponse)
getChannelMessageResponse_httpStatus :: Lens.Lens' GetChannelMessageResponse Prelude.Int
getChannelMessageResponse_httpStatus :: (Int -> f Int)
-> GetChannelMessageResponse -> f GetChannelMessageResponse
getChannelMessageResponse_httpStatus = (GetChannelMessageResponse -> Int)
-> (GetChannelMessageResponse -> Int -> GetChannelMessageResponse)
-> Lens GetChannelMessageResponse GetChannelMessageResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetChannelMessageResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetChannelMessageResponse' :: GetChannelMessageResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetChannelMessageResponse
s@GetChannelMessageResponse' {} Int
a -> GetChannelMessageResponse
s {$sel:httpStatus:GetChannelMessageResponse' :: Int
httpStatus = Int
a} :: GetChannelMessageResponse)
instance Prelude.NFData GetChannelMessageResponse