{-# 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.Wisdom.SearchContent
-- 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 for content in a specified knowledge base. Can be used to get a
-- specific content resource by its name.
--
-- This operation returns paginated results.
module Amazonka.Wisdom.SearchContent
  ( -- * Creating a Request
    SearchContent (..),
    newSearchContent,

    -- * Request Lenses
    searchContent_nextToken,
    searchContent_maxResults,
    searchContent_knowledgeBaseId,
    searchContent_searchExpression,

    -- * Destructuring the Response
    SearchContentResponse (..),
    newSearchContentResponse,

    -- * Response Lenses
    searchContentResponse_nextToken,
    searchContentResponse_httpStatus,
    searchContentResponse_contentSummaries,
  )
where

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
import Amazonka.Wisdom.Types

-- | /See:/ 'newSearchContent' smart constructor.
data SearchContent = SearchContent'
  { -- | The token for the next set of results. Use the value returned in the
    -- previous response in the next request to retrieve the next set of
    -- results.
    SearchContent -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return per page.
    SearchContent -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The the identifier of the knowledge base. Can be either the ID or the
    -- ARN. URLs cannot contain the ARN.
    SearchContent -> Text
knowledgeBaseId :: Prelude.Text,
    -- | The search expression to filter results.
    SearchContent -> SearchExpression
searchExpression :: SearchExpression
  }
  deriving (SearchContent -> SearchContent -> Bool
(SearchContent -> SearchContent -> Bool)
-> (SearchContent -> SearchContent -> Bool) -> Eq SearchContent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchContent -> SearchContent -> Bool
$c/= :: SearchContent -> SearchContent -> Bool
== :: SearchContent -> SearchContent -> Bool
$c== :: SearchContent -> SearchContent -> Bool
Prelude.Eq, ReadPrec [SearchContent]
ReadPrec SearchContent
Int -> ReadS SearchContent
ReadS [SearchContent]
(Int -> ReadS SearchContent)
-> ReadS [SearchContent]
-> ReadPrec SearchContent
-> ReadPrec [SearchContent]
-> Read SearchContent
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SearchContent]
$creadListPrec :: ReadPrec [SearchContent]
readPrec :: ReadPrec SearchContent
$creadPrec :: ReadPrec SearchContent
readList :: ReadS [SearchContent]
$creadList :: ReadS [SearchContent]
readsPrec :: Int -> ReadS SearchContent
$creadsPrec :: Int -> ReadS SearchContent
Prelude.Read, Int -> SearchContent -> ShowS
[SearchContent] -> ShowS
SearchContent -> String
(Int -> SearchContent -> ShowS)
-> (SearchContent -> String)
-> ([SearchContent] -> ShowS)
-> Show SearchContent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchContent] -> ShowS
$cshowList :: [SearchContent] -> ShowS
show :: SearchContent -> String
$cshow :: SearchContent -> String
showsPrec :: Int -> SearchContent -> ShowS
$cshowsPrec :: Int -> SearchContent -> ShowS
Prelude.Show, (forall x. SearchContent -> Rep SearchContent x)
-> (forall x. Rep SearchContent x -> SearchContent)
-> Generic SearchContent
forall x. Rep SearchContent x -> SearchContent
forall x. SearchContent -> Rep SearchContent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SearchContent x -> SearchContent
$cfrom :: forall x. SearchContent -> Rep SearchContent x
Prelude.Generic)

-- |
-- Create a value of 'SearchContent' 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:
--
-- 'nextToken', 'searchContent_nextToken' - The token for the next set of results. Use the value returned in the
-- previous response in the next request to retrieve the next set of
-- results.
--
-- 'maxResults', 'searchContent_maxResults' - The maximum number of results to return per page.
--
-- 'knowledgeBaseId', 'searchContent_knowledgeBaseId' - The the identifier of the knowledge base. Can be either the ID or the
-- ARN. URLs cannot contain the ARN.
--
-- 'searchExpression', 'searchContent_searchExpression' - The search expression to filter results.
newSearchContent ::
  -- | 'knowledgeBaseId'
  Prelude.Text ->
  -- | 'searchExpression'
  SearchExpression ->
  SearchContent
