{-# 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.ServiceCatalog.SearchProducts
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets information about the products to which the caller has access.
module Amazonka.ServiceCatalog.SearchProducts
  ( -- * Creating a Request
    SearchProducts (..),
    newSearchProducts,

    -- * Request Lenses
    searchProducts_acceptLanguage,
    searchProducts_filters,
    searchProducts_pageSize,
    searchProducts_pageToken,
    searchProducts_sortBy,
    searchProducts_sortOrder,

    -- * Destructuring the Response
    SearchProductsResponse (..),
    newSearchProductsResponse,

    -- * Response Lenses
    searchProductsResponse_nextPageToken,
    searchProductsResponse_productViewAggregations,
    searchProductsResponse_productViewSummaries,
    searchProductsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.ServiceCatalog.Types

-- | /See:/ 'newSearchProducts' smart constructor.
data SearchProducts = SearchProducts'
  { -- | The language code.
    --
    -- -   @en@ - English (default)
    --
    -- -   @jp@ - Japanese
    --
    -- -   @zh@ - Chinese
    SearchProducts -> Maybe Text
acceptLanguage :: Prelude.Maybe Prelude.Text,
    -- | The search filters. If no search filters are specified, the output
    -- includes all products to which the caller has access.
    SearchProducts -> Maybe (HashMap ProductViewFilterBy [Text])
filters :: Prelude.Maybe (Prelude.HashMap ProductViewFilterBy [Prelude.Text]),
    -- | The maximum number of items to return with this call.
    SearchProducts -> Maybe Natural
pageSize :: Prelude.Maybe Prelude.Natural,
    -- | The page token for the next set of results. To retrieve the first set of
    -- results, use null.
    SearchProducts -> Maybe Text
pageToken :: Prelude.Maybe Prelude.Text,
    -- | The sort field. If no value is specified, the results are not sorted.
    SearchProducts -> Maybe ProductViewSortBy
sortBy :: Prelude.Maybe ProductViewSortBy,
    -- | The sort order. If no value is specified, the results are not sorted.
    SearchProducts -> Maybe SortOrder
sortOrder :: Prelude.Maybe SortOrder
  }
  deriving (SearchProducts -> SearchProducts -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchProducts -> SearchProducts -> Bool
$c/= :: SearchProducts -> SearchProducts -> Bool
== :: SearchProducts -> SearchProducts -> Bool
$c== :: SearchProducts -> SearchProducts -> Bool
Prelude.Eq, ReadPrec [SearchProducts]
ReadPrec SearchProducts
Int -> ReadS SearchProducts
ReadS [SearchProducts]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SearchProducts]
$creadListPrec :: ReadPrec [SearchProducts]
readPrec :: ReadPrec SearchProducts
$creadPrec :: ReadPrec SearchProducts
readList :: ReadS [SearchProducts]
$creadList :: ReadS [SearchProducts]
readsPrec :: Int -> ReadS SearchProducts
$creadsPrec :: Int -> ReadS SearchProducts
Prelude.Read, Int -> SearchProducts -> ShowS
[SearchProducts] -> ShowS
SearchProducts -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchProducts] -> ShowS
$cshowList :: [SearchProducts] -> ShowS
show :: SearchProducts -> String
$cshow :: SearchProducts -> String
showsPrec :: Int -> SearchProducts -> ShowS
$cshowsPrec :: Int -> SearchProducts -> ShowS
Prelude.Show, forall x. Rep SearchProducts x -> SearchProducts
forall x. SearchProducts -> Rep SearchProducts x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SearchProducts x -> SearchProducts
$cfrom :: forall x. SearchProducts -> Rep SearchProducts x
Prelude.Generic)

-- |
-- Create a value of 'SearchProducts' 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:
--
-- 'acceptLanguage', 'searchProducts_acceptLanguage' - The language code.
--
-- -   @en@ - English (default)
--
-- -   @jp@ - Japanese
--
-- -   @zh@ - Chinese
--
-- 'filters', 'searchProducts_filters' - The search filters. If no search filters are specified, the output
-- includes all products to which the caller has access.
--
-- 'pageSize', 'searchProducts_pageSize' - The maximum number of items to return with this call.
--
-- 'pageToken', 'searchProducts_pageToken' - The page token for the next set of results. To retrieve the first set of
-- results, use null.
--
-- 'sortBy', 'searchProducts_sortBy' - The sort field. If no value is specified, the results are not sorted.
--
-- 'sortOrder', 'searchProducts_sortOrder' - The sort order. If no value is specified, the results are not sorted.
newSearchProducts ::
  SearchProducts
