{-# 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.Settings.Filters.Create
(
UsersSettingsFiltersCreateResource
, usersSettingsFiltersCreate
, UsersSettingsFiltersCreate
, usfcPayload
, usfcUserId
) where
import Network.Google.Gmail.Types
import Network.Google.Prelude
type UsersSettingsFiltersCreateResource =
"gmail" :>
"v1" :>
"users" :>
Capture "userId" Text :>
"settings" :>
"filters" :>
QueryParam "alt" AltJSON :>
ReqBody '[JSON] Filter :> Post '[JSON] Filter
data UsersSettingsFiltersCreate = UsersSettingsFiltersCreate'
{ _usfcPayload :: !Filter
, _usfcUserId :: !Text
} deriving (Eq,Show,Data,Typeable,Generic)
usersSettingsFiltersCreate
:: Filter
-> UsersSettingsFiltersCreate
usersSettingsFiltersCreate pUsfcPayload_ =
UsersSettingsFiltersCreate'
{ _usfcPayload = pUsfcPayload_
, _usfcUserId = "me"
}
usfcPayload :: Lens' UsersSettingsFiltersCreate Filter
usfcPayload
= lens _usfcPayload (\ s a -> s{_usfcPayload = a})
usfcUserId :: Lens' UsersSettingsFiltersCreate Text
usfcUserId
= lens _usfcUserId (\ s a -> s{_usfcUserId = a})
instance GoogleRequest UsersSettingsFiltersCreate
where
type Rs UsersSettingsFiltersCreate = Filter
type Scopes UsersSettingsFiltersCreate =
'["https://www.googleapis.com/auth/gmail.settings.basic"]
requestClient UsersSettingsFiltersCreate'{..}
= go _usfcUserId (Just AltJSON) _usfcPayload
gmailService
where go
= buildClient
(Proxy :: Proxy UsersSettingsFiltersCreateResource)
mempty