{-# 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.Threads.List
(
UsersThreadsListResource
, usersThreadsList
, UsersThreadsList
, utlQ
, utlUserId
, utlIncludeSpamTrash
, utlLabelIds
, utlPageToken
, utlMaxResults
) where
import Network.Google.Gmail.Types
import Network.Google.Prelude
type UsersThreadsListResource =
"gmail" :>
"v1" :>
"users" :>
Capture "userId" Text :>
"threads" :>
QueryParam "q" Text :>
QueryParam "includeSpamTrash" Bool :>
QueryParams "labelIds" Text :>
QueryParam "pageToken" Text :>
QueryParam "maxResults" (Textual Word32) :>
QueryParam "alt" AltJSON :>
Get '[JSON] ListThreadsResponse
data UsersThreadsList = UsersThreadsList'
{ _utlQ :: !(Maybe Text)
, _utlUserId :: !Text
, _utlIncludeSpamTrash :: !Bool
, _utlLabelIds :: !(Maybe [Text])
, _utlPageToken :: !(Maybe Text)
, _utlMaxResults :: !(Textual Word32)
} deriving (Eq,Show,Data,Typeable,Generic)
usersThreadsList
:: UsersThreadsList
usersThreadsList =
UsersThreadsList'
{ _utlQ = Nothing
, _utlUserId = "me"
, _utlIncludeSpamTrash = False
, _utlLabelIds = Nothing
, _utlPageToken = Nothing
, _utlMaxResults = 100
}
utlQ :: Lens' UsersThreadsList (Maybe Text)
utlQ = lens _utlQ (\ s a -> s{_utlQ = a})
utlUserId :: Lens' UsersThreadsList Text
utlUserId
= lens _utlUserId (\ s a -> s{_utlUserId = a})
utlIncludeSpamTrash :: Lens' UsersThreadsList Bool
utlIncludeSpamTrash
= lens _utlIncludeSpamTrash
(\ s a -> s{_utlIncludeSpamTrash = a})
utlLabelIds :: Lens' UsersThreadsList [Text]
utlLabelIds
= lens _utlLabelIds (\ s a -> s{_utlLabelIds = a}) .
_Default
. _Coerce
utlPageToken :: Lens' UsersThreadsList (Maybe Text)
utlPageToken
= lens _utlPageToken (\ s a -> s{_utlPageToken = a})
utlMaxResults :: Lens' UsersThreadsList Word32
utlMaxResults
= lens _utlMaxResults
(\ s a -> s{_utlMaxResults = a})
. _Coerce
instance GoogleRequest UsersThreadsList where
type Rs UsersThreadsList = ListThreadsResponse
type Scopes UsersThreadsList =
'["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 UsersThreadsList'{..}
= go _utlUserId _utlQ (Just _utlIncludeSpamTrash)
(_utlLabelIds ^. _Default)
_utlPageToken
(Just _utlMaxResults)
(Just AltJSON)
gmailService
where go
= buildClient
(Proxy :: Proxy UsersThreadsListResource)
mempty