{-# 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.Blogger.Posts.Search
(
PostsSearchResource
, postsSearch
, PostsSearch
, psOrderBy
, psBlogId
, psQ
, psFetchBodies
) where
import Network.Google.Blogger.Types
import Network.Google.Prelude
type PostsSearchResource =
"blogger" :>
"v3" :>
"blogs" :>
Capture "blogId" Text :>
"posts" :>
"search" :>
QueryParam "q" Text :>
QueryParam "orderBy" PostsSearchOrderBy :>
QueryParam "fetchBodies" Bool :>
QueryParam "alt" AltJSON :> Get '[JSON] PostList
data PostsSearch = PostsSearch'
{ _psOrderBy :: !PostsSearchOrderBy
, _psBlogId :: !Text
, _psQ :: !Text
, _psFetchBodies :: !Bool
} deriving (Eq,Show,Data,Typeable,Generic)
postsSearch
:: Text
-> Text
-> PostsSearch
postsSearch pPsBlogId_ pPsQ_ =
PostsSearch'
{ _psOrderBy = PSOBPublished
, _psBlogId = pPsBlogId_
, _psQ = pPsQ_
, _psFetchBodies = True
}
psOrderBy :: Lens' PostsSearch PostsSearchOrderBy
psOrderBy
= lens _psOrderBy (\ s a -> s{_psOrderBy = a})
psBlogId :: Lens' PostsSearch Text
psBlogId = lens _psBlogId (\ s a -> s{_psBlogId = a})
psQ :: Lens' PostsSearch Text
psQ = lens _psQ (\ s a -> s{_psQ = a})
psFetchBodies :: Lens' PostsSearch Bool
psFetchBodies
= lens _psFetchBodies
(\ s a -> s{_psFetchBodies = a})
instance GoogleRequest PostsSearch where
type Rs PostsSearch = PostList
type Scopes PostsSearch =
'["https://www.googleapis.com/auth/blogger",
"https://www.googleapis.com/auth/blogger.readonly"]
requestClient PostsSearch'{..}
= go _psBlogId (Just _psQ) (Just _psOrderBy)
(Just _psFetchBodies)
(Just AltJSON)
bloggerService
where go
= buildClient (Proxy :: Proxy PostsSearchResource)
mempty