{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.AlexaBusiness.SearchRooms
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Searches rooms and lists the ones that meet a set of filter and sort
-- criteria.
--
-- This operation returns paginated results.
module Amazonka.AlexaBusiness.SearchRooms
  ( -- * Creating a Request
    SearchRooms (..),
    newSearchRooms,

    -- * Request Lenses
    searchRooms_filters,
    searchRooms_sortCriteria,
    searchRooms_nextToken,
    searchRooms_maxResults,

    -- * Destructuring the Response
    SearchRoomsResponse (..),
    newSearchRoomsResponse,

    -- * Response Lenses
    searchRoomsResponse_rooms,
    searchRoomsResponse_nextToken,
    searchRoomsResponse_totalCount,
    searchRoomsResponse_httpStatus,
  )
where

import Amazonka.AlexaBusiness.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

-- | /See:/ 'newSearchRooms' smart constructor.
data SearchRooms = SearchRooms'
  { -- | The filters to use to list a specified set of rooms. The supported
    -- filter keys are RoomName and ProfileName.
    SearchRooms -> Maybe [Filter]
filters :: Prelude.Maybe [Filter],
    -- | The sort order to use in listing the specified set of rooms. The
    -- supported sort keys are RoomName and ProfileName.
    SearchRooms -> Maybe [Sort]
sortCriteria :: Prelude.Maybe [Sort],
    -- | An optional token returned from a prior request. Use this token for
    -- pagination of results from this action. If this parameter is specified,
    -- the response includes only results beyond the token, up to the value
    -- specified by @MaxResults@.
    SearchRooms -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to include in the response. If more
    -- results exist than the specified @MaxResults@ value, a token is included
    -- in the response so that the remaining results can be retrieved.
    SearchRooms -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (SearchRooms -> SearchRooms -> Bool
(SearchRooms -> SearchRooms -> Bool)
-> (SearchRooms -> SearchRooms -> Bool) -> Eq SearchRooms
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchRooms -> SearchRooms -> Bool
$c/= :: SearchRooms -> SearchRooms -> Bool
== :: SearchRooms -> SearchRooms -> Bool
$c== :: SearchRooms -> SearchRooms -> Bool
Prelude.Eq, ReadPrec [SearchRooms]
ReadPrec SearchRooms
Int -> ReadS SearchRooms
ReadS [SearchRooms]
(Int -> ReadS SearchRooms)
-> ReadS [SearchRooms]
-> ReadPrec SearchRooms
-> ReadPrec [SearchRooms]
-> Read SearchRooms
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SearchRooms]
$creadListPrec :: ReadPrec [SearchRooms]
readPrec :: ReadPrec SearchRooms
$creadPrec :: ReadPrec SearchRooms
readList :: ReadS [SearchRooms]
$creadList :: ReadS [SearchRooms]
readsPrec :: Int -> ReadS SearchRooms
$creadsPrec :: Int -> ReadS SearchRooms
Prelude.Read, Int -> SearchRooms -> ShowS
[SearchRooms] -> ShowS
SearchRooms -> String
(Int -> SearchRooms -> ShowS)
-> (SearchRooms -> String)
-> ([SearchRooms] -> ShowS)
-> Show SearchRooms
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchRooms] -> ShowS
$cshowList :: [SearchRooms] -> ShowS
show :: SearchRooms -> String
$cshow :: SearchRooms -> String
showsPrec :: Int -> SearchRooms -> ShowS
$cshowsPrec :: Int -> SearchRooms -> ShowS
Prelude.Show, (forall x. SearchRooms -> Rep SearchRooms x)
-> (forall x. Rep SearchRooms x -> SearchRooms)
-> Generic SearchRooms
forall x. Rep SearchRooms x -> SearchRooms
forall x. SearchRooms -> Rep SearchRooms x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SearchRooms x -> SearchRooms
$cfrom :: forall x. SearchRooms -> Rep SearchRooms x
Prelude.Generic)