newSearchProducts :: SearchProducts
newSearchProducts =
  SearchProducts'
    { $sel:acceptLanguage:SearchProducts' :: Maybe Text
acceptLanguage = forall a. Maybe a
Prelude.Nothing,
      $sel:filters:SearchProducts' :: Maybe (HashMap ProductViewFilterBy [Text])
filters = forall a. Maybe a
Prelude.Nothing,
      $sel:pageSize:SearchProducts' :: Maybe Natural
pageSize = forall a. Maybe a
Prelude.Nothing,
      $sel:pageToken:SearchProducts' :: Maybe Text
pageToken = forall a. Maybe a
Prelude.Nothing,
      $sel:sortBy:SearchProducts' :: Maybe ProductViewSortBy
sortBy = forall a. Maybe a
Prelude.Nothing,
      $sel:sortOrder:SearchProducts' :: Maybe SortOrder
sortOrder = forall a. Maybe a
Prelude.Nothing
    }

-- | The language code.
--
-- -   @en@ - English (default)
--
-- -   @jp@ - Japanese
--
-- -   @zh@ - Chinese
searchProducts_acceptLanguage :: Lens.Lens' SearchProducts (Prelude.Maybe Prelude.Text)
searchProducts_acceptLanguage :: Lens' SearchProducts (Maybe Text)
searchProducts_acceptLanguage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchProducts' {Maybe Text
acceptLanguage :: Maybe Text
$sel:acceptLanguage:SearchProducts' :: SearchProducts -> Maybe Text
acceptLanguage} -> Maybe Text
acceptLanguage) (\s :: SearchProducts
s@SearchProducts' {} Maybe Text
a -> SearchProducts
s {$sel:acceptLanguage:SearchProducts' :: Maybe Text
acceptLanguage = Maybe Text
a} :: SearchProducts)

-- | The search filters. If no search filters are specified, the output
-- includes all products to which the caller has access.
searchProducts_filters :: Lens.Lens' SearchProducts (Prelude.Maybe (Prelude.HashMap ProductViewFilterBy [Prelude.Text]))
searchProducts_filters :: Lens' SearchProducts (Maybe (HashMap ProductViewFilterBy [Text]))
searchProducts_filters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchProducts' {Maybe (HashMap ProductViewFilterBy [Text])
filters :: Maybe (HashMap ProductViewFilterBy [Text])
$sel:filters:SearchProducts' :: SearchProducts -> Maybe (HashMap ProductViewFilterBy [Text])
filters} -> Maybe (HashMap ProductViewFilterBy [Text])
filters) (\s :: SearchProducts
s@SearchProducts' {} Maybe (HashMap ProductViewFilterBy [Text])
a -> SearchProducts
s {$sel:filters:SearchProducts' :: Maybe (HashMap ProductViewFilterBy [Text])
filters = Maybe (HashMap ProductViewFilterBy [Text])
a} :: SearchProducts) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The maximum number of items to return with this call.
searchProducts_pageSize :: Lens.Lens' SearchProducts (Prelude.Maybe Prelude.Natural)
searchProducts_pageSize :: Lens' SearchProducts (Maybe Natural)
searchProducts_pageSize = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchProducts' {Maybe Natural
pageSize :: Maybe Natural
$sel:pageSize:SearchProducts' :: SearchProducts -> Maybe Natural
pageSize} -> Maybe Natural
pageSize) (\s :: SearchProducts
s@SearchProducts' {} Maybe Natural
a -> SearchProducts
s {$sel:pageSize:SearchProducts' :: Maybe Natural
pageSize = Maybe Natural
a} :: SearchProducts)

-- | The page token for the next set of results. To retrieve the first set of
-- results, use null.
searchProducts_pageToken :: Lens.Lens' SearchProducts (Prelude.Maybe Prelude.Text)
searchProducts_pageToken :: Lens' SearchProducts (Maybe Text)
searchProducts_pageToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchProducts' {Maybe Text
pageToken :: Maybe Text
$sel:pageToken:SearchProducts' :: SearchProducts -> Maybe Text
pageToken} -> Maybe Text
pageToken) (\s :: SearchProducts
s@SearchProducts' {} Maybe Text
a -> SearchProducts
s {$sel:pageToken:SearchProducts' :: Maybe Text
pageToken = Maybe Text
a} :: SearchProducts)

