module Network.AWS.WorkDocs.GetCurrentUser
(
getCurrentUser
, GetCurrentUser
, gcuAuthenticationToken
, getCurrentUserResponse
, GetCurrentUserResponse
, gcursUser
, gcursResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.WorkDocs.Types
import Network.AWS.WorkDocs.Types.Product
newtype GetCurrentUser = GetCurrentUser'
{ _gcuAuthenticationToken :: Sensitive Text
} deriving (Eq, Show, Data, Typeable, Generic)
getCurrentUser
:: Text
-> GetCurrentUser
getCurrentUser pAuthenticationToken_ =
GetCurrentUser' {_gcuAuthenticationToken = _Sensitive # pAuthenticationToken_}
gcuAuthenticationToken :: Lens' GetCurrentUser Text
gcuAuthenticationToken = lens _gcuAuthenticationToken (\ s a -> s{_gcuAuthenticationToken = a}) . _Sensitive;
instance AWSRequest GetCurrentUser where
type Rs GetCurrentUser = GetCurrentUserResponse
request = get workDocs
response
= receiveJSON
(\ s h x ->
GetCurrentUserResponse' <$>
(x .?> "User") <*> (pure (fromEnum s)))
instance Hashable GetCurrentUser where
instance NFData GetCurrentUser where
instance ToHeaders GetCurrentUser where
toHeaders GetCurrentUser'{..}
= mconcat
["Authentication" =# _gcuAuthenticationToken,
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)]
instance ToPath GetCurrentUser where
toPath = const "/api/v1/me"
instance ToQuery GetCurrentUser where
toQuery = const mempty
data GetCurrentUserResponse = GetCurrentUserResponse'
{ _gcursUser :: !(Maybe User)
, _gcursResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getCurrentUserResponse
:: Int
-> GetCurrentUserResponse
getCurrentUserResponse pResponseStatus_ =
GetCurrentUserResponse'
{_gcursUser = Nothing, _gcursResponseStatus = pResponseStatus_}
gcursUser :: Lens' GetCurrentUserResponse (Maybe User)
gcursUser = lens _gcursUser (\ s a -> s{_gcursUser = a});
gcursResponseStatus :: Lens' GetCurrentUserResponse Int
gcursResponseStatus = lens _gcursResponseStatus (\ s a -> s{_gcursResponseStatus = a});
instance NFData GetCurrentUserResponse where