{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Network.AWS.LexModels.GetBuiltinIntents
(
getBuiltinIntents
, GetBuiltinIntents
, gbiLocale
, gbiNextToken
, gbiSignatureContains
, gbiMaxResults
, getBuiltinIntentsResponse
, GetBuiltinIntentsResponse
, grsIntents
, grsNextToken
, grsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.LexModels.Types
import Network.AWS.LexModels.Types.Product
import Network.AWS.Pager
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data GetBuiltinIntents = GetBuiltinIntents'
{ _gbiLocale :: !(Maybe Locale)
, _gbiNextToken :: !(Maybe Text)
, _gbiSignatureContains :: !(Maybe Text)
, _gbiMaxResults :: !(Maybe Nat)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getBuiltinIntents
:: GetBuiltinIntents
getBuiltinIntents =
GetBuiltinIntents'
{ _gbiLocale = Nothing
, _gbiNextToken = Nothing
, _gbiSignatureContains = Nothing
, _gbiMaxResults = Nothing
}
gbiLocale :: Lens' GetBuiltinIntents (Maybe Locale)
gbiLocale = lens _gbiLocale (\ s a -> s{_gbiLocale = a})
gbiNextToken :: Lens' GetBuiltinIntents (Maybe Text)
gbiNextToken = lens _gbiNextToken (\ s a -> s{_gbiNextToken = a})
gbiSignatureContains :: Lens' GetBuiltinIntents (Maybe Text)
gbiSignatureContains = lens _gbiSignatureContains (\ s a -> s{_gbiSignatureContains = a})
gbiMaxResults :: Lens' GetBuiltinIntents (Maybe Natural)
gbiMaxResults = lens _gbiMaxResults (\ s a -> s{_gbiMaxResults = a}) . mapping _Nat
instance AWSPager GetBuiltinIntents where
page rq rs
| stop (rs ^. grsNextToken) = Nothing
| stop (rs ^. grsIntents) = Nothing
| otherwise =
Just $ rq & gbiNextToken .~ rs ^. grsNextToken
instance AWSRequest GetBuiltinIntents where
type Rs GetBuiltinIntents = GetBuiltinIntentsResponse
request = get lexModels
response
= receiveJSON
(\ s h x ->
GetBuiltinIntentsResponse' <$>
(x .?> "intents" .!@ mempty) <*> (x .?> "nextToken")
<*> (pure (fromEnum s)))
instance Hashable GetBuiltinIntents where
instance NFData GetBuiltinIntents where
instance ToHeaders GetBuiltinIntents where
toHeaders
= const
(mconcat
["Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToPath GetBuiltinIntents where
toPath = const "/builtins/intents/"
instance ToQuery GetBuiltinIntents where
toQuery GetBuiltinIntents'{..}
= mconcat
["locale" =: _gbiLocale,
"nextToken" =: _gbiNextToken,
"signatureContains" =: _gbiSignatureContains,
"maxResults" =: _gbiMaxResults]
data GetBuiltinIntentsResponse = GetBuiltinIntentsResponse'
{ _grsIntents :: !(Maybe [BuiltinIntentMetadata])
, _grsNextToken :: !(Maybe Text)
, _grsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getBuiltinIntentsResponse
:: Int
-> GetBuiltinIntentsResponse
getBuiltinIntentsResponse pResponseStatus_ =
GetBuiltinIntentsResponse'
{ _grsIntents = Nothing
, _grsNextToken = Nothing
, _grsResponseStatus = pResponseStatus_
}
grsIntents :: Lens' GetBuiltinIntentsResponse [BuiltinIntentMetadata]
grsIntents = lens _grsIntents (\ s a -> s{_grsIntents = a}) . _Default . _Coerce
grsNextToken :: Lens' GetBuiltinIntentsResponse (Maybe Text)
grsNextToken = lens _grsNextToken (\ s a -> s{_grsNextToken = a})
grsResponseStatus :: Lens' GetBuiltinIntentsResponse Int
grsResponseStatus = lens _grsResponseStatus (\ s a -> s{_grsResponseStatus = a})
instance NFData GetBuiltinIntentsResponse where