{-# 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.Pinpoint.GetSegments
(
getSegments
, GetSegments
, gssToken
, gssPageSize
, gssApplicationId
, getSegmentsResponse
, GetSegmentsResponse
, gsrsResponseStatus
, gsrsSegmentsResponse
) where
import Network.AWS.Lens
import Network.AWS.Pinpoint.Types
import Network.AWS.Pinpoint.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data GetSegments = GetSegments'
{ _gssToken :: !(Maybe Text)
, _gssPageSize :: !(Maybe Text)
, _gssApplicationId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getSegments
:: Text
-> GetSegments
getSegments pApplicationId_ =
GetSegments'
{ _gssToken = Nothing
, _gssPageSize = Nothing
, _gssApplicationId = pApplicationId_
}
gssToken :: Lens' GetSegments (Maybe Text)
gssToken = lens _gssToken (\ s a -> s{_gssToken = a})
gssPageSize :: Lens' GetSegments (Maybe Text)
gssPageSize = lens _gssPageSize (\ s a -> s{_gssPageSize = a})
gssApplicationId :: Lens' GetSegments Text
gssApplicationId = lens _gssApplicationId (\ s a -> s{_gssApplicationId = a})
instance AWSRequest GetSegments where
type Rs GetSegments = GetSegmentsResponse
request = get pinpoint
response
= receiveJSON
(\ s h x ->
GetSegmentsResponse' <$>
(pure (fromEnum s)) <*> (eitherParseJSON x))
instance Hashable GetSegments where
instance NFData GetSegments where
instance ToHeaders GetSegments where
toHeaders
= const
(mconcat
["Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToPath GetSegments where
toPath GetSegments'{..}
= mconcat
["/v1/apps/", toBS _gssApplicationId, "/segments"]
instance ToQuery GetSegments where
toQuery GetSegments'{..}
= mconcat
["token" =: _gssToken, "page-size" =: _gssPageSize]
data GetSegmentsResponse = GetSegmentsResponse'
{ _gsrsResponseStatus :: !Int
, _gsrsSegmentsResponse :: !SegmentsResponse
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getSegmentsResponse
:: Int
-> SegmentsResponse
-> GetSegmentsResponse
getSegmentsResponse pResponseStatus_ pSegmentsResponse_ =
GetSegmentsResponse'
{ _gsrsResponseStatus = pResponseStatus_
, _gsrsSegmentsResponse = pSegmentsResponse_
}
gsrsResponseStatus :: Lens' GetSegmentsResponse Int
gsrsResponseStatus = lens _gsrsResponseStatus (\ s a -> s{_gsrsResponseStatus = a})
gsrsSegmentsResponse :: Lens' GetSegmentsResponse SegmentsResponse
gsrsSegmentsResponse = lens _gsrsSegmentsResponse (\ s a -> s{_gsrsSegmentsResponse = a})
instance NFData GetSegmentsResponse where