{-# 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.SearchProfiles
-- 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 room profiles and lists the ones that meet a set of filter
-- criteria.
--
-- This operation returns paginated results.
module Amazonka.AlexaBusiness.SearchProfiles
  ( -- * Creating a Request
    SearchProfiles (..),
    newSearchProfiles,

    -- * Request Lenses
    searchProfiles_filters,
    searchProfiles_sortCriteria,
    searchProfiles_nextToken,
    searchProfiles_maxResults,

    -- * Destructuring the Response
    SearchProfilesResponse (..),
    newSearchProfilesResponse,

    -- * Response Lenses
    searchProfilesResponse_profiles,
    searchProfilesResponse_nextToken,
    searchProfilesResponse_totalCount,
    searchProfilesResponse_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:/ 'newSearchProfiles' smart constructor.
data SearchProfiles = SearchProfiles'
  { -- | The filters to use to list a specified set of room profiles. Supported
    -- filter keys are ProfileName and Address. Required.
    SearchProfiles -> Maybe [Filter]
filters :: Prelude.Maybe [Filter],
    -- | The sort order to use in listing the specified set of room profiles.
    -- Supported sort keys are ProfileName and Address.
    SearchProfiles -> 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@.
    SearchProfiles -> 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.
    SearchProfiles -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (SearchProfiles -> SearchProfiles -> Bool
(SearchProfiles -> SearchProfiles -> Bool)
-> (SearchProfiles -> SearchProfiles -> Bool) -> Eq SearchProfiles
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchProfiles -> SearchProfiles -> Bool
$c/= :: SearchProfiles -> SearchProfiles -> Bool
== :: SearchProfiles -> SearchProfiles -> Bool
$c== :: SearchProfiles -> SearchProfiles -> Bool
Prelude.Eq, ReadPrec [SearchProfiles]
ReadPrec SearchProfiles
Int -> ReadS SearchProfiles
ReadS [SearchProfiles]
(Int -> ReadS SearchProfiles)
-> ReadS [SearchProfiles]
-> ReadPrec SearchProfiles
-> ReadPrec [SearchProfiles]
-> Read SearchProfiles
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SearchProfiles]
$creadListPrec :: ReadPrec [SearchProfiles]
readPrec :: ReadPrec SearchProfiles
$creadPrec :: ReadPrec SearchProfiles
readList :: ReadS [SearchProfiles]
$creadList :: ReadS [SearchProfiles]
readsPrec :: Int -> ReadS SearchProfiles
$creadsPrec :: Int -> ReadS SearchProfiles
Prelude.Read, Int -> SearchProfiles -> ShowS
[SearchProfiles] -> ShowS
SearchProfiles -> String
(Int -> SearchProfiles -> ShowS)
-> (SearchProfiles -> String)
-> ([SearchProfiles] -> ShowS)
-> Show SearchProfiles
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchProfiles] -> ShowS
$cshowList :: [SearchProfiles] -> ShowS
show :: SearchProfiles -> String
$cshow :: SearchProfiles -> String
showsPrec :: Int -> SearchProfiles -> ShowS
$cshowsPrec :: Int -> SearchProfiles -> ShowS
Prelude.Show, (forall x. SearchProfiles -> Rep SearchProfiles x)
-> (forall x. Rep SearchProfiles x -> SearchProfiles)
-> Generic SearchProfiles
forall x. Rep SearchProfiles x -> SearchProfiles
forall x. SearchProfiles -> Rep SearchProfiles x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SearchProfiles x -> SearchProfiles
$cfrom :: forall x. SearchProfiles -> Rep SearchProfiles x
Prelude.Generic)

-- |
-- Create a value of 'SearchProfiles' 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', 'searchProfiles_filters' - The filters to use to list a specified set of room profiles. Supported
-- filter keys are ProfileName and Address. Required.
--
-- 'sortCriteria', 'searchProfiles_sortCriteria' - The sort order to use in listing the specified set of room profiles.
-- Supported sort keys are ProfileName and Address.
--
-- 'nextToken', 'searchProfiles_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', 'searchProfiles_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.
newSearchProfiles ::
  SearchProfiles
newSearchProfiles :: SearchProfiles
newSearchProfiles =
  SearchProfiles' :: Maybe [Filter]
-> Maybe [Sort] -> Maybe Text -> Maybe Natural -> SearchProfiles
SearchProfiles'
    { $sel:filters:SearchProfiles' :: Maybe [Filter]
filters = Maybe [Filter]
forall a. Maybe a
Prelude.Nothing,
      $sel:sortCriteria:SearchProfiles' :: Maybe [Sort]
sortCriteria = Maybe [Sort]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:SearchProfiles' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:SearchProfiles' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The filters to use to list a specified set of room profiles. Supported
-- filter keys are ProfileName and Address. Required.
searchProfiles_filters :: Lens.Lens' SearchProfiles (Prelude.Maybe [Filter])
searchProfiles_filters :: (Maybe [Filter] -> f (Maybe [Filter]))
-> SearchProfiles -> f SearchProfiles
searchProfiles_filters = (SearchProfiles -> Maybe [Filter])
-> (SearchProfiles -> Maybe [Filter] -> SearchProfiles)
-> Lens
     SearchProfiles SearchProfiles (Maybe [Filter]) (Maybe [Filter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchProfiles' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:SearchProfiles' :: SearchProfiles -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: SearchProfiles
s@SearchProfiles' {} Maybe [Filter]
a -> SearchProfiles
s {$sel:filters:SearchProfiles' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: SearchProfiles) ((Maybe [Filter] -> f (Maybe [Filter]))
 -> SearchProfiles -> f SearchProfiles)
-> ((Maybe [Filter] -> f (Maybe [Filter]))
    -> Maybe [Filter] -> f (Maybe [Filter]))
-> (Maybe [Filter] -> f (Maybe [Filter]))
-> SearchProfiles
-> f SearchProfiles
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 room profiles.
-- Supported sort keys are ProfileName and Address.
searchProfiles_sortCriteria :: Lens.Lens' SearchProfiles (Prelude.Maybe [Sort])
searchProfiles_sortCriteria :: (Maybe [Sort] -> f (Maybe [Sort]))
-> SearchProfiles -> f SearchProfiles
searchProfiles_sortCriteria = (SearchProfiles -> Maybe [Sort])
-> (SearchProfiles -> Maybe [Sort] -> SearchProfiles)
-> Lens SearchProfiles SearchProfiles (Maybe [Sort]) (Maybe [Sort])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchProfiles' {Maybe [Sort]
sortCriteria :: Maybe [Sort]
$sel:sortCriteria:SearchProfiles' :: SearchProfiles -> Maybe [Sort]
sortCriteria} -> Maybe [Sort]
sortCriteria) (\s :: SearchProfiles
s@SearchProfiles' {} Maybe [Sort]
a -> SearchProfiles
s {$sel:sortCriteria:SearchProfiles' :: Maybe [Sort]
sortCriteria = Maybe [Sort]
a} :: SearchProfiles) ((Maybe [Sort] -> f (Maybe [Sort]))
 -> SearchProfiles -> f SearchProfiles)
-> ((Maybe [Sort] -> f (Maybe [Sort]))
    -> Maybe [Sort] -> f (Maybe [Sort]))
-> (Maybe [Sort] -> f (Maybe [Sort]))
-> SearchProfiles
-> f SearchProfiles
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@.
searchProfiles_nextToken :: Lens.Lens' SearchProfiles (Prelude.Maybe Prelude.Text)
searchProfiles_nextToken :: (Maybe Text -> f (Maybe Text))
-> SearchProfiles -> f SearchProfiles
searchProfiles_nextToken = (SearchProfiles -> Maybe Text)
-> (SearchProfiles -> Maybe Text -> SearchProfiles)
-> Lens SearchProfiles SearchProfiles (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchProfiles' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:SearchProfiles' :: SearchProfiles -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: SearchProfiles
s@SearchProfiles' {} Maybe Text
a -> SearchProfiles
s {$sel:nextToken:SearchProfiles' :: Maybe Text
nextToken = Maybe Text
a} :: SearchProfiles)

-- | 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.
searchProfiles_maxResults :: Lens.Lens' SearchProfiles (Prelude.Maybe Prelude.Natural)
searchProfiles_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> SearchProfiles -> f SearchProfiles
searchProfiles_maxResults = (SearchProfiles -> Maybe Natural)
-> (SearchProfiles -> Maybe Natural -> SearchProfiles)
-> Lens
     SearchProfiles SearchProfiles (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchProfiles' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:SearchProfiles' :: SearchProfiles -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: SearchProfiles
s@SearchProfiles' {} Maybe Natural
a -> SearchProfiles
s {$sel:maxResults:SearchProfiles' :: Maybe Natural
maxResults = Maybe Natural
a} :: SearchProfiles)

instance Core.AWSPager SearchProfiles where
  page :: SearchProfiles
-> AWSResponse SearchProfiles -> Maybe SearchProfiles
page SearchProfiles
rq AWSResponse SearchProfiles
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse SearchProfiles
SearchProfilesResponse
rs
            SearchProfilesResponse
-> Getting (First Text) SearchProfilesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> SearchProfilesResponse
-> Const (First Text) SearchProfilesResponse
Lens' SearchProfilesResponse (Maybe Text)
searchProfilesResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> SearchProfilesResponse
 -> Const (First Text) SearchProfilesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) SearchProfilesResponse 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 SearchProfiles
forall a. Maybe a
Prelude.Nothing
    | Maybe [ProfileData] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse SearchProfiles
SearchProfilesResponse
rs
            SearchProfilesResponse
-> Getting
     (First [ProfileData]) SearchProfilesResponse [ProfileData]
-> Maybe [ProfileData]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [ProfileData]
 -> Const (First [ProfileData]) (Maybe [ProfileData]))
