{-# 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.Labels.Create
(
UsersLabelsCreateResource
, usersLabelsCreate
, UsersLabelsCreate
, ulcPayload
, ulcUserId
) where
import Network.Google.Gmail.Types
import Network.Google.Prelude
type UsersLabelsCreateResource =
"gmail" :>
"v1" :>
"users" :>
Capture "userId" Text :>
"labels" :>
QueryParam "alt" AltJSON :>
ReqBody '[JSON] Label :> Post '[JSON] Label
data UsersLabelsCreate = UsersLabelsCreate'
{ _ulcPayload :: !Label
, _ulcUserId :: !Text
} deriving (Eq,Show,Data,Typeable,Generic)
usersLabelsCreate
:: Label
-> UsersLabelsCreate
usersLabelsCreate pUlcPayload_ =
UsersLabelsCreate'
{ _ulcPayload = pUlcPayload_
, _ulcUserId = "me"
}
ulcPayload :: Lens' UsersLabelsCreate Label
ulcPayload
= lens _ulcPayload (\ s a -> s{_ulcPayload = a})
ulcUserId :: Lens' UsersLabelsCreate Text
ulcUserId
= lens _ulcUserId (\ s a -> s{_ulcUserId = a})
instance GoogleRequest UsersLabelsCreate where
type Rs UsersLabelsCreate = Label
type Scopes UsersLabelsCreate =
'["https://mail.google.com/",
"https://www.googleapis.com/auth/gmail.labels",
"https://www.googleapis.com/auth/gmail.modify"]
requestClient UsersLabelsCreate'{..}
= go _ulcUserId (Just AltJSON) _ulcPayload
gmailService
where go
= buildClient
(Proxy :: Proxy UsersLabelsCreateResource)
mempty