newSearchContent :: Text -> SearchExpression -> SearchContent
newSearchContent Text
pKnowledgeBaseId_ SearchExpression
pSearchExpression_ =
  SearchContent' :: Maybe Text
-> Maybe Natural -> Text -> SearchExpression -> SearchContent
SearchContent'
    { $sel:nextToken:SearchContent' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:SearchContent' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:knowledgeBaseId:SearchContent' :: Text
knowledgeBaseId = Text
pKnowledgeBaseId_,
      $sel:searchExpression:SearchContent' :: SearchExpression
searchExpression = SearchExpression
pSearchExpression_
    }

-- | The token for the next set of results. Use the value returned in the
-- previous response in the next request to retrieve the next set of
-- results.
searchContent_nextToken :: Lens.Lens' SearchContent (Prelude.Maybe Prelude.Text)
searchContent_nextToken :: (Maybe Text -> f (Maybe Text)) -> SearchContent -> f SearchContent
searchContent_nextToken = (SearchContent -> Maybe Text)
-> (SearchContent -> Maybe Text -> SearchContent)
-> Lens SearchContent SearchContent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchContent' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:SearchContent' :: SearchContent -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: SearchContent
s@SearchContent' {} Maybe Text
a -> SearchContent
s {$sel:nextToken:SearchContent' :: Maybe Text
nextToken = Maybe Text
a} :: SearchContent)

-- | The maximum number of results to return per page.
searchContent_maxResults :: Lens.Lens' SearchContent (Prelude.Maybe Prelude.Natural)
searchContent_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> SearchContent -> f SearchContent
searchContent_maxResults = (SearchContent -> Maybe Natural)
-> (SearchContent -> Maybe Natural -> SearchContent)
-> Lens SearchContent SearchContent (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchContent' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:SearchContent' :: SearchContent -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: SearchContent
s@SearchContent' {} Maybe Natural
a -> SearchContent
s {$sel:maxResults:SearchContent' :: Maybe Natural
maxResults = Maybe Natural
a} :: SearchContent)

-- | The the identifier of the knowledge base. Can be either the ID or the
-- ARN. URLs cannot contain the ARN.
searchContent_knowledgeBaseId :: Lens.Lens' SearchContent Prelude.Text
searchContent_knowledgeBaseId :: (Text -> f Text) -> SearchContent -> f SearchContent
searchContent_knowledgeBaseId = (SearchContent -> Text)
-> (SearchContent -> Text -> SearchContent)
-> Lens SearchContent SearchContent Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchContent' {Text
knowledgeBaseId :: Text
$sel:knowledgeBaseId:SearchContent' :: SearchContent -> Text
knowledgeBaseId} -> Text
knowledgeBaseId) (\s :: SearchContent
s@SearchContent' {} Text
a -> SearchContent
s {$sel:knowledgeBaseId:SearchContent' :: Text
knowledgeBaseId = Text
a} :: SearchContent)

-- | The search expression to filter results.
searchContent_searchExpression :: Lens.Lens' SearchContent SearchExpression
searchContent_searchExpression :: (SearchExpression -> f SearchExpression)
-> SearchContent -> f SearchContent
searchContent_searchExpression = (SearchContent -> SearchExpression)
-> (SearchContent -> SearchExpression -> SearchContent)
-> Lens
     SearchContent SearchContent SearchExpression SearchExpression
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchContent' {SearchExpression
searchExpression :: SearchExpression
$sel:searchExpression:SearchContent' :: SearchContent -> SearchExpression
searchExpression} -> SearchExpression
searchExpression) (\s :: SearchContent
s@SearchContent' {} SearchExpression
a -> SearchContent
s {$sel:searchExpression:SearchContent' :: SearchExpression
searchExpression = SearchExpression
a} :: SearchContent)

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

instance Prelude.Hashable SearchContent

instance Prelude.NFData SearchContent

