{-# 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.Chime.GetRoom
(
GetRoom (..),
newGetRoom,
getRoom_accountId,
getRoom_roomId,
GetRoomResponse (..),
newGetRoomResponse,
getRoomResponse_room,
getRoomResponse_httpStatus,
)
where
import Amazonka.Chime.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 GetRoom = GetRoom'
{
GetRoom -> Text
accountId :: Prelude.Text,
GetRoom -> Text
roomId :: Prelude.Text
}
deriving (GetRoom -> GetRoom -> Bool
(GetRoom -> GetRoom -> Bool)
-> (GetRoom -> GetRoom -> Bool) -> Eq GetRoom
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRoom -> GetRoom -> Bool
$c/= :: GetRoom -> GetRoom -> Bool
== :: GetRoom -> GetRoom -> Bool
$c== :: GetRoom -> GetRoom -> Bool
Prelude.Eq, ReadPrec [GetRoom]
ReadPrec GetRoom
Int -> ReadS GetRoom
ReadS [GetRoom]
(Int -> ReadS GetRoom)
-> ReadS [GetRoom]
-> ReadPrec GetRoom
-> ReadPrec [GetRoom]
-> Read GetRoom
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRoom]
$creadListPrec :: ReadPrec [GetRoom]
readPrec :: ReadPrec GetRoom
$creadPrec :: ReadPrec GetRoom
readList :: ReadS [GetRoom]
$creadList :: ReadS [GetRoom]
readsPrec :: Int -> ReadS GetRoom
$creadsPrec :: Int -> ReadS GetRoom
Prelude.Read, Int -> GetRoom -> ShowS
[GetRoom] -> ShowS
GetRoom -> String
(Int -> GetRoom -> ShowS)
-> (GetRoom -> String) -> ([GetRoom] -> ShowS) -> Show GetRoom
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRoom] -> ShowS
$cshowList :: [GetRoom] -> ShowS
show :: GetRoom -> String
$cshow :: GetRoom -> String
showsPrec :: Int -> GetRoom -> ShowS
$cshowsPrec :: Int -> GetRoom -> ShowS
Prelude.Show, (forall x. GetRoom -> Rep GetRoom x)
-> (forall x. Rep GetRoom x -> GetRoom) -> Generic GetRoom
forall x. Rep GetRoom x -> GetRoom
forall x. GetRoom -> Rep GetRoom x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetRoom x -> GetRoom
$cfrom :: forall x. GetRoom -> Rep GetRoom x
Prelude.Generic)
newGetRoom ::
Prelude.Text ->
Prelude.Text ->
GetRoom
newGetRoom :: Text -> Text -> GetRoom
newGetRoom Text
pAccountId_ Text
pRoomId_ =
GetRoom' :: Text -> Text -> GetRoom
GetRoom'
{ $sel:accountId:GetRoom' :: Text
accountId = Text
pAccountId_,
$sel:roomId:GetRoom' :: Text
roomId = Text
pRoomId_
}
getRoom_accountId :: Lens.Lens' GetRoom Prelude.Text
getRoom_accountId :: (Text -> f Text) -> GetRoom -> f GetRoom
getRoom_accountId = (GetRoom -> Text)
-> (GetRoom -> Text -> GetRoom) -> Lens GetRoom GetRoom Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRoom' {Text
accountId :: Text
$sel:accountId:GetRoom' :: GetRoom -> Text
accountId} -> Text
accountId) (\s :: GetRoom
s@GetRoom' {} Text
a -> GetRoom
s {$sel:accountId:GetRoom' :: Text
accountId = Text
a} :: GetRoom)
getRoom_roomId :: Lens.Lens' GetRoom Prelude.Text
getRoom_roomId :: (Text -> f Text) -> GetRoom -> f GetRoom
getRoom_roomId = (GetRoom -> Text)
-> (GetRoom -> Text -> GetRoom) -> Lens GetRoom GetRoom Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRoom' {Text
roomId :: Text
$sel:roomId:GetRoom' :: GetRoom -> Text
roomId} -> Text
roomId) (\s :: GetRoom
s@GetRoom' {} Text
a -> GetRoom
s {$sel:roomId:GetRoom' :: Text
roomId = Text
a} :: GetRoom)
instance Core.AWSRequest GetRoom where
type AWSResponse GetRoom = GetRoomResponse
request :: GetRoom -> Request GetRoom
request = Service -> GetRoom -> Request GetRoom
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetRoom
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetRoom)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetRoom))
-> Logger
-> Service
-> Proxy GetRoom
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetRoom)))
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 Room -> Int -> GetRoomResponse
GetRoomResponse'
(Maybe Room -> Int -> GetRoomResponse)
-> Either String (Maybe Room)
-> Either String (Int -> GetRoomResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Room)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Room")
Either String (Int -> GetRoomResponse)
-> Either String Int -> Either String GetRoomResponse
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 GetRoom
instance Prelude.NFData GetRoom
instance Core.ToHeaders GetRoom where
toHeaders :: GetRoom -> ResponseHeaders
toHeaders = ResponseHeaders -> GetRoom -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath GetRoom where
toPath :: GetRoom -> ByteString
toPath GetRoom' {Text
roomId :: Text
accountId :: Text
$sel:roomId:GetRoom' :: GetRoom -> Text
$sel:accountId:GetRoom' :: GetRoom -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/accounts/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
accountId,
ByteString
"/rooms/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
roomId
]
instance Core.ToQuery GetRoom where
toQuery :: GetRoom -> QueryString
toQuery = QueryString -> GetRoom -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetRoomResponse = GetRoomResponse'
{
GetRoomResponse -> Maybe Room
room :: Prelude.Maybe Room,
GetRoomResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetRoomResponse -> GetRoomResponse -> Bool
(GetRoomResponse -> GetRoomResponse -> Bool)
-> (GetRoomResponse -> GetRoomResponse -> Bool)
-> Eq GetRoomResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRoomResponse -> GetRoomResponse -> Bool
$c/= :: GetRoomResponse -> GetRoomResponse -> Bool
== :: GetRoomResponse -> GetRoomResponse -> Bool
$c== :: GetRoomResponse -> GetRoomResponse -> Bool
Prelude.Eq, Int -> GetRoomResponse -> ShowS
[GetRoomResponse] -> ShowS
GetRoomResponse -> String
(Int -> GetRoomResponse -> ShowS)
-> (GetRoomResponse -> String)
-> ([GetRoomResponse] -> ShowS)
-> Show GetRoomResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRoomResponse] -> ShowS
$cshowList :: [GetRoomResponse] -> ShowS
show :: GetRoomResponse -> String
$cshow :: GetRoomResponse -> String
showsPrec :: Int -> GetRoomResponse -> ShowS
$cshowsPrec :: Int -> GetRoomResponse -> ShowS
Prelude.Show, (forall x. GetRoomResponse -> Rep GetRoomResponse x)
-> (forall x. Rep GetRoomResponse x -> GetRoomResponse)
-> Generic GetRoomResponse
forall x. Rep GetRoomResponse x -> GetRoomResponse
forall x. GetRoomResponse -> Rep GetRoomResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetRoomResponse x -> GetRoomResponse
$cfrom :: forall x. GetRoomResponse -> Rep GetRoomResponse x
Prelude.Generic)
newGetRoomResponse ::
Prelude.Int ->
GetRoomResponse
newGetRoomResponse :: Int -> GetRoomResponse
newGetRoomResponse Int
pHttpStatus_ =
GetRoomResponse' :: Maybe Room -> Int -> GetRoomResponse
GetRoomResponse'
{ $sel:room:GetRoomResponse' :: Maybe Room
room = Maybe Room
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetRoomResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getRoomResponse_room :: Lens.Lens' GetRoomResponse (Prelude.Maybe Room)
getRoomResponse_room :: (Maybe Room -> f (Maybe Room))
-> GetRoomResponse -> f GetRoomResponse
getRoomResponse_room = (GetRoomResponse -> Maybe Room)
-> (GetRoomResponse -> Maybe Room -> GetRoomResponse)
-> Lens GetRoomResponse GetRoomResponse (Maybe Room) (Maybe Room)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRoomResponse' {Maybe Room
room :: Maybe Room
$sel:room:GetRoomResponse' :: GetRoomResponse -> Maybe Room
room} -> Maybe Room
room) (\s :: GetRoomResponse
s@GetRoomResponse' {} Maybe Room
a -> GetRoomResponse
s {$sel:room:GetRoomResponse' :: Maybe Room
room = Maybe Room
a} :: GetRoomResponse)
getRoomResponse_httpStatus :: Lens.Lens' GetRoomResponse Prelude.Int
getRoomResponse_httpStatus :: (Int -> f Int) -> GetRoomResponse -> f GetRoomResponse
getRoomResponse_httpStatus = (GetRoomResponse -> Int)
-> (GetRoomResponse -> Int -> GetRoomResponse)
-> Lens GetRoomResponse GetRoomResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRoomResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetRoomResponse' :: GetRoomResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetRoomResponse
s@GetRoomResponse' {} Int
a -> GetRoomResponse
s {$sel:httpStatus:GetRoomResponse' :: Int
httpStatus = Int
a} :: GetRoomResponse)
instance Prelude.NFData GetRoomResponse