{-# 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.Update
(
UsersDraftsUpdateResource
, usersDraftsUpdate
, UsersDraftsUpdate
, uduPayload
, uduUserId
, uduId
) where
import Network.Google.Gmail.Types
import Network.Google.Prelude
type UsersDraftsUpdateResource =
"gmail" :>
"v1" :>
"users" :>
Capture "userId" Text :>
"drafts" :>
Capture "id" Text :>
QueryParam "alt" AltJSON :>
ReqBody '[JSON] Draft :> Put '[JSON] Draft
:<|>
"upload" :>
"gmail" :>
"v1" :>
"users" :>
Capture "userId" Text :>
"drafts" :>
Capture "id" Text :>
QueryParam "alt" AltJSON :>
QueryParam "uploadType" Multipart :>
MultipartRelated '[JSON] Draft :> Put '[JSON] Draft
data UsersDraftsUpdate = UsersDraftsUpdate'
{ _uduPayload :: !Draft
, _uduUserId :: !Text
, _uduId :: !Text
} deriving (Eq,Show,Data,Typeable,Generic)
usersDraftsUpdate
:: Draft
-> Text
-> UsersDraftsUpdate
usersDraftsUpdate pUduPayload_ pUduId_ =
UsersDraftsUpdate'
{ _uduPayload = pUduPayload_
, _uduUserId = "me"
, _uduId = pUduId_
}
uduPayload :: Lens' UsersDraftsUpdate Draft
uduPayload
= lens _uduPayload (\ s a -> s{_uduPayload = a})
uduUserId :: Lens' UsersDraftsUpdate Text
uduUserId
= lens _uduUserId (\ s a -> s{_uduUserId = a})
uduId :: Lens' UsersDraftsUpdate Text
uduId = lens _uduId (\ s a -> s{_uduId = a})
instance GoogleRequest UsersDraftsUpdate where
type Rs UsersDraftsUpdate = Draft
type Scopes UsersDraftsUpdate =
'["https://mail.google.com/",
"https://www.googleapis.com/auth/gmail.compose",
"https://www.googleapis.com/auth/gmail.modify"]
requestClient UsersDraftsUpdate'{..}
= go _uduUserId _uduId (Just AltJSON) _uduPayload
gmailService
where go :<|> _
= buildClient
(Proxy :: Proxy UsersDraftsUpdateResource)
mempty
instance GoogleRequest
(MediaUpload UsersDraftsUpdate) where
type Rs (MediaUpload UsersDraftsUpdate) = Draft
type Scopes (MediaUpload UsersDraftsUpdate) =
Scopes UsersDraftsUpdate
requestClient
(MediaUpload UsersDraftsUpdate'{..} body)
= go _uduUserId _uduId (Just AltJSON)
(Just Multipart)
_uduPayload
body
gmailService
where _ :<|> go
= buildClient
(Proxy :: Proxy UsersDraftsUpdateResource)
mempty