{-# 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.SearchSessions
-- 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 sessions.
--
-- This operation returns paginated results.
module Amazonka.Wisdom.SearchSessions
  ( -- * Creating a Request
    SearchSessions (..),
    newSearchSessions,

    -- * Request Lenses
    searchSessions_nextToken,
    searchSessions_maxResults,
    searchSessions_assistantId,
    searchSessions_searchExpression,

    -- * Destructuring the Response
    SearchSessionsResponse (..),
    newSearchSessionsResponse,

    -- * Response Lenses
    searchSessionsResponse_nextToken,
    searchSessionsResponse_httpStatus,
    searchSessionsResponse_sessionSummaries,
  )
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:/ 'newSearchSessions' smart constructor.
data SearchSessions = SearchSessions'
  { -- | 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.
    SearchSessions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return per page.
    SearchSessions -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The identifier of the Wisdom assistant. Can be either the ID or the ARN.
    -- URLs cannot contain the ARN.
    SearchSessions -> Text
assistantId :: Prelude.Text,
    -- | The search expression to filter results.
    SearchSessions -> SearchExpression
searchExpression :: SearchExpression
  }
  deriving (SearchSessions -> SearchSessions -> Bool
(SearchSessions -> SearchSessions -> Bool)
-> (SearchSessions -> SearchSessions -> Bool) -> Eq SearchSessions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchSessions -> SearchSessions -> Bool
$c/= :: SearchSessions -> SearchSessions -> Bool
== :: SearchSessions -> SearchSessions -> Bool
$c== :: SearchSessions -> SearchSessions -> Bool
Prelude.Eq, ReadPrec [SearchSessions]
ReadPrec SearchSessions
Int -> ReadS SearchSessions
ReadS [SearchSessions]
(Int -> ReadS SearchSessions)
-> ReadS [SearchSessions]
-> ReadPrec SearchSessions
-> ReadPrec [SearchSessions]
-> Read SearchSessions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SearchSessions]
$creadListPrec :: ReadPrec [SearchSessions]
readPrec :: ReadPrec SearchSessions
$creadPrec :: ReadPrec SearchSessions
readList :: ReadS [SearchSessions]
$creadList :: ReadS [SearchSessions]
readsPrec :: Int -> ReadS SearchSessions
$creadsPrec :: Int -> ReadS SearchSessions
Prelude.Read, Int -> SearchSessions -> ShowS
[SearchSessions] -> ShowS
SearchSessions -> String
(Int -> SearchSessions -> ShowS)
-> (SearchSessions -> String)
-> ([SearchSessions] -> ShowS)
-> Show SearchSessions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchSessions] -> ShowS
$cshowList :: [SearchSessions] -> ShowS
show :: SearchSessions -> String
$cshow :: SearchSessions -> String
showsPrec :: Int -> SearchSessions -> ShowS
$cshowsPrec :: Int -> SearchSessions -> ShowS
Prelude.Show, (forall x. SearchSessions -> Rep SearchSessions x)
-> (forall x. Rep SearchSessions x -> SearchSessions)
-> Generic SearchSessions
forall x. Rep SearchSessions x -> SearchSessions
forall x. SearchSessions -> Rep SearchSessions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SearchSessions x -> SearchSessions
$cfrom :: forall x. SearchSessions -> Rep SearchSessions x
Prelude.Generic)

-- |
-- Create a value of 'SearchSessions' 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', 'searchSessions_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', 'searchSessions_maxResults' - The maximum number of results to return per page.
--
-- 'assistantId', 'searchSessions_assistantId' - The identifier of the Wisdom assistant. Can be either the ID or the ARN.
-- URLs cannot contain the ARN.
--
-- 'searchExpression', 'searchSessions_searchExpression' - The search expression to filter results.
newSearchSessions ::
  -- | 'assistantId'
  Prelude.Text ->
  -- | 'searchExpression'
  SearchExpression ->
  SearchSessions
newSearchSessions :: Text -> SearchExpression -> SearchSessions
newSearchSessions Text
pAssistantId_ SearchExpression
pSearchExpression_ =
  SearchSessions' :: Maybe Text
