{-# 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.APIGateway.GetDocumentationParts
(
getDocumentationParts
, GetDocumentationParts
, gdpPath
, gdpNameQuery
, gdpLimit
, gdpType
, gdpPosition
, gdpRestAPIId
, getDocumentationPartsResponse
, GetDocumentationPartsResponse
, gdprsItems
, gdprsPosition
, gdprsResponseStatus
) where
import Network.AWS.APIGateway.Types
import Network.AWS.APIGateway.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data GetDocumentationParts = GetDocumentationParts'
{ _gdpPath :: !(Maybe Text)
, _gdpNameQuery :: !(Maybe Text)
, _gdpLimit :: !(Maybe Int)
, _gdpType :: !(Maybe DocumentationPartType)
, _gdpPosition :: !(Maybe Text)
, _gdpRestAPIId :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getDocumentationParts
:: Text
-> GetDocumentationParts
getDocumentationParts pRestAPIId_ =
GetDocumentationParts'
{ _gdpPath = Nothing
, _gdpNameQuery = Nothing
, _gdpLimit = Nothing
, _gdpType = Nothing
, _gdpPosition = Nothing
, _gdpRestAPIId = pRestAPIId_
}
gdpPath :: Lens' GetDocumentationParts (Maybe Text)
gdpPath = lens _gdpPath (\ s a -> s{_gdpPath = a});
gdpNameQuery :: Lens' GetDocumentationParts (Maybe Text)
gdpNameQuery = lens _gdpNameQuery (\ s a -> s{_gdpNameQuery = a});
gdpLimit :: Lens' GetDocumentationParts (Maybe Int)
gdpLimit = lens _gdpLimit (\ s a -> s{_gdpLimit = a});
gdpType :: Lens' GetDocumentationParts (Maybe DocumentationPartType)
gdpType = lens _gdpType (\ s a -> s{_gdpType = a});
gdpPosition :: Lens' GetDocumentationParts (Maybe Text)
gdpPosition = lens _gdpPosition (\ s a -> s{_gdpPosition = a});
gdpRestAPIId :: Lens' GetDocumentationParts Text
gdpRestAPIId = lens _gdpRestAPIId (\ s a -> s{_gdpRestAPIId = a});
instance AWSRequest GetDocumentationParts where
type Rs GetDocumentationParts =
GetDocumentationPartsResponse
request = get apiGateway
response
= receiveJSON
(\ s h x ->
GetDocumentationPartsResponse' <$>
(x .?> "item" .!@ mempty) <*> (x .?> "position") <*>
(pure (fromEnum s)))
instance Hashable GetDocumentationParts
instance NFData GetDocumentationParts
instance ToHeaders GetDocumentationParts where
toHeaders
= const
(mconcat
["Accept" =# ("application/json" :: ByteString)])
instance ToPath GetDocumentationParts where
toPath GetDocumentationParts'{..}
= mconcat
["/restapis/", toBS _gdpRestAPIId,
"/documentation/parts"]
instance ToQuery GetDocumentationParts where
toQuery GetDocumentationParts'{..}
= mconcat
["path" =: _gdpPath, "name" =: _gdpNameQuery,
"limit" =: _gdpLimit, "type" =: _gdpType,
"position" =: _gdpPosition]
data GetDocumentationPartsResponse = GetDocumentationPartsResponse'
{ _gdprsItems :: !(Maybe [DocumentationPart])
, _gdprsPosition :: !(Maybe Text)
, _gdprsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getDocumentationPartsResponse
:: Int
-> GetDocumentationPartsResponse
getDocumentationPartsResponse pResponseStatus_ =
GetDocumentationPartsResponse'
{ _gdprsItems = Nothing
, _gdprsPosition = Nothing
, _gdprsResponseStatus = pResponseStatus_
}
gdprsItems :: Lens' GetDocumentationPartsResponse [DocumentationPart]
gdprsItems = lens _gdprsItems (\ s a -> s{_gdprsItems = a}) . _Default . _Coerce;
gdprsPosition :: Lens' GetDocumentationPartsResponse (Maybe Text)
gdprsPosition = lens _gdprsPosition (\ s a -> s{_gdprsPosition = a});
gdprsResponseStatus :: Lens' GetDocumentationPartsResponse Int
gdprsResponseStatus = lens _gdprsResponseStatus (\ s a -> s{_gdprsResponseStatus = a});
instance NFData GetDocumentationPartsResponse