{-# 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.Rekognition.ListCollections
(
listCollections
, ListCollections
, lcNextToken
, lcMaxResults
, listCollectionsResponse
, ListCollectionsResponse
, lcrsCollectionIds
, lcrsNextToken
, lcrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Rekognition.Types
import Network.AWS.Rekognition.Types.Product
import Network.AWS.Request
import Network.AWS.Response
data ListCollections = ListCollections'
{ _lcNextToken :: !(Maybe Text)
, _lcMaxResults :: !(Maybe Nat)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listCollections
:: ListCollections
listCollections =
ListCollections'
{ _lcNextToken = Nothing
, _lcMaxResults = Nothing
}
lcNextToken :: Lens' ListCollections (Maybe Text)
lcNextToken = lens _lcNextToken (\ s a -> s{_lcNextToken = a});
lcMaxResults :: Lens' ListCollections (Maybe Natural)
lcMaxResults = lens _lcMaxResults (\ s a -> s{_lcMaxResults = a}) . mapping _Nat;
instance AWSRequest ListCollections where
type Rs ListCollections = ListCollectionsResponse
request = postJSON rekognition
response
= receiveJSON
(\ s h x ->
ListCollectionsResponse' <$>
(x .?> "CollectionIds" .!@ mempty) <*>
(x .?> "NextToken")
<*> (pure (fromEnum s)))
instance Hashable ListCollections
instance NFData ListCollections
instance ToHeaders ListCollections where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("RekognitionService.ListCollections" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ListCollections where
toJSON ListCollections'{..}
= object
(catMaybes
[("NextToken" .=) <$> _lcNextToken,
("MaxResults" .=) <$> _lcMaxResults])
instance ToPath ListCollections where
toPath = const "/"
instance ToQuery ListCollections where
toQuery = const mempty
data ListCollectionsResponse = ListCollectionsResponse'
{ _lcrsCollectionIds :: !(Maybe [Text])
, _lcrsNextToken :: !(Maybe Text)
, _lcrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listCollectionsResponse
:: Int
-> ListCollectionsResponse
listCollectionsResponse pResponseStatus_ =
ListCollectionsResponse'
{ _lcrsCollectionIds = Nothing
, _lcrsNextToken = Nothing
, _lcrsResponseStatus = pResponseStatus_
}
lcrsCollectionIds :: Lens' ListCollectionsResponse [Text]
lcrsCollectionIds = lens _lcrsCollectionIds (\ s a -> s{_lcrsCollectionIds = a}) . _Default . _Coerce;
lcrsNextToken :: Lens' ListCollectionsResponse (Maybe Text)
lcrsNextToken = lens _lcrsNextToken (\ s a -> s{_lcrsNextToken = a});
lcrsResponseStatus :: Lens' ListCollectionsResponse Int
lcrsResponseStatus = lens _lcrsResponseStatus (\ s a -> s{_lcrsResponseStatus = a});
instance NFData ListCollectionsResponse