{-# 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.AdSense.Reports.Generate
(
ReportsGenerateResource
, reportsGenerate
, ReportsGenerate
, rgDimension
, rgLocale
, rgEndDate
, rgStartDate
, rgAccountId
, rgMetric
, rgCurrency
, rgSort
, rgFilter
, rgStartIndex
, rgUseTimezoneReporting
, rgMaxResults
) where
import Network.Google.AdSense.Types
import Network.Google.Prelude
type ReportsGenerateResource =
"adsense" :>
"v1.4" :>
"reports" :>
QueryParam "startDate" Text :>
QueryParam "endDate" Text :>
QueryParams "dimension" Text :>
QueryParam "locale" Text :>
QueryParams "accountId" Text :>
QueryParams "metric" Text :>
QueryParam "currency" Text :>
QueryParams "sort" Text :>
QueryParams "filter" Text :>
QueryParam "startIndex" (Textual Int32) :>
QueryParam "useTimezoneReporting" Bool :>
QueryParam "maxResults" (Textual Int32) :>
QueryParam "alt" AltJSON :>
Get '[JSON] AdsenseReportsGenerateResponse
:<|>
"adsense" :>
"v1.4" :>
"reports" :>
QueryParam "startDate" Text :>
QueryParam "endDate" Text :>
QueryParams "dimension" Text :>
QueryParam "locale" Text :>
QueryParams "accountId" Text :>
QueryParams "metric" Text :>
QueryParam "currency" Text :>
QueryParams "sort" Text :>
QueryParams "filter" Text :>
QueryParam "startIndex" (Textual Int32) :>
QueryParam "useTimezoneReporting" Bool :>
QueryParam "maxResults" (Textual Int32) :>
QueryParam "alt" AltMedia :>
Get '[OctetStream] Stream
data ReportsGenerate = ReportsGenerate'
{ _rgDimension :: !(Maybe [Text])
, _rgLocale :: !(Maybe Text)
, _rgEndDate :: !Text
, _rgStartDate :: !Text
, _rgAccountId :: !(Maybe [Text])
, _rgMetric :: !(Maybe [Text])
, _rgCurrency :: !(Maybe Text)
, _rgSort :: !(Maybe [Text])
, _rgFilter :: !(Maybe [Text])
, _rgStartIndex :: !(Maybe (Textual Int32))
, _rgUseTimezoneReporting :: !(Maybe Bool)
, _rgMaxResults :: !(Maybe (Textual Int32))
} deriving (Eq,Show,Data,Typeable,Generic)
reportsGenerate
:: Text
-> Text
-> ReportsGenerate
reportsGenerate pRgEndDate_ pRgStartDate_ =
ReportsGenerate'
{ _rgDimension = Nothing
, _rgLocale = Nothing
, _rgEndDate = pRgEndDate_
, _rgStartDate = pRgStartDate_
, _rgAccountId = Nothing
, _rgMetric = Nothing
, _rgCurrency = Nothing
, _rgSort = Nothing
, _rgFilter = Nothing
, _rgStartIndex = Nothing
, _rgUseTimezoneReporting = Nothing
, _rgMaxResults = Nothing
}
rgDimension :: Lens' ReportsGenerate [Text]
rgDimension
= lens _rgDimension (\ s a -> s{_rgDimension = a}) .
_Default
. _Coerce
rgLocale :: Lens' ReportsGenerate (Maybe Text)
rgLocale = lens _rgLocale (\ s a -> s{_rgLocale = a})
rgEndDate :: Lens' ReportsGenerate Text
rgEndDate
= lens _rgEndDate (\ s a -> s{_rgEndDate = a})
rgStartDate :: Lens' ReportsGenerate Text
rgStartDate
= lens _rgStartDate (\ s a -> s{_rgStartDate = a})
rgAccountId :: Lens' ReportsGenerate [Text]
rgAccountId
= lens _rgAccountId (\ s a -> s{_rgAccountId = a}) .
_Default
. _Coerce
rgMetric :: Lens' ReportsGenerate [Text]
rgMetric
= lens _rgMetric (\ s a -> s{_rgMetric = a}) .
_Default
. _Coerce
rgCurrency :: Lens' ReportsGenerate (Maybe Text)
rgCurrency
= lens _rgCurrency (\ s a -> s{_rgCurrency = a})
rgSort :: Lens' ReportsGenerate [Text]
rgSort
= lens _rgSort (\ s a -> s{_rgSort = a}) . _Default .
_Coerce
rgFilter :: Lens' ReportsGenerate [Text]
rgFilter
= lens _rgFilter (\ s a -> s{_rgFilter = a}) .
_Default
. _Coerce
rgStartIndex :: Lens' ReportsGenerate (Maybe Int32)
rgStartIndex
= lens _rgStartIndex (\ s a -> s{_rgStartIndex = a})
. mapping _Coerce
rgUseTimezoneReporting :: Lens' ReportsGenerate (Maybe Bool)
rgUseTimezoneReporting
= lens _rgUseTimezoneReporting
(\ s a -> s{_rgUseTimezoneReporting = a})
rgMaxResults :: Lens' ReportsGenerate (Maybe Int32)
rgMaxResults
= lens _rgMaxResults (\ s a -> s{_rgMaxResults = a})
. mapping _Coerce
instance GoogleRequest ReportsGenerate where
type Rs ReportsGenerate =
AdsenseReportsGenerateResponse
type Scopes ReportsGenerate =
'["https://www.googleapis.com/auth/adsense",
"https://www.googleapis.com/auth/adsense.readonly"]
requestClient ReportsGenerate'{..}
= go (Just _rgStartDate) (Just _rgEndDate)
(_rgDimension ^. _Default)
_rgLocale
(_rgAccountId ^. _Default)
(_rgMetric ^. _Default)
_rgCurrency
(_rgSort ^. _Default)
(_rgFilter ^. _Default)
_rgStartIndex
_rgUseTimezoneReporting
_rgMaxResults
(Just AltJSON)
adSenseService
where go :<|> _
= buildClient
(Proxy :: Proxy ReportsGenerateResource)
mempty
instance GoogleRequest
(MediaDownload ReportsGenerate) where
type Rs (MediaDownload ReportsGenerate) = Stream
type Scopes (MediaDownload ReportsGenerate) =
Scopes ReportsGenerate
requestClient (MediaDownload ReportsGenerate'{..})
= go (Just _rgStartDate) (Just _rgEndDate)
(_rgDimension ^. _Default)
_rgLocale
(_rgAccountId ^. _Default)
(_rgMetric ^. _Default)
_rgCurrency
(_rgSort ^. _Default)
(_rgFilter ^. _Default)
_rgStartIndex
_rgUseTimezoneReporting
_rgMaxResults
(Just AltMedia)
adSenseService
where _ :<|> go
= buildClient
(Proxy :: Proxy ReportsGenerateResource)
mempty