-- |
-- Create a value of 'SearchRooms' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'filters', 'searchRooms_filters' - The filters to use to list a specified set of rooms. The supported
-- filter keys are RoomName and ProfileName.
--
-- 'sortCriteria', 'searchRooms_sortCriteria' - The sort order to use in listing the specified set of rooms. The
-- supported sort keys are RoomName and ProfileName.
--
-- 'nextToken', 'searchRooms_nextToken' - An optional token returned from a prior request. Use this token for
-- pagination of results from this action. If this parameter is specified,
-- the response includes only results beyond the token, up to the value
-- specified by @MaxResults@.
--
-- 'maxResults', 'searchRooms_maxResults' - The maximum number of results to include in the response. If more
-- results exist than the specified @MaxResults@ value, a token is included
-- in the response so that the remaining results can be retrieved.
newSearchRooms ::
  SearchRooms
newSearchRooms :: SearchRooms
newSearchRooms =
  SearchRooms' :: Maybe [Filter]
-> Maybe [Sort] -> Maybe Text -> Maybe Natural -> SearchRooms
SearchRooms'
    { $sel:filters:SearchRooms' :: Maybe [Filter]
filters = Maybe [Filter]
forall a. Maybe a
Prelude.Nothing,
      $sel:sortCriteria:SearchRooms' :: Maybe [Sort]
sortCriteria = Maybe [Sort]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:SearchRooms' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:SearchRooms' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The filters to use to list a specified set of rooms. The supported
-- filter keys are RoomName and ProfileName.
searchRooms_filters :: Lens.Lens' SearchRooms (Prelude.Maybe [Filter])
searchRooms_filters :: (Maybe [Filter] -> f (Maybe [Filter]))
-> SearchRooms -> f SearchRooms
searchRooms_filters = (SearchRooms -> Maybe [Filter])
-> (SearchRooms -> Maybe [Filter] -> SearchRooms)
-> Lens SearchRooms SearchRooms (Maybe [Filter]) (Maybe [Filter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchRooms' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:SearchRooms' :: SearchRooms -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: SearchRooms
s@SearchRooms' {} Maybe [Filter]
a -> SearchRooms
s {$sel:filters:SearchRooms' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: SearchRooms) ((Maybe [Filter] -> f (Maybe [Filter]))
 -> SearchRooms -> f SearchRooms)
-> ((Maybe [Filter] -> f (Maybe [Filter]))
    -> Maybe [Filter] -> f (Maybe [Filter]))
-> (Maybe [Filter] -> f (Maybe [Filter]))
-> SearchRooms
-> f SearchRooms
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Filter] [Filter] [Filter] [Filter]
-> Iso
     (Maybe [Filter]) (Maybe [Filter]) (Maybe [Filter]) (Maybe [Filter])
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 [Filter] [Filter] [Filter] [Filter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The sort order to use in listing the specified set of rooms. The
-- supported sort keys are RoomName and ProfileName.
searchRooms_sortCriteria :: Lens.Lens' SearchRooms (Prelude.Maybe [Sort])
searchRooms_sortCriteria :: (Maybe [Sort] -> f (Maybe [Sort])) -> SearchRooms -> f SearchRooms
searchRooms_sortCriteria = (SearchRooms -> Maybe [Sort])
-> (SearchRooms -> Maybe [Sort] -> SearchRooms)
-> Lens SearchRooms SearchRooms (Maybe [Sort]) (Maybe [Sort])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchRooms' {Maybe [Sort]
sortCriteria :: Maybe [Sort]
$sel:sortCriteria:SearchRooms' :: SearchRooms -> Maybe [Sort]
sortCriteria} -> Maybe [Sort]
sortCriteria) (\s :: SearchRooms
s@SearchRooms' {} Maybe [Sort]
a -> SearchRooms
s {$sel:sortCriteria:SearchRooms' :: Maybe [Sort]
sortCriteria = Maybe [Sort]
a} :: SearchRooms) ((Maybe [Sort] -> f (Maybe [Sort]))
 -> SearchRooms -> f SearchRooms)
-> ((Maybe [Sort] -> f (Maybe [Sort]))
    -> Maybe [Sort] -> f (Maybe [Sort]))
-> (Maybe [Sort] -> f (Maybe [Sort]))
-> SearchRooms
-> f SearchRooms
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Sort] [Sort] [Sort] [Sort]
-> Iso (Maybe [Sort]) (Maybe [Sort]) (Maybe [Sort]) (Maybe [Sort])
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 [Sort] [Sort] [Sort] [Sort]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An optional token returned from a prior request. Use this token for
-- pagination of results from this action. If this parameter is specified,
-- the response includes only results beyond the token, up to the value
-- specified by @MaxResults@.
searchRooms_nextToken :: Lens.Lens' SearchRooms (Prelude.Maybe Prelude.Text)
searchRooms_nextToken :: (Maybe Text -> f (Maybe Text)) -> SearchRooms -> f SearchRooms
searchRooms_nextToken = (SearchRooms -> Maybe Text)
-> (SearchRooms -> Maybe Text -> SearchRooms)
-> Lens SearchRooms SearchRooms (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchRooms' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:SearchRooms' :: SearchRooms -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: SearchRooms
s@SearchRooms' {} Maybe Text
a -> SearchRooms
s {$sel:nextToken:SearchRooms' :: Maybe Text
nextToken = Maybe Text
a} :: SearchRooms)

