{-# 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.Watch
(
UsersWatchResource
, usersWatch
, UsersWatch
, uwPayload
, uwUserId
) where
import Network.Google.Gmail.Types
import Network.Google.Prelude
type UsersWatchResource =
"gmail" :>
"v1" :>
"users" :>
Capture "userId" Text :>
"watch" :>
QueryParam "alt" AltJSON :>
ReqBody '[JSON] WatchRequest :>
Post '[JSON] WatchResponse
data UsersWatch = UsersWatch'
{ _uwPayload :: !WatchRequest
, _uwUserId :: !Text
} deriving (Eq,Show,Data,Typeable,Generic)
usersWatch
:: WatchRequest
-> UsersWatch
usersWatch pUwPayload_ =
UsersWatch'
{ _uwPayload = pUwPayload_
, _uwUserId = "me"
}
uwPayload :: Lens' UsersWatch WatchRequest
uwPayload
= lens _uwPayload (\ s a -> s{_uwPayload = a})
uwUserId :: Lens' UsersWatch Text
uwUserId = lens _uwUserId (\ s a -> s{_uwUserId = a})
instance GoogleRequest UsersWatch where
type Rs UsersWatch = WatchResponse
type Scopes UsersWatch =
'["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 UsersWatch'{..}
= go _uwUserId (Just AltJSON) _uwPayload gmailService
where go
= buildClient (Proxy :: Proxy UsersWatchResource)
mempty