{-# 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.Import
(
UsersMessagesImportResource
, usersMessagesImport
, UsersMessagesImport
, umiPayload
, umiUserId
, umiProcessForCalendar
, umiDeleted
, umiNeverMarkSpam
, umiInternalDateSource
) where
import Network.Google.Gmail.Types
import Network.Google.Prelude
type UsersMessagesImportResource =
"gmail" :>
"v1" :>
"users" :>
Capture "userId" Text :>
"messages" :>
"import" :>
QueryParam "processForCalendar" Bool :>
QueryParam "deleted" Bool :>
QueryParam "neverMarkSpam" Bool :>
QueryParam "internalDateSource"
UsersMessagesImportInternalDateSource
:>
QueryParam "alt" AltJSON :>
ReqBody '[JSON] Message :> Post '[JSON] Message
:<|>
"upload" :>
"gmail" :>
"v1" :>
"users" :>
Capture "userId" Text :>
"messages" :>
"import" :>
QueryParam "processForCalendar" Bool :>
QueryParam "deleted" Bool :>
QueryParam "neverMarkSpam" Bool :>
QueryParam "internalDateSource"
UsersMessagesImportInternalDateSource
:>
QueryParam "alt" AltJSON :>
QueryParam "uploadType" Multipart :>
MultipartRelated '[JSON] Message :>
Post '[JSON] Message
data UsersMessagesImport = UsersMessagesImport'
{ _umiPayload :: !Message
, _umiUserId :: !Text
, _umiProcessForCalendar :: !Bool
, _umiDeleted :: !Bool
, _umiNeverMarkSpam :: !Bool
, _umiInternalDateSource :: !UsersMessagesImportInternalDateSource
} deriving (Eq,Show,Data,Typeable,Generic)
usersMessagesImport
:: Message
-> UsersMessagesImport
usersMessagesImport pUmiPayload_ =
UsersMessagesImport'
{ _umiPayload = pUmiPayload_
, _umiUserId = "me"
, _umiProcessForCalendar = False
, _umiDeleted = False
, _umiNeverMarkSpam = False
, _umiInternalDateSource = DateHeader
}
umiPayload :: Lens' UsersMessagesImport Message
umiPayload
= lens _umiPayload (\ s a -> s{_umiPayload = a})
umiUserId :: Lens' UsersMessagesImport Text
umiUserId
= lens _umiUserId (\ s a -> s{_umiUserId = a})
umiProcessForCalendar :: Lens' UsersMessagesImport Bool
umiProcessForCalendar
= lens _umiProcessForCalendar
(\ s a -> s{_umiProcessForCalendar = a})
umiDeleted :: Lens' UsersMessagesImport Bool
umiDeleted
= lens _umiDeleted (\ s a -> s{_umiDeleted = a})
umiNeverMarkSpam :: Lens' UsersMessagesImport Bool
umiNeverMarkSpam
= lens _umiNeverMarkSpam
(\ s a -> s{_umiNeverMarkSpam = a})
umiInternalDateSource :: Lens' UsersMessagesImport UsersMessagesImportInternalDateSource
umiInternalDateSource
= lens _umiInternalDateSource
(\ s a -> s{_umiInternalDateSource = a})
instance GoogleRequest UsersMessagesImport where
type Rs UsersMessagesImport = Message
type Scopes UsersMessagesImport =
'["https://mail.google.com/",
"https://www.googleapis.com/auth/gmail.insert",
"https://www.googleapis.com/auth/gmail.modify"]
requestClient UsersMessagesImport'{..}
= go _umiUserId (Just _umiProcessForCalendar)
(Just _umiDeleted)
(Just _umiNeverMarkSpam)
(Just _umiInternalDateSource)
(Just AltJSON)
_umiPayload
gmailService
where go :<|> _
= buildClient
(Proxy :: Proxy UsersMessagesImportResource)
mempty
instance GoogleRequest
(MediaUpload UsersMessagesImport) where
type Rs (MediaUpload UsersMessagesImport) = Message
type Scopes (MediaUpload UsersMessagesImport) =
Scopes UsersMessagesImport
requestClient
(MediaUpload UsersMessagesImport'{..} body)
= go _umiUserId (Just _umiProcessForCalendar)
(Just _umiDeleted)
(Just _umiNeverMarkSpam)
(Just _umiInternalDateSource)
(Just AltJSON)
(Just Multipart)
_umiPayload
body
gmailService
where _ :<|> go
= buildClient
(Proxy :: Proxy UsersMessagesImportResource)
mempty