-- | The maximum number of results to include in the response. If more
-- results exist than the specified @MaxResults@ value, a token is included
-- in the response so that the remaining results can be retrieved.
searchRooms_maxResults :: Lens.Lens' SearchRooms (Prelude.Maybe Prelude.Natural)
searchRooms_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> SearchRooms -> f SearchRooms
searchRooms_maxResults = (SearchRooms -> Maybe Natural)
-> (SearchRooms -> Maybe Natural -> SearchRooms)
-> Lens SearchRooms SearchRooms (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchRooms' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:SearchRooms' :: SearchRooms -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: SearchRooms
s@SearchRooms' {} Maybe Natural
a -> SearchRooms
s {$sel:maxResults:SearchRooms' :: Maybe Natural
maxResults = Maybe Natural
a} :: SearchRooms)

instance Core.AWSPager SearchRooms where
  page :: SearchRooms -> AWSResponse SearchRooms -> Maybe SearchRooms
page SearchRooms
rq AWSResponse SearchRooms
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse SearchRooms
SearchRoomsResponse
rs
            SearchRoomsResponse
-> Getting (First Text) SearchRoomsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> SearchRoomsResponse -> Const (First Text) SearchRoomsResponse
Lens' SearchRoomsResponse (Maybe Text)
searchRoomsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
 -> SearchRoomsResponse -> Const (First Text) SearchRoomsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) SearchRoomsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe SearchRooms
forall a. Maybe a
Prelude.Nothing
    | Maybe [RoomData] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse SearchRooms
SearchRoomsResponse
rs
            SearchRoomsResponse
-> Getting (First [RoomData]) SearchRoomsResponse [RoomData]
-> Maybe [RoomData]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [RoomData] -> Const (First [RoomData]) (Maybe [RoomData]))
-> SearchRoomsResponse
-> Const (First [RoomData]) SearchRoomsResponse
Lens' SearchRoomsResponse (Maybe [RoomData])
searchRoomsResponse_rooms ((Maybe [RoomData] -> Const (First [RoomData]) (Maybe [RoomData]))
 -> SearchRoomsResponse
 -> Const (First [RoomData]) SearchRoomsResponse)
-> (([RoomData] -> Const (First [RoomData]) [RoomData])
    -> Maybe [RoomData] -> Const (First [RoomData]) (Maybe [RoomData]))
-> Getting (First [RoomData]) SearchRoomsResponse [RoomData]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([RoomData] -> Const (First [RoomData]) [RoomData])
-> Maybe [RoomData] -> Const (First [RoomData]) (Maybe [RoomData])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe SearchRooms
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      SearchRooms -> Maybe SearchRooms
forall a. a -> Maybe a
Prelude.Just (SearchRooms -> Maybe SearchRooms)
-> SearchRooms -> Maybe SearchRooms
forall a b. (a -> b) -> a -> b
Prelude.$
        SearchRooms