-> Maybe Natural -> Text -> SearchExpression -> SearchSessions
SearchSessions'
    { $sel:nextToken:SearchSessions' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:SearchSessions' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:assistantId:SearchSessions' :: Text
assistantId = Text
pAssistantId_,
      $sel:searchExpression:SearchSessions' :: 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.
searchSessions_nextToken :: Lens.Lens' SearchSessions (Prelude.Maybe Prelude.Text)
searchSessions_nextToken :: (Maybe Text -> f (Maybe Text))
-> SearchSessions -> f SearchSessions
searchSessions_nextToken = (SearchSessions -> Maybe Text)
-> (SearchSessions -> Maybe Text -> SearchSessions)
-> Lens SearchSessions SearchSessions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchSessions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:SearchSessions' :: SearchSessions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: SearchSessions
s@SearchSessions' {} Maybe Text
a -> SearchSessions
s {$sel:nextToken:SearchSessions' :: Maybe Text
nextToken = Maybe Text
a} :: SearchSessions)

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

-- | The identifier of the Wisdom assistant. Can be either the ID or the ARN.
-- URLs cannot contain the ARN.
searchSessions_assistantId :: Lens.Lens' SearchSessions Prelude.Text
searchSessions_assistantId :: (Text -> f Text) -> SearchSessions -> f SearchSessions
searchSessions_assistantId = (SearchSessions -> Text)
-> (SearchSessions -> Text -> SearchSessions)
-> Lens SearchSessions SearchSessions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchSessions' {Text
assistantId :: Text
$sel:assistantId:SearchSessions' :: SearchSessions -> Text
assistantId} -> Text
assistantId) (\s :: SearchSessions
s@SearchSessions' {} Text
a -> SearchSessions
s {$sel:assistantId:SearchSessions' :: Text
assistantId = Text
a} :: SearchSessions)

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

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

instance Prelude.Hashable SearchSessions

instance Prelude.NFData SearchSessions

instance Core.ToHeaders SearchSessions where
  toHeaders :: SearchSessions -> ResponseHeaders
toHeaders =
    ResponseHeaders -> SearchSessions -> 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 SearchSessions where
  toJSON :: SearchSessions -> Value
toJSON SearchSessions' {Maybe Natural
Maybe Text
Text
SearchExpression
searchExpression :: SearchExpression
assistantId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:searchExpression:SearchSessions' :: SearchSessions -> SearchExpression
$sel:assistantId:SearchSessions' :: SearchSessions -> Text
$sel:maxResults:SearchSessions' :: SearchSessions -> Maybe Natural
$sel:nextToken:SearchSessions' :: SearchSessions -> 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 SearchSessions where
  toPath :: SearchSessions -> ByteString
toPath SearchSessions' {Maybe Natural
Maybe Text
Text
SearchExpression
searchExpression :: SearchExpression
assistantId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:searchExpression:SearchSessions' :: SearchSessions -> SearchExpression
$sel:assistantId:SearchSessions' :: SearchSessions -> Text
$sel:maxResults:SearchSessions' :: SearchSessions -> Maybe Natural
$sel:nextToken:SearchSessions' :: SearchSessions -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/assistants/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
assistantId,
        ByteString
"/searchSessions"
      ]

instance Core.ToQuery SearchSessions where
  toQuery :: SearchSessions -> QueryString
toQuery SearchSessions' {Maybe Natural
Maybe Text
Text
SearchExpression
searchExpression :: SearchExpression
assistantId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:searchExpression:SearchSessions' :: SearchSessions -> SearchExpression
$sel:assistantId:SearchSessions' :: SearchSessions -> Text
$sel:maxResults:SearchSessions' :: SearchSessions -> Maybe Natural
$sel:nextToken:SearchSessions' :: SearchSessions -> 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:/ 'newSearchSessionsResponse' smart constructor.
data SearchSessionsResponse = SearchSessionsResponse'
  { -- | If there are additional results, this is the token for the next set of
    -- results.
    SearchSessionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    SearchSessionsResponse -> Int
httpStatus :: Prelude.Int,
    -- | Summary information about the sessions.
    SearchSessionsResponse -> [SessionSummary]
sessionSummaries :: [SessionSummary]
  }
  deriving (SearchSessionsResponse -> SearchSessionsResponse -> Bool
(SearchSessionsResponse -> SearchSessionsResponse -> Bool)
-> (SearchSessionsResponse -> SearchSessionsResponse -> Bool)
-> Eq SearchSessionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchSessionsResponse -> SearchSessionsResponse -> Bool
$c/= :: SearchSessionsResponse -> SearchSessionsResponse -> Bool
== :: SearchSessionsResponse -> SearchSessionsResponse -> Bool
$c== :: SearchSessionsResponse -> SearchSessionsResponse -> Bool
Prelude.Eq, ReadPrec [SearchSessionsResponse]
ReadPrec SearchSessionsResponse
Int -> ReadS SearchSessionsResponse
ReadS [SearchSessionsResponse]
(Int -> ReadS SearchSessionsResponse)
-> ReadS [SearchSessionsResponse]
-> ReadPrec SearchSessionsResponse
-> ReadPrec [SearchSessionsResponse]
-> Read SearchSessionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SearchSessionsResponse]
$creadListPrec :: ReadPrec [SearchSessionsResponse]
readPrec :: ReadPrec SearchSessionsResponse
$creadPrec :: ReadPrec SearchSessionsResponse
readList :: ReadS [SearchSessionsResponse]
$creadList :: ReadS [SearchSessionsResponse]
readsPrec :: Int -> ReadS SearchSessionsResponse
$creadsPrec :: Int -> ReadS SearchSessionsResponse
Prelude.Read, Int -> SearchSessionsResponse -> ShowS
[SearchSessionsResponse] -> ShowS
SearchSessionsResponse -> String
(Int -> SearchSessionsResponse -> ShowS)
-> (SearchSessionsResponse -> String)
-> ([SearchSessionsResponse] -> ShowS)
-> Show SearchSessionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchSessionsResponse] -> ShowS
$cshowList :: [SearchSessionsResponse] -> ShowS
show :: SearchSessionsResponse -> String
$cshow :: SearchSessionsResponse -> String
showsPrec :: Int -> SearchSessionsResponse -> ShowS
$cshowsPrec :: Int -> SearchSessionsResponse -> ShowS
Prelude.Show, (forall x. SearchSessionsResponse -> Rep SearchSessionsResponse x)
-> (forall x.
    Rep SearchSessionsResponse x -> SearchSessionsResponse)
