{-# 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.Webmasters.Searchanalytics.Query
(
SearchanalyticsQueryResource
, searchanalyticsQuery
, SearchanalyticsQuery
, sqSiteURL
, sqPayload
) where
import Network.Google.Prelude
import Network.Google.WebmasterTools.Types
type SearchanalyticsQueryResource =
"webmasters" :>
"v3" :>
"sites" :>
Capture "siteUrl" Text :>
"searchAnalytics" :>
"query" :>
QueryParam "alt" AltJSON :>
ReqBody '[JSON] SearchAnalyticsQueryRequest :>
Post '[JSON] SearchAnalyticsQueryResponse
-- | Query your data with filters and parameters that you define. Returns
-- zero or more rows grouped by the row keys that you define. You must
-- define a date range of one or more days. When date is one of the group
-- by values, any days without data are omitted from the result list. If
-- you need to know which days have data, issue a broad date range query
-- grouped by date for any metric, and see which day rows are returned.
--
-- /See:/ 'searchanalyticsQuery' smart constructor.
data SearchanalyticsQuery = SearchanalyticsQuery'
{ _sqSiteURL :: !Text
, _sqPayload :: !SearchAnalyticsQueryRequest
} deriving (Eq,Show,Data,Typeable,Generic)
-- | Creates a value of 'SearchanalyticsQuery' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'sqSiteURL'
--
-- * 'sqPayload'
searchanalyticsQuery
:: Text -- ^ 'sqSiteURL'
-> SearchAnalyticsQueryRequest -- ^ 'sqPayload'
-> SearchanalyticsQuery
searchanalyticsQuery pSqSiteURL_ pSqPayload_ =
SearchanalyticsQuery'
{ _sqSiteURL = pSqSiteURL_
, _sqPayload = pSqPayload_
}
-- | The site\'s URL, including protocol. For example:
-- http:\/\/www.example.com\/
sqSiteURL :: Lens' SearchanalyticsQuery Text
sqSiteURL
= lens _sqSiteURL (\ s a -> s{_sqSiteURL = a})
-- | Multipart request metadata.
sqPayload :: Lens' SearchanalyticsQuery SearchAnalyticsQueryRequest
sqPayload
= lens _sqPayload (\ s a -> s{_sqPayload = a})
instance GoogleRequest SearchanalyticsQuery where
type Rs SearchanalyticsQuery =
SearchAnalyticsQueryResponse
type Scopes SearchanalyticsQuery =
'["https://www.googleapis.com/auth/webmasters",
"https://www.googleapis.com/auth/webmasters.readonly"]
requestClient SearchanalyticsQuery'{..}
= go _sqSiteURL (Just AltJSON) _sqPayload
webmasterToolsService
where go
= buildClient
(Proxy :: Proxy SearchanalyticsQueryResource)
mempty