rq
          SearchRooms -> (SearchRooms -> SearchRooms) -> SearchRooms
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> SearchRooms -> Identity SearchRooms
Lens SearchRooms SearchRooms (Maybe Text) (Maybe Text)
searchRooms_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> SearchRooms -> Identity SearchRooms)
-> Maybe Text -> SearchRooms -> SearchRooms
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse SearchRooms
SearchRoomsResponse
rs
          SearchRoomsResponse
-> Getting (First Text) SearchRoomsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> SearchRoomsResponse -> Const (First Text) SearchRoomsResponse
Lens' SearchRoomsResponse (Maybe Text)
searchRoomsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
 -> SearchRoomsResponse -> Const (First Text) SearchRoomsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) SearchRoomsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest SearchRooms where
  type AWSResponse SearchRooms = SearchRoomsResponse
  request :: SearchRooms -> Request SearchRooms
request = Service -> SearchRooms -> Request SearchRooms
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy SearchRooms
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SearchRooms)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse SearchRooms))
-> Logger
-> Service
-> Proxy SearchRooms
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SearchRooms)))
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 [RoomData]
-> Maybe Text -> Maybe Int -> Int -> SearchRoomsResponse
SearchRoomsResponse'
            (Maybe [RoomData]
 -> Maybe Text -> Maybe Int -> Int -> SearchRoomsResponse)
-> Either String (Maybe [RoomData])
-> Either
     String (Maybe Text -> Maybe Int -> Int -> SearchRoomsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [RoomData]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Rooms" Either String (Maybe (Maybe [RoomData]))
-> Maybe [RoomData] -> Either String (Maybe [RoomData])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [RoomData]
forall a. Monoid a => a
Prelude.mempty)
            Either
  String (Maybe Text -> Maybe Int -> Int -> SearchRoomsResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Int -> Int -> SearchRoomsResponse)
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 (Maybe Int -> Int -> SearchRoomsResponse)
-> Either String (Maybe Int)
-> Either String (Int -> SearchRoomsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Int)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"TotalCount")
            Either String (Int -> SearchRoomsResponse)
-> Either String Int -> Either String SearchRoomsResponse
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 SearchRooms

instance Prelude.NFData SearchRooms

instance Core.ToHeaders SearchRooms where
  toHeaders :: SearchRooms -> ResponseHeaders
toHeaders =
    ResponseHeaders -> SearchRooms -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AlexaForBusiness.SearchRooms" ::
                          Prelude.ByteString
                      ),
            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 SearchRooms where
  toJSON :: SearchRooms -> Value
toJSON SearchRooms' {Maybe Natural
Maybe [Filter]
Maybe [Sort]
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
sortCriteria :: Maybe [Sort]
filters :: Maybe [Filter]
$sel:maxResults:SearchRooms' :: SearchRooms -> Maybe Natural
$sel:nextToken:SearchRooms' :: SearchRooms -> Maybe Text
$sel:sortCriteria:SearchRooms' :: SearchRooms -> Maybe [Sort]
$sel:filters:SearchRooms' :: SearchRooms -> Maybe [Filter]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Filters" Text -> [Filter] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Filter] -> Pair) -> Maybe [Filter] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Filter]
filters,
            (Text
"SortCriteria" Text -> [Sort] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Sort] -> Pair) -> Maybe [Sort] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Sort]
sortCriteria,
            (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults
          ]
      )

instance Core.ToPath SearchRooms where
  toPath :: SearchRooms -> ByteString
toPath = ByteString -> SearchRooms -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery SearchRooms where
  toQuery :: SearchRooms -> QueryString