-> Generic SearchSessionsResponse
forall x. Rep SearchSessionsResponse x -> SearchSessionsResponse
forall x. SearchSessionsResponse -> Rep SearchSessionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SearchSessionsResponse x -> SearchSessionsResponse
$cfrom :: forall x. SearchSessionsResponse -> Rep SearchSessionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'SearchSessionsResponse' 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', 'searchSessionsResponse_nextToken' - If there are additional results, this is the token for the next set of
-- results.
--
-- 'httpStatus', 'searchSessionsResponse_httpStatus' - The response's http status code.
--
-- 'sessionSummaries', 'searchSessionsResponse_sessionSummaries' - Summary information about the sessions.
newSearchSessionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  SearchSessionsResponse
newSearchSessionsResponse :: Int -> SearchSessionsResponse
newSearchSessionsResponse Int
pHttpStatus_ =
  SearchSessionsResponse' :: Maybe Text -> Int -> [SessionSummary] -> SearchSessionsResponse
SearchSessionsResponse'
    { $sel:nextToken:SearchSessionsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:SearchSessionsResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:sessionSummaries:SearchSessionsResponse' :: [SessionSummary]
sessionSummaries = [SessionSummary]
forall a. Monoid a => a
Prelude.mempty
    }

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

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

-- | Summary information about the sessions.
searchSessionsResponse_sessionSummaries :: Lens.Lens' SearchSessionsResponse [SessionSummary]
searchSessionsResponse_sessionSummaries :: ([SessionSummary] -> f [SessionSummary])
-> SearchSessionsResponse -> f SearchSessionsResponse
searchSessionsResponse_sessionSummaries = (SearchSessionsResponse -> [SessionSummary])
-> (SearchSessionsResponse
    -> [SessionSummary] -> SearchSessionsResponse)
-> Lens' SearchSessionsResponse [SessionSummary]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchSessionsResponse' {[SessionSummary]
sessionSummaries :: [SessionSummary]
$sel:sessionSummaries:SearchSessionsResponse' :: SearchSessionsResponse -> [SessionSummary]
sessionSummaries} -> [SessionSummary]
sessionSummaries) (\s :: SearchSessionsResponse
s@SearchSessionsResponse' {} [SessionSummary]
a -> SearchSessionsResponse
s {$sel:sessionSummaries:SearchSessionsResponse' :: [SessionSummary]
sessionSummaries = [SessionSummary]
a} :: SearchSessionsResponse) (([SessionSummary] -> f [SessionSummary])
 -> SearchSessionsResponse -> f SearchSessionsResponse)
-> (([SessionSummary] -> f [SessionSummary])
    -> [SessionSummary] -> f [SessionSummary])
-> ([SessionSummary] -> f [SessionSummary])
-> SearchSessionsResponse
-> f SearchSessionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([SessionSummary] -> f [SessionSummary])
-> [SessionSummary] -> f [SessionSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.NFData SearchSessionsResponse