{-# 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.List
(
UsersMessagesListResource
, usersMessagesList
, UsersMessagesList
, umlQ
, umlUserId
, umlIncludeSpamTrash
, umlLabelIds
, umlPageToken
, umlMaxResults
) where
import Network.Google.Gmail.Types
import Network.Google.Prelude
type UsersMessagesListResource =
"gmail" :>
"v1" :>
"users" :>
Capture "userId" Text :>
"messages" :>
QueryParam "q" Text :>
QueryParam "includeSpamTrash" Bool :>
QueryParams "labelIds" Text :>
QueryParam "pageToken" Text :>
QueryParam "maxResults" (Textual Word32) :>
QueryParam "alt" AltJSON :>
Get '[JSON] ListMessagesResponse
data UsersMessagesList = UsersMessagesList'
{ _umlQ :: !(Maybe Text)
, _umlUserId :: !Text
, _umlIncludeSpamTrash :: !Bool
, _umlLabelIds :: !(Maybe [Text])
, _umlPageToken :: !(Maybe Text)
, _umlMaxResults :: !(Textual Word32)
} deriving (Eq,Show,Data,Typeable,Generic)
usersMessagesList
:: UsersMessagesList
usersMessagesList =
UsersMessagesList'
{ _umlQ = Nothing
, _umlUserId = "me"
, _umlIncludeSpamTrash = False
, _umlLabelIds = Nothing
, _umlPageToken = Nothing
, _umlMaxResults = 100
}
umlQ :: Lens' UsersMessagesList (Maybe Text)
umlQ = lens _umlQ (\ s a -> s{_umlQ = a})
umlUserId :: Lens' UsersMessagesList Text
umlUserId
= lens _umlUserId (\ s a -> s{_umlUserId = a})
umlIncludeSpamTrash :: Lens' UsersMessagesList Bool
umlIncludeSpamTrash
= lens _umlIncludeSpamTrash
(\ s a -> s{_umlIncludeSpamTrash = a})
umlLabelIds :: Lens' UsersMessagesList [Text]
umlLabelIds
= lens _umlLabelIds (\ s a -> s{_umlLabelIds = a}) .
_Default
. _Coerce
umlPageToken :: Lens' UsersMessagesList (Maybe Text)
umlPageToken
= lens _umlPageToken (\ s a -> s{_umlPageToken = a})
umlMaxResults :: Lens' UsersMessagesList Word32
umlMaxResults
= lens _umlMaxResults
(\ s a -> s{_umlMaxResults = a})
. _Coerce
instance GoogleRequest UsersMessagesList where
type Rs UsersMessagesList = ListMessagesResponse
type Scopes UsersMessagesList =
'["https://mail.google.com/",
"https://www.googleapis.com/auth/gmail.metadata",
"https://www.googleapis.com/auth/gmail.modify",
"https://www.googleapis.com/auth/gmail.readonly"]
requestClient UsersMessagesList'{..}
= go _umlUserId _umlQ (Just _umlIncludeSpamTrash)
(_umlLabelIds ^. _Default)
_umlPageToken
(Just _umlMaxResults)
(Just AltJSON)
gmailService
where go
= buildClient
(Proxy :: Proxy UsersMessagesListResource)
mempty