{-# 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.ListRooms
(
ListRooms (..),
newListRooms,
listRooms_memberId,
listRooms_nextToken,
listRooms_maxResults,
listRooms_accountId,
ListRoomsResponse (..),
newListRoomsResponse,
listRoomsResponse_rooms,
listRoomsResponse_nextToken,
listRoomsResponse_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 ListRooms = ListRooms'
{
ListRooms -> Maybe Text
memberId :: Prelude.Maybe Prelude.Text,
ListRooms -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListRooms -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListRooms -> Text
accountId :: Prelude.Text
}
deriving (ListRooms -> ListRooms -> Bool
(ListRooms -> ListRooms -> Bool)
-> (ListRooms -> ListRooms -> Bool) -> Eq ListRooms
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListRooms -> ListRooms -> Bool
$c/= :: ListRooms -> ListRooms -> Bool
== :: ListRooms -> ListRooms -> Bool
$c== :: ListRooms -> ListRooms -> Bool
Prelude.Eq, ReadPrec [ListRooms]
ReadPrec ListRooms
Int -> ReadS ListRooms
ReadS [ListRooms]
(Int -> ReadS ListRooms)
-> ReadS [ListRooms]
-> ReadPrec ListRooms
-> ReadPrec [ListRooms]
-> Read ListRooms
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListRooms]
$creadListPrec :: ReadPrec [ListRooms]
readPrec :: ReadPrec ListRooms
$creadPrec :: ReadPrec ListRooms
readList :: ReadS [ListRooms]
$creadList :: ReadS [ListRooms]
readsPrec :: Int -> ReadS ListRooms
$creadsPrec :: Int -> ReadS ListRooms
Prelude.Read, Int -> ListRooms -> ShowS
[ListRooms] -> ShowS
ListRooms -> String
(Int -> ListRooms -> ShowS)
-> (ListRooms -> String)
-> ([ListRooms] -> ShowS)
-> Show ListRooms
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListRooms] -> ShowS
$cshowList :: [ListRooms] -> ShowS
show :: ListRooms -> String
$cshow :: ListRooms -> String
showsPrec :: Int -> ListRooms -> ShowS
$cshowsPrec :: Int -> ListRooms -> ShowS
Prelude.Show, (forall x. ListRooms -> Rep ListRooms x)
-> (forall x. Rep ListRooms x -> ListRooms) -> Generic ListRooms
forall x. Rep ListRooms x -> ListRooms
forall x. ListRooms -> Rep ListRooms x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListRooms x -> ListRooms
$cfrom :: forall x. ListRooms -> Rep ListRooms x
Prelude.Generic)
newListRooms ::
Prelude.Text ->
ListRooms
newListRooms :: Text -> ListRooms
newListRooms Text
pAccountId_ =
ListRooms' :: Maybe Text -> Maybe Text -> Maybe Natural -> Text -> ListRooms
ListRooms'
{ $sel:memberId:ListRooms' :: Maybe Text
memberId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListRooms' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListRooms' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:accountId:ListRooms' :: Text
accountId = Text
pAccountId_
}
listRooms_memberId :: Lens.Lens' ListRooms (Prelude.Maybe Prelude.Text)
listRooms_memberId :: (Maybe Text -> f (Maybe Text)) -> ListRooms -> f ListRooms
listRooms_memberId = (ListRooms -> Maybe Text)
-> (ListRooms -> Maybe Text -> ListRooms)
-> Lens ListRooms ListRooms (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRooms' {Maybe Text
memberId :: Maybe Text
$sel:memberId:ListRooms' :: ListRooms -> Maybe Text
memberId} -> Maybe Text
memberId) (\s :: ListRooms
s@ListRooms' {} Maybe Text
a -> ListRooms
s {$sel:memberId:ListRooms' :: Maybe Text
memberId = Maybe Text
a} :: ListRooms)
listRooms_nextToken :: Lens.Lens' ListRooms (Prelude.Maybe Prelude.Text)
listRooms_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListRooms -> f ListRooms
listRooms_nextToken = (ListRooms -> Maybe Text)
-> (ListRooms -> Maybe Text -> ListRooms)
-> Lens ListRooms ListRooms (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRooms' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListRooms' :: ListRooms -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListRooms
s@ListRooms' {} Maybe Text
a -> ListRooms
s {$sel:nextToken:ListRooms' :: Maybe Text
nextToken = Maybe Text
a} :: ListRooms)
listRooms_maxResults :: Lens.Lens' ListRooms (Prelude.Maybe Prelude.Natural)
listRooms_maxResults :: (Maybe Natural -> f (Maybe Natural)) -> ListRooms -> f ListRooms
listRooms_maxResults = (ListRooms -> Maybe Natural)
-> (ListRooms -> Maybe Natural -> ListRooms)
-> Lens ListRooms ListRooms (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRooms' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListRooms' :: ListRooms -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListRooms
s@ListRooms' {} Maybe Natural
a -> ListRooms
s {$sel:maxResults:ListRooms' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListRooms)
listRooms_accountId :: Lens.Lens' ListRooms Prelude.Text
listRooms_accountId :: (Text -> f Text) -> ListRooms -> f ListRooms
listRooms_accountId = (ListRooms -> Text)
-> (ListRooms -> Text -> ListRooms)
-> Lens ListRooms ListRooms Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRooms' {Text
accountId :: Text
$sel:accountId:ListRooms' :: ListRooms -> Text
accountId} -> Text
accountId) (\s :: ListRooms
s@ListRooms' {} Text
a -> ListRooms
s {$sel:accountId:ListRooms' :: Text
accountId = Text
a} :: ListRooms)
instance Core.AWSRequest ListRooms where
type AWSResponse ListRooms = ListRoomsResponse
request :: ListRooms -> Request ListRooms
request = Service -> ListRooms -> Request ListRooms
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy ListRooms
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListRooms)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListRooms))
-> Logger
-> Service
-> Proxy ListRooms
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListRooms)))
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] -> Maybe Text -> Int -> ListRoomsResponse
ListRoomsResponse'
(Maybe [Room] -> Maybe Text -> Int -> ListRoomsResponse)
-> Either String (Maybe [Room])
-> Either String (Maybe Text -> Int -> ListRoomsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Room]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Rooms" Either String (Maybe (Maybe [Room]))
-> Maybe [Room] -> Either String (Maybe [Room])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Room]
forall a. Monoid a => a
Prelude.mempty)
Either String (Maybe Text -> Int -> ListRoomsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListRoomsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
Either String (Int -> ListRoomsResponse)
-> Either String Int -> Either String ListRoomsResponse
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 ListRooms
instance Prelude.NFData ListRooms
instance Core.ToHeaders ListRooms where
toHeaders :: ListRooms -> ResponseHeaders
toHeaders = ResponseHeaders -> ListRooms -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath ListRooms where
toPath :: ListRooms -> ByteString
toPath ListRooms' {Maybe Natural
Maybe Text
Text
accountId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
memberId :: Maybe Text
$sel:accountId:ListRooms' :: ListRooms -> Text
$sel:maxResults:ListRooms' :: ListRooms -> Maybe Natural
$sel:nextToken:ListRooms' :: ListRooms -> Maybe Text
$sel:memberId:ListRooms' :: ListRooms -> Maybe 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"]
instance Core.ToQuery ListRooms where
toQuery :: ListRooms -> QueryString
toQuery ListRooms' {Maybe Natural
Maybe Text
Text
accountId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
memberId :: Maybe Text
$sel:accountId:ListRooms' :: ListRooms -> Text
$sel:maxResults:ListRooms' :: ListRooms -> Maybe Natural
$sel:nextToken:ListRooms' :: ListRooms -> Maybe Text
$sel:memberId:ListRooms' :: ListRooms -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"member-id" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
memberId,
ByteString
"next-token" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
ByteString
"max-results" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
]
data ListRoomsResponse = ListRoomsResponse'
{
ListRoomsResponse -> Maybe [Room]
rooms :: Prelude.Maybe [Room],
ListRoomsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListRoomsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListRoomsResponse -> ListRoomsResponse -> Bool
(ListRoomsResponse -> ListRoomsResponse -> Bool)
-> (ListRoomsResponse -> ListRoomsResponse -> Bool)
-> Eq ListRoomsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListRoomsResponse -> ListRoomsResponse -> Bool
$c/= :: ListRoomsResponse -> ListRoomsResponse -> Bool
== :: ListRoomsResponse -> ListRoomsResponse -> Bool
$c== :: ListRoomsResponse -> ListRoomsResponse -> Bool
Prelude.Eq, Int -> ListRoomsResponse -> ShowS
[ListRoomsResponse] -> ShowS
ListRoomsResponse -> String
(Int -> ListRoomsResponse -> ShowS)
-> (ListRoomsResponse -> String)
-> ([ListRoomsResponse] -> ShowS)
-> Show ListRoomsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListRoomsResponse] -> ShowS
$cshowList :: [ListRoomsResponse] -> ShowS
show :: ListRoomsResponse -> String
$cshow :: ListRoomsResponse -> String
showsPrec :: Int -> ListRoomsResponse -> ShowS
$cshowsPrec :: Int -> ListRoomsResponse -> ShowS
Prelude.Show, (forall x. ListRoomsResponse -> Rep ListRoomsResponse x)
-> (forall x. Rep ListRoomsResponse x -> ListRoomsResponse)
-> Generic ListRoomsResponse
forall x. Rep ListRoomsResponse x -> ListRoomsResponse
forall x. ListRoomsResponse -> Rep ListRoomsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListRoomsResponse x -> ListRoomsResponse
$cfrom :: forall x. ListRoomsResponse -> Rep ListRoomsResponse x
Prelude.Generic)
newListRoomsResponse ::
Prelude.Int ->
ListRoomsResponse
newListRoomsResponse :: Int -> ListRoomsResponse
newListRoomsResponse Int
pHttpStatus_ =
ListRoomsResponse' :: Maybe [Room] -> Maybe Text -> Int -> ListRoomsResponse
ListRoomsResponse'
{ $sel:rooms:ListRoomsResponse' :: Maybe [Room]
rooms = Maybe [Room]
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListRoomsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListRoomsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listRoomsResponse_rooms :: Lens.Lens' ListRoomsResponse (Prelude.Maybe [Room])
listRoomsResponse_rooms :: (Maybe [Room] -> f (Maybe [Room]))
-> ListRoomsResponse -> f ListRoomsResponse
listRoomsResponse_rooms = (ListRoomsResponse -> Maybe [Room])
-> (ListRoomsResponse -> Maybe [Room] -> ListRoomsResponse)
-> Lens
ListRoomsResponse ListRoomsResponse (Maybe [Room]) (Maybe [Room])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRoomsResponse' {Maybe [Room]
rooms :: Maybe [Room]
$sel:rooms:ListRoomsResponse' :: ListRoomsResponse -> Maybe [Room]
rooms} -> Maybe [Room]
rooms) (\s :: ListRoomsResponse
s@ListRoomsResponse' {} Maybe [Room]
a -> ListRoomsResponse
s {$sel:rooms:ListRoomsResponse' :: Maybe [Room]
rooms = Maybe [Room]
a} :: ListRoomsResponse) ((Maybe [Room] -> f (Maybe [Room]))
-> ListRoomsResponse -> f ListRoomsResponse)
-> ((Maybe [Room] -> f (Maybe [Room]))
-> Maybe [Room] -> f (Maybe [Room]))
-> (Maybe [Room] -> f (Maybe [Room]))
-> ListRoomsResponse
-> f ListRoomsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Room] [Room] [Room] [Room]
-> Iso (Maybe [Room]) (Maybe [Room]) (Maybe [Room]) (Maybe [Room])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Room] [Room] [Room] [Room]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listRoomsResponse_nextToken :: Lens.Lens' ListRoomsResponse (Prelude.Maybe Prelude.Text)
listRoomsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListRoomsResponse -> f ListRoomsResponse
listRoomsResponse_nextToken = (ListRoomsResponse -> Maybe Text)
-> (ListRoomsResponse -> Maybe Text -> ListRoomsResponse)
-> Lens
ListRoomsResponse ListRoomsResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRoomsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListRoomsResponse' :: ListRoomsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListRoomsResponse
s@ListRoomsResponse' {} Maybe Text
a -> ListRoomsResponse
s {$sel:nextToken:ListRoomsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListRoomsResponse)
listRoomsResponse_httpStatus :: Lens.Lens' ListRoomsResponse Prelude.Int
listRoomsResponse_httpStatus :: (Int -> f Int) -> ListRoomsResponse -> f ListRoomsResponse
listRoomsResponse_httpStatus = (ListRoomsResponse -> Int)
-> (ListRoomsResponse -> Int -> ListRoomsResponse)
-> Lens ListRoomsResponse ListRoomsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRoomsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListRoomsResponse' :: ListRoomsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListRoomsResponse
s@ListRoomsResponse' {} Int
a -> ListRoomsResponse
s {$sel:httpStatus:ListRoomsResponse' :: Int
httpStatus = Int
a} :: ListRoomsResponse)
instance Prelude.NFData ListRoomsResponse