{-# 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.List
(
UsersDraftsListResource
, usersDraftsList
, UsersDraftsList
, udlQ
, udlUserId
, udlIncludeSpamTrash
, udlPageToken
, udlMaxResults
) where
import Network.Google.Gmail.Types
import Network.Google.Prelude
type UsersDraftsListResource =
"gmail" :>
"v1" :>
"users" :>
Capture "userId" Text :>
"drafts" :>
QueryParam "q" Text :>
QueryParam "includeSpamTrash" Bool :>
QueryParam "pageToken" Text :>
QueryParam "maxResults" (Textual Word32) :>
QueryParam "alt" AltJSON :>
Get '[JSON] ListDraftsResponse
data UsersDraftsList = UsersDraftsList'
{ _udlQ :: !(Maybe Text)
, _udlUserId :: !Text
, _udlIncludeSpamTrash :: !Bool
, _udlPageToken :: !(Maybe Text)
, _udlMaxResults :: !(Textual Word32)
} deriving (Eq,Show,Data,Typeable,Generic)
usersDraftsList
:: UsersDraftsList
usersDraftsList =
UsersDraftsList'
{ _udlQ = Nothing
, _udlUserId = "me"
, _udlIncludeSpamTrash = False
, _udlPageToken = Nothing
, _udlMaxResults = 100
}
udlQ :: Lens' UsersDraftsList (Maybe Text)
udlQ = lens _udlQ (\ s a -> s{_udlQ = a})
udlUserId :: Lens' UsersDraftsList Text
udlUserId
= lens _udlUserId (\ s a -> s{_udlUserId = a})
udlIncludeSpamTrash :: Lens' UsersDraftsList Bool
udlIncludeSpamTrash
= lens _udlIncludeSpamTrash
(\ s a -> s{_udlIncludeSpamTrash = a})
udlPageToken :: Lens' UsersDraftsList (Maybe Text)
udlPageToken
= lens _udlPageToken (\ s a -> s{_udlPageToken = a})
udlMaxResults :: Lens' UsersDraftsList Word32
udlMaxResults
= lens _udlMaxResults
(\ s a -> s{_udlMaxResults = a})
. _Coerce
instance GoogleRequest UsersDraftsList where
type Rs UsersDraftsList = ListDraftsResponse
type Scopes UsersDraftsList =
'["https://mail.google.com/",
"https://www.googleapis.com/auth/gmail.compose",
"https://www.googleapis.com/auth/gmail.modify",
"https://www.googleapis.com/auth/gmail.readonly"]
requestClient UsersDraftsList'{..}
= go _udlUserId _udlQ (Just _udlIncludeSpamTrash)
_udlPageToken
(Just _udlMaxResults)
(Just AltJSON)
gmailService
where go
= buildClient
(Proxy :: Proxy UsersDraftsListResource)
mempty