-> SearchProfilesResponse
-> Const (First [ProfileData]) SearchProfilesResponse
Lens' SearchProfilesResponse (Maybe [ProfileData])
searchProfilesResponse_profiles ((Maybe [ProfileData]
  -> Const (First [ProfileData]) (Maybe [ProfileData]))
 -> SearchProfilesResponse
 -> Const (First [ProfileData]) SearchProfilesResponse)
-> (([ProfileData] -> Const (First [ProfileData]) [ProfileData])
    -> Maybe [ProfileData]
    -> Const (First [ProfileData]) (Maybe [ProfileData]))
-> Getting
     (First [ProfileData]) SearchProfilesResponse [ProfileData]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ProfileData] -> Const (First [ProfileData]) [ProfileData])
-> Maybe [ProfileData]
-> Const (First [ProfileData]) (Maybe [ProfileData])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe SearchProfiles
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      SearchProfiles -> Maybe SearchProfiles
forall a. a -> Maybe a
Prelude.Just (SearchProfiles -> Maybe SearchProfiles)
-> SearchProfiles -> Maybe SearchProfiles
forall a b. (a -> b) -> a -> b
Prelude.$
        SearchProfiles
rq
          SearchProfiles
-> (SearchProfiles -> SearchProfiles) -> SearchProfiles
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> SearchProfiles -> Identity SearchProfiles
Lens SearchProfiles SearchProfiles (Maybe Text) (Maybe Text)
searchProfiles_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> SearchProfiles -> Identity SearchProfiles)
-> Maybe Text -> SearchProfiles -> SearchProfiles
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse SearchProfiles
SearchProfilesResponse
rs
          SearchProfilesResponse