toQuery = QueryString -> SearchRooms -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newSearchRoomsResponse' smart constructor.
data SearchRoomsResponse = SearchRoomsResponse'
  { -- | The rooms that meet the specified set of filter criteria, in sort order.
    SearchRoomsResponse -> Maybe [RoomData]
rooms :: Prelude.Maybe [RoomData],
    -- | The token returned to indicate that there is more data available.
    SearchRoomsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The total number of rooms returned.
    SearchRoomsResponse -> Maybe Int
totalCount :: Prelude.Maybe Prelude.Int,
    -- | The response's http status code.
    SearchRoomsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (SearchRoomsResponse -> SearchRoomsResponse -> Bool
(SearchRoomsResponse -> SearchRoomsResponse -> Bool)
-> (SearchRoomsResponse -> SearchRoomsResponse -> Bool)
-> Eq SearchRoomsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchRoomsResponse -> SearchRoomsResponse -> Bool
$c/= :: SearchRoomsResponse -> SearchRoomsResponse -> Bool
== :: SearchRoomsResponse -> SearchRoomsResponse -> Bool
$c== :: SearchRoomsResponse -> SearchRoomsResponse -> Bool
Prelude.Eq, ReadPrec [SearchRoomsResponse]
ReadPrec SearchRoomsResponse
Int -> ReadS SearchRoomsResponse
ReadS [SearchRoomsResponse]
(Int -> ReadS SearchRoomsResponse)
-> ReadS [SearchRoomsResponse]
-> ReadPrec SearchRoomsResponse
-> ReadPrec [SearchRoomsResponse]
-> Read SearchRoomsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SearchRoomsResponse]
$creadListPrec :: ReadPrec [SearchRoomsResponse]
readPrec :: ReadPrec SearchRoomsResponse
$creadPrec :: ReadPrec SearchRoomsResponse
readList :: ReadS [SearchRoomsResponse]
$creadList :: ReadS [SearchRoomsResponse]
readsPrec :: Int -> ReadS SearchRoomsResponse
$creadsPrec :: Int -> ReadS SearchRoomsResponse
Prelude.Read, Int -> SearchRoomsResponse -> ShowS
[SearchRoomsResponse] -> ShowS
SearchRoomsResponse -> String
(Int -> SearchRoomsResponse -> ShowS)
-> (SearchRoomsResponse -> String)
-> ([SearchRoomsResponse] -> ShowS)
-> Show SearchRoomsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchRoomsResponse] -> ShowS
$cshowList :: [SearchRoomsResponse] -> ShowS
show :: SearchRoomsResponse -> String
$cshow :: SearchRoomsResponse -> String
showsPrec :: Int -> SearchRoomsResponse -> ShowS
$cshowsPrec :: Int -> SearchRoomsResponse -> ShowS
Prelude.Show, (forall x. SearchRoomsResponse -> Rep SearchRoomsResponse x)
-> (forall x. Rep SearchRoomsResponse x -> SearchRoomsResponse)
-> Generic SearchRoomsResponse
forall x. Rep SearchRoomsResponse x -> SearchRoomsResponse
forall x. SearchRoomsResponse -> Rep SearchRoomsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SearchRoomsResponse x -> SearchRoomsResponse
$cfrom :: forall x. SearchRoomsResponse -> Rep SearchRoomsResponse x
Prelude.Generic)

-- |
-- Create a value of 'SearchRoomsResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'rooms', 'searchRoomsResponse_rooms' - The rooms that meet the specified set of filter criteria, in sort order.
--
-- 'nextToken', 'searchRoomsResponse_nextToken' - The token returned to indicate that there is more data available.
--
-- 'totalCount', 'searchRoomsResponse_totalCount' - The total number of rooms returned.
--
-- 'httpStatus', 'searchRoomsResponse_httpStatus' - The response's http status code.
newSearchRoomsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  SearchRoomsResponse
newSearchRoomsResponse :: Int -> SearchRoomsResponse
newSearchRoomsResponse Int
pHttpStatus_ =
  SearchRoomsResponse' :: Maybe [RoomData]
