{-# 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 #-}
module Amazonka.Wisdom.ListAssistants
(
ListAssistants (..),
newListAssistants,
listAssistants_nextToken,
listAssistants_maxResults,
ListAssistantsResponse (..),
newListAssistantsResponse,
listAssistantsResponse_nextToken,
listAssistantsResponse_httpStatus,
listAssistantsResponse_assistantSummaries,
)
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
data ListAssistants = ListAssistants'
{
ListAssistants -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListAssistants -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
}
deriving (ListAssistants -> ListAssistants -> Bool
(ListAssistants -> ListAssistants -> Bool)
-> (ListAssistants -> ListAssistants -> Bool) -> Eq ListAssistants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAssistants -> ListAssistants -> Bool
$c/= :: ListAssistants -> ListAssistants -> Bool
== :: ListAssistants -> ListAssistants -> Bool
$c== :: ListAssistants -> ListAssistants -> Bool
Prelude.Eq, ReadPrec [ListAssistants]
ReadPrec ListAssistants
Int -> ReadS ListAssistants
ReadS [ListAssistants]
(Int -> ReadS ListAssistants)
-> ReadS [ListAssistants]
-> ReadPrec ListAssistants
-> ReadPrec [ListAssistants]
-> Read ListAssistants
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAssistants]
$creadListPrec :: ReadPrec [ListAssistants]
readPrec :: ReadPrec ListAssistants
$creadPrec :: ReadPrec ListAssistants
readList :: ReadS [ListAssistants]
$creadList :: ReadS [ListAssistants]
readsPrec :: Int -> ReadS ListAssistants
$creadsPrec :: Int -> ReadS ListAssistants
Prelude.Read, Int -> ListAssistants -> ShowS
[ListAssistants] -> ShowS
ListAssistants -> String
(Int -> ListAssistants -> ShowS)
-> (ListAssistants -> String)
-> ([ListAssistants] -> ShowS)
-> Show ListAssistants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAssistants] -> ShowS
$cshowList :: [ListAssistants] -> ShowS
show :: ListAssistants -> String
$cshow :: ListAssistants -> String
showsPrec :: Int -> ListAssistants -> ShowS
$cshowsPrec :: Int -> ListAssistants -> ShowS
Prelude.Show, (forall x. ListAssistants -> Rep ListAssistants x)
-> (forall x. Rep ListAssistants x -> ListAssistants)
-> Generic ListAssistants
forall x. Rep ListAssistants x -> ListAssistants
forall x. ListAssistants -> Rep ListAssistants x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListAssistants x -> ListAssistants
$cfrom :: forall x. ListAssistants -> Rep ListAssistants x
Prelude.Generic)
newListAssistants ::
ListAssistants
newListAssistants :: ListAssistants
newListAssistants =
ListAssistants' :: Maybe Text -> Maybe Natural -> ListAssistants
ListAssistants'
{ $sel:nextToken:ListAssistants' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListAssistants' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
listAssistants_nextToken :: Lens.Lens' ListAssistants (Prelude.Maybe Prelude.Text)
listAssistants_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListAssistants -> f ListAssistants
listAssistants_nextToken = (ListAssistants -> Maybe Text)
-> (ListAssistants -> Maybe Text -> ListAssistants)
-> Lens ListAssistants ListAssistants (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssistants' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAssistants' :: ListAssistants -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAssistants
s@ListAssistants' {} Maybe Text
a -> ListAssistants
s {$sel:nextToken:ListAssistants' :: Maybe Text
nextToken = Maybe Text
a} :: ListAssistants)
listAssistants_maxResults :: Lens.Lens' ListAssistants (Prelude.Maybe Prelude.Natural)
listAssistants_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListAssistants -> f ListAssistants
listAssistants_maxResults = (ListAssistants -> Maybe Natural)
-> (ListAssistants -> Maybe Natural -> ListAssistants)
-> Lens
ListAssistants ListAssistants (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssistants' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListAssistants' :: ListAssistants -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListAssistants
s@ListAssistants' {} Maybe Natural
a -> ListAssistants
s {$sel:maxResults:ListAssistants' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListAssistants)
instance Core.AWSPager ListAssistants where
page :: ListAssistants
-> AWSResponse ListAssistants -> Maybe ListAssistants
page ListAssistants
rq AWSResponse ListAssistants
rs
| Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListAssistants
ListAssistantsResponse
rs
ListAssistantsResponse
-> Getting (First Text) ListAssistantsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListAssistantsResponse
-> Const (First Text) ListAssistantsResponse
Lens' ListAssistantsResponse (Maybe Text)
listAssistantsResponse_nextToken
((Maybe Text -> Const (First Text) (Maybe Text))
-> ListAssistantsResponse
-> Const (First Text) ListAssistantsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListAssistantsResponse 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 ListAssistants
forall a. Maybe a
Prelude.Nothing
| [AssistantSummary] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListAssistants
ListAssistantsResponse
rs
ListAssistantsResponse
-> Getting
[AssistantSummary] ListAssistantsResponse [AssistantSummary]
-> [AssistantSummary]
forall s a. s -> Getting a s a -> a
Lens.^. Getting
[AssistantSummary] ListAssistantsResponse [AssistantSummary]
Lens' ListAssistantsResponse [AssistantSummary]
listAssistantsResponse_assistantSummaries
) =
Maybe ListAssistants
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
ListAssistants -> Maybe ListAssistants
forall a. a -> Maybe a
Prelude.Just (ListAssistants -> Maybe ListAssistants)
-> ListAssistants -> Maybe ListAssistants
forall a b. (a -> b) -> a -> b
Prelude.$
ListAssistants
rq
ListAssistants
-> (ListAssistants -> ListAssistants) -> ListAssistants
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListAssistants -> Identity ListAssistants
Lens ListAssistants ListAssistants (Maybe Text) (Maybe Text)
listAssistants_nextToken
((Maybe Text -> Identity (Maybe Text))
-> ListAssistants -> Identity ListAssistants)
-> Maybe Text -> ListAssistants -> ListAssistants
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListAssistants
ListAssistantsResponse
rs
ListAssistantsResponse
-> Getting (First Text) ListAssistantsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListAssistantsResponse
-> Const (First Text) ListAssistantsResponse
Lens' ListAssistantsResponse (Maybe Text)
listAssistantsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListAssistantsResponse
-> Const (First Text) ListAssistantsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListAssistantsResponse 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 ListAssistants where
type
AWSResponse ListAssistants =
ListAssistantsResponse
request :: ListAssistants -> Request ListAssistants
request = Service -> ListAssistants -> Request ListAssistants
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy ListAssistants
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListAssistants)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListAssistants))
-> Logger
-> Service
-> Proxy ListAssistants
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListAssistants)))
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 -> [AssistantSummary] -> ListAssistantsResponse
ListAssistantsResponse'
(Maybe Text -> Int -> [AssistantSummary] -> ListAssistantsResponse)
-> Either String (Maybe Text)
-> Either
String (Int -> [AssistantSummary] -> ListAssistantsResponse)
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 -> [AssistantSummary] -> ListAssistantsResponse)
-> Either String Int
-> Either String ([AssistantSummary] -> ListAssistantsResponse)
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 ([AssistantSummary] -> ListAssistantsResponse)
-> Either String [AssistantSummary]
-> Either String ListAssistantsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe [AssistantSummary])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"assistantSummaries"
Either String (Maybe [AssistantSummary])
-> [AssistantSummary] -> Either String [AssistantSummary]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [AssistantSummary]
forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable ListAssistants
instance Prelude.NFData ListAssistants
instance Core.ToHeaders ListAssistants where
toHeaders :: ListAssistants -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListAssistants -> 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.ToPath ListAssistants where
toPath :: ListAssistants -> ByteString
toPath = ByteString -> ListAssistants -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/assistants"
instance Core.ToQuery ListAssistants where
toQuery :: ListAssistants -> QueryString
toQuery ListAssistants' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:maxResults:ListAssistants' :: ListAssistants -> Maybe Natural
$sel:nextToken:ListAssistants' :: ListAssistants -> 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
]
data ListAssistantsResponse = ListAssistantsResponse'
{
ListAssistantsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListAssistantsResponse -> Int
httpStatus :: Prelude.Int,
ListAssistantsResponse -> [AssistantSummary]
assistantSummaries :: [AssistantSummary]
}
deriving (ListAssistantsResponse -> ListAssistantsResponse -> Bool
(ListAssistantsResponse -> ListAssistantsResponse -> Bool)
-> (ListAssistantsResponse -> ListAssistantsResponse -> Bool)
-> Eq ListAssistantsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAssistantsResponse -> ListAssistantsResponse -> Bool
$c/= :: ListAssistantsResponse -> ListAssistantsResponse -> Bool
== :: ListAssistantsResponse -> ListAssistantsResponse -> Bool
$c== :: ListAssistantsResponse -> ListAssistantsResponse -> Bool
Prelude.Eq, ReadPrec [ListAssistantsResponse]
ReadPrec ListAssistantsResponse
Int -> ReadS ListAssistantsResponse
ReadS [ListAssistantsResponse]
(Int -> ReadS ListAssistantsResponse)
-> ReadS [ListAssistantsResponse]
-> ReadPrec ListAssistantsResponse
-> ReadPrec [ListAssistantsResponse]
-> Read ListAssistantsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAssistantsResponse]
$creadListPrec :: ReadPrec [ListAssistantsResponse]
readPrec :: ReadPrec ListAssistantsResponse
$creadPrec :: ReadPrec ListAssistantsResponse
readList :: ReadS [ListAssistantsResponse]
$creadList :: ReadS [ListAssistantsResponse]
readsPrec :: Int -> ReadS ListAssistantsResponse
$creadsPrec :: Int -> ReadS ListAssistantsResponse
Prelude.Read, Int -> ListAssistantsResponse -> ShowS
[ListAssistantsResponse] -> ShowS
ListAssistantsResponse -> String
(Int -> ListAssistantsResponse -> ShowS)
-> (ListAssistantsResponse -> String)
-> ([ListAssistantsResponse] -> ShowS)
-> Show ListAssistantsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAssistantsResponse] -> ShowS
$cshowList :: [ListAssistantsResponse] -> ShowS
show :: ListAssistantsResponse -> String
$cshow :: ListAssistantsResponse -> String
showsPrec :: Int -> ListAssistantsResponse -> ShowS
$cshowsPrec :: Int -> ListAssistantsResponse -> ShowS
Prelude.Show, (forall x. ListAssistantsResponse -> Rep ListAssistantsResponse x)
-> (forall x.
Rep ListAssistantsResponse x -> ListAssistantsResponse)
-> Generic ListAssistantsResponse
forall x. Rep ListAssistantsResponse x -> ListAssistantsResponse
forall x. ListAssistantsResponse -> Rep ListAssistantsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListAssistantsResponse x -> ListAssistantsResponse
$cfrom :: forall x. ListAssistantsResponse -> Rep ListAssistantsResponse x
Prelude.Generic)
newListAssistantsResponse ::
Prelude.Int ->
ListAssistantsResponse
newListAssistantsResponse :: Int -> ListAssistantsResponse
newListAssistantsResponse Int
pHttpStatus_ =
ListAssistantsResponse' :: Maybe Text -> Int -> [AssistantSummary] -> ListAssistantsResponse
ListAssistantsResponse'
{ $sel:nextToken:ListAssistantsResponse' :: Maybe Text
nextToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListAssistantsResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:assistantSummaries:ListAssistantsResponse' :: [AssistantSummary]
assistantSummaries = [AssistantSummary]
forall a. Monoid a => a
Prelude.mempty
}
listAssistantsResponse_nextToken :: Lens.Lens' ListAssistantsResponse (Prelude.Maybe Prelude.Text)
listAssistantsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListAssistantsResponse -> f ListAssistantsResponse
listAssistantsResponse_nextToken = (ListAssistantsResponse -> Maybe Text)
-> (ListAssistantsResponse -> Maybe Text -> ListAssistantsResponse)
-> Lens' ListAssistantsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssistantsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAssistantsResponse' :: ListAssistantsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAssistantsResponse
s@ListAssistantsResponse' {} Maybe Text
a -> ListAssistantsResponse
s {$sel:nextToken:ListAssistantsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListAssistantsResponse)
listAssistantsResponse_httpStatus :: Lens.Lens' ListAssistantsResponse Prelude.Int
listAssistantsResponse_httpStatus :: (Int -> f Int)
-> ListAssistantsResponse -> f ListAssistantsResponse
listAssistantsResponse_httpStatus = (ListAssistantsResponse -> Int)
-> (ListAssistantsResponse -> Int -> ListAssistantsResponse)
-> Lens ListAssistantsResponse ListAssistantsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssistantsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListAssistantsResponse' :: ListAssistantsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListAssistantsResponse
s@ListAssistantsResponse' {} Int
a -> ListAssistantsResponse
s {$sel:httpStatus:ListAssistantsResponse' :: Int
httpStatus = Int
a} :: ListAssistantsResponse)
listAssistantsResponse_assistantSummaries :: Lens.Lens' ListAssistantsResponse [AssistantSummary]
listAssistantsResponse_assistantSummaries :: ([AssistantSummary] -> f [AssistantSummary])
-> ListAssistantsResponse -> f ListAssistantsResponse
listAssistantsResponse_assistantSummaries = (ListAssistantsResponse -> [AssistantSummary])
-> (ListAssistantsResponse
-> [AssistantSummary] -> ListAssistantsResponse)
-> Lens' ListAssistantsResponse [AssistantSummary]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssistantsResponse' {[AssistantSummary]
assistantSummaries :: [AssistantSummary]
$sel:assistantSummaries:ListAssistantsResponse' :: ListAssistantsResponse -> [AssistantSummary]
assistantSummaries} -> [AssistantSummary]
assistantSummaries) (\s :: ListAssistantsResponse
s@ListAssistantsResponse' {} [AssistantSummary]
a -> ListAssistantsResponse
s {$sel:assistantSummaries:ListAssistantsResponse' :: [AssistantSummary]
assistantSummaries = [AssistantSummary]
a} :: ListAssistantsResponse) (([AssistantSummary] -> f [AssistantSummary])
-> ListAssistantsResponse -> f ListAssistantsResponse)
-> (([AssistantSummary] -> f [AssistantSummary])
-> [AssistantSummary] -> f [AssistantSummary])
-> ([AssistantSummary] -> f [AssistantSummary])
-> ListAssistantsResponse
-> f ListAssistantsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([AssistantSummary] -> f [AssistantSummary])
-> [AssistantSummary] -> f [AssistantSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData ListAssistantsResponse