-- | The sort field. If no value is specified, the results are not sorted.
searchProducts_sortBy :: Lens.Lens' SearchProducts (Prelude.Maybe ProductViewSortBy)
searchProducts_sortBy :: Lens' SearchProducts (Maybe ProductViewSortBy)
searchProducts_sortBy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchProducts' {Maybe ProductViewSortBy
sortBy :: Maybe ProductViewSortBy
$sel:sortBy:SearchProducts' :: SearchProducts -> Maybe ProductViewSortBy
sortBy} -> Maybe ProductViewSortBy
sortBy) (\s :: SearchProducts
s@SearchProducts' {} Maybe ProductViewSortBy
a -> SearchProducts
s {$sel:sortBy:SearchProducts' :: Maybe ProductViewSortBy
sortBy = Maybe ProductViewSortBy
a} :: SearchProducts)

-- | The sort order. If no value is specified, the results are not sorted.
searchProducts_sortOrder :: Lens.Lens' SearchProducts (Prelude.Maybe SortOrder)
searchProducts_sortOrder :: Lens' SearchProducts (Maybe SortOrder)
searchProducts_sortOrder = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchProducts' {Maybe SortOrder
sortOrder :: Maybe SortOrder
$sel:sortOrder:SearchProducts' :: SearchProducts -> Maybe SortOrder
sortOrder} -> Maybe SortOrder
sortOrder) (\s :: SearchProducts
s@SearchProducts' {} Maybe SortOrder
a -> SearchProducts
s {$sel:sortOrder:SearchProducts' :: Maybe SortOrder
sortOrder = Maybe SortOrder
a} :: SearchProducts)

instance Core.AWSRequest SearchProducts where
  type
    AWSResponse SearchProducts =
      SearchProductsResponse
  request :: (Service -> Service) -> SearchProducts -> Request SearchProducts
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy SearchProducts
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SearchProducts)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe (HashMap Text [ProductViewAggregationValue])
-> Maybe [ProductViewSummary]
-> Int
-> SearchProductsResponse
SearchProductsResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"NextPageToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ProductViewAggregations"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ProductViewSummaries"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable SearchProducts where
  hashWithSalt :: Int -> SearchProducts -> Int
hashWithSalt Int
_salt SearchProducts' {Maybe Natural
Maybe Text
Maybe (HashMap ProductViewFilterBy [Text])
Maybe ProductViewSortBy
Maybe SortOrder
sortOrder :: Maybe SortOrder
sortBy :: Maybe ProductViewSortBy
pageToken :: Maybe Text
pageSize :: Maybe Natural
filters :: Maybe (HashMap ProductViewFilterBy [Text])
acceptLanguage :: Maybe Text
$sel:sortOrder:SearchProducts' :: SearchProducts -> Maybe SortOrder
$sel:sortBy:SearchProducts' :: SearchProducts -> Maybe ProductViewSortBy
$sel:pageToken:SearchProducts' :: SearchProducts -> Maybe Text
$sel:pageSize:SearchProducts' :: SearchProducts -> Maybe Natural
$sel:filters:SearchProducts' :: SearchProducts -> Maybe (HashMap ProductViewFilterBy [Text])
$sel:acceptLanguage:SearchProducts' :: SearchProducts -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
acceptLanguage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap ProductViewFilterBy [Text])
filters
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
pageSize
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
pageToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ProductViewSortBy
sortBy
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SortOrder
sortOrder

instance Prelude.NFData SearchProducts where
  rnf :: SearchProducts -> ()
rnf SearchProducts' {Maybe Natural
Maybe Text
Maybe (HashMap ProductViewFilterBy [Text])
Maybe ProductViewSortBy
Maybe SortOrder
sortOrder :: Maybe SortOrder
sortBy :: Maybe ProductViewSortBy
pageToken :: Maybe Text
pageSize :: Maybe Natural
filters :: Maybe (HashMap ProductViewFilterBy [Text])
acceptLanguage :: Maybe Text
$sel:sortOrder:SearchProducts' :: SearchProducts -> Maybe SortOrder
$sel:sortBy:SearchProducts' :: SearchProducts -> Maybe ProductViewSortBy
$sel:pageToken:SearchProducts' :: SearchProducts -> Maybe Text
$sel:pageSize:SearchProducts' :: SearchProducts -> Maybe Natural
$sel:filters:SearchProducts' :: SearchProducts -> Maybe (HashMap ProductViewFilterBy [Text])
$sel:acceptLanguage:SearchProducts' :: SearchProducts -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
acceptLanguage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap ProductViewFilterBy [Text])
filters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
pageSize
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
pageToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ProductViewSortBy
sortBy
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SortOrder
sortOrder

instance Data.ToHeaders SearchProducts where
  toHeaders :: SearchProducts -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AWS242ServiceCatalogService.SearchProducts" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON SearchProducts where
  toJSON :: SearchProducts -> Value