-> Maybe Text -> Maybe Int -> Int -> SearchRoomsResponse
SearchRoomsResponse'
    { $sel:rooms:SearchRoomsResponse' :: Maybe [RoomData]
rooms = Maybe [RoomData]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:SearchRoomsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:totalCount:SearchRoomsResponse' :: Maybe Int
totalCount = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:SearchRoomsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The rooms that meet the specified set of filter criteria, in sort order.
searchRoomsResponse_rooms :: Lens.Lens' SearchRoomsResponse (Prelude.Maybe [RoomData])
searchRoomsResponse_rooms :: (Maybe [RoomData] -> f (Maybe [RoomData]))
-> SearchRoomsResponse -> f SearchRoomsResponse
searchRoomsResponse_rooms = (SearchRoomsResponse -> Maybe [RoomData])
-> (SearchRoomsResponse -> Maybe [RoomData] -> SearchRoomsResponse)
-> Lens' SearchRoomsResponse (Maybe [RoomData])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchRoomsResponse' {Maybe [RoomData]
rooms :: Maybe [RoomData]
$sel:rooms:SearchRoomsResponse' :: SearchRoomsResponse -> Maybe [RoomData]
rooms} -> Maybe [RoomData]
rooms) (\s :: SearchRoomsResponse
s@SearchRoomsResponse' {} Maybe [RoomData]
a -> SearchRoomsResponse
s {$sel:rooms:SearchRoomsResponse' :: Maybe [RoomData]
rooms = Maybe [RoomData]
a} :: SearchRoomsResponse) ((Maybe [RoomData] -> f (Maybe [RoomData]))
 -> SearchRoomsResponse -> f SearchRoomsResponse)
-> ((Maybe [RoomData] -> f (Maybe [RoomData]))
    -> Maybe [RoomData] -> f (Maybe [RoomData]))
-> (Maybe [RoomData] -> f (Maybe [RoomData]))
-> SearchRoomsResponse
-> f SearchRoomsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [RoomData] [RoomData] [RoomData] [RoomData]
-> Iso
     (Maybe [RoomData])
     (Maybe [RoomData])
     (Maybe [RoomData])
     (Maybe [RoomData])
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 [RoomData] [RoomData] [RoomData] [RoomData]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The token returned to indicate that there is more data available.
searchRoomsResponse_nextToken :: Lens.Lens' SearchRoomsResponse (Prelude.Maybe Prelude.Text)
searchRoomsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> SearchRoomsResponse -> f SearchRoomsResponse
searchRoomsResponse_nextToken = (SearchRoomsResponse -> Maybe Text)
-> (SearchRoomsResponse -> Maybe Text -> SearchRoomsResponse)
-> Lens' SearchRoomsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchRoomsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:SearchRoomsResponse' :: SearchRoomsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: SearchRoomsResponse
s@SearchRoomsResponse' {} Maybe Text
a -> SearchRoomsResponse
s {$sel:nextToken:SearchRoomsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: SearchRoomsResponse)

-- | The total number of rooms returned.
searchRoomsResponse_totalCount :: Lens.Lens' SearchRoomsResponse (Prelude.Maybe Prelude.Int)
searchRoomsResponse_totalCount :: (Maybe Int -> f (Maybe Int))
-> SearchRoomsResponse -> f SearchRoomsResponse
searchRoomsResponse_totalCount = (SearchRoomsResponse -> Maybe Int)
-> (SearchRoomsResponse -> Maybe Int -> SearchRoomsResponse)
-> Lens
     SearchRoomsResponse SearchRoomsResponse (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchRoomsResponse' {Maybe Int
totalCount :: Maybe Int
$sel:totalCount:SearchRoomsResponse' :: SearchRoomsResponse -> Maybe Int
totalCount} -> Maybe Int
totalCount) (\s :: SearchRoomsResponse
s@SearchRoomsResponse' {} Maybe Int
a -> SearchRoomsResponse
s {$sel:totalCount:SearchRoomsResponse' :: Maybe Int
totalCount = Maybe Int
a} :: SearchRoomsResponse)

-- | The response's http status code.
searchRoomsResponse_httpStatus :: Lens.Lens' SearchRoomsResponse Prelude.Int
searchRoomsResponse_httpStatus :: (Int -> f Int) -> SearchRoomsResponse -> f SearchRoomsResponse
searchRoomsResponse_httpStatus = (SearchRoomsResponse -> Int)
-> (SearchRoomsResponse -> Int -> SearchRoomsResponse)
-> Lens SearchRoomsResponse SearchRoomsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchRoomsResponse' {Int
httpStatus :: Int
$sel:httpStatus:SearchRoomsResponse' :: SearchRoomsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: SearchRoomsResponse
s@SearchRoomsResponse' {} Int
a -> SearchRoomsResponse
s {$sel:httpStatus:SearchRoomsResponse' :: Int
httpStatus = Int
a} :: SearchRoomsResponse)

instance Prelude.NFData SearchRoomsResponse