{-# 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.Comprehend.ListTopicsDetectionJobs
(
listTopicsDetectionJobs
, ListTopicsDetectionJobs
, ltdjNextToken
, ltdjFilter
, ltdjMaxResults
, listTopicsDetectionJobsResponse
, ListTopicsDetectionJobsResponse
, ltdjrsNextToken
, ltdjrsTopicsDetectionJobPropertiesList
, ltdjrsResponseStatus
) where
import Network.AWS.Comprehend.Types
import Network.AWS.Comprehend.Types.Product
import Network.AWS.Lens
import Network.AWS.Pager
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data ListTopicsDetectionJobs = ListTopicsDetectionJobs'
{ _ltdjNextToken :: !(Maybe Text)
, _ltdjFilter :: !(Maybe TopicsDetectionJobFilter)
, _ltdjMaxResults :: !(Maybe Nat)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listTopicsDetectionJobs
:: ListTopicsDetectionJobs
listTopicsDetectionJobs =
ListTopicsDetectionJobs'
{_ltdjNextToken = Nothing, _ltdjFilter = Nothing, _ltdjMaxResults = Nothing}
ltdjNextToken :: Lens' ListTopicsDetectionJobs (Maybe Text)
ltdjNextToken = lens _ltdjNextToken (\ s a -> s{_ltdjNextToken = a})
ltdjFilter :: Lens' ListTopicsDetectionJobs (Maybe TopicsDetectionJobFilter)
ltdjFilter = lens _ltdjFilter (\ s a -> s{_ltdjFilter = a})
ltdjMaxResults :: Lens' ListTopicsDetectionJobs (Maybe Natural)
ltdjMaxResults = lens _ltdjMaxResults (\ s a -> s{_ltdjMaxResults = a}) . mapping _Nat
instance AWSPager ListTopicsDetectionJobs where
page rq rs
| stop (rs ^. ltdjrsNextToken) = Nothing
| stop (rs ^. ltdjrsTopicsDetectionJobPropertiesList)
= Nothing
| otherwise =
Just $ rq & ltdjNextToken .~ rs ^. ltdjrsNextToken
instance AWSRequest ListTopicsDetectionJobs where
type Rs ListTopicsDetectionJobs =
ListTopicsDetectionJobsResponse
request = postJSON comprehend
response
= receiveJSON
(\ s h x ->
ListTopicsDetectionJobsResponse' <$>
(x .?> "NextToken") <*>
(x .?> "TopicsDetectionJobPropertiesList" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable ListTopicsDetectionJobs where
instance NFData ListTopicsDetectionJobs where
instance ToHeaders ListTopicsDetectionJobs where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("Comprehend_20171127.ListTopicsDetectionJobs" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ListTopicsDetectionJobs where
toJSON ListTopicsDetectionJobs'{..}
= object
(catMaybes
[("NextToken" .=) <$> _ltdjNextToken,
("Filter" .=) <$> _ltdjFilter,
("MaxResults" .=) <$> _ltdjMaxResults])
instance ToPath ListTopicsDetectionJobs where
toPath = const "/"
instance ToQuery ListTopicsDetectionJobs where
toQuery = const mempty
data ListTopicsDetectionJobsResponse = ListTopicsDetectionJobsResponse'
{ _ltdjrsNextToken :: !(Maybe Text)
, _ltdjrsTopicsDetectionJobPropertiesList :: !(Maybe [TopicsDetectionJobProperties])
, _ltdjrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listTopicsDetectionJobsResponse
:: Int
-> ListTopicsDetectionJobsResponse
listTopicsDetectionJobsResponse pResponseStatus_ =
ListTopicsDetectionJobsResponse'
{ _ltdjrsNextToken = Nothing
, _ltdjrsTopicsDetectionJobPropertiesList = Nothing
, _ltdjrsResponseStatus = pResponseStatus_
}
ltdjrsNextToken :: Lens' ListTopicsDetectionJobsResponse (Maybe Text)
ltdjrsNextToken = lens _ltdjrsNextToken (\ s a -> s{_ltdjrsNextToken = a})
ltdjrsTopicsDetectionJobPropertiesList :: Lens' ListTopicsDetectionJobsResponse [TopicsDetectionJobProperties]
ltdjrsTopicsDetectionJobPropertiesList = lens _ltdjrsTopicsDetectionJobPropertiesList (\ s a -> s{_ltdjrsTopicsDetectionJobPropertiesList = a}) . _Default . _Coerce
ltdjrsResponseStatus :: Lens' ListTopicsDetectionJobsResponse Int
ltdjrsResponseStatus = lens _ltdjrsResponseStatus (\ s a -> s{_ltdjrsResponseStatus = a})
instance NFData ListTopicsDetectionJobsResponse where