{-# 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.GetSlotTypes
(
getSlotTypes
, GetSlotTypes
, gstNameContains
, gstNextToken
, gstMaxResults
, getSlotTypesResponse
, GetSlotTypesResponse
, gstrsNextToken
, gstrsSlotTypes
, gstrsResponseStatus
) 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 GetSlotTypes = GetSlotTypes'
{ _gstNameContains :: !(Maybe Text)
, _gstNextToken :: !(Maybe Text)
, _gstMaxResults :: !(Maybe Nat)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getSlotTypes
:: GetSlotTypes
getSlotTypes =
GetSlotTypes'
{ _gstNameContains = Nothing
, _gstNextToken = Nothing
, _gstMaxResults = Nothing
}
gstNameContains :: Lens' GetSlotTypes (Maybe Text)
gstNameContains = lens _gstNameContains (\ s a -> s{_gstNameContains = a})
gstNextToken :: Lens' GetSlotTypes (Maybe Text)
gstNextToken = lens _gstNextToken (\ s a -> s{_gstNextToken = a})
gstMaxResults :: Lens' GetSlotTypes (Maybe Natural)
gstMaxResults = lens _gstMaxResults (\ s a -> s{_gstMaxResults = a}) . mapping _Nat
instance AWSPager GetSlotTypes where
page rq rs
| stop (rs ^. gstrsNextToken) = Nothing
| stop (rs ^. gstrsSlotTypes) = Nothing
| otherwise =
Just $ rq & gstNextToken .~ rs ^. gstrsNextToken
instance AWSRequest GetSlotTypes where
type Rs GetSlotTypes = GetSlotTypesResponse
request = get lexModels
response
= receiveJSON
(\ s h x ->
GetSlotTypesResponse' <$>
(x .?> "nextToken") <*>
(x .?> "slotTypes" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable GetSlotTypes where
instance NFData GetSlotTypes where
instance ToHeaders GetSlotTypes where
toHeaders
= const
(mconcat
["Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToPath GetSlotTypes where
toPath = const "/slottypes/"
instance ToQuery GetSlotTypes where
toQuery GetSlotTypes'{..}
= mconcat
["nameContains" =: _gstNameContains,
"nextToken" =: _gstNextToken,
"maxResults" =: _gstMaxResults]
data GetSlotTypesResponse = GetSlotTypesResponse'
{ _gstrsNextToken :: !(Maybe Text)
, _gstrsSlotTypes :: !(Maybe [SlotTypeMetadata])
, _gstrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getSlotTypesResponse
:: Int
-> GetSlotTypesResponse
getSlotTypesResponse pResponseStatus_ =
GetSlotTypesResponse'
{ _gstrsNextToken = Nothing
, _gstrsSlotTypes = Nothing
, _gstrsResponseStatus = pResponseStatus_
}
gstrsNextToken :: Lens' GetSlotTypesResponse (Maybe Text)
gstrsNextToken = lens _gstrsNextToken (\ s a -> s{_gstrsNextToken = a})
gstrsSlotTypes :: Lens' GetSlotTypesResponse [SlotTypeMetadata]
gstrsSlotTypes = lens _gstrsSlotTypes (\ s a -> s{_gstrsSlotTypes = a}) . _Default . _Coerce
gstrsResponseStatus :: Lens' GetSlotTypesResponse Int
gstrsResponseStatus = lens _gstrsResponseStatus (\ s a -> s{_gstrsResponseStatus = a})
instance NFData GetSlotTypesResponse where