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