{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# OPTIONS_GHC -fno-warn-duplicate-exports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module Network.Google.Resource.Gmail.Users.Messages.Get
(
UsersMessagesGetResource
, usersMessagesGet
, UsersMessagesGet
, umgFormat
, umgUserId
, umgId
, umgMetadataHeaders
) where
import Network.Google.Gmail.Types
import Network.Google.Prelude
type UsersMessagesGetResource =
"gmail" :>
"v1" :>
"users" :>
Capture "userId" Text :>
"messages" :>
Capture "id" Text :>
QueryParam "format" UsersMessagesGetFormat :>
QueryParams "metadataHeaders" Text :>
QueryParam "alt" AltJSON :> Get '[JSON] Message
data UsersMessagesGet = UsersMessagesGet'
{ _umgFormat :: !UsersMessagesGetFormat
, _umgUserId :: !Text
, _umgId :: !Text
, _umgMetadataHeaders :: !(Maybe [Text])
} deriving (Eq,Show,Data,Typeable,Generic)
usersMessagesGet
:: Text
-> UsersMessagesGet
usersMessagesGet pUmgId_ =
UsersMessagesGet'
{ _umgFormat = Full
, _umgUserId = "me"
, _umgId = pUmgId_
, _umgMetadataHeaders = Nothing
}
umgFormat :: Lens' UsersMessagesGet UsersMessagesGetFormat
umgFormat
= lens _umgFormat (\ s a -> s{_umgFormat = a})
umgUserId :: Lens' UsersMessagesGet Text
umgUserId
= lens _umgUserId (\ s a -> s{_umgUserId = a})
umgId :: Lens' UsersMessagesGet Text
umgId = lens _umgId (\ s a -> s{_umgId = a})
umgMetadataHeaders :: Lens' UsersMessagesGet [Text]
umgMetadataHeaders
= lens _umgMetadataHeaders
(\ s a -> s{_umgMetadataHeaders = a})
. _Default
. _Coerce
instance GoogleRequest UsersMessagesGet where
type Rs UsersMessagesGet = Message
type Scopes UsersMessagesGet =
'["https://mail.google.com/",
"https://www.googleapis.com/auth/gmail.metadata",
"https://www.googleapis.com/auth/gmail.modify",
"https://www.googleapis.com/auth/gmail.readonly"]
requestClient UsersMessagesGet'{..}
= go _umgUserId _umgId (Just _umgFormat)
(_umgMetadataHeaders ^. _Default)
(Just AltJSON)
gmailService
where go
= buildClient
(Proxy :: Proxy UsersMessagesGetResource)
mempty