instance Core.ToHeaders SearchContent where
  toHeaders :: SearchContent -> ResponseHeaders
toHeaders =
    ResponseHeaders -> SearchContent -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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 SearchContent where
  toJSON :: SearchContent -> Value
toJSON SearchContent' {Maybe Natural
Maybe Text
Text
SearchExpression
searchExpression :: SearchExpression
knowledgeBaseId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:searchExpression:SearchContent' :: SearchContent -> SearchExpression
$sel:knowledgeBaseId:SearchContent' :: SearchContent -> Text
$sel:maxResults:SearchContent' :: SearchContent -> Maybe Natural
$sel:nextToken:SearchContent' :: SearchContent -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"searchExpression" Text -> SearchExpression -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= SearchExpression
searchExpression)
          ]
      )

instance Core.ToPath SearchContent where
  toPath :: SearchContent -> ByteString
toPath SearchContent' {Maybe Natural
Maybe Text
Text
SearchExpression
searchExpression :: SearchExpression
knowledgeBaseId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:searchExpression:SearchContent' :: SearchContent -> SearchExpression
$sel:knowledgeBaseId:SearchContent' :: SearchContent -> Text
$sel:maxResults:SearchContent' :: SearchContent -> Maybe Natural
$sel:nextToken:SearchContent' :: SearchContent -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/knowledgeBases/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
knowledgeBaseId,
        ByteString
"/search"
      ]

instance Core.ToQuery SearchContent where
  toQuery :: SearchContent -> QueryString
toQuery SearchContent' {Maybe Natural
Maybe Text
Text
SearchExpression
searchExpression :: SearchExpression
knowledgeBaseId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:searchExpression:SearchContent' :: SearchContent -> SearchExpression
$sel:knowledgeBaseId:SearchContent' :: SearchContent -> Text
$sel:maxResults:SearchContent' :: SearchContent -> Maybe Natural
$sel:nextToken:SearchContent' :: SearchContent -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"nextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"maxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
      ]

-- | /See:/ 'newSearchContentResponse' smart constructor.
data SearchContentResponse = SearchContentResponse'
  { -- | If there are additional results, this is the token for the next set of
    -- results.
    SearchContentResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    SearchContentResponse -> Int
httpStatus :: Prelude.Int,
    -- | Summary information about the content.
    SearchContentResponse -> [ContentSummary]
contentSummaries :: [ContentSummary]
  }
  deriving (SearchContentResponse -> SearchContentResponse -> Bool
(SearchContentResponse -> SearchContentResponse -> Bool)
-> (SearchContentResponse -> SearchContentResponse -> Bool)
-> Eq SearchContentResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchContentResponse -> SearchContentResponse -> Bool
$c/= :: SearchContentResponse -> SearchContentResponse -> Bool
== :: SearchContentResponse -> SearchContentResponse -> Bool
$c== :: SearchContentResponse -> SearchContentResponse -> Bool
Prelude.Eq, ReadPrec [SearchContentResponse]
ReadPrec SearchContentResponse
Int -> ReadS SearchContentResponse
ReadS [SearchContentResponse]
(Int -> ReadS SearchContentResponse)
-> ReadS [SearchContentResponse]
-> ReadPrec SearchContentResponse
-> ReadPrec [SearchContentResponse]
-> Read SearchContentResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SearchContentResponse]
$creadListPrec :: ReadPrec [SearchContentResponse]
readPrec :: ReadPrec SearchContentResponse
$creadPrec :: ReadPrec SearchContentResponse
readList :: ReadS [SearchContentResponse]
$creadList :: ReadS [SearchContentResponse]
readsPrec :: Int -> ReadS SearchContentResponse
$creadsPrec :: Int -> ReadS SearchContentResponse
Prelude.Read, Int -> SearchContentResponse -> ShowS
[SearchContentResponse] -> ShowS
SearchContentResponse -> String
(Int -> SearchContentResponse -> ShowS)
-> (SearchContentResponse -> String)
-> ([SearchContentResponse] -> ShowS)
-> Show SearchContentResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchContentResponse] -> ShowS
$cshowList :: [SearchContentResponse] -> ShowS
show :: SearchContentResponse -> String
$cshow :: SearchContentResponse -> String
showsPrec :: Int -> SearchContentResponse -> ShowS
$cshowsPrec :: Int -> SearchContentResponse -> ShowS
Prelude.Show, (forall x. SearchContentResponse -> Rep SearchContentResponse x)
-> (forall x. Rep SearchContentResponse x -> SearchContentResponse)
-> Generic SearchContentResponse
forall x. Rep SearchContentResponse x -> SearchContentResponse
forall x. SearchContentResponse -> Rep SearchContentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SearchContentResponse x -> SearchContentResponse
$cfrom :: forall x. SearchContentResponse -> Rep SearchContentResponse x
Prelude.Generic)

