{-# 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.ListContents
(
ListContents (..),
newListContents,
listContents_maxResults,
listContents_nextToken,
listContents_knowledgeBaseId,
ListContentsResponse (..),
newListContentsResponse,
listContentsResponse_nextToken,
listContentsResponse_httpStatus,
listContentsResponse_contentSummaries,
)
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.Wisdom.Types
data ListContents = ListContents'
{
ListContents -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListContents -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListContents -> Text
knowledgeBaseId :: Prelude.Text
}
deriving (ListContents -> ListContents -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListContents -> ListContents -> Bool
$c/= :: ListContents -> ListContents -> Bool
== :: ListContents -> ListContents -> Bool
$c== :: ListContents -> ListContents -> Bool
Prelude.Eq, ReadPrec [ListContents]
ReadPrec ListContents
Int -> ReadS ListContents
ReadS [ListContents]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListContents]
$creadListPrec :: ReadPrec [ListContents]
readPrec :: ReadPrec ListContents
$creadPrec :: ReadPrec ListContents
readList :: ReadS [ListContents]
$creadList :: ReadS [ListContents]
readsPrec :: Int -> ReadS ListContents
$creadsPrec :: Int -> ReadS ListContents
Prelude.Read, Int -> ListContents -> ShowS
[ListContents] -> ShowS
ListContents -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListContents] -> ShowS
$cshowList :: [ListContents] -> ShowS
show :: ListContents -> String
$cshow :: ListContents -> String
showsPrec :: Int -> ListContents -> ShowS
$cshowsPrec :: Int -> ListContents -> ShowS
Prelude.Show, forall x. Rep ListContents x -> ListContents
forall x. ListContents -> Rep ListContents x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListContents x -> ListContents
$cfrom :: forall x. ListContents -> Rep ListContents x
Prelude.Generic)
newListContents ::
Prelude.Text ->
ListContents
newListContents :: Text -> ListContents
newListContents Text
pKnowledgeBaseId_ =
ListContents'
{ $sel:maxResults:ListContents' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListContents' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:knowledgeBaseId:ListContents' :: Text
knowledgeBaseId = Text
pKnowledgeBaseId_
}
listContents_maxResults :: Lens.Lens' ListContents (Prelude.Maybe Prelude.Natural)
listContents_maxResults :: Lens' ListContents (Maybe Natural)
listContents_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListContents' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListContents' :: ListContents -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListContents
s@ListContents' {} Maybe Natural
a -> ListContents
s {$sel:maxResults:ListContents' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListContents)
listContents_nextToken :: Lens.Lens' ListContents (Prelude.Maybe Prelude.Text)
listContents_nextToken :: Lens' ListContents (Maybe Text)
listContents_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListContents' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListContents' :: ListContents -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListContents
s@ListContents' {} Maybe Text
a -> ListContents
s {$sel:nextToken:ListContents' :: Maybe Text
nextToken = Maybe Text
a} :: ListContents)
listContents_knowledgeBaseId :: Lens.Lens' ListContents Prelude.Text
listContents_knowledgeBaseId :: Lens' ListContents Text
listContents_knowledgeBaseId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListContents' {Text
knowledgeBaseId :: Text
$sel:knowledgeBaseId:ListContents' :: ListContents -> Text
knowledgeBaseId} -> Text
knowledgeBaseId) (\s :: ListContents
s@ListContents' {} Text
a -> ListContents
s {$sel:knowledgeBaseId:ListContents' :: Text
knowledgeBaseId = Text
a} :: ListContents)
instance Core.AWSPager ListContents where
page :: ListContents -> AWSResponse ListContents -> Maybe ListContents
page ListContents
rq AWSResponse ListContents
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListContents
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListContentsResponse (Maybe Text)
listContentsResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. AWSTruncated a => a -> Bool
Core.stop
(AWSResponse ListContents
rs forall s a. s -> Getting a s a -> a
Lens.^. Lens' ListContentsResponse [ContentSummary]
listContentsResponse_contentSummaries) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListContents
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListContents (Maybe Text)
listContents_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListContents
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListContentsResponse (Maybe Text)
listContentsResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListContents where
type AWSResponse ListContents = ListContentsResponse
request :: (Service -> Service) -> ListContents -> Request ListContents
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListContents
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListContents)))
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 -> Int -> [ContentSummary] -> ListContentsResponse
ListContentsResponse'
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
"nextToken")
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))
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
"contentSummaries"
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable ListContents where
hashWithSalt :: Int -> ListContents -> Int
hashWithSalt Int
_salt ListContents' {Maybe Natural
Maybe Text
Text
knowledgeBaseId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:knowledgeBaseId:ListContents' :: ListContents -> Text
$sel:nextToken:ListContents' :: ListContents -> Maybe Text
$sel:maxResults:ListContents' :: ListContents -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
knowledgeBaseId
instance Prelude.NFData ListContents where
rnf :: ListContents -> ()
rnf ListContents' {Maybe Natural
Maybe Text
Text
knowledgeBaseId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:knowledgeBaseId:ListContents' :: ListContents -> Text
$sel:nextToken:ListContents' :: ListContents -> Maybe Text
$sel:maxResults:ListContents' :: ListContents -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
knowledgeBaseId
instance Data.ToHeaders ListContents where
toHeaders :: ListContents -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToPath ListContents where
toPath :: ListContents -> ByteString
toPath ListContents' {Maybe Natural
Maybe Text
Text
knowledgeBaseId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:knowledgeBaseId:ListContents' :: ListContents -> Text
$sel:nextToken:ListContents' :: ListContents -> Maybe Text
$sel:maxResults:ListContents' :: ListContents -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/knowledgeBases/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
knowledgeBaseId,
ByteString
"/contents"
]
instance Data.ToQuery ListContents where
toQuery :: ListContents -> QueryString
toQuery ListContents' {Maybe Natural
Maybe Text
Text
knowledgeBaseId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:knowledgeBaseId:ListContents' :: ListContents -> Text
$sel:nextToken:ListContents' :: ListContents -> Maybe Text
$sel:maxResults:ListContents' :: ListContents -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"maxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
ByteString
"nextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken
]
data ListContentsResponse = ListContentsResponse'
{
ListContentsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListContentsResponse -> Int
httpStatus :: Prelude.Int,
ListContentsResponse -> [ContentSummary]
contentSummaries :: [ContentSummary]
}
deriving (ListContentsResponse -> ListContentsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListContentsResponse -> ListContentsResponse -> Bool
$c/= :: ListContentsResponse -> ListContentsResponse -> Bool
== :: ListContentsResponse -> ListContentsResponse -> Bool
$c== :: ListContentsResponse -> ListContentsResponse -> Bool
Prelude.Eq, ReadPrec [ListContentsResponse]
ReadPrec ListContentsResponse
Int -> ReadS ListContentsResponse
ReadS [ListContentsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListContentsResponse]
$creadListPrec :: ReadPrec [ListContentsResponse]
readPrec :: ReadPrec ListContentsResponse
$creadPrec :: ReadPrec ListContentsResponse
readList :: ReadS [ListContentsResponse]
$creadList :: ReadS [ListContentsResponse]
readsPrec :: Int -> ReadS ListContentsResponse
$creadsPrec :: Int -> ReadS ListContentsResponse
Prelude.Read, Int -> ListContentsResponse -> ShowS
[ListContentsResponse] -> ShowS
ListContentsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListContentsResponse] -> ShowS
$cshowList :: [ListContentsResponse] -> ShowS
show :: ListContentsResponse -> String
$cshow :: ListContentsResponse -> String
showsPrec :: Int -> ListContentsResponse -> ShowS
$cshowsPrec :: Int -> ListContentsResponse -> ShowS
Prelude.Show, forall x. Rep ListContentsResponse x -> ListContentsResponse
forall x. ListContentsResponse -> Rep ListContentsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListContentsResponse x -> ListContentsResponse
$cfrom :: forall x. ListContentsResponse -> Rep ListContentsResponse x
Prelude.Generic)
newListContentsResponse ::
Prelude.Int ->
ListContentsResponse
newListContentsResponse :: Int -> ListContentsResponse
newListContentsResponse Int
pHttpStatus_ =
ListContentsResponse'
{ $sel:nextToken:ListContentsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListContentsResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:contentSummaries:ListContentsResponse' :: [ContentSummary]
contentSummaries = forall a. Monoid a => a
Prelude.mempty
}
listContentsResponse_nextToken :: Lens.Lens' ListContentsResponse (Prelude.Maybe Prelude.Text)
listContentsResponse_nextToken :: Lens' ListContentsResponse (Maybe Text)
listContentsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListContentsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListContentsResponse' :: ListContentsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListContentsResponse
s@ListContentsResponse' {} Maybe Text
a -> ListContentsResponse
s {$sel:nextToken:ListContentsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListContentsResponse)
listContentsResponse_httpStatus :: Lens.Lens' ListContentsResponse Prelude.Int
listContentsResponse_httpStatus :: Lens' ListContentsResponse Int
listContentsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListContentsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListContentsResponse' :: ListContentsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListContentsResponse
s@ListContentsResponse' {} Int
a -> ListContentsResponse
s {$sel:httpStatus:ListContentsResponse' :: Int
httpStatus = Int
a} :: ListContentsResponse)
listContentsResponse_contentSummaries :: Lens.Lens' ListContentsResponse [ContentSummary]
listContentsResponse_contentSummaries :: Lens' ListContentsResponse [ContentSummary]
listContentsResponse_contentSummaries = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListContentsResponse' {[ContentSummary]
contentSummaries :: [ContentSummary]
$sel:contentSummaries:ListContentsResponse' :: ListContentsResponse -> [ContentSummary]
contentSummaries} -> [ContentSummary]
contentSummaries) (\s :: ListContentsResponse
s@ListContentsResponse' {} [ContentSummary]
a -> ListContentsResponse
s {$sel:contentSummaries:ListContentsResponse' :: [ContentSummary]
contentSummaries = [ContentSummary]
a} :: ListContentsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData ListContentsResponse where
rnf :: ListContentsResponse -> ()
rnf ListContentsResponse' {Int
[ContentSummary]
Maybe Text
contentSummaries :: [ContentSummary]
httpStatus :: Int
nextToken :: Maybe Text
$sel:contentSummaries:ListContentsResponse' :: ListContentsResponse -> [ContentSummary]
$sel:httpStatus:ListContentsResponse' :: ListContentsResponse -> Int
$sel:nextToken:ListContentsResponse' :: ListContentsResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [ContentSummary]
contentSummaries