toJSON SearchProducts' {Maybe Natural
Maybe Text
Maybe (HashMap ProductViewFilterBy [Text])
Maybe ProductViewSortBy
Maybe SortOrder
sortOrder :: Maybe SortOrder
sortBy :: Maybe ProductViewSortBy
pageToken :: Maybe Text
pageSize :: Maybe Natural
filters :: Maybe (HashMap ProductViewFilterBy [Text])
acceptLanguage :: Maybe Text
$sel:sortOrder:SearchProducts' :: SearchProducts -> Maybe SortOrder
$sel:sortBy:SearchProducts' :: SearchProducts -> Maybe ProductViewSortBy
$sel:pageToken:SearchProducts' :: SearchProducts -> Maybe Text
$sel:pageSize:SearchProducts' :: SearchProducts -> Maybe Natural
$sel:filters:SearchProducts' :: SearchProducts -> Maybe (HashMap ProductViewFilterBy [Text])
$sel:acceptLanguage:SearchProducts' :: SearchProducts -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AcceptLanguage" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
acceptLanguage,
            (Key
"Filters" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap ProductViewFilterBy [Text])
filters,
            (Key
"PageSize" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
pageSize,
            (Key
"PageToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
pageToken,
            (Key
"SortBy" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ProductViewSortBy
sortBy,
            (Key
"SortOrder" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SortOrder
sortOrder
          ]
      )

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

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

-- | /See:/ 'newSearchProductsResponse' smart constructor.
data SearchProductsResponse = SearchProductsResponse'
  { -- | The page token to use to retrieve the next set of results. If there are
    -- no additional results, this value is null.
    SearchProductsResponse -> Maybe Text
nextPageToken :: Prelude.Maybe Prelude.Text,
    -- | The product view aggregations.
    SearchProductsResponse
-> Maybe (HashMap Text [ProductViewAggregationValue])
productViewAggregations :: Prelude.Maybe (Prelude.HashMap Prelude.Text [ProductViewAggregationValue]),
    -- | Information about the product views.
    SearchProductsResponse -> Maybe [ProductViewSummary]
productViewSummaries :: Prelude.Maybe [ProductViewSummary],
    -- | The response's http status code.
    SearchProductsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (SearchProductsResponse -> SearchProductsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchProductsResponse -> SearchProductsResponse -> Bool
$c/= :: SearchProductsResponse -> SearchProductsResponse -> Bool
== :: SearchProductsResponse -> SearchProductsResponse -> Bool
$c== :: SearchProductsResponse -> SearchProductsResponse -> Bool
Prelude.Eq, ReadPrec [SearchProductsResponse]
ReadPrec SearchProductsResponse
Int -> ReadS SearchProductsResponse
ReadS [SearchProductsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SearchProductsResponse]
$creadListPrec :: ReadPrec [SearchProductsResponse]
readPrec :: ReadPrec SearchProductsResponse
$creadPrec :: ReadPrec SearchProductsResponse
readList :: ReadS [SearchProductsResponse]
$creadList :: ReadS [SearchProductsResponse]
readsPrec :: Int -> ReadS SearchProductsResponse
$creadsPrec :: Int -> ReadS SearchProductsResponse
Prelude.Read, Int -> SearchProductsResponse -> ShowS
[SearchProductsResponse] -> ShowS
SearchProductsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchProductsResponse] -> ShowS
$cshowList :: [SearchProductsResponse] -> ShowS
show :: SearchProductsResponse -> String
$cshow :: SearchProductsResponse -> String
showsPrec :: Int -> SearchProductsResponse -> ShowS
$cshowsPrec :: Int -> SearchProductsResponse -> ShowS
Prelude.Show, forall x. Rep SearchProductsResponse x -> SearchProductsResponse
forall x. SearchProductsResponse -> Rep SearchProductsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SearchProductsResponse x -> SearchProductsResponse
$cfrom :: forall x. SearchProductsResponse -> Rep SearchProductsResponse x
Prelude.Generic)

-- |
-- Create a value of 'SearchProductsResponse' 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:
--
-- 'nextPageToken', 'searchProductsResponse_nextPageToken' - The page token to use to retrieve the next set of results. If there are
-- no additional results, this value is null.
--
-- 'productViewAggregations', 'searchProductsResponse_productViewAggregations' - The product view aggregations.
--
-- 'productViewSummaries', 'searchProductsResponse_productViewSummaries' - Information about the product views.
--
-- 'httpStatus', 'searchProductsResponse_httpStatus' - The response's http status code.
newSearchProductsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  SearchProductsResponse
newSearchProductsResponse :: Int -> SearchProductsResponse
newSearchProductsResponse Int
pHttpStatus_ =
  SearchProductsResponse'
    { $sel:nextPageToken:SearchProductsResponse' :: Maybe Text
nextPageToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:productViewAggregations:SearchProductsResponse' :: Maybe (HashMap Text [ProductViewAggregationValue])
productViewAggregations = forall a. Maybe a
Prelude.Nothing,
      $sel:productViewSummaries:SearchProductsResponse' :: Maybe [ProductViewSummary]
productViewSummaries = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:SearchProductsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The page token to use to retrieve the next set of results. If there are
-- no additional results, this value is null.
searchProductsResponse_nextPageToken :: Lens.Lens' SearchProductsResponse (Prelude.Maybe Prelude.Text)
searchProductsResponse_nextPageToken :: Lens' SearchProductsResponse (Maybe Text)
searchProductsResponse_nextPageToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchProductsResponse' {Maybe Text
nextPageToken :: Maybe Text
$sel:nextPageToken:SearchProductsResponse' :: SearchProductsResponse -> Maybe Text
nextPageToken} -> Maybe Text
nextPageToken) (\s :: SearchProductsResponse
s@SearchProductsResponse' {} Maybe Text
a -> SearchProductsResponse
s {$sel:nextPageToken:SearchProductsResponse' :: Maybe Text
nextPageToken = Maybe Text
a} :: SearchProductsResponse)

-- | The product view aggregations.
searchProductsResponse_productViewAggregations :: Lens.Lens' SearchProductsResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text [ProductViewAggregationValue]))
searchProductsResponse_productViewAggregations :: Lens'
  SearchProductsResponse
  (Maybe (HashMap Text [ProductViewAggregationValue]))
searchProductsResponse_productViewAggregations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchProductsResponse' {Maybe (HashMap Text [ProductViewAggregationValue])
productViewAggregations :: Maybe (HashMap Text [ProductViewAggregationValue])
$sel:productViewAggregations:SearchProductsResponse' :: SearchProductsResponse
-> Maybe (HashMap Text [ProductViewAggregationValue])
productViewAggregations} -> Maybe (HashMap Text [ProductViewAggregationValue])
productViewAggregations) (\s :: SearchProductsResponse
s@SearchProductsResponse' {} Maybe (HashMap Text [ProductViewAggregationValue])
a -> SearchProductsResponse
s {$sel:productViewAggregations:SearchProductsResponse' :: Maybe (HashMap Text [ProductViewAggregationValue])
productViewAggregations = Maybe (HashMap Text [ProductViewAggregationValue])
a} :: SearchProductsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Information about the product views.
searchProductsResponse_productViewSummaries :: Lens.Lens' SearchProductsResponse (Prelude.Maybe [ProductViewSummary])
searchProductsResponse_productViewSummaries :: Lens' SearchProductsResponse (Maybe [ProductViewSummary])
searchProductsResponse_productViewSummaries = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchProductsResponse' {Maybe [ProductViewSummary]
productViewSummaries :: Maybe [ProductViewSummary]
$sel:productViewSummaries:SearchProductsResponse' :: SearchProductsResponse -> Maybe [ProductViewSummary]
productViewSummaries} -> Maybe [ProductViewSummary]
productViewSummaries) (\s :: SearchProductsResponse
s@SearchProductsResponse' {} Maybe [ProductViewSummary]
a -> SearchProductsResponse
s {$sel:productViewSummaries:SearchProductsResponse' :: Maybe [ProductViewSummary]
productViewSummaries = Maybe [ProductViewSummary]
a} :: SearchProductsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData SearchProductsResponse where
  rnf :: SearchProductsResponse -> ()
rnf SearchProductsResponse' {Int
Maybe [ProductViewSummary]
Maybe Text
Maybe (HashMap Text [ProductViewAggregationValue])
httpStatus :: Int
productViewSummaries :: Maybe [ProductViewSummary]
productViewAggregations :: Maybe (HashMap Text [ProductViewAggregationValue])
nextPageToken :: Maybe Text
$sel:httpStatus:SearchProductsResponse' :: SearchProductsResponse -> Int
$sel:productViewSummaries:SearchProductsResponse' :: SearchProductsResponse -> Maybe [ProductViewSummary]
$sel:productViewAggregations:SearchProductsResponse' :: SearchProductsResponse
-> Maybe (HashMap Text [ProductViewAggregationValue])
$sel:nextPageToken:SearchProductsResponse' :: SearchProductsResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextPageToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text [ProductViewAggregationValue])
productViewAggregations
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ProductViewSummary]
productViewSummaries
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus