{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module Network.Google.AdExperienceReport.Types.Product where
import Network.Google.AdExperienceReport.Types.Sum
import Network.Google.Prelude
data SiteSummaryResponse = SiteSummaryResponse'
{ _ssrMobileSummary :: !(Maybe PlatformSummary)
, _ssrReviewedSite :: !(Maybe Text)
, _ssrDesktopSummary :: !(Maybe PlatformSummary)
} deriving (Eq,Show,Data,Typeable,Generic)
siteSummaryResponse
:: SiteSummaryResponse
siteSummaryResponse =
SiteSummaryResponse'
{ _ssrMobileSummary = Nothing
, _ssrReviewedSite = Nothing
, _ssrDesktopSummary = Nothing
}
ssrMobileSummary :: Lens' SiteSummaryResponse (Maybe PlatformSummary)
ssrMobileSummary
= lens _ssrMobileSummary
(\ s a -> s{_ssrMobileSummary = a})
ssrReviewedSite :: Lens' SiteSummaryResponse (Maybe Text)
ssrReviewedSite
= lens _ssrReviewedSite
(\ s a -> s{_ssrReviewedSite = a})
ssrDesktopSummary :: Lens' SiteSummaryResponse (Maybe PlatformSummary)
ssrDesktopSummary
= lens _ssrDesktopSummary
(\ s a -> s{_ssrDesktopSummary = a})
instance FromJSON SiteSummaryResponse where
parseJSON
= withObject "SiteSummaryResponse"
(\ o ->
SiteSummaryResponse' <$>
(o .:? "mobileSummary") <*> (o .:? "reviewedSite")
<*> (o .:? "desktopSummary"))
instance ToJSON SiteSummaryResponse where
toJSON SiteSummaryResponse'{..}
= object
(catMaybes
[("mobileSummary" .=) <$> _ssrMobileSummary,
("reviewedSite" .=) <$> _ssrReviewedSite,
("desktopSummary" .=) <$> _ssrDesktopSummary])
newtype ViolatingSitesResponse = ViolatingSitesResponse'
{ _vsrViolatingSites :: Maybe [SiteSummaryResponse]
} deriving (Eq,Show,Data,Typeable,Generic)
violatingSitesResponse
:: ViolatingSitesResponse
violatingSitesResponse =
ViolatingSitesResponse'
{ _vsrViolatingSites = Nothing
}
vsrViolatingSites :: Lens' ViolatingSitesResponse [SiteSummaryResponse]
vsrViolatingSites
= lens _vsrViolatingSites
(\ s a -> s{_vsrViolatingSites = a})
. _Default
. _Coerce
instance FromJSON ViolatingSitesResponse where
parseJSON
= withObject "ViolatingSitesResponse"
(\ o ->
ViolatingSitesResponse' <$>
(o .:? "violatingSites" .!= mempty))
instance ToJSON ViolatingSitesResponse where
toJSON ViolatingSitesResponse'{..}
= object
(catMaybes
[("violatingSites" .=) <$> _vsrViolatingSites])
data PlatformSummary = PlatformSummary'
{ _psEnforcementTime :: !(Maybe DateTime')
, _psLastChangeTime :: !(Maybe DateTime')
, _psFilterStatus :: !(Maybe PlatformSummaryFilterStatus)
, _psUnderReview :: !(Maybe Bool)
, _psBetterAdsStatus :: !(Maybe PlatformSummaryBetterAdsStatus)
, _psReportURL :: !(Maybe Text)
, _psRegion :: !(Maybe [Text])
} deriving (Eq,Show,Data,Typeable,Generic)
platformSummary
:: PlatformSummary
platformSummary =
PlatformSummary'
{ _psEnforcementTime = Nothing
, _psLastChangeTime = Nothing
, _psFilterStatus = Nothing
, _psUnderReview = Nothing
, _psBetterAdsStatus = Nothing
, _psReportURL = Nothing
, _psRegion = Nothing
}
psEnforcementTime :: Lens' PlatformSummary (Maybe UTCTime)
psEnforcementTime
= lens _psEnforcementTime
(\ s a -> s{_psEnforcementTime = a})
. mapping _DateTime
psLastChangeTime :: Lens' PlatformSummary (Maybe UTCTime)
psLastChangeTime
= lens _psLastChangeTime
(\ s a -> s{_psLastChangeTime = a})
. mapping _DateTime
psFilterStatus :: Lens' PlatformSummary (Maybe PlatformSummaryFilterStatus)
psFilterStatus
= lens _psFilterStatus
(\ s a -> s{_psFilterStatus = a})
psUnderReview :: Lens' PlatformSummary (Maybe Bool)
psUnderReview
= lens _psUnderReview
(\ s a -> s{_psUnderReview = a})
psBetterAdsStatus :: Lens' PlatformSummary (Maybe PlatformSummaryBetterAdsStatus)
psBetterAdsStatus
= lens _psBetterAdsStatus
(\ s a -> s{_psBetterAdsStatus = a})
psReportURL :: Lens' PlatformSummary (Maybe Text)
psReportURL
= lens _psReportURL (\ s a -> s{_psReportURL = a})
psRegion :: Lens' PlatformSummary [Text]
psRegion
= lens _psRegion (\ s a -> s{_psRegion = a}) .
_Default
. _Coerce
instance FromJSON PlatformSummary where
parseJSON
= withObject "PlatformSummary"
(\ o ->
PlatformSummary' <$>
(o .:? "enforcementTime") <*>
(o .:? "lastChangeTime")
<*> (o .:? "filterStatus")
<*> (o .:? "underReview")
<*> (o .:? "betterAdsStatus")
<*> (o .:? "reportUrl")
<*> (o .:? "region" .!= mempty))
instance ToJSON PlatformSummary where
toJSON PlatformSummary'{..}
= object
(catMaybes
[("enforcementTime" .=) <$> _psEnforcementTime,
("lastChangeTime" .=) <$> _psLastChangeTime,
("filterStatus" .=) <$> _psFilterStatus,
("underReview" .=) <$> _psUnderReview,
("betterAdsStatus" .=) <$> _psBetterAdsStatus,
("reportUrl" .=) <$> _psReportURL,
("region" .=) <$> _psRegion])