-- |
-- Create a value of 'SearchContentResponse' 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:
--
-- 'nextToken', 'searchContentResponse_nextToken' - If there are additional results, this is the token for the next set of
-- results.
--
-- 'httpStatus', 'searchContentResponse_httpStatus' - The response's http status code.
--
-- 'contentSummaries', 'searchContentResponse_contentSummaries' - Summary information about the content.
newSearchContentResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  SearchContentResponse
newSearchContentResponse :: Int -> SearchContentResponse
newSearchContentResponse Int
pHttpStatus_ =
  SearchContentResponse' :: Maybe Text -> Int -> [ContentSummary] -> SearchContentResponse
SearchContentResponse'
    { $sel:nextToken:SearchContentResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:SearchContentResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:contentSummaries:SearchContentResponse' :: [ContentSummary]
contentSummaries = [ContentSummary]
forall a. Monoid a => a
Prelude.mempty
    }

-- | If there are additional results, this is the token for the next set of
-- results.
searchContentResponse_nextToken :: Lens.Lens' SearchContentResponse (Prelude.Maybe Prelude.Text)
searchContentResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> SearchContentResponse -> f SearchContentResponse
searchContentResponse_nextToken = (SearchContentResponse -> Maybe Text)
-> (SearchContentResponse -> Maybe Text -> SearchContentResponse)
-> Lens' SearchContentResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchContentResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:SearchContentResponse' :: SearchContentResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: SearchContentResponse
s@SearchContentResponse' {} Maybe Text
a -> SearchContentResponse
s {$sel:nextToken:SearchContentResponse' :: Maybe Text
nextToken = Maybe Text
a} :: SearchContentResponse)

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

-- | Summary information about the content.
searchContentResponse_contentSummaries :: Lens.Lens' SearchContentResponse [ContentSummary]
searchContentResponse_contentSummaries :: ([ContentSummary] -> f [ContentSummary])
-> SearchContentResponse -> f SearchContentResponse
searchContentResponse_contentSummaries = (SearchContentResponse -> [ContentSummary])
-> (SearchContentResponse
    -> [ContentSummary] -> SearchContentResponse)
-> Lens' SearchContentResponse [ContentSummary]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchContentResponse' {[ContentSummary]
contentSummaries :: [ContentSummary]
$sel:contentSummaries:SearchContentResponse' :: SearchContentResponse -> [ContentSummary]
contentSummaries} -> [ContentSummary]
contentSummaries) (\s :: SearchContentResponse
s@SearchContentResponse' {} [ContentSummary]
a -> SearchContentResponse
s {$sel:contentSummaries:SearchContentResponse' :: [ContentSummary]
contentSummaries = [ContentSummary]
a} :: SearchContentResponse) (([ContentSummary] -> f [ContentSummary])
 -> SearchContentResponse -> f SearchContentResponse)
-> (([ContentSummary] -> f [ContentSummary])
    -> [ContentSummary] -> f [ContentSummary])
-> ([ContentSummary] -> f [ContentSummary])
-> SearchContentResponse
-> f SearchContentResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ContentSummary] -> f [ContentSummary])
-> [ContentSummary] -> f [ContentSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.NFData SearchContentResponse