module Network.Google.Resource.EmailMigration.Mail.Insert
(
MailInsertResource
, mailInsert
, MailInsert
, miPayload
, miUserKey
) where
import Network.Google.EmailMigration.Types
import Network.Google.Prelude
type MailInsertResource =
"email" :>
"v2" :>
"users" :>
Capture "userKey" Text :>
"mail" :>
QueryParam "alt" AltJSON :>
ReqBody '[JSON] MailItem :> Post '[JSON] ()
:<|>
"upload" :>
"email" :>
"v2" :>
"users" :>
Capture "userKey" Text :>
"mail" :>
QueryParam "alt" AltJSON :>
QueryParam "uploadType" Multipart :>
MultipartRelated '[JSON] MailItem :> Post '[JSON] ()
data MailInsert = MailInsert'
{ _miPayload :: !MailItem
, _miUserKey :: !Text
} deriving (Eq,Show,Data,Typeable,Generic)
mailInsert
:: MailItem
-> Text
-> MailInsert
mailInsert pMiPayload_ pMiUserKey_ =
MailInsert'
{ _miPayload = pMiPayload_
, _miUserKey = pMiUserKey_
}
miPayload :: Lens' MailInsert MailItem
miPayload
= lens _miPayload (\ s a -> s{_miPayload = a})
miUserKey :: Lens' MailInsert Text
miUserKey
= lens _miUserKey (\ s a -> s{_miUserKey = a})
instance GoogleRequest MailInsert where
type Rs MailInsert = ()
type Scopes MailInsert =
'["https://www.googleapis.com/auth/email.migration"]
requestClient MailInsert'{..}
= go _miUserKey (Just AltJSON) _miPayload
emailMigrationService
where go :<|> _
= buildClient (Proxy :: Proxy MailInsertResource)
mempty
instance GoogleRequest (MediaUpload MailInsert) where
type Rs (MediaUpload MailInsert) = ()
type Scopes (MediaUpload MailInsert) =
Scopes MailInsert
requestClient (MediaUpload MailInsert'{..} body)
= go _miUserKey (Just AltJSON) (Just Multipart)
_miPayload
body
emailMigrationService
where _ :<|> go
= buildClient (Proxy :: Proxy MailInsertResource)
mempty