-> Getting (First Text) SearchProfilesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> SearchProfilesResponse
-> Const (First Text) SearchProfilesResponse
Lens' SearchProfilesResponse (Maybe Text)
searchProfilesResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
 -> SearchProfilesResponse
 -> Const (First Text) SearchProfilesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) SearchProfilesResponse 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 SearchProfiles where
  type
    AWSResponse SearchProfiles =
      SearchProfilesResponse
  request :: SearchProfiles -> Request SearchProfiles
request = Service -> SearchProfiles -> Request SearchProfiles
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy SearchProfiles
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SearchProfiles)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse SearchProfiles))
-> Logger
-> Service
-> Proxy SearchProfiles
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SearchProfiles)))
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 [ProfileData]
-> Maybe Text -> Maybe Int -> Int -> SearchProfilesResponse
SearchProfilesResponse'
            (Maybe [ProfileData]
 -> Maybe Text -> Maybe Int -> Int -> SearchProfilesResponse)
-> Either String (Maybe [ProfileData])
-> Either
     String (Maybe Text -> Maybe Int -> Int -> SearchProfilesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [ProfileData]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Profiles" Either String (Maybe (Maybe [ProfileData]))
-> Maybe [ProfileData] -> Either String (Maybe [ProfileData])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ProfileData]
forall a. Monoid a => a
Prelude.mempty)
            Either
  String (Maybe Text -> Maybe Int -> Int -> SearchProfilesResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Int -> Int -> SearchProfilesResponse)
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 -> SearchProfilesResponse)
-> Either String (Maybe Int)
-> Either String (Int -> SearchProfilesResponse)
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 -> SearchProfilesResponse)
-> Either String Int -> Either String SearchProfilesResponse
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 SearchProfiles

instance Prelude.NFData SearchProfiles

instance Core.ToHeaders SearchProfiles where
  toHeaders :: SearchProfiles -> ResponseHeaders
toHeaders =
    ResponseHeaders -> SearchProfiles -> 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.SearchProfiles" ::
                          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 SearchProfiles where
  toJSON :: SearchProfiles -> Value
