{-# 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.Send
(
UsersMessagesSendResource
, usersMessagesSend
, UsersMessagesSend
, umsPayload
, umsUserId
) where
import Network.Google.Gmail.Types
import Network.Google.Prelude
type UsersMessagesSendResource =
"gmail" :>
"v1" :>
"users" :>
Capture "userId" Text :>
"messages" :>
"send" :>
QueryParam "alt" AltJSON :>
ReqBody '[JSON] Message :> Post '[JSON] Message
:<|>
"upload" :>
"gmail" :>
"v1" :>
"users" :>
Capture "userId" Text :>
"messages" :>
"send" :>
QueryParam "alt" AltJSON :>
QueryParam "uploadType" Multipart :>
MultipartRelated '[JSON] Message :>
Post '[JSON] Message
data UsersMessagesSend = UsersMessagesSend'
{ _umsPayload :: !Message
, _umsUserId :: !Text
} deriving (Eq,Show,Data,Typeable,Generic)
usersMessagesSend
:: Message
-> UsersMessagesSend
usersMessagesSend pUmsPayload_ =
UsersMessagesSend'
{ _umsPayload = pUmsPayload_
, _umsUserId = "me"
}
umsPayload :: Lens' UsersMessagesSend Message
umsPayload
= lens _umsPayload (\ s a -> s{_umsPayload = a})
umsUserId :: Lens' UsersMessagesSend Text
umsUserId
= lens _umsUserId (\ s a -> s{_umsUserId = a})
instance GoogleRequest UsersMessagesSend where
type Rs UsersMessagesSend = Message
type Scopes UsersMessagesSend =
'["https://mail.google.com/",
"https://www.googleapis.com/auth/gmail.compose",
"https://www.googleapis.com/auth/gmail.modify",
"https://www.googleapis.com/auth/gmail.send"]
requestClient UsersMessagesSend'{..}
= go _umsUserId (Just AltJSON) _umsPayload
gmailService
where go :<|> _
= buildClient
(Proxy :: Proxy UsersMessagesSendResource)
mempty
instance GoogleRequest
(MediaUpload UsersMessagesSend) where
type Rs (MediaUpload UsersMessagesSend) = Message
type Scopes (MediaUpload UsersMessagesSend) =
Scopes UsersMessagesSend
requestClient
(MediaUpload UsersMessagesSend'{..} body)
= go _umsUserId (Just AltJSON) (Just Multipart)
_umsPayload
body
gmailService
where _ :<|> go
= buildClient
(Proxy :: Proxy UsersMessagesSendResource)
mempty