toJSON SearchProfiles' {Maybe Natural
Maybe [Filter]
Maybe [Sort]
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
sortCriteria :: Maybe [Sort]
filters :: Maybe [Filter]
$sel:maxResults:SearchProfiles' :: SearchProfiles -> Maybe Natural
$sel:nextToken:SearchProfiles' :: SearchProfiles -> Maybe Text
$sel:sortCriteria:SearchProfiles' :: SearchProfiles -> Maybe [Sort]
$sel:filters:SearchProfiles' :: SearchProfiles -> 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 SearchProfiles where
  toPath :: SearchProfiles -> ByteString
toPath = ByteString -> SearchProfiles -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

-- |
-- Create a value of 'SearchProfilesResponse' 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:
--
-- 'profiles', 'searchProfilesResponse_profiles' - The profiles that meet the specified set of filter criteria, in sort
-- order.
--
-- 'nextToken', 'searchProfilesResponse_nextToken' - The token returned to indicate that there is more data available.
--
-- 'totalCount', 'searchProfilesResponse_totalCount' - The total number of room profiles returned.
--
-- 'httpStatus', 'searchProfilesResponse_httpStatus' - The response's http status code.
newSearchProfilesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  SearchProfilesResponse
newSearchProfilesResponse :: Int -> SearchProfilesResponse
newSearchProfilesResponse Int
pHttpStatus_ =
  SearchProfilesResponse' :: Maybe [ProfileData]
-> Maybe Text -> Maybe Int -> Int -> SearchProfilesResponse
SearchProfilesResponse'
    { $sel:profiles:SearchProfilesResponse' :: Maybe [ProfileData]
profiles = Maybe [ProfileData]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:SearchProfilesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:totalCount:SearchProfilesResponse' :: Maybe Int
totalCount = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:SearchProfilesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The profiles that meet the specified set of filter criteria, in sort
-- order.
searchProfilesResponse_profiles :: Lens.Lens' SearchProfilesResponse (Prelude.Maybe [ProfileData])
searchProfilesResponse_profiles :: (Maybe [ProfileData] -> f (Maybe [ProfileData]))
-> SearchProfilesResponse -> f SearchProfilesResponse
searchProfilesResponse_profiles = (SearchProfilesResponse -> Maybe [ProfileData])
-> (SearchProfilesResponse
    -> Maybe [ProfileData] -> SearchProfilesResponse)
-> Lens' SearchProfilesResponse (Maybe [ProfileData])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchProfilesResponse' {Maybe [ProfileData]
profiles :: Maybe [ProfileData]
$sel:profiles:SearchProfilesResponse' :: SearchProfilesResponse -> Maybe [ProfileData]
profiles} -> Maybe [ProfileData]
profiles) (\s :: SearchProfilesResponse
s@SearchProfilesResponse' {} Maybe [ProfileData]
a -> SearchProfilesResponse
s {$sel:profiles:SearchProfilesResponse' :: Maybe [ProfileData]
profiles = Maybe [ProfileData]
a} :: SearchProfilesResponse) ((Maybe [ProfileData] -> f (Maybe [ProfileData]))
 -> SearchProfilesResponse -> f SearchProfilesResponse)
-> ((Maybe [ProfileData] -> f (Maybe [ProfileData]))
    -> Maybe [ProfileData] -> f (Maybe [ProfileData]))
-> (Maybe [ProfileData] -> f (Maybe [ProfileData]))
-> SearchProfilesResponse
-> f SearchProfilesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [ProfileData] [ProfileData] [ProfileData] [ProfileData]
-> Iso
     (Maybe [ProfileData])
     (Maybe [ProfileData])
     (Maybe [ProfileData])
     (Maybe [ProfileData])
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 [ProfileData] [ProfileData] [ProfileData] [ProfileData]
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.
searchProfilesResponse_nextToken :: Lens.Lens' SearchProfilesResponse (Prelude.Maybe Prelude.Text)
searchProfilesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> SearchProfilesResponse -> f SearchProfilesResponse
searchProfilesResponse_nextToken = (SearchProfilesResponse -> Maybe Text)
-> (SearchProfilesResponse -> Maybe Text -> SearchProfilesResponse)
-> Lens' SearchProfilesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchProfilesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:SearchProfilesResponse' :: SearchProfilesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: SearchProfilesResponse
s@SearchProfilesResponse' {} Maybe Text
a -> SearchProfilesResponse
s {$sel:nextToken:SearchProfilesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: SearchProfilesResponse)

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

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

instance Prelude.NFData SearchProfilesResponse