@@ -1,6 +1,7 @@
11{-# LANGUAGE DeriveDataTypeable #-}
22{-# LANGUAGE DeriveGeneric #-}
33{-# LANGUAGE OverloadedStrings #-}
4+{-# LANGUAGE RecordWildCards #-}
45
56{-# OPTIONS_GHC -fno-warn-unused-imports #-}
67
@@ -103,6 +104,32 @@ accPermissions
103104 = lens _accPermissions
104105 (\ s a -> s{_accPermissions = a})
105106
107+instance FromJSON Account where
108+ parseJSON
109+ = withObject "Account"
110+ (\ o ->
111+ Account <$>
112+ (o .:? "childLink") <*>
113+ (o .:? "kind" .!= "analytics#account")
114+ <*> (o .:? "created")
115+ <*> (o .:? "selfLink")
116+ <*> (o .:? "name")
117+ <*> (o .:? "id")
118+ <*> (o .:? "updated")
119+ <*> (o .:? "permissions"))
120+
121+instance ToJSON Account where
122+ toJSON Account{..}
123+ = object
124+ (catMaybes
125+ [("childLink" .=) <$> _accChildLink,
126+ Just ("kind" .= _accKind),
127+ ("created" .=) <$> _accCreated,
128+ ("selfLink" .=) <$> _accSelfLink,
129+ ("name" .=) <$> _accName, ("id" .=) <$> _accId,
130+ ("updated" .=) <$> _accUpdated,
131+ ("permissions" .=) <$> _accPermissions])
132+
106133-- | Child link for an account entry. Points to the list of web properties
107134-- for this account.
108135--
@@ -135,6 +162,21 @@ aclHref = lens _aclHref (\ s a -> s{_aclHref = a})
135162aclType :: Lens' AccountChildLink Text
136163aclType = lens _aclType (\ s a -> s{_aclType = a})
137164
165+instance FromJSON AccountChildLink where
166+ parseJSON
167+ = withObject "AccountChildLink"
168+ (\ o ->
169+ AccountChildLink <$>
170+ (o .:? "href") <*>
171+ (o .:? "type" .!= "analytics#webproperties"))
172+
173+instance ToJSON AccountChildLink where
174+ toJSON AccountChildLink{..}
175+ = object
176+ (catMaybes
177+ [("href" .=) <$> _aclHref,
178+ Just ("type" .= _aclType)])
179+
138180-- | Permissions the user has for this account.
139181--
140182-- /See:/ 'accountPermissions' smart constructor.
@@ -162,6 +204,18 @@ apEffective
162204 _Default
163205 . _Coerce
164206
207+instance FromJSON AccountPermissions where
208+ parseJSON
209+ = withObject "AccountPermissions"
210+ (\ o ->
211+ AccountPermissions <$>
212+ (o .:? "effective" .!= mempty))
213+
214+instance ToJSON AccountPermissions where
215+ toJSON AccountPermissions{..}
216+ = object
217+ (catMaybes [("effective" .=) <$> _apEffective])
218+
165219-- | JSON template for a linked account.
166220--
167221-- /See:/ 'accountRef' smart constructor.
@@ -209,6 +263,23 @@ arName = lens _arName (\ s a -> s{_arName = a})
209263arId :: Lens' AccountRef (Maybe Text)
210264arId = lens _arId (\ s a -> s{_arId = a})
211265
266+instance FromJSON AccountRef where
267+ parseJSON
268+ = withObject "AccountRef"
269+ (\ o ->
270+ AccountRef <$>
271+ (o .:? "kind" .!= "analytics#accountRef") <*>
272+ (o .:? "href")
273+ <*> (o .:? "name")
274+ <*> (o .:? "id"))
275+
276+instance ToJSON AccountRef where
277+ toJSON AccountRef{..}
278+ = object
279+ (catMaybes
280+ [Just ("kind" .= _arKind), ("href" .=) <$> _arHref,
281+ ("name" .=) <$> _arName, ("id" .=) <$> _arId])
282+
212283-- | An AccountSummary collection lists a summary of accounts, properties and
213284-- views (profiles) to which the user has access. Each resource in the
214285-- collection corresponds to a single AccountSummary.
@@ -308,6 +379,32 @@ assPreviousLink
308379 = lens _assPreviousLink
309380 (\ s a -> s{_assPreviousLink = a})
310381
382+instance FromJSON AccountSummaries where
383+ parseJSON
384+ = withObject "AccountSummaries"
385+ (\ o ->
386+ AccountSummaries <$>
387+ (o .:? "nextLink") <*> (o .:? "itemsPerPage") <*>
388+ (o .:? "kind" .!= "analytics#accountSummaries")
389+ <*> (o .:? "username")
390+ <*> (o .:? "items" .!= mempty)
391+ <*> (o .:? "totalResults")
392+ <*> (o .:? "startIndex")
393+ <*> (o .:? "previousLink"))
394+
395+instance ToJSON AccountSummaries where
396+ toJSON AccountSummaries{..}
397+ = object
398+ (catMaybes
399+ [("nextLink" .=) <$> _assNextLink,
400+ ("itemsPerPage" .=) <$> _assItemsPerPage,
401+ Just ("kind" .= _assKind),
402+ ("username" .=) <$> _assUsername,
403+ ("items" .=) <$> _assItems,
404+ ("totalResults" .=) <$> _assTotalResults,
405+ ("startIndex" .=) <$> _assStartIndex,
406+ ("previousLink" .=) <$> _assPreviousLink])
407+
311408-- | JSON template for an Analytics AccountSummary. An AccountSummary is a
312409-- lightweight tree comprised of properties\/profiles.
313410--
@@ -360,6 +457,24 @@ asName = lens _asName (\ s a -> s{_asName = a})
360457asId :: Lens' AccountSummary (Maybe Text)
361458asId = lens _asId (\ s a -> s{_asId = a})
362459
460+instance FromJSON AccountSummary where
461+ parseJSON
462+ = withObject "AccountSummary"
463+ (\ o ->
464+ AccountSummary <$>
465+ (o .:? "kind" .!= "analytics#accountSummary") <*>
466+ (o .:? "webProperties" .!= mempty)
467+ <*> (o .:? "name")
468+ <*> (o .:? "id"))
469+
470+instance ToJSON AccountSummary where
471+ toJSON AccountSummary{..}
472+ = object
473+ (catMaybes
474+ [Just ("kind" .= _asKind),
475+ ("webProperties" .=) <$> _asWebProperties,
476+ ("name" .=) <$> _asName, ("id" .=) <$> _asId])
477+
363478-- | JSON template for an Analytics account ticket. The account ticket
364479-- consists of the ticket ID and the basic information for the account,
365480-- property and profile.
@@ -432,6 +547,29 @@ atWebproperty
432547atId :: Lens' AccountTicket (Maybe Text)
433548atId = lens _atId (\ s a -> s{_atId = a})
434549
550+instance FromJSON AccountTicket where
551+ parseJSON
552+ = withObject "AccountTicket"
553+ (\ o ->
554+ AccountTicket <$>
555+ (o .:? "redirectUri") <*>
556+ (o .:? "kind" .!= "analytics#accountTicket")
557+ <*> (o .:? "profile")
558+ <*> (o .:? "account")
559+ <*> (o .:? "webproperty")
560+ <*> (o .:? "id"))
561+
562+instance ToJSON AccountTicket where
563+ toJSON AccountTicket{..}
564+ = object
565+ (catMaybes
566+ [("redirectUri" .=) <$> _atRedirectUri,
567+ Just ("kind" .= _atKind),
568+ ("profile" .=) <$> _atProfile,
569+ ("account" .=) <$> _atAccount,
570+ ("webproperty" .=) <$> _atWebproperty,
571+ ("id" .=) <$> _atId])
572+
435573-- | An account collection provides a list of Analytics accounts to which a
436574-- user has access. The account collection is the entry point to all
437575-- management information. Each resource in the collection corresponds to a
@@ -530,6 +668,32 @@ aPreviousLink
530668 = lens _aPreviousLink
531669 (\ s a -> s{_aPreviousLink = a})
532670
671+instance FromJSON Accounts where
672+ parseJSON
673+ = withObject "Accounts"
674+ (\ o ->
675+ Accounts <$>
676+ (o .:? "nextLink") <*> (o .:? "itemsPerPage") <*>
677+ (o .:? "kind" .!= "analytics#accounts")
678+ <*> (o .:? "username")
679+ <*> (o .:? "items" .!= mempty)
680+ <*> (o .:? "totalResults")
681+ <*> (o .:? "startIndex")
682+ <*> (o .:? "previousLink"))
683+
684+instance ToJSON Accounts where
685+ toJSON Accounts{..}
686+ = object
687+ (catMaybes
688+ [("nextLink" .=) <$> _aNextLink,
689+ ("itemsPerPage" .=) <$> _aItemsPerPage,
690+ Just ("kind" .= _aKind),
691+ ("username" .=) <$> _aUsername,
692+ ("items" .=) <$> _aItems,
693+ ("totalResults" .=) <$> _aTotalResults,
694+ ("startIndex" .=) <$> _aStartIndex,
695+ ("previousLink" .=) <$> _aPreviousLink])
696+
533697-- | JSON template for an AdWords account.
534698--
535699-- /See:/ 'adWordsAccount' smart constructor.
@@ -574,6 +738,24 @@ awaCustomerId
574738 = lens _awaCustomerId
575739 (\ s a -> s{_awaCustomerId = a})
576740
741+instance FromJSON AdWordsAccount where
742+ parseJSON
743+ = withObject "AdWordsAccount"
744+ (\ o ->
745+ AdWordsAccount <$>
746+ (o .:? "autoTaggingEnabled") <*>
747+ (o .:? "kind" .!= "analytics#adWordsAccount")
748+ <*> (o .:? "customerId"))
749+
750+instance ToJSON AdWordsAccount where
751+ toJSON AdWordsAccount{..}
752+ = object
753+ (catMaybes
754+ [("autoTaggingEnabled" .=) <$>
755+ _awaAutoTaggingEnabled,
756+ Just ("kind" .= _awaKind),
757+ ("customerId" .=) <$> _awaCustomerId])
758+
577759-- | Request template for the delete upload data request.
578760--
579761-- /See:/ 'analyticsDataimportDeleteUploadDataRequest' smart constructor.
@@ -601,6 +783,23 @@ addudrCustomDataImportUids
601783 . _Default
602784 . _Coerce
603785
786+instance FromJSON
787+ AnalyticsDataimportDeleteUploadDataRequest where
788+ parseJSON
789+ = withObject
790+ "AnalyticsDataimportDeleteUploadDataRequest"
791+ (\ o ->
792+ AnalyticsDataimportDeleteUploadDataRequest <$>
793+ (o .:? "customDataImportUids" .!= mempty))
794+
795+instance ToJSON
796+ AnalyticsDataimportDeleteUploadDataRequest where
797+ toJSON AnalyticsDataimportDeleteUploadDataRequest{..}
798+ = object
799+ (catMaybes
800+ [("customDataImportUids" .=) <$>
801+ _addudrCustomDataImportUids])
802+
604803-- | JSON template for a metadata column.
605804--
606805-- /See:/ 'column' smart constructor.
@@ -641,6 +840,23 @@ ccAttributes
641840ccId :: Lens' Column (Maybe Text)
642841ccId = lens _ccId (\ s a -> s{_ccId = a})
643842
843+instance FromJSON Column where
844+ parseJSON
845+ = withObject "Column"
846+ (\ o ->
847+ Column <$>
848+ (o .:? "kind" .!= "analytics#column") <*>
849+ (o .:? "attributes")
850+ <*> (o .:? "id"))
851+
852+instance ToJSON Column where
853+ toJSON Column{..}
854+ = object
855+ (catMaybes
856+ [Just ("kind" .= _ccKind),
857+ ("attributes" .=) <$> _ccAttributes,
858+ ("id" .=) <$> _ccId])
859+
644860-- | Map of attribute name and value for this column.
645861--
646862-- /See:/ 'columnAttributes' smart constructor.
@@ -654,6 +870,14 @@ columnAttributes
654870 :: ColumnAttributes
655871columnAttributes = ColumnAttributes
656872
873+instance FromJSON ColumnAttributes where
874+ parseJSON
875+ = withObject "ColumnAttributes"
876+ (\ o -> pure ColumnAttributes)
877+
878+instance ToJSON ColumnAttributes where
879+ toJSON = const (Object mempty)
880+
657881-- | Lists columns (dimensions and metrics) for a particular report type.
658882--
659883-- /See:/ 'columns' smart constructor.
@@ -719,6 +943,26 @@ colAttributeNames
719943 . _Default
720944 . _Coerce
721945
946+instance FromJSON Columns where
947+ parseJSON
948+ = withObject "Columns"
949+ (\ o ->
950+ Columns <$>
951+ (o .:? "etag") <*>
952+ (o .:? "kind" .!= "analytics#columns")
953+ <*> (o .:? "items" .!= mempty)
954+ <*> (o .:? "totalResults")
955+ <*> (o .:? "attributeNames" .!= mempty))
956+
957+instance ToJSON Columns where
958+ toJSON Columns{..}
959+ = object
960+ (catMaybes
961+ [("etag" .=) <$> _colEtag, Just ("kind" .= _colKind),
962+ ("items" .=) <$> _colItems,
963+ ("totalResults" .=) <$> _colTotalResults,
964+ ("attributeNames" .=) <$> _colAttributeNames])
965+
722966-- | JSON template for an Analytics custom data source.
723967--
724968-- /See:/ 'customDataSource' smart constructor.
@@ -872,6 +1116,45 @@ cdsProfilesLinked
8721116 . _Default
8731117 . _Coerce
8741118
1119+instance FromJSON CustomDataSource where
1120+ parseJSON
1121+ = withObject "CustomDataSource"
1122+ (\ o ->
1123+ CustomDataSource <$>
1124+ (o .:? "parentLink") <*> (o .:? "webPropertyId") <*>
1125+ (o .:? "childLink")
1126+ <*> (o .:? "kind" .!= "analytics#customDataSource")
1127+ <*> (o .:? "created")
1128+ <*> (o .:? "uploadType")
1129+ <*> (o .:? "importBehavior")
1130+ <*> (o .:? "selfLink")
1131+ <*> (o .:? "accountId")
1132+ <*> (o .:? "name")
1133+ <*> (o .:? "id")
1134+ <*> (o .:? "updated")
1135+ <*> (o .:? "type")
1136+ <*> (o .:? "description")
1137+ <*> (o .:? "profilesLinked" .!= mempty))
1138+
1139+instance ToJSON CustomDataSource where
1140+ toJSON CustomDataSource{..}
1141+ = object
1142+ (catMaybes
1143+ [("parentLink" .=) <$> _cdsParentLink,
1144+ ("webPropertyId" .=) <$> _cdsWebPropertyId,
1145+ ("childLink" .=) <$> _cdsChildLink,
1146+ Just ("kind" .= _cdsKind),
1147+ ("created" .=) <$> _cdsCreated,
1148+ ("uploadType" .=) <$> _cdsUploadType,
1149+ ("importBehavior" .=) <$> _cdsImportBehavior,
1150+ ("selfLink" .=) <$> _cdsSelfLink,
1151+ ("accountId" .=) <$> _cdsAccountId,
1152+ ("name" .=) <$> _cdsName, ("id" .=) <$> _cdsId,
1153+ ("updated" .=) <$> _cdsUpdated,
1154+ ("type" .=) <$> _cdsType,
1155+ ("description" .=) <$> _cdsDescription,
1156+ ("profilesLinked" .=) <$> _cdsProfilesLinked])
1157+
8751158--
8761159-- /See:/ 'customDataSourceChildLink' smart constructor.
8771160data CustomDataSourceChildLink = CustomDataSourceChildLink
@@ -905,6 +1188,20 @@ cdsclType :: Lens' CustomDataSourceChildLink (Maybe Text)
9051188cdsclType
9061189 = lens _cdsclType (\ s a -> s{_cdsclType = a})
9071190
1191+instance FromJSON CustomDataSourceChildLink where
1192+ parseJSON
1193+ = withObject "CustomDataSourceChildLink"
1194+ (\ o ->
1195+ CustomDataSourceChildLink <$>
1196+ (o .:? "href") <*> (o .:? "type"))
1197+
1198+instance ToJSON CustomDataSourceChildLink where
1199+ toJSON CustomDataSourceChildLink{..}
1200+ = object
1201+ (catMaybes
1202+ [("href" .=) <$> _cdsclHref,
1203+ ("type" .=) <$> _cdsclType])
1204+
9081205-- | Parent link for this custom data source. Points to the web property to
9091206-- which this custom data source belongs.
9101207--
@@ -939,6 +1236,21 @@ cdsplType :: Lens' CustomDataSourceParentLink Text
9391236cdsplType
9401237 = lens _cdsplType (\ s a -> s{_cdsplType = a})
9411238
1239+instance FromJSON CustomDataSourceParentLink where
1240+ parseJSON
1241+ = withObject "CustomDataSourceParentLink"
1242+ (\ o ->
1243+ CustomDataSourceParentLink <$>
1244+ (o .:? "href") <*>
1245+ (o .:? "type" .!= "analytics#webproperty"))
1246+
1247+instance ToJSON CustomDataSourceParentLink where
1248+ toJSON CustomDataSourceParentLink{..}
1249+ = object
1250+ (catMaybes
1251+ [("href" .=) <$> _cdsplHref,
1252+ Just ("type" .= _cdsplType)])
1253+
9421254-- | Lists Analytics custom data sources to which the user has access. Each
9431255-- resource in the collection corresponds to a single Analytics custom data
9441256-- source.
@@ -1038,6 +1350,32 @@ cdssPreviousLink
10381350 = lens _cdssPreviousLink
10391351 (\ s a -> s{_cdssPreviousLink = a})
10401352
1353+instance FromJSON CustomDataSources where
1354+ parseJSON
1355+ = withObject "CustomDataSources"
1356+ (\ o ->
1357+ CustomDataSources <$>
1358+ (o .:? "nextLink") <*> (o .:? "itemsPerPage") <*>
1359+ (o .:? "kind" .!= "analytics#customDataSources")
1360+ <*> (o .:? "username")
1361+ <*> (o .:? "items" .!= mempty)
1362+ <*> (o .:? "totalResults")
1363+ <*> (o .:? "startIndex")
1364+ <*> (o .:? "previousLink"))
1365+
1366+instance ToJSON CustomDataSources where
1367+ toJSON CustomDataSources{..}
1368+ = object
1369+ (catMaybes
1370+ [("nextLink" .=) <$> _cdssNextLink,
1371+ ("itemsPerPage" .=) <$> _cdssItemsPerPage,
1372+ Just ("kind" .= _cdssKind),
1373+ ("username" .=) <$> _cdssUsername,
1374+ ("items" .=) <$> _cdssItems,
1375+ ("totalResults" .=) <$> _cdssTotalResults,
1376+ ("startIndex" .=) <$> _cdssStartIndex,
1377+ ("previousLink" .=) <$> _cdssPreviousLink])
1378+
10411379-- | JSON template for Analytics Custom Dimension.
10421380--
10431381-- /See:/ 'customDimension' smart constructor.
@@ -1160,6 +1498,38 @@ cusUpdated
11601498cusIndex :: Lens' CustomDimension (Maybe Int32)
11611499cusIndex = lens _cusIndex (\ s a -> s{_cusIndex = a})
11621500
1501+instance FromJSON CustomDimension where
1502+ parseJSON
1503+ = withObject "CustomDimension"
1504+ (\ o ->
1505+ CustomDimension <$>
1506+ (o .:? "parentLink") <*> (o .:? "webPropertyId") <*>
1507+ (o .:? "kind" .!= "analytics#customDimension")
1508+ <*> (o .:? "created")
1509+ <*> (o .:? "active")
1510+ <*> (o .:? "selfLink")
1511+ <*> (o .:? "accountId")
1512+ <*> (o .:? "name")
1513+ <*> (o .:? "scope")
1514+ <*> (o .:? "id")
1515+ <*> (o .:? "updated")
1516+ <*> (o .:? "index"))
1517+
1518+instance ToJSON CustomDimension where
1519+ toJSON CustomDimension{..}
1520+ = object
1521+ (catMaybes
1522+ [("parentLink" .=) <$> _cusParentLink,
1523+ ("webPropertyId" .=) <$> _cusWebPropertyId,
1524+ Just ("kind" .= _cusKind),
1525+ ("created" .=) <$> _cusCreated,
1526+ ("active" .=) <$> _cusActive,
1527+ ("selfLink" .=) <$> _cusSelfLink,
1528+ ("accountId" .=) <$> _cusAccountId,
1529+ ("name" .=) <$> _cusName, ("scope" .=) <$> _cusScope,
1530+ ("id" .=) <$> _cusId, ("updated" .=) <$> _cusUpdated,
1531+ ("index" .=) <$> _cusIndex])
1532+
11631533-- | Parent link for the custom dimension. Points to the property to which
11641534-- the custom dimension belongs.
11651535--
@@ -1192,6 +1562,21 @@ cdplHref = lens _cdplHref (\ s a -> s{_cdplHref = a})
11921562cdplType :: Lens' CustomDimensionParentLink Text
11931563cdplType = lens _cdplType (\ s a -> s{_cdplType = a})
11941564
1565+instance FromJSON CustomDimensionParentLink where
1566+ parseJSON
1567+ = withObject "CustomDimensionParentLink"
1568+ (\ o ->
1569+ CustomDimensionParentLink <$>
1570+ (o .:? "href") <*>
1571+ (o .:? "type" .!= "analytics#webproperty"))
1572+
1573+instance ToJSON CustomDimensionParentLink where
1574+ toJSON CustomDimensionParentLink{..}
1575+ = object
1576+ (catMaybes
1577+ [("href" .=) <$> _cdplHref,
1578+ Just ("type" .= _cdplType)])
1579+
11951580-- | A custom dimension collection lists Analytics custom dimensions to which
11961581-- the user has access. Each resource in the collection corresponds to a
11971582-- single Analytics custom dimension.
@@ -1289,6 +1674,32 @@ cdPreviousLink
12891674 = lens _cdPreviousLink
12901675 (\ s a -> s{_cdPreviousLink = a})
12911676
1677+instance FromJSON CustomDimensions where
1678+ parseJSON
1679+ = withObject "CustomDimensions"
1680+ (\ o ->
1681+ CustomDimensions <$>
1682+ (o .:? "nextLink") <*> (o .:? "itemsPerPage") <*>
1683+ (o .:? "kind" .!= "analytics#customDimensions")
1684+ <*> (o .:? "username")
1685+ <*> (o .:? "items" .!= mempty)
1686+ <*> (o .:? "totalResults")
1687+ <*> (o .:? "startIndex")
1688+ <*> (o .:? "previousLink"))
1689+
1690+instance ToJSON CustomDimensions where
1691+ toJSON CustomDimensions{..}
1692+ = object
1693+ (catMaybes
1694+ [("nextLink" .=) <$> _cdNextLink,
1695+ ("itemsPerPage" .=) <$> _cdItemsPerPage,
1696+ Just ("kind" .= _cdKind),
1697+ ("username" .=) <$> _cdUsername,
1698+ ("items" .=) <$> _cdItems,
1699+ ("totalResults" .=) <$> _cdTotalResults,
1700+ ("startIndex" .=) <$> _cdStartIndex,
1701+ ("previousLink" .=) <$> _cdPreviousLink])
1702+
12921703-- | JSON template for Analytics Custom Metric.
12931704--
12941705-- /See:/ 'customMetric' smart constructor.
@@ -1433,6 +1844,43 @@ cType = lens _cType (\ s a -> s{_cType = a})
14331844cIndex :: Lens' CustomMetric (Maybe Int32)
14341845cIndex = lens _cIndex (\ s a -> s{_cIndex = a})
14351846
1847+instance FromJSON CustomMetric where
1848+ parseJSON
1849+ = withObject "CustomMetric"
1850+ (\ o ->
1851+ CustomMetric <$>
1852+ (o .:? "parentLink") <*> (o .:? "webPropertyId") <*>
1853+ (o .:? "kind" .!= "analytics#customMetric")
1854+ <*> (o .:? "max_value")
1855+ <*> (o .:? "created")
1856+ <*> (o .:? "min_value")
1857+ <*> (o .:? "active")
1858+ <*> (o .:? "selfLink")
1859+ <*> (o .:? "accountId")
1860+ <*> (o .:? "name")
1861+ <*> (o .:? "scope")
1862+ <*> (o .:? "id")
1863+ <*> (o .:? "updated")
1864+ <*> (o .:? "type")
1865+ <*> (o .:? "index"))
1866+
1867+instance ToJSON CustomMetric where
1868+ toJSON CustomMetric{..}
1869+ = object
1870+ (catMaybes
1871+ [("parentLink" .=) <$> _cParentLink,
1872+ ("webPropertyId" .=) <$> _cWebPropertyId,
1873+ Just ("kind" .= _cKind),
1874+ ("max_value" .=) <$> _cMaxValue,
1875+ ("created" .=) <$> _cCreated,
1876+ ("min_value" .=) <$> _cMinValue,
1877+ ("active" .=) <$> _cActive,
1878+ ("selfLink" .=) <$> _cSelfLink,
1879+ ("accountId" .=) <$> _cAccountId,
1880+ ("name" .=) <$> _cName, ("scope" .=) <$> _cScope,
1881+ ("id" .=) <$> _cId, ("updated" .=) <$> _cUpdated,
1882+ ("type" .=) <$> _cType, ("index" .=) <$> _cIndex])
1883+
14361884-- | Parent link for the custom metric. Points to the property to which the
14371885-- custom metric belongs.
14381886--
@@ -1465,6 +1913,21 @@ cmplHref = lens _cmplHref (\ s a -> s{_cmplHref = a})
14651913cmplType :: Lens' CustomMetricParentLink Text
14661914cmplType = lens _cmplType (\ s a -> s{_cmplType = a})
14671915
1916+instance FromJSON CustomMetricParentLink where
1917+ parseJSON
1918+ = withObject "CustomMetricParentLink"
1919+ (\ o ->
1920+ CustomMetricParentLink <$>
1921+ (o .:? "href") <*>
1922+ (o .:? "type" .!= "analytics#webproperty"))
1923+
1924+instance ToJSON CustomMetricParentLink where
1925+ toJSON CustomMetricParentLink{..}
1926+ = object
1927+ (catMaybes
1928+ [("href" .=) <$> _cmplHref,
1929+ Just ("type" .= _cmplType)])
1930+
14681931-- | A custom metric collection lists Analytics custom metrics to which the
14691932-- user has access. Each resource in the collection corresponds to a single
14701933-- Analytics custom metric.
@@ -1562,6 +2025,32 @@ cmPreviousLink
15622025 = lens _cmPreviousLink
15632026 (\ s a -> s{_cmPreviousLink = a})
15642027
2028+instance FromJSON CustomMetrics where
2029+ parseJSON
2030+ = withObject "CustomMetrics"
2031+ (\ o ->
2032+ CustomMetrics <$>
2033+ (o .:? "nextLink") <*> (o .:? "itemsPerPage") <*>
2034+ (o .:? "kind" .!= "analytics#customMetrics")
2035+ <*> (o .:? "username")
2036+ <*> (o .:? "items" .!= mempty)
2037+ <*> (o .:? "totalResults")
2038+ <*> (o .:? "startIndex")
2039+ <*> (o .:? "previousLink"))
2040+
2041+instance ToJSON CustomMetrics where
2042+ toJSON CustomMetrics{..}
2043+ = object
2044+ (catMaybes
2045+ [("nextLink" .=) <$> _cmNextLink,
2046+ ("itemsPerPage" .=) <$> _cmItemsPerPage,
2047+ Just ("kind" .= _cmKind),
2048+ ("username" .=) <$> _cmUsername,
2049+ ("items" .=) <$> _cmItems,
2050+ ("totalResults" .=) <$> _cmTotalResults,
2051+ ("startIndex" .=) <$> _cmStartIndex,
2052+ ("previousLink" .=) <$> _cmPreviousLink])
2053+
15652054-- | JSON template for Analytics Entity AdWords Link.
15662055--
15672056-- /See:/ 'entityAdWordsLink' smart constructor.
@@ -1644,6 +2133,30 @@ entEntity :: Lens' EntityAdWordsLink (Maybe EntityAdWordsLinkEntity)
16442133entEntity
16452134 = lens _entEntity (\ s a -> s{_entEntity = a})
16462135
2136+instance FromJSON EntityAdWordsLink where
2137+ parseJSON
2138+ = withObject "EntityAdWordsLink"
2139+ (\ o ->
2140+ EntityAdWordsLink <$>
2141+ (o .:? "adWordsAccounts" .!= mempty) <*>
2142+ (o .:? "profileIds" .!= mempty)
2143+ <*> (o .:? "kind" .!= "analytics#entityAdWordsLink")
2144+ <*> (o .:? "selfLink")
2145+ <*> (o .:? "name")
2146+ <*> (o .:? "id")
2147+ <*> (o .:? "entity"))
2148+
2149+instance ToJSON EntityAdWordsLink where
2150+ toJSON EntityAdWordsLink{..}
2151+ = object
2152+ (catMaybes
2153+ [("adWordsAccounts" .=) <$> _entAdWordsAccounts,
2154+ ("profileIds" .=) <$> _entProfileIds,
2155+ Just ("kind" .= _entKind),
2156+ ("selfLink" .=) <$> _entSelfLink,
2157+ ("name" .=) <$> _entName, ("id" .=) <$> _entId,
2158+ ("entity" .=) <$> _entEntity])
2159+
16472160-- | Web property being linked.
16482161--
16492162-- /See:/ 'entityAdWordsLinkEntity' smart constructor.
@@ -1668,6 +2181,18 @@ eawleWebPropertyRef
16682181 = lens _eawleWebPropertyRef
16692182 (\ s a -> s{_eawleWebPropertyRef = a})
16702183
2184+instance FromJSON EntityAdWordsLinkEntity where
2185+ parseJSON
2186+ = withObject "EntityAdWordsLinkEntity"
2187+ (\ o ->
2188+ EntityAdWordsLinkEntity <$> (o .:? "webPropertyRef"))
2189+
2190+instance ToJSON EntityAdWordsLinkEntity where
2191+ toJSON EntityAdWordsLinkEntity{..}
2192+ = object
2193+ (catMaybes
2194+ [("webPropertyRef" .=) <$> _eawleWebPropertyRef])
2195+
16712196-- | An entity AdWords link collection provides a list of GA-AdWords links
16722197-- Each resource in this collection corresponds to a single link.
16732198--
@@ -1757,6 +2282,30 @@ eawlPreviousLink
17572282 = lens _eawlPreviousLink
17582283 (\ s a -> s{_eawlPreviousLink = a})
17592284
2285+instance FromJSON EntityAdWordsLinks where
2286+ parseJSON
2287+ = withObject "EntityAdWordsLinks"
2288+ (\ o ->
2289+ EntityAdWordsLinks <$>
2290+ (o .:? "nextLink") <*> (o .:? "itemsPerPage") <*>
2291+ (o .:? "kind" .!= "analytics#entityAdWordsLinks")
2292+ <*> (o .:? "items" .!= mempty)
2293+ <*> (o .:? "totalResults")
2294+ <*> (o .:? "startIndex")
2295+ <*> (o .:? "previousLink"))
2296+
2297+instance ToJSON EntityAdWordsLinks where
2298+ toJSON EntityAdWordsLinks{..}
2299+ = object
2300+ (catMaybes
2301+ [("nextLink" .=) <$> _eawlNextLink,
2302+ ("itemsPerPage" .=) <$> _eawlItemsPerPage,
2303+ Just ("kind" .= _eawlKind),
2304+ ("items" .=) <$> _eawlItems,
2305+ ("totalResults" .=) <$> _eawlTotalResults,
2306+ ("startIndex" .=) <$> _eawlStartIndex,
2307+ ("previousLink" .=) <$> _eawlPreviousLink])
2308+
17602309-- | JSON template for an Analytics Entity-User Link. Returns permissions
17612310-- that a user has for an entity.
17622311--
@@ -1827,6 +2376,29 @@ eulEntity :: Lens' EntityUserLink (Maybe EntityUserLinkEntity)
18272376eulEntity
18282377 = lens _eulEntity (\ s a -> s{_eulEntity = a})
18292378
2379+instance FromJSON EntityUserLink where
2380+ parseJSON
2381+ = withObject "EntityUserLink"
2382+ (\ o ->
2383+ EntityUserLink <$>
2384+ (o .:? "kind" .!= "analytics#entityUserLink") <*>
2385+ (o .:? "userRef")
2386+ <*> (o .:? "selfLink")
2387+ <*> (o .:? "id")
2388+ <*> (o .:? "permissions")
2389+ <*> (o .:? "entity"))
2390+
2391+instance ToJSON EntityUserLink where
2392+ toJSON EntityUserLink{..}
2393+ = object
2394+ (catMaybes
2395+ [Just ("kind" .= _eulKind),
2396+ ("userRef" .=) <$> _eulUserRef,
2397+ ("selfLink" .=) <$> _eulSelfLink,
2398+ ("id" .=) <$> _eulId,
2399+ ("permissions" .=) <$> _eulPermissions,
2400+ ("entity" .=) <$> _eulEntity])
2401+
18302402-- | Entity for this link. It can be an account, a web property, or a view
18312403-- (profile).
18322404--
@@ -1873,6 +2445,22 @@ euleWebPropertyRef
18732445 = lens _euleWebPropertyRef
18742446 (\ s a -> s{_euleWebPropertyRef = a})
18752447
2448+instance FromJSON EntityUserLinkEntity where
2449+ parseJSON
2450+ = withObject "EntityUserLinkEntity"
2451+ (\ o ->
2452+ EntityUserLinkEntity <$>
2453+ (o .:? "profileRef") <*> (o .:? "accountRef") <*>
2454+ (o .:? "webPropertyRef"))
2455+
2456+instance ToJSON EntityUserLinkEntity where
2457+ toJSON EntityUserLinkEntity{..}
2458+ = object
2459+ (catMaybes
2460+ [("profileRef" .=) <$> _euleProfileRef,
2461+ ("accountRef" .=) <$> _euleAccountRef,
2462+ ("webPropertyRef" .=) <$> _euleWebPropertyRef])
2463+
18762464-- | Permissions the user has for this entity.
18772465--
18782466-- /See:/ 'entityUserLinkPermissions' smart constructor.
@@ -1916,6 +2504,21 @@ eulpEffective
19162504 . _Default
19172505 . _Coerce
19182506
2507+instance FromJSON EntityUserLinkPermissions where
2508+ parseJSON
2509+ = withObject "EntityUserLinkPermissions"
2510+ (\ o ->
2511+ EntityUserLinkPermissions <$>
2512+ (o .:? "local" .!= mempty) <*>
2513+ (o .:? "effective" .!= mempty))
2514+
2515+instance ToJSON EntityUserLinkPermissions where
2516+ toJSON EntityUserLinkPermissions{..}
2517+ = object
2518+ (catMaybes
2519+ [("local" .=) <$> _eulpLocal,
2520+ ("effective" .=) <$> _eulpEffective])
2521+
19192522-- | An entity user link collection provides a list of Analytics ACL links
19202523-- Each resource in this collection corresponds to a single link.
19212524--
@@ -2005,6 +2608,30 @@ eulsPreviousLink
20052608 = lens _eulsPreviousLink
20062609 (\ s a -> s{_eulsPreviousLink = a})
20072610
2611+instance FromJSON EntityUserLinks where
2612+ parseJSON
2613+ = withObject "EntityUserLinks"
2614+ (\ o ->
2615+ EntityUserLinks <$>
2616+ (o .:? "nextLink") <*> (o .:? "itemsPerPage") <*>
2617+ (o .:? "kind" .!= "analytics#entityUserLinks")
2618+ <*> (o .:? "items" .!= mempty)
2619+ <*> (o .:? "totalResults")
2620+ <*> (o .:? "startIndex")
2621+ <*> (o .:? "previousLink"))
2622+
2623+instance ToJSON EntityUserLinks where
2624+ toJSON EntityUserLinks{..}
2625+ = object
2626+ (catMaybes
2627+ [("nextLink" .=) <$> _eulsNextLink,
2628+ ("itemsPerPage" .=) <$> _eulsItemsPerPage,
2629+ Just ("kind" .= _eulsKind),
2630+ ("items" .=) <$> _eulsItems,
2631+ ("totalResults" .=) <$> _eulsTotalResults,
2632+ ("startIndex" .=) <$> _eulsStartIndex,
2633+ ("previousLink" .=) <$> _eulsPreviousLink])
2634+
20082635-- | JSON template for Analytics experiment resource.
20092636--
20102637-- /See:/ 'experiment' smart constructor.
@@ -2339,6 +2966,76 @@ expDescription
23392966 = lens _expDescription
23402967 (\ s a -> s{_expDescription = a})
23412968
2969+instance FromJSON Experiment where
2970+ parseJSON
2971+ = withObject "Experiment"
2972+ (\ o ->
2973+ Experiment <$>
2974+ (o .:? "parentLink") <*> (o .:? "equalWeighting") <*>
2975+ (o .:? "status")
2976+ <*> (o .:? "webPropertyId")
2977+ <*> (o .:? "startTime")
2978+ <*> (o .:? "snippet")
2979+ <*> (o .:? "kind" .!= "analytics#experiment")
2980+ <*> (o .:? "created")
2981+ <*> (o .:? "reasonExperimentEnded")
2982+ <*> (o .:? "trafficCoverage")
2983+ <*> (o .:? "editableInGaUi")
2984+ <*> (o .:? "minimumExperimentLengthInDays")
2985+ <*> (o .:? "profileId")
2986+ <*> (o .:? "optimizationType")
2987+ <*> (o .:? "selfLink")
2988+ <*> (o .:? "accountId")
2989+ <*> (o .:? "name")
2990+ <*> (o .:? "winnerFound")
2991+ <*> (o .:? "endTime")
2992+ <*> (o .:? "variations" .!= mempty)
2993+ <*> (o .:? "internalWebPropertyId")
2994+ <*> (o .:? "id")
2995+ <*> (o .:? "updated")
2996+ <*> (o .:? "rewriteVariationUrlsAsOriginal")
2997+ <*> (o .:? "objectiveMetric")
2998+ <*> (o .:? "winnerConfidenceLevel")
2999+ <*> (o .:? "servingFramework")
3000+ <*> (o .:? "description"))
3001+
3002+instance ToJSON Experiment where
3003+ toJSON Experiment{..}
3004+ = object
3005+ (catMaybes
3006+ [("parentLink" .=) <$> _expParentLink,
3007+ ("equalWeighting" .=) <$> _expEqualWeighting,
3008+ ("status" .=) <$> _expStatus,
3009+ ("webPropertyId" .=) <$> _expWebPropertyId,
3010+ ("startTime" .=) <$> _expStartTime,
3011+ ("snippet" .=) <$> _expSnippet,
3012+ Just ("kind" .= _expKind),
3013+ ("created" .=) <$> _expCreated,
3014+ ("reasonExperimentEnded" .=) <$>
3015+ _expReasonExperimentEnded,
3016+ ("trafficCoverage" .=) <$> _expTrafficCoverage,
3017+ ("editableInGaUi" .=) <$> _expEditableInGaUi,
3018+ ("minimumExperimentLengthInDays" .=) <$>
3019+ _expMinimumExperimentLengthInDays,
3020+ ("profileId" .=) <$> _expProfileId,
3021+ ("optimizationType" .=) <$> _expOptimizationType,
3022+ ("selfLink" .=) <$> _expSelfLink,
3023+ ("accountId" .=) <$> _expAccountId,
3024+ ("name" .=) <$> _expName,
3025+ ("winnerFound" .=) <$> _expWinnerFound,
3026+ ("endTime" .=) <$> _expEndTime,
3027+ ("variations" .=) <$> _expVariations,
3028+ ("internalWebPropertyId" .=) <$>
3029+ _expInternalWebPropertyId,
3030+ ("id" .=) <$> _expId, ("updated" .=) <$> _expUpdated,
3031+ ("rewriteVariationUrlsAsOriginal" .=) <$>
3032+ _expRewriteVariationUrlsAsOriginal,
3033+ ("objectiveMetric" .=) <$> _expObjectiveMetric,
3034+ ("winnerConfidenceLevel" .=) <$>
3035+ _expWinnerConfidenceLevel,
3036+ ("servingFramework" .=) <$> _expServingFramework,
3037+ ("description" .=) <$> _expDescription])
3038+
23423039--
23433040-- /See:/ 'experimentItemVariations' smart constructor.
23443041data ExperimentItemVariations = ExperimentItemVariations
@@ -2403,6 +3100,24 @@ eivWon = lens _eivWon (\ s a -> s{_eivWon = a})
24033100eivName :: Lens' ExperimentItemVariations (Maybe Text)
24043101eivName = lens _eivName (\ s a -> s{_eivName = a})
24053102
3103+instance FromJSON ExperimentItemVariations where
3104+ parseJSON
3105+ = withObject "ExperimentItemVariations"
3106+ (\ o ->
3107+ ExperimentItemVariations <$>
3108+ (o .:? "status") <*> (o .:? "weight") <*>
3109+ (o .:? "url")
3110+ <*> (o .:? "won")
3111+ <*> (o .:? "name"))
3112+
3113+instance ToJSON ExperimentItemVariations where
3114+ toJSON ExperimentItemVariations{..}
3115+ = object
3116+ (catMaybes
3117+ [("status" .=) <$> _eivStatus,
3118+ ("weight" .=) <$> _eivWeight, ("url" .=) <$> _eivUrl,
3119+ ("won" .=) <$> _eivWon, ("name" .=) <$> _eivName])
3120+
24063121-- | Parent link for an experiment. Points to the view (profile) to which
24073122-- this experiment belongs.
24083123--
@@ -2436,6 +3151,21 @@ eplHref = lens _eplHref (\ s a -> s{_eplHref = a})
24363151eplType :: Lens' ExperimentParentLink Text
24373152eplType = lens _eplType (\ s a -> s{_eplType = a})
24383153
3154+instance FromJSON ExperimentParentLink where
3155+ parseJSON
3156+ = withObject "ExperimentParentLink"
3157+ (\ o ->
3158+ ExperimentParentLink <$>
3159+ (o .:? "href") <*>
3160+ (o .:? "type" .!= "analytics#profile"))
3161+
3162+instance ToJSON ExperimentParentLink where
3163+ toJSON ExperimentParentLink{..}
3164+ = object
3165+ (catMaybes
3166+ [("href" .=) <$> _eplHref,
3167+ Just ("type" .= _eplType)])
3168+
24393169-- | An experiment collection lists Analytics experiments to which the user
24403170-- has access. Each view (profile) can have a set of experiments. Each
24413171-- resource in the Experiment collection corresponds to a single Analytics
@@ -2534,6 +3264,32 @@ ePreviousLink
25343264 = lens _ePreviousLink
25353265 (\ s a -> s{_ePreviousLink = a})
25363266
3267+instance FromJSON Experiments where
3268+ parseJSON
3269+ = withObject "Experiments"
3270+ (\ o ->
3271+ Experiments <$>
3272+ (o .:? "nextLink") <*> (o .:? "itemsPerPage") <*>
3273+ (o .:? "kind" .!= "analytics#experiments")
3274+ <*> (o .:? "username")
3275+ <*> (o .:? "items" .!= mempty)
3276+ <*> (o .:? "totalResults")
3277+ <*> (o .:? "startIndex")
3278+ <*> (o .:? "previousLink"))
3279+
3280+instance ToJSON Experiments where
3281+ toJSON Experiments{..}
3282+ = object
3283+ (catMaybes
3284+ [("nextLink" .=) <$> _eNextLink,
3285+ ("itemsPerPage" .=) <$> _eItemsPerPage,
3286+ Just ("kind" .= _eKind),
3287+ ("username" .=) <$> _eUsername,
3288+ ("items" .=) <$> _eItems,
3289+ ("totalResults" .=) <$> _eTotalResults,
3290+ ("startIndex" .=) <$> _eStartIndex,
3291+ ("previousLink" .=) <$> _ePreviousLink])
3292+
25373293-- | JSON template for an Analytics account filter.
25383294--
25393295-- /See:/ 'filter'' smart constructor.
@@ -2686,6 +3442,45 @@ fSearchAndReplaceDetails
26863442 = lens _fSearchAndReplaceDetails
26873443 (\ s a -> s{_fSearchAndReplaceDetails = a})
26883444
3445+instance FromJSON Filter where
3446+ parseJSON
3447+ = withObject "Filter"
3448+ (\ o ->
3449+ Filter <$>
3450+ (o .:? "parentLink") <*> (o .:? "advancedDetails")
3451+ <*> (o .:? "uppercaseDetails")
3452+ <*> (o .:? "lowercaseDetails")
3453+ <*> (o .:? "kind" .!= "analytics#filter")
3454+ <*> (o .:? "created")
3455+ <*> (o .:? "includeDetails")
3456+ <*> (o .:? "excludeDetails")
3457+ <*> (o .:? "selfLink")
3458+ <*> (o .:? "accountId")
3459+ <*> (o .:? "name")
3460+ <*> (o .:? "id")
3461+ <*> (o .:? "updated")
3462+ <*> (o .:? "type")
3463+ <*> (o .:? "searchAndReplaceDetails"))
3464+
3465+instance ToJSON Filter where
3466+ toJSON Filter{..}
3467+ = object
3468+ (catMaybes
3469+ [("parentLink" .=) <$> _fParentLink,
3470+ ("advancedDetails" .=) <$> _fAdvancedDetails,
3471+ ("uppercaseDetails" .=) <$> _fUppercaseDetails,
3472+ ("lowercaseDetails" .=) <$> _fLowercaseDetails,
3473+ Just ("kind" .= _fKind),
3474+ ("created" .=) <$> _fCreated,
3475+ ("includeDetails" .=) <$> _fIncludeDetails,
3476+ ("excludeDetails" .=) <$> _fExcludeDetails,
3477+ ("selfLink" .=) <$> _fSelfLink,
3478+ ("accountId" .=) <$> _fAccountId,
3479+ ("name" .=) <$> _fName, ("id" .=) <$> _fId,
3480+ ("updated" .=) <$> _fUpdated, ("type" .=) <$> _fType,
3481+ ("searchAndReplaceDetails" .=) <$>
3482+ _fSearchAndReplaceDetails])
3483+
26893484-- | Details for the filter of the type ADVANCED.
26903485--
26913486-- /See:/ 'filterAdvancedDetails' smart constructor.
@@ -2831,6 +3626,43 @@ fadOverrideOutputField
28313626 = lens _fadOverrideOutputField
28323627 (\ s a -> s{_fadOverrideOutputField = a})
28333628
3629+instance FromJSON FilterAdvancedDetails where
3630+ parseJSON
3631+ = withObject "FilterAdvancedDetails"
3632+ (\ o ->
3633+ FilterAdvancedDetails <$>
3634+ (o .:? "extractA") <*> (o .:? "fieldARequired") <*>
3635+ (o .:? "fieldA")
3636+ <*> (o .:? "fieldBIndex")
3637+ <*> (o .:? "outputToField")
3638+ <*> (o .:? "outputConstructor")
3639+ <*> (o .:? "extractB")
3640+ <*> (o .:? "fieldAIndex")
3641+ <*> (o .:? "caseSensitive")
3642+ <*> (o .:? "outputToFieldIndex")
3643+ <*> (o .:? "fieldB")
3644+ <*> (o .:? "fieldBRequired")
3645+ <*> (o .:? "overrideOutputField"))
3646+
3647+instance ToJSON FilterAdvancedDetails where
3648+ toJSON FilterAdvancedDetails{..}
3649+ = object
3650+ (catMaybes
3651+ [("extractA" .=) <$> _fadExtractA,
3652+ ("fieldARequired" .=) <$> _fadFieldARequired,
3653+ ("fieldA" .=) <$> _fadFieldA,
3654+ ("fieldBIndex" .=) <$> _fadFieldBIndex,
3655+ ("outputToField" .=) <$> _fadOutputToField,
3656+ ("outputConstructor" .=) <$> _fadOutputConstructor,
3657+ ("extractB" .=) <$> _fadExtractB,
3658+ ("fieldAIndex" .=) <$> _fadFieldAIndex,
3659+ ("caseSensitive" .=) <$> _fadCaseSensitive,
3660+ ("outputToFieldIndex" .=) <$> _fadOutputToFieldIndex,
3661+ ("fieldB" .=) <$> _fadFieldB,
3662+ ("fieldBRequired" .=) <$> _fadFieldBRequired,
3663+ ("overrideOutputField" .=) <$>
3664+ _fadOverrideOutputField])
3665+
28343666-- | JSON template for an Analytics filter expression.
28353667--
28363668-- /See:/ 'filterExpression' smart constructor.
@@ -2932,6 +3764,27 @@ feExpressionValue
29323764 = lens _feExpressionValue
29333765 (\ s a -> s{_feExpressionValue = a})
29343766
3767+instance FromJSON FilterExpression where
3768+ parseJSON
3769+ = withObject "FilterExpression"
3770+ (\ o ->
3771+ FilterExpression <$>
3772+ (o .:? "fieldIndex") <*> (o .:? "field") <*>
3773+ (o .:? "kind" .!= "analytics#filterExpression")
3774+ <*> (o .:? "matchType")
3775+ <*> (o .:? "caseSensitive")
3776+ <*> (o .:? "expressionValue"))
3777+
3778+instance ToJSON FilterExpression where
3779+ toJSON FilterExpression{..}
3780+ = object
3781+ (catMaybes
3782+ [("fieldIndex" .=) <$> _feFieldIndex,
3783+ ("field" .=) <$> _feField, Just ("kind" .= _feKind),
3784+ ("matchType" .=) <$> _feMatchType,
3785+ ("caseSensitive" .=) <$> _feCaseSensitive,
3786+ ("expressionValue" .=) <$> _feExpressionValue])
3787+
29353788-- | Details for the filter of the type LOWER.
29363789--
29373790-- /See:/ 'filterLowercaseDetails' smart constructor.
@@ -2966,6 +3819,20 @@ fldFieldIndex
29663819fldField :: Lens' FilterLowercaseDetails (Maybe Text)
29673820fldField = lens _fldField (\ s a -> s{_fldField = a})
29683821
3822+instance FromJSON FilterLowercaseDetails where
3823+ parseJSON
3824+ = withObject "FilterLowercaseDetails"
3825+ (\ o ->
3826+ FilterLowercaseDetails <$>
3827+ (o .:? "fieldIndex") <*> (o .:? "field"))
3828+
3829+instance ToJSON FilterLowercaseDetails where
3830+ toJSON FilterLowercaseDetails{..}
3831+ = object
3832+ (catMaybes
3833+ [("fieldIndex" .=) <$> _fldFieldIndex,
3834+ ("field" .=) <$> _fldField])
3835+
29693836-- | Parent link for this filter. Points to the account to which this filter
29703837-- belongs.
29713838--
@@ -2998,6 +3865,21 @@ fplHref = lens _fplHref (\ s a -> s{_fplHref = a})
29983865fplType :: Lens' FilterParentLink Text
29993866fplType = lens _fplType (\ s a -> s{_fplType = a})
30003867
3868+instance FromJSON FilterParentLink where
3869+ parseJSON
3870+ = withObject "FilterParentLink"
3871+ (\ o ->
3872+ FilterParentLink <$>
3873+ (o .:? "href") <*>
3874+ (o .:? "type" .!= "analytics#account"))
3875+
3876+instance ToJSON FilterParentLink where
3877+ toJSON FilterParentLink{..}
3878+ = object
3879+ (catMaybes
3880+ [("href" .=) <$> _fplHref,
3881+ Just ("type" .= _fplType)])
3882+
30013883-- | JSON template for a profile filter link.
30023884--
30033885-- /See:/ 'filterRef' smart constructor.
@@ -3054,6 +3936,25 @@ frName = lens _frName (\ s a -> s{_frName = a})
30543936frId :: Lens' FilterRef (Maybe Text)
30553937frId = lens _frId (\ s a -> s{_frId = a})
30563938
3939+instance FromJSON FilterRef where
3940+ parseJSON
3941+ = withObject "FilterRef"
3942+ (\ o ->
3943+ FilterRef <$>
3944+ (o .:? "kind" .!= "analytics#filterRef") <*>
3945+ (o .:? "href")
3946+ <*> (o .:? "accountId")
3947+ <*> (o .:? "name")
3948+ <*> (o .:? "id"))
3949+
3950+instance ToJSON FilterRef where
3951+ toJSON FilterRef{..}
3952+ = object
3953+ (catMaybes
3954+ [Just ("kind" .= _frKind), ("href" .=) <$> _frHref,
3955+ ("accountId" .=) <$> _frAccountId,
3956+ ("name" .=) <$> _frName, ("id" .=) <$> _frId])
3957+
30573958-- | Details for the filter of the type SEARCH_AND_REPLACE.
30583959--
30593960-- /See:/ 'filterSearchAndReplaceDetails' smart constructor.
@@ -3119,6 +4020,26 @@ fsardCaseSensitive
31194020 = lens _fsardCaseSensitive
31204021 (\ s a -> s{_fsardCaseSensitive = a})
31214022
4023+instance FromJSON FilterSearchAndReplaceDetails where
4024+ parseJSON
4025+ = withObject "FilterSearchAndReplaceDetails"
4026+ (\ o ->
4027+ FilterSearchAndReplaceDetails <$>
4028+ (o .:? "fieldIndex") <*> (o .:? "field") <*>
4029+ (o .:? "searchString")
4030+ <*> (o .:? "replaceString")
4031+ <*> (o .:? "caseSensitive"))
4032+
4033+instance ToJSON FilterSearchAndReplaceDetails where
4034+ toJSON FilterSearchAndReplaceDetails{..}
4035+ = object
4036+ (catMaybes
4037+ [("fieldIndex" .=) <$> _fsardFieldIndex,
4038+ ("field" .=) <$> _fsardField,
4039+ ("searchString" .=) <$> _fsardSearchString,
4040+ ("replaceString" .=) <$> _fsardReplaceString,
4041+ ("caseSensitive" .=) <$> _fsardCaseSensitive])
4042+
31224043-- | Details for the filter of the type UPPER.
31234044--
31244045-- /See:/ 'filterUppercaseDetails' smart constructor.
@@ -3153,6 +4074,20 @@ fudFieldIndex
31534074fudField :: Lens' FilterUppercaseDetails (Maybe Text)
31544075fudField = lens _fudField (\ s a -> s{_fudField = a})
31554076
4077+instance FromJSON FilterUppercaseDetails where
4078+ parseJSON
4079+ = withObject "FilterUppercaseDetails"
4080+ (\ o ->
4081+ FilterUppercaseDetails <$>
4082+ (o .:? "fieldIndex") <*> (o .:? "field"))
4083+
4084+instance ToJSON FilterUppercaseDetails where
4085+ toJSON FilterUppercaseDetails{..}
4086+ = object
4087+ (catMaybes
4088+ [("fieldIndex" .=) <$> _fudFieldIndex,
4089+ ("field" .=) <$> _fudField])
4090+
31564091-- | A filter collection lists filters created by users in an Analytics
31574092-- account. Each resource in the collection corresponds to a filter.
31584093--
@@ -3251,6 +4186,32 @@ filPreviousLink
32514186 = lens _filPreviousLink
32524187 (\ s a -> s{_filPreviousLink = a})
32534188
4189+instance FromJSON Filters where
4190+ parseJSON
4191+ = withObject "Filters"
4192+ (\ o ->
4193+ Filters <$>
4194+ (o .:? "nextLink") <*> (o .:? "itemsPerPage") <*>
4195+ (o .:? "kind" .!= "analytics#filters")
4196+ <*> (o .:? "username")
4197+ <*> (o .:? "items" .!= mempty)
4198+ <*> (o .:? "totalResults")
4199+ <*> (o .:? "startIndex")
4200+ <*> (o .:? "previousLink"))
4201+
4202+instance ToJSON Filters where
4203+ toJSON Filters{..}
4204+ = object
4205+ (catMaybes
4206+ [("nextLink" .=) <$> _filNextLink,
4207+ ("itemsPerPage" .=) <$> _filItemsPerPage,
4208+ Just ("kind" .= _filKind),
4209+ ("username" .=) <$> _filUsername,
4210+ ("items" .=) <$> _filItems,
4211+ ("totalResults" .=) <$> _filTotalResults,
4212+ ("startIndex" .=) <$> _filStartIndex,
4213+ ("previousLink" .=) <$> _filPreviousLink])
4214+
32544215-- | Analytics data for a given view (profile).
32554216--
32564217-- /See:/ 'gaData' smart constructor.
@@ -3427,6 +4388,50 @@ gdPreviousLink
34274388 = lens _gdPreviousLink
34284389 (\ s a -> s{_gdPreviousLink = a})
34294390
4391+instance FromJSON GaData where
4392+ parseJSON
4393+ = withObject "GaData"
4394+ (\ o ->
4395+ GaData <$>
4396+ (o .:? "nextLink") <*> (o .:? "sampleSpace") <*>
4397+ (o .:? "itemsPerPage")
4398+ <*> (o .:? "profileInfo")
4399+ <*> (o .:? "kind" .!= "analytics#gaData")
4400+ <*> (o .:? "sampleSize")
4401+ <*> (o .:? "rows" .!= mempty)
4402+ <*> (o .:? "selfLink")
4403+ <*> (o .:? "query")
4404+ <*> (o .:? "columnHeaders" .!= mempty)
4405+ <*> (o .:? "id")
4406+ <*> (o .:? "totalResults")
4407+ <*> (o .:? "dataTable")
4408+ <*> (o .:? "containsSampledData")
4409+ <*> (o .:? "totalsForAllResults")
4410+ <*> (o .:? "previousLink"))
4411+
4412+instance ToJSON GaData where
4413+ toJSON GaData{..}
4414+ = object
4415+ (catMaybes
4416+ [("nextLink" .=) <$> _gdNextLink,
4417+ ("sampleSpace" .=) <$> _gdSampleSpace,
4418+ ("itemsPerPage" .=) <$> _gdItemsPerPage,
4419+ ("profileInfo" .=) <$> _gdProfileInfo,
4420+ Just ("kind" .= _gdKind),
4421+ ("sampleSize" .=) <$> _gdSampleSize,
4422+ ("rows" .=) <$> _gdRows,
4423+ ("selfLink" .=) <$> _gdSelfLink,
4424+ ("query" .=) <$> _gdQuery,
4425+ ("columnHeaders" .=) <$> _gdColumnHeaders,
4426+ ("id" .=) <$> _gdId,
4427+ ("totalResults" .=) <$> _gdTotalResults,
4428+ ("dataTable" .=) <$> _gdDataTable,
4429+ ("containsSampledData" .=) <$>
4430+ _gdContainsSampledData,
4431+ ("totalsForAllResults" .=) <$>
4432+ _gdTotalsForAllResults,
4433+ ("previousLink" .=) <$> _gdPreviousLink])
4434+
34304435--
34314436-- /See:/ 'gaDataDataTable' smart constructor.
34324437data GaDataDataTable = GaDataDataTable
@@ -3461,6 +4466,21 @@ gddtRows
34614466 _Default
34624467 . _Coerce
34634468
4469+instance FromJSON GaDataDataTable where
4470+ parseJSON
4471+ = withObject "GaDataDataTable"
4472+ (\ o ->
4473+ GaDataDataTable <$>
4474+ (o .:? "cols" .!= mempty) <*>
4475+ (o .:? "rows" .!= mempty))
4476+
4477+instance ToJSON GaDataDataTable where
4478+ toJSON GaDataDataTable{..}
4479+ = object
4480+ (catMaybes
4481+ [("cols" .=) <$> _gddtCols,
4482+ ("rows" .=) <$> _gddtRows])
4483+
34644484--
34654485-- /See:/ 'gaDataItemCItemRowsDataTable' smart constructor.
34664486newtype GaDataItemCItemRowsDataTable = GaDataItemCItemRowsDataTable
@@ -3483,6 +4503,15 @@ gdicirdtV :: Lens' GaDataItemCItemRowsDataTable (Maybe Text)
34834503gdicirdtV
34844504 = lens _gdicirdtV (\ s a -> s{_gdicirdtV = a})
34854505
4506+instance FromJSON GaDataItemCItemRowsDataTable where
4507+ parseJSON
4508+ = withObject "GaDataItemCItemRowsDataTable"
4509+ (\ o -> GaDataItemCItemRowsDataTable <$> (o .:? "v"))
4510+
4511+instance ToJSON GaDataItemCItemRowsDataTable where
4512+ toJSON GaDataItemCItemRowsDataTable{..}
4513+ = object (catMaybes [("v" .=) <$> _gdicirdtV])
4514+
34864515--
34874516-- /See:/ 'gaDataItemColsDataTable' smart constructor.
34884517data GaDataItemColsDataTable = GaDataItemColsDataTable
@@ -3520,6 +4549,21 @@ gdicdtLabel :: Lens' GaDataItemColsDataTable (Maybe Text)
35204549gdicdtLabel
35214550 = lens _gdicdtLabel (\ s a -> s{_gdicdtLabel = a})
35224551
4552+instance FromJSON GaDataItemColsDataTable where
4553+ parseJSON
4554+ = withObject "GaDataItemColsDataTable"
4555+ (\ o ->
4556+ GaDataItemColsDataTable <$>
4557+ (o .:? "id") <*> (o .:? "type") <*> (o .:? "label"))
4558+
4559+instance ToJSON GaDataItemColsDataTable where
4560+ toJSON GaDataItemColsDataTable{..}
4561+ = object
4562+ (catMaybes
4563+ [("id" .=) <$> _gdicdtId,
4564+ ("type" .=) <$> _gdicdtType,
4565+ ("label" .=) <$> _gdicdtLabel])
4566+
35234567--
35244568-- /See:/ 'gaDataItemColumnHeaders' smart constructor.
35254569data GaDataItemColumnHeaders = GaDataItemColumnHeaders
@@ -3565,6 +4609,22 @@ gdichDataType
35654609 = lens _gdichDataType
35664610 (\ s a -> s{_gdichDataType = a})
35674611
4612+instance FromJSON GaDataItemColumnHeaders where
4613+ parseJSON
4614+ = withObject "GaDataItemColumnHeaders"
4615+ (\ o ->
4616+ GaDataItemColumnHeaders <$>
4617+ (o .:? "columnType") <*> (o .:? "name") <*>
4618+ (o .:? "dataType"))
4619+
4620+instance ToJSON GaDataItemColumnHeaders where
4621+ toJSON GaDataItemColumnHeaders{..}
4622+ = object
4623+ (catMaybes
4624+ [("columnType" .=) <$> _gdichColumnType,
4625+ ("name" .=) <$> _gdichName,
4626+ ("dataType" .=) <$> _gdichDataType])
4627+
35684628--
35694629-- /See:/ 'gaDataItemRowsDataTable' smart constructor.
35704630newtype GaDataItemRowsDataTable = GaDataItemRowsDataTable
@@ -3588,6 +4648,16 @@ gdirdtC
35884648 = lens _gdirdtC (\ s a -> s{_gdirdtC = a}) . _Default
35894649 . _Coerce
35904650
4651+instance FromJSON GaDataItemRowsDataTable where
4652+ parseJSON
4653+ = withObject "GaDataItemRowsDataTable"
4654+ (\ o ->
4655+ GaDataItemRowsDataTable <$> (o .:? "c" .!= mempty))
4656+
4657+instance ToJSON GaDataItemRowsDataTable where
4658+ toJSON GaDataItemRowsDataTable{..}
4659+ = object (catMaybes [("c" .=) <$> _gdirdtC])
4660+
35914661-- | Information for the view (profile), for which the Analytics data was
35924662-- requested.
35934663--
@@ -3663,6 +4733,29 @@ gdpiTableId :: Lens' GaDataProfileInfo (Maybe Text)
36634733gdpiTableId
36644734 = lens _gdpiTableId (\ s a -> s{_gdpiTableId = a})
36654735
4736+instance FromJSON GaDataProfileInfo where
4737+ parseJSON
4738+ = withObject "GaDataProfileInfo"
4739+ (\ o ->
4740+ GaDataProfileInfo <$>
4741+ (o .:? "webPropertyId") <*> (o .:? "profileId") <*>
4742+ (o .:? "profileName")
4743+ <*> (o .:? "accountId")
4744+ <*> (o .:? "internalWebPropertyId")
4745+ <*> (o .:? "tableId"))
4746+
4747+instance ToJSON GaDataProfileInfo where
4748+ toJSON GaDataProfileInfo{..}
4749+ = object
4750+ (catMaybes
4751+ [("webPropertyId" .=) <$> _gdpiWebPropertyId,
4752+ ("profileId" .=) <$> _gdpiProfileId,
4753+ ("profileName" .=) <$> _gdpiProfileName,
4754+ ("accountId" .=) <$> _gdpiAccountId,
4755+ ("internalWebPropertyId" .=) <$>
4756+ _gdpiInternalWebPropertyId,
4757+ ("tableId" .=) <$> _gdpiTableId])
4758+
36664759-- | Analytics data request query parameters.
36674760--
36684761-- /See:/ 'gaDataQuery' smart constructor.
@@ -3783,6 +4876,39 @@ gdqStartDate :: Lens' GaDataQuery (Maybe Text)
37834876gdqStartDate
37844877 = lens _gdqStartDate (\ s a -> s{_gdqStartDate = a})
37854878
4879+instance FromJSON GaDataQuery where
4880+ parseJSON
4881+ = withObject "GaDataQuery"
4882+ (\ o ->
4883+ GaDataQuery <$>
4884+ (o .:? "metrics" .!= mempty) <*>
4885+ (o .:? "samplingLevel")
4886+ <*> (o .:? "filters")
4887+ <*> (o .:? "ids")
4888+ <*> (o .:? "end-date")
4889+ <*> (o .:? "sort" .!= mempty)
4890+ <*> (o .:? "dimensions")
4891+ <*> (o .:? "start-index")
4892+ <*> (o .:? "max-results")
4893+ <*> (o .:? "segment")
4894+ <*> (o .:? "start-date"))
4895+
4896+instance ToJSON GaDataQuery where
4897+ toJSON GaDataQuery{..}
4898+ = object
4899+ (catMaybes
4900+ [("metrics" .=) <$> _gdqMetrics,
4901+ ("samplingLevel" .=) <$> _gdqSamplingLevel,
4902+ ("filters" .=) <$> _gdqFilters,
4903+ ("ids" .=) <$> _gdqIds,
4904+ ("end-date" .=) <$> _gdqEndDate,
4905+ ("sort" .=) <$> _gdqSort,
4906+ ("dimensions" .=) <$> _gdqDimensions,
4907+ ("start-index" .=) <$> _gdqStartIndex,
4908+ ("max-results" .=) <$> _gdqMaxResults,
4909+ ("segment" .=) <$> _gdqSegment,
4910+ ("start-date" .=) <$> _gdqStartDate])
4911+
37864912-- | Total values for the requested metrics over all the results, not just
37874913-- the results returned in this response. The order of the metric totals is
37884914-- same as the metric order specified in the request.
@@ -3798,6 +4924,14 @@ gaDataTotalsForAllResults
37984924 :: GaDataTotalsForAllResults
37994925gaDataTotalsForAllResults = GaDataTotalsForAllResults
38004926
4927+instance FromJSON GaDataTotalsForAllResults where
4928+ parseJSON
4929+ = withObject "GaDataTotalsForAllResults"
4930+ (\ o -> pure GaDataTotalsForAllResults)
4931+
4932+instance ToJSON GaDataTotalsForAllResults where
4933+ toJSON = const (Object mempty)
4934+
38014935-- | JSON template for Analytics goal resource.
38024936--
38034937-- /See:/ 'goal' smart constructor.
@@ -3976,6 +5110,56 @@ gUpdated = lens _gUpdated (\ s a -> s{_gUpdated = a})
39765110gType :: Lens' Goal (Maybe Text)
39775111gType = lens _gType (\ s a -> s{_gType = a})
39785112
5113+instance FromJSON Goal where
5114+ parseJSON
5115+ = withObject "Goal"
5116+ (\ o ->
5117+ Goal <$>
5118+ (o .:? "parentLink") <*> (o .:? "webPropertyId") <*>
5119+ (o .:? "kind" .!= "analytics#goal")
5120+ <*> (o .:? "created")
5121+ <*> (o .:? "value")
5122+ <*> (o .:? "profileId")
5123+ <*> (o .:? "eventDetails")
5124+ <*> (o .:? "active")
5125+ <*> (o .:? "selfLink")
5126+ <*> (o .:? "visitTimeOnSiteDetails")
5127+ <*> (o .:? "accountId")
5128+ <*> (o .:? "name")
5129+ <*> (o .:? "internalWebPropertyId")
5130+ <*> (o .:? "id")
5131+ <*> (o .:? "urlDestinationDetails")
5132+ <*> (o .:? "visitNumPagesDetails")
5133+ <*> (o .:? "updated")
5134+ <*> (o .:? "type"))
5135+
5136+instance ToJSON Goal where
5137+ toJSON Goal{..}
5138+ = object
5139+ (catMaybes
5140+ [("parentLink" .=) <$> _gParentLink,
5141+ ("webPropertyId" .=) <$> _gWebPropertyId,
5142+ Just ("kind" .= _gKind),
5143+ ("created" .=) <$> _gCreated,
5144+ ("value" .=) <$> _gValue,
5145+ ("profileId" .=) <$> _gProfileId,
5146+ ("eventDetails" .=) <$> _gEventDetails,
5147+ ("active" .=) <$> _gActive,
5148+ ("selfLink" .=) <$> _gSelfLink,
5149+ ("visitTimeOnSiteDetails" .=) <$>
5150+ _gVisitTimeOnSiteDetails,
5151+ ("accountId" .=) <$> _gAccountId,
5152+ ("name" .=) <$> _gName,
5153+ ("internalWebPropertyId" .=) <$>
5154+ _gInternalWebPropertyId,
5155+ ("id" .=) <$> _gId,
5156+ ("urlDestinationDetails" .=) <$>
5157+ _gUrlDestinationDetails,
5158+ ("visitNumPagesDetails" .=) <$>
5159+ _gVisitNumPagesDetails,
5160+ ("updated" .=) <$> _gUpdated,
5161+ ("type" .=) <$> _gType])
5162+
39795163-- | Details for the goal of the type EVENT.
39805164--
39815165-- /See:/ 'goalEventDetails' smart constructor.
@@ -4013,6 +5197,21 @@ gedEventConditions
40135197 . _Default
40145198 . _Coerce
40155199
5200+instance FromJSON GoalEventDetails where
5201+ parseJSON
5202+ = withObject "GoalEventDetails"
5203+ (\ o ->
5204+ GoalEventDetails <$>
5205+ (o .:? "useEventValue") <*>
5206+ (o .:? "eventConditions" .!= mempty))
5207+
5208+instance ToJSON GoalEventDetails where
5209+ toJSON GoalEventDetails{..}
5210+ = object
5211+ (catMaybes
5212+ [("useEventValue" .=) <$> _gedUseEventValue,
5213+ ("eventConditions" .=) <$> _gedEventConditions])
5214+
40165215--
40175216-- /See:/ 'goalItemEventConditionsEventDetails' smart constructor.
40185217data GoalItemEventConditionsEventDetails = GoalItemEventConditionsEventDetails
@@ -4079,6 +5278,28 @@ giecedComparisonType
40795278 = lens _giecedComparisonType
40805279 (\ s a -> s{_giecedComparisonType = a})
40815280
5281+instance FromJSON GoalItemEventConditionsEventDetails
5282+ where
5283+ parseJSON
5284+ = withObject "GoalItemEventConditionsEventDetails"
5285+ (\ o ->
5286+ GoalItemEventConditionsEventDetails <$>
5287+ (o .:? "matchType") <*> (o .:? "expression") <*>
5288+ (o .:? "comparisonValue")
5289+ <*> (o .:? "type")
5290+ <*> (o .:? "comparisonType"))
5291+
5292+instance ToJSON GoalItemEventConditionsEventDetails
5293+ where
5294+ toJSON GoalItemEventConditionsEventDetails{..}
5295+ = object
5296+ (catMaybes
5297+ [("matchType" .=) <$> _giecedMatchType,
5298+ ("expression" .=) <$> _giecedExpression,
5299+ ("comparisonValue" .=) <$> _giecedComparisonValue,
5300+ ("type" .=) <$> _giecedType,
5301+ ("comparisonType" .=) <$> _giecedComparisonType])
5302+
40825303--
40835304-- /See:/ 'goalItemStepsUrlDestinationDetails' smart constructor.
40845305data GoalItemStepsUrlDestinationDetails = GoalItemStepsUrlDestinationDetails
@@ -4120,6 +5341,24 @@ gisuddNumber :: Lens' GoalItemStepsUrlDestinationDetails (Maybe Int32)
41205341gisuddNumber
41215342 = lens _gisuddNumber (\ s a -> s{_gisuddNumber = a})
41225343
5344+instance FromJSON GoalItemStepsUrlDestinationDetails
5345+ where
5346+ parseJSON
5347+ = withObject "GoalItemStepsUrlDestinationDetails"
5348+ (\ o ->
5349+ GoalItemStepsUrlDestinationDetails <$>
5350+ (o .:? "url") <*> (o .:? "name") <*>
5351+ (o .:? "number"))
5352+
5353+instance ToJSON GoalItemStepsUrlDestinationDetails
5354+ where
5355+ toJSON GoalItemStepsUrlDestinationDetails{..}
5356+ = object
5357+ (catMaybes
5358+ [("url" .=) <$> _gisuddUrl,
5359+ ("name" .=) <$> _gisuddName,
5360+ ("number" .=) <$> _gisuddNumber])
5361+
41235362-- | Parent link for a goal. Points to the view (profile) to which this goal
41245363-- belongs.
41255364--
@@ -4152,6 +5391,21 @@ gplHref = lens _gplHref (\ s a -> s{_gplHref = a})
41525391gplType :: Lens' GoalParentLink Text
41535392gplType = lens _gplType (\ s a -> s{_gplType = a})
41545393
5394+instance FromJSON GoalParentLink where
5395+ parseJSON
5396+ = withObject "GoalParentLink"
5397+ (\ o ->
5398+ GoalParentLink <$>
5399+ (o .:? "href") <*>
5400+ (o .:? "type" .!= "analytics#profile"))
5401+
5402+instance ToJSON GoalParentLink where
5403+ toJSON GoalParentLink{..}
5404+ = object
5405+ (catMaybes
5406+ [("href" .=) <$> _gplHref,
5407+ Just ("type" .= _gplType)])
5408+
41555409-- | Details for the goal of the type URL_DESTINATION.
41565410--
41575411-- /See:/ 'goalUrlDestinationDetails' smart constructor.
@@ -4217,6 +5471,26 @@ guddFirstStepRequired
42175471 = lens _guddFirstStepRequired
42185472 (\ s a -> s{_guddFirstStepRequired = a})
42195473
5474+instance FromJSON GoalUrlDestinationDetails where
5475+ parseJSON
5476+ = withObject "GoalUrlDestinationDetails"
5477+ (\ o ->
5478+ GoalUrlDestinationDetails <$>
5479+ (o .:? "url") <*> (o .:? "matchType") <*>
5480+ (o .:? "steps" .!= mempty)
5481+ <*> (o .:? "caseSensitive")
5482+ <*> (o .:? "firstStepRequired"))
5483+
5484+instance ToJSON GoalUrlDestinationDetails where
5485+ toJSON GoalUrlDestinationDetails{..}
5486+ = object
5487+ (catMaybes
5488+ [("url" .=) <$> _guddUrl,
5489+ ("matchType" .=) <$> _guddMatchType,
5490+ ("steps" .=) <$> _guddSteps,
5491+ ("caseSensitive" .=) <$> _guddCaseSensitive,
5492+ ("firstStepRequired" .=) <$> _guddFirstStepRequired])
5493+
42205494-- | Details for the goal of the type VISIT_NUM_PAGES.
42215495--
42225496-- /See:/ 'goalVisitNumPagesDetails' smart constructor.
@@ -4253,6 +5527,21 @@ gvnpdComparisonType
42535527 = lens _gvnpdComparisonType
42545528 (\ s a -> s{_gvnpdComparisonType = a})
42555529
5530+instance FromJSON GoalVisitNumPagesDetails where
5531+ parseJSON
5532+ = withObject "GoalVisitNumPagesDetails"
5533+ (\ o ->
5534+ GoalVisitNumPagesDetails <$>
5535+ (o .:? "comparisonValue") <*>
5536+ (o .:? "comparisonType"))
5537+
5538+instance ToJSON GoalVisitNumPagesDetails where
5539+ toJSON GoalVisitNumPagesDetails{..}
5540+ = object
5541+ (catMaybes
5542+ [("comparisonValue" .=) <$> _gvnpdComparisonValue,
5543+ ("comparisonType" .=) <$> _gvnpdComparisonType])
5544+
42565545-- | Details for the goal of the type VISIT_TIME_ON_SITE.
42575546--
42585547-- /See:/ 'goalVisitTimeOnSiteDetails' smart constructor.
@@ -4288,6 +5577,21 @@ gvtosdComparisonType
42885577 = lens _gvtosdComparisonType
42895578 (\ s a -> s{_gvtosdComparisonType = a})
42905579
5580+instance FromJSON GoalVisitTimeOnSiteDetails where
5581+ parseJSON
5582+ = withObject "GoalVisitTimeOnSiteDetails"
5583+ (\ o ->
5584+ GoalVisitTimeOnSiteDetails <$>
5585+ (o .:? "comparisonValue") <*>
5586+ (o .:? "comparisonType"))
5587+
5588+instance ToJSON GoalVisitTimeOnSiteDetails where
5589+ toJSON GoalVisitTimeOnSiteDetails{..}
5590+ = object
5591+ (catMaybes
5592+ [("comparisonValue" .=) <$> _gvtosdComparisonValue,
5593+ ("comparisonType" .=) <$> _gvtosdComparisonType])
5594+
42915595-- | A goal collection lists Analytics goals to which the user has access.
42925596-- Each view (profile) can have a set of goals. Each resource in the Goal
42935597-- collection corresponds to a single Analytics goal.
@@ -4387,6 +5691,32 @@ goaPreviousLink
43875691 = lens _goaPreviousLink
43885692 (\ s a -> s{_goaPreviousLink = a})
43895693
5694+instance FromJSON Goals where
5695+ parseJSON
5696+ = withObject "Goals"
5697+ (\ o ->
5698+ Goals <$>
5699+ (o .:? "nextLink") <*> (o .:? "itemsPerPage") <*>
5700+ (o .:? "kind" .!= "analytics#goals")
5701+ <*> (o .:? "username")
5702+ <*> (o .:? "items" .!= mempty)
5703+ <*> (o .:? "totalResults")
5704+ <*> (o .:? "startIndex")
5705+ <*> (o .:? "previousLink"))
5706+
5707+instance ToJSON Goals where
5708+ toJSON Goals{..}
5709+ = object
5710+ (catMaybes
5711+ [("nextLink" .=) <$> _goaNextLink,
5712+ ("itemsPerPage" .=) <$> _goaItemsPerPage,
5713+ Just ("kind" .= _goaKind),
5714+ ("username" .=) <$> _goaUsername,
5715+ ("items" .=) <$> _goaItems,
5716+ ("totalResults" .=) <$> _goaTotalResults,
5717+ ("startIndex" .=) <$> _goaStartIndex,
5718+ ("previousLink" .=) <$> _goaPreviousLink])
5719+
43905720-- | Multi-Channel Funnels data for a given view (profile).
43915721--
43925722-- /See:/ 'mcfData' smart constructor.
@@ -4555,6 +5885,48 @@ mdPreviousLink
45555885 = lens _mdPreviousLink
45565886 (\ s a -> s{_mdPreviousLink = a})
45575887
5888+instance FromJSON McfData where
5889+ parseJSON
5890+ = withObject "McfData"
5891+ (\ o ->
5892+ McfData <$>
5893+ (o .:? "nextLink") <*> (o .:? "sampleSpace") <*>
5894+ (o .:? "itemsPerPage")
5895+ <*> (o .:? "profileInfo")
5896+ <*> (o .:? "kind" .!= "analytics#mcfData")
5897+ <*> (o .:? "sampleSize")
5898+ <*> (o .:? "rows" .!= mempty)
5899+ <*> (o .:? "selfLink")
5900+ <*> (o .:? "query")
5901+ <*> (o .:? "columnHeaders" .!= mempty)
5902+ <*> (o .:? "id")
5903+ <*> (o .:? "totalResults")
5904+ <*> (o .:? "containsSampledData")
5905+ <*> (o .:? "totalsForAllResults")
5906+ <*> (o .:? "previousLink"))
5907+
5908+instance ToJSON McfData where
5909+ toJSON McfData{..}
5910+ = object
5911+ (catMaybes
5912+ [("nextLink" .=) <$> _mdNextLink,
5913+ ("sampleSpace" .=) <$> _mdSampleSpace,
5914+ ("itemsPerPage" .=) <$> _mdItemsPerPage,
5915+ ("profileInfo" .=) <$> _mdProfileInfo,
5916+ Just ("kind" .= _mdKind),
5917+ ("sampleSize" .=) <$> _mdSampleSize,
5918+ ("rows" .=) <$> _mdRows,
5919+ ("selfLink" .=) <$> _mdSelfLink,
5920+ ("query" .=) <$> _mdQuery,
5921+ ("columnHeaders" .=) <$> _mdColumnHeaders,
5922+ ("id" .=) <$> _mdId,
5923+ ("totalResults" .=) <$> _mdTotalResults,
5924+ ("containsSampledData" .=) <$>
5925+ _mdContainsSampledData,
5926+ ("totalsForAllResults" .=) <$>
5927+ _mdTotalsForAllResults,
5928+ ("previousLink" .=) <$> _mdPreviousLink])
5929+
45585930--
45595931-- /See:/ 'mcfDataItemColumnHeaders' smart constructor.
45605932data McfDataItemColumnHeaders = McfDataItemColumnHeaders
@@ -4599,6 +5971,22 @@ mdichDataType
45995971 = lens _mdichDataType
46005972 (\ s a -> s{_mdichDataType = a})
46015973
5974+instance FromJSON McfDataItemColumnHeaders where
5975+ parseJSON
5976+ = withObject "McfDataItemColumnHeaders"
5977+ (\ o ->
5978+ McfDataItemColumnHeaders <$>
5979+ (o .:? "columnType") <*> (o .:? "name") <*>
5980+ (o .:? "dataType"))
5981+
5982+instance ToJSON McfDataItemColumnHeaders where
5983+ toJSON McfDataItemColumnHeaders{..}
5984+ = object
5985+ (catMaybes
5986+ [("columnType" .=) <$> _mdichColumnType,
5987+ ("name" .=) <$> _mdichName,
5988+ ("dataType" .=) <$> _mdichDataType])
5989+
46025990--
46035991-- /See:/ 'mcfDataItemConversionPathValueItemItemRows' smart constructor.
46045992data McfDataItemConversionPathValueItemItemRows = McfDataItemConversionPathValueItemItemRows
@@ -4635,6 +6023,24 @@ mdicpviirNodeValue
46356023 = lens _mdicpviirNodeValue
46366024 (\ s a -> s{_mdicpviirNodeValue = a})
46376025
6026+instance FromJSON
6027+ McfDataItemConversionPathValueItemItemRows where
6028+ parseJSON
6029+ = withObject
6030+ "McfDataItemConversionPathValueItemItemRows"
6031+ (\ o ->
6032+ McfDataItemConversionPathValueItemItemRows <$>
6033+ (o .:? "interactionType") <*> (o .:? "nodeValue"))
6034+
6035+instance ToJSON
6036+ McfDataItemConversionPathValueItemItemRows where
6037+ toJSON McfDataItemConversionPathValueItemItemRows{..}
6038+ = object
6039+ (catMaybes
6040+ [("interactionType" .=) <$>
6041+ _mdicpviirInteractionType,
6042+ ("nodeValue" .=) <$> _mdicpviirNodeValue])
6043+
46386044-- | A union object representing a dimension or metric value. Only one of
46396045-- \"primitiveValue\" or \"conversionPathValue\" attribute will be
46406046-- populated.
@@ -4675,6 +6081,22 @@ mdiirConversionPathValue
46756081 . _Default
46766082 . _Coerce
46776083
6084+instance FromJSON McfDataItemItemRows where
6085+ parseJSON
6086+ = withObject "McfDataItemItemRows"
6087+ (\ o ->
6088+ McfDataItemItemRows <$>
6089+ (o .:? "primitiveValue") <*>
6090+ (o .:? "conversionPathValue" .!= mempty))
6091+
6092+instance ToJSON McfDataItemItemRows where
6093+ toJSON McfDataItemItemRows{..}
6094+ = object
6095+ (catMaybes
6096+ [("primitiveValue" .=) <$> _mdiirPrimitiveValue,
6097+ ("conversionPathValue" .=) <$>
6098+ _mdiirConversionPathValue])
6099+
46786100-- | Information for the view (profile), for which the Analytics data was
46796101-- requested.
46806102--
@@ -4750,6 +6172,29 @@ mdpiTableId :: Lens' McfDataProfileInfo (Maybe Text)
47506172mdpiTableId
47516173 = lens _mdpiTableId (\ s a -> s{_mdpiTableId = a})
47526174
6175+instance FromJSON McfDataProfileInfo where
6176+ parseJSON
6177+ = withObject "McfDataProfileInfo"
6178+ (\ o ->
6179+ McfDataProfileInfo <$>
6180+ (o .:? "webPropertyId") <*> (o .:? "profileId") <*>
6181+ (o .:? "profileName")
6182+ <*> (o .:? "accountId")
6183+ <*> (o .:? "internalWebPropertyId")
6184+ <*> (o .:? "tableId"))
6185+
6186+instance ToJSON McfDataProfileInfo where
6187+ toJSON McfDataProfileInfo{..}
6188+ = object
6189+ (catMaybes
6190+ [("webPropertyId" .=) <$> _mdpiWebPropertyId,
6191+ ("profileId" .=) <$> _mdpiProfileId,
6192+ ("profileName" .=) <$> _mdpiProfileName,
6193+ ("accountId" .=) <$> _mdpiAccountId,
6194+ ("internalWebPropertyId" .=) <$>
6195+ _mdpiInternalWebPropertyId,
6196+ ("tableId" .=) <$> _mdpiTableId])
6197+
47536198-- | Analytics data request query parameters.
47546199--
47556200-- /See:/ 'mcfDataQuery' smart constructor.
@@ -4870,6 +6315,39 @@ mdqStartDate :: Lens' McfDataQuery (Maybe Text)
48706315mdqStartDate
48716316 = lens _mdqStartDate (\ s a -> s{_mdqStartDate = a})
48726317
6318+instance FromJSON McfDataQuery where
6319+ parseJSON
6320+ = withObject "McfDataQuery"
6321+ (\ o ->
6322+ McfDataQuery <$>
6323+ (o .:? "metrics" .!= mempty) <*>
6324+ (o .:? "samplingLevel")
6325+ <*> (o .:? "filters")
6326+ <*> (o .:? "ids")
6327+ <*> (o .:? "end-date")
6328+ <*> (o .:? "sort" .!= mempty)
6329+ <*> (o .:? "dimensions")
6330+ <*> (o .:? "start-index")
6331+ <*> (o .:? "max-results")
6332+ <*> (o .:? "segment")
6333+ <*> (o .:? "start-date"))
6334+
6335+instance ToJSON McfDataQuery where
6336+ toJSON McfDataQuery{..}
6337+ = object
6338+ (catMaybes
6339+ [("metrics" .=) <$> _mdqMetrics,
6340+ ("samplingLevel" .=) <$> _mdqSamplingLevel,
6341+ ("filters" .=) <$> _mdqFilters,
6342+ ("ids" .=) <$> _mdqIds,
6343+ ("end-date" .=) <$> _mdqEndDate,
6344+ ("sort" .=) <$> _mdqSort,
6345+ ("dimensions" .=) <$> _mdqDimensions,
6346+ ("start-index" .=) <$> _mdqStartIndex,
6347+ ("max-results" .=) <$> _mdqMaxResults,
6348+ ("segment" .=) <$> _mdqSegment,
6349+ ("start-date" .=) <$> _mdqStartDate])
6350+
48736351-- | Total values for the requested metrics over all the results, not just
48746352-- the results returned in this response. The order of the metric totals is
48756353-- same as the metric order specified in the request.
@@ -4885,6 +6363,14 @@ mcfDataTotalsForAllResults
48856363 :: McfDataTotalsForAllResults
48866364mcfDataTotalsForAllResults = McfDataTotalsForAllResults
48876365
6366+instance FromJSON McfDataTotalsForAllResults where
6367+ parseJSON
6368+ = withObject "McfDataTotalsForAllResults"
6369+ (\ o -> pure McfDataTotalsForAllResults)
6370+
6371+instance ToJSON McfDataTotalsForAllResults where
6372+ toJSON = const (Object mempty)
6373+
48886374-- | JSON template for an Analytics view (profile).
48896375--
48906376-- /See:/ 'profile' smart constructor.
@@ -5135,6 +6621,70 @@ ppStripSiteSearchQueryParameters
51356621 = lens _ppStripSiteSearchQueryParameters
51366622 (\ s a -> s{_ppStripSiteSearchQueryParameters = a})
51376623
6624+instance FromJSON Profile where
6625+ parseJSON
6626+ = withObject "Profile"
6627+ (\ o ->
6628+ Profile <$>
6629+ (o .:? "parentLink") <*> (o .:? "eCommerceTracking")
6630+ <*> (o .:? "siteSearchCategoryParameters")
6631+ <*> (o .:? "webPropertyId")
6632+ <*> (o .:? "childLink")
6633+ <*> (o .:? "siteSearchQueryParameters")
6634+ <*> (o .:? "kind" .!= "analytics#profile")
6635+ <*> (o .:? "defaultPage")
6636+ <*> (o .:? "created")
6637+ <*> (o .:? "selfLink")
6638+ <*> (o .:? "accountId")
6639+ <*> (o .:? "name")
6640+ <*> (o .:? "currency")
6641+ <*> (o .:? "internalWebPropertyId")
6642+ <*> (o .:? "id")
6643+ <*> (o .:? "updated")
6644+ <*> (o .:? "permissions")
6645+ <*> (o .:? "websiteUrl")
6646+ <*> (o .:? "type")
6647+ <*> (o .:? "stripSiteSearchCategoryParameters")
6648+ <*> (o .:? "timezone")
6649+ <*> (o .:? "excludeQueryParameters")
6650+ <*> (o .:? "enhancedECommerceTracking")
6651+ <*> (o .:? "stripSiteSearchQueryParameters"))
6652+
6653+instance ToJSON Profile where
6654+ toJSON Profile{..}
6655+ = object
6656+ (catMaybes
6657+ [("parentLink" .=) <$> _ppParentLink,
6658+ ("eCommerceTracking" .=) <$> _ppECommerceTracking,
6659+ ("siteSearchCategoryParameters" .=) <$>
6660+ _ppSiteSearchCategoryParameters,
6661+ ("webPropertyId" .=) <$> _ppWebPropertyId,
6662+ ("childLink" .=) <$> _ppChildLink,
6663+ ("siteSearchQueryParameters" .=) <$>
6664+ _ppSiteSearchQueryParameters,
6665+ Just ("kind" .= _ppKind),
6666+ ("defaultPage" .=) <$> _ppDefaultPage,
6667+ ("created" .=) <$> _ppCreated,
6668+ ("selfLink" .=) <$> _ppSelfLink,
6669+ ("accountId" .=) <$> _ppAccountId,
6670+ ("name" .=) <$> _ppName,
6671+ ("currency" .=) <$> _ppCurrency,
6672+ ("internalWebPropertyId" .=) <$>
6673+ _ppInternalWebPropertyId,
6674+ ("id" .=) <$> _ppId, ("updated" .=) <$> _ppUpdated,
6675+ ("permissions" .=) <$> _ppPermissions,
6676+ ("websiteUrl" .=) <$> _ppWebsiteUrl,
6677+ ("type" .=) <$> _ppType,
6678+ ("stripSiteSearchCategoryParameters" .=) <$>
6679+ _ppStripSiteSearchCategoryParameters,
6680+ ("timezone" .=) <$> _ppTimezone,
6681+ ("excludeQueryParameters" .=) <$>
6682+ _ppExcludeQueryParameters,
6683+ ("enhancedECommerceTracking" .=) <$>
6684+ _ppEnhancedECommerceTracking,
6685+ ("stripSiteSearchQueryParameters" .=) <$>
6686+ _ppStripSiteSearchQueryParameters])
6687+
51386688-- | Child link for this view (profile). Points to the list of goals for this
51396689-- view (profile).
51406690--
@@ -5167,6 +6717,21 @@ pclHref = lens _pclHref (\ s a -> s{_pclHref = a})
51676717pclType :: Lens' ProfileChildLink Text
51686718pclType = lens _pclType (\ s a -> s{_pclType = a})
51696719
6720+instance FromJSON ProfileChildLink where
6721+ parseJSON
6722+ = withObject "ProfileChildLink"
6723+ (\ o ->
6724+ ProfileChildLink <$>
6725+ (o .:? "href") <*>
6726+ (o .:? "type" .!= "analytics#goals"))
6727+
6728+instance ToJSON ProfileChildLink where
6729+ toJSON ProfileChildLink{..}
6730+ = object
6731+ (catMaybes
6732+ [("href" .=) <$> _pclHref,
6733+ Just ("type" .= _pclType)])
6734+
51706735-- | JSON template for an Analytics profile filter link.
51716736--
51726737-- /See:/ 'profileFilterLink' smart constructor.
@@ -5243,6 +6808,28 @@ pId = lens _pId (\ s a -> s{_pId = a})
52436808pRank :: Lens' ProfileFilterLink (Maybe Int32)
52446809pRank = lens _pRank (\ s a -> s{_pRank = a})
52456810
6811+instance FromJSON ProfileFilterLink where
6812+ parseJSON
6813+ = withObject "ProfileFilterLink"
6814+ (\ o ->
6815+ ProfileFilterLink <$>
6816+ (o .:? "profileRef") <*>
6817+ (o .:? "kind" .!= "analytics#profileFilterLink")
6818+ <*> (o .:? "filterRef")
6819+ <*> (o .:? "selfLink")
6820+ <*> (o .:? "id")
6821+ <*> (o .:? "rank"))
6822+
6823+instance ToJSON ProfileFilterLink where
6824+ toJSON ProfileFilterLink{..}
6825+ = object
6826+ (catMaybes
6827+ [("profileRef" .=) <$> _pProfileRef,
6828+ Just ("kind" .= _pKind),
6829+ ("filterRef" .=) <$> _pFilterRef,
6830+ ("selfLink" .=) <$> _pSelfLink, ("id" .=) <$> _pId,
6831+ ("rank" .=) <$> _pRank])
6832+
52466833-- | A profile filter link collection lists profile filter links between
52476834-- profiles and filters. Each resource in the collection corresponds to a
52486835-- profile filter link.
@@ -5342,6 +6929,32 @@ pflPreviousLink
53426929 = lens _pflPreviousLink
53436930 (\ s a -> s{_pflPreviousLink = a})
53446931
6932+instance FromJSON ProfileFilterLinks where
6933+ parseJSON
6934+ = withObject "ProfileFilterLinks"
6935+ (\ o ->
6936+ ProfileFilterLinks <$>
6937+ (o .:? "nextLink") <*> (o .:? "itemsPerPage") <*>
6938+ (o .:? "kind" .!= "analytics#profileFilterLinks")
6939+ <*> (o .:? "username")
6940+ <*> (o .:? "items" .!= mempty)
6941+ <*> (o .:? "totalResults")
6942+ <*> (o .:? "startIndex")
6943+ <*> (o .:? "previousLink"))
6944+
6945+instance ToJSON ProfileFilterLinks where
6946+ toJSON ProfileFilterLinks{..}
6947+ = object
6948+ (catMaybes
6949+ [("nextLink" .=) <$> _pflNextLink,
6950+ ("itemsPerPage" .=) <$> _pflItemsPerPage,
6951+ Just ("kind" .= _pflKind),
6952+ ("username" .=) <$> _pflUsername,
6953+ ("items" .=) <$> _pflItems,
6954+ ("totalResults" .=) <$> _pflTotalResults,
6955+ ("startIndex" .=) <$> _pflStartIndex,
6956+ ("previousLink" .=) <$> _pflPreviousLink])
6957+
53456958-- | Parent link for this view (profile). Points to the web property to which
53466959-- this view (profile) belongs.
53476960--
@@ -5374,6 +6987,21 @@ pplHref = lens _pplHref (\ s a -> s{_pplHref = a})
53746987pplType :: Lens' ProfileParentLink Text
53756988pplType = lens _pplType (\ s a -> s{_pplType = a})
53766989
6990+instance FromJSON ProfileParentLink where
6991+ parseJSON
6992+ = withObject "ProfileParentLink"
6993+ (\ o ->
6994+ ProfileParentLink <$>
6995+ (o .:? "href") <*>
6996+ (o .:? "type" .!= "analytics#webproperty"))
6997+
6998+instance ToJSON ProfileParentLink where
6999+ toJSON ProfileParentLink{..}
7000+ = object
7001+ (catMaybes
7002+ [("href" .=) <$> _pplHref,
7003+ Just ("type" .= _pplType)])
7004+
53777005-- | Permissions the user has for this view (profile).
53787006--
53797007-- /See:/ 'profilePermissions' smart constructor.
@@ -5402,6 +7030,18 @@ ppEffective
54027030 _Default
54037031 . _Coerce
54047032
7033+instance FromJSON ProfilePermissions where
7034+ parseJSON
7035+ = withObject "ProfilePermissions"
7036+ (\ o ->
7037+ ProfilePermissions <$>
7038+ (o .:? "effective" .!= mempty))
7039+
7040+instance ToJSON ProfilePermissions where
7041+ toJSON ProfilePermissions{..}
7042+ = object
7043+ (catMaybes [("effective" .=) <$> _ppEffective])
7044+
54057045-- | JSON template for a linked view (profile).
54067046--
54077047-- /See:/ 'profileRef' smart constructor.
@@ -5479,6 +7119,31 @@ prInternalWebPropertyId
54797119prId :: Lens' ProfileRef (Maybe Text)
54807120prId = lens _prId (\ s a -> s{_prId = a})
54817121
7122+instance FromJSON ProfileRef where
7123+ parseJSON
7124+ = withObject "ProfileRef"
7125+ (\ o ->
7126+ ProfileRef <$>
7127+ (o .:? "webPropertyId") <*>
7128+ (o .:? "kind" .!= "analytics#profileRef")
7129+ <*> (o .:? "href")
7130+ <*> (o .:? "accountId")
7131+ <*> (o .:? "name")
7132+ <*> (o .:? "internalWebPropertyId")
7133+ <*> (o .:? "id"))
7134+
7135+instance ToJSON ProfileRef where
7136+ toJSON ProfileRef{..}
7137+ = object
7138+ (catMaybes
7139+ [("webPropertyId" .=) <$> _prWebPropertyId,
7140+ Just ("kind" .= _prKind), ("href" .=) <$> _prHref,
7141+ ("accountId" .=) <$> _prAccountId,
7142+ ("name" .=) <$> _prName,
7143+ ("internalWebPropertyId" .=) <$>
7144+ _prInternalWebPropertyId,
7145+ ("id" .=) <$> _prId])
7146+
54827147-- | JSON template for an Analytics ProfileSummary. ProfileSummary returns
54837148-- basic information (i.e., summary) for a profile.
54847149--
@@ -5527,6 +7192,23 @@ psId = lens _psId (\ s a -> s{_psId = a})
55277192psType :: Lens' ProfileSummary (Maybe Text)
55287193psType = lens _psType (\ s a -> s{_psType = a})
55297194
7195+instance FromJSON ProfileSummary where
7196+ parseJSON
7197+ = withObject "ProfileSummary"
7198+ (\ o ->
7199+ ProfileSummary <$>
7200+ (o .:? "kind" .!= "analytics#profileSummary") <*>
7201+ (o .:? "name")
7202+ <*> (o .:? "id")
7203+ <*> (o .:? "type"))
7204+
7205+instance ToJSON ProfileSummary where
7206+ toJSON ProfileSummary{..}
7207+ = object
7208+ (catMaybes
7209+ [Just ("kind" .= _psKind), ("name" .=) <$> _psName,
7210+ ("id" .=) <$> _psId, ("type" .=) <$> _psType])
7211+
55307212-- | A view (profile) collection lists Analytics views (profiles) to which
55317213-- the user has access. Each resource in the collection corresponds to a
55327214-- single Analytics view (profile).
@@ -5626,6 +7308,32 @@ proPreviousLink
56267308 = lens _proPreviousLink
56277309 (\ s a -> s{_proPreviousLink = a})
56287310
7311+instance FromJSON Profiles where
7312+ parseJSON
7313+ = withObject "Profiles"
7314+ (\ o ->
7315+ Profiles <$>
7316+ (o .:? "nextLink") <*> (o .:? "itemsPerPage") <*>
7317+ (o .:? "kind" .!= "analytics#profiles")
7318+ <*> (o .:? "username")
7319+ <*> (o .:? "items" .!= mempty)
7320+ <*> (o .:? "totalResults")
7321+ <*> (o .:? "startIndex")
7322+ <*> (o .:? "previousLink"))
7323+
7324+instance ToJSON Profiles where
7325+ toJSON Profiles{..}
7326+ = object
7327+ (catMaybes
7328+ [("nextLink" .=) <$> _proNextLink,
7329+ ("itemsPerPage" .=) <$> _proItemsPerPage,
7330+ Just ("kind" .= _proKind),
7331+ ("username" .=) <$> _proUsername,
7332+ ("items" .=) <$> _proItems,
7333+ ("totalResults" .=) <$> _proTotalResults,
7334+ ("startIndex" .=) <$> _proStartIndex,
7335+ ("previousLink" .=) <$> _proPreviousLink])
7336+
56297337-- | Real time data for a given view (profile).
56307338--
56317339-- /See:/ 'realtimeData' smart constructor.
@@ -5733,6 +7441,35 @@ rdTotalsForAllResults
57337441 = lens _rdTotalsForAllResults
57347442 (\ s a -> s{_rdTotalsForAllResults = a})
57357443
7444+instance FromJSON RealtimeData where
7445+ parseJSON
7446+ = withObject "RealtimeData"
7447+ (\ o ->
7448+ RealtimeData <$>
7449+ (o .:? "profileInfo") <*>
7450+ (o .:? "kind" .!= "analytics#realtimeData")
7451+ <*> (o .:? "rows" .!= mempty)
7452+ <*> (o .:? "selfLink")
7453+ <*> (o .:? "query")
7454+ <*> (o .:? "columnHeaders" .!= mempty)
7455+ <*> (o .:? "id")
7456+ <*> (o .:? "totalResults")
7457+ <*> (o .:? "totalsForAllResults"))
7458+
7459+instance ToJSON RealtimeData where
7460+ toJSON RealtimeData{..}
7461+ = object
7462+ (catMaybes
7463+ [("profileInfo" .=) <$> _rdProfileInfo,
7464+ Just ("kind" .= _rdKind), ("rows" .=) <$> _rdRows,
7465+ ("selfLink" .=) <$> _rdSelfLink,
7466+ ("query" .=) <$> _rdQuery,
7467+ ("columnHeaders" .=) <$> _rdColumnHeaders,
7468+ ("id" .=) <$> _rdId,
7469+ ("totalResults" .=) <$> _rdTotalResults,
7470+ ("totalsForAllResults" .=) <$>
7471+ _rdTotalsForAllResults])
7472+
57367473--
57377474-- /See:/ 'realtimeDataItemColumnHeaders' smart constructor.
57387475data RealtimeDataItemColumnHeaders = RealtimeDataItemColumnHeaders
@@ -5778,6 +7515,22 @@ rdichDataType
57787515 = lens _rdichDataType
57797516 (\ s a -> s{_rdichDataType = a})
57807517
7518+instance FromJSON RealtimeDataItemColumnHeaders where
7519+ parseJSON
7520+ = withObject "RealtimeDataItemColumnHeaders"
7521+ (\ o ->
7522+ RealtimeDataItemColumnHeaders <$>
7523+ (o .:? "columnType") <*> (o .:? "name") <*>
7524+ (o .:? "dataType"))
7525+
7526+instance ToJSON RealtimeDataItemColumnHeaders where
7527+ toJSON RealtimeDataItemColumnHeaders{..}
7528+ = object
7529+ (catMaybes
7530+ [("columnType" .=) <$> _rdichColumnType,
7531+ ("name" .=) <$> _rdichName,
7532+ ("dataType" .=) <$> _rdichDataType])
7533+
57817534-- | Information for the view (profile), for which the real time data was
57827535-- requested.
57837536--
@@ -5853,6 +7606,29 @@ rdpiTableId :: Lens' RealtimeDataProfileInfo (Maybe Text)
58537606rdpiTableId
58547607 = lens _rdpiTableId (\ s a -> s{_rdpiTableId = a})
58557608
7609+instance FromJSON RealtimeDataProfileInfo where
7610+ parseJSON
7611+ = withObject "RealtimeDataProfileInfo"
7612+ (\ o ->
7613+ RealtimeDataProfileInfo <$>
7614+ (o .:? "webPropertyId") <*> (o .:? "profileId") <*>
7615+ (o .:? "profileName")
7616+ <*> (o .:? "accountId")
7617+ <*> (o .:? "internalWebPropertyId")
7618+ <*> (o .:? "tableId"))
7619+
7620+instance ToJSON RealtimeDataProfileInfo where
7621+ toJSON RealtimeDataProfileInfo{..}
7622+ = object
7623+ (catMaybes
7624+ [("webPropertyId" .=) <$> _rdpiWebPropertyId,
7625+ ("profileId" .=) <$> _rdpiProfileId,
7626+ ("profileName" .=) <$> _rdpiProfileName,
7627+ ("accountId" .=) <$> _rdpiAccountId,
7628+ ("internalWebPropertyId" .=) <$>
7629+ _rdpiInternalWebPropertyId,
7630+ ("tableId" .=) <$> _rdpiTableId])
7631+
58567632-- | Real time data request query parameters.
58577633--
58587634-- /See:/ 'realtimeDataQuery' smart constructor.
@@ -5926,6 +7702,27 @@ rdqMaxResults
59267702 = lens _rdqMaxResults
59277703 (\ s a -> s{_rdqMaxResults = a})
59287704
7705+instance FromJSON RealtimeDataQuery where
7706+ parseJSON
7707+ = withObject "RealtimeDataQuery"
7708+ (\ o ->
7709+ RealtimeDataQuery <$>
7710+ (o .:? "metrics" .!= mempty) <*> (o .:? "filters")
7711+ <*> (o .:? "ids")
7712+ <*> (o .:? "sort" .!= mempty)
7713+ <*> (o .:? "dimensions")
7714+ <*> (o .:? "max-results"))
7715+
7716+instance ToJSON RealtimeDataQuery where
7717+ toJSON RealtimeDataQuery{..}
7718+ = object
7719+ (catMaybes
7720+ [("metrics" .=) <$> _rdqMetrics,
7721+ ("filters" .=) <$> _rdqFilters,
7722+ ("ids" .=) <$> _rdqIds, ("sort" .=) <$> _rdqSort,
7723+ ("dimensions" .=) <$> _rdqDimensions,
7724+ ("max-results" .=) <$> _rdqMaxResults])
7725+
59297726-- | Total values for the requested metrics over all the results, not just
59307727-- the results returned in this response. The order of the metric totals is
59317728-- same as the metric order specified in the request.
@@ -5941,6 +7738,15 @@ realtimeDataTotalsForAllResults
59417738 :: RealtimeDataTotalsForAllResults
59427739realtimeDataTotalsForAllResults = RealtimeDataTotalsForAllResults
59437740
7741+instance FromJSON RealtimeDataTotalsForAllResults
7742+ where
7743+ parseJSON
7744+ = withObject "RealtimeDataTotalsForAllResults"
7745+ (\ o -> pure RealtimeDataTotalsForAllResults)
7746+
7747+instance ToJSON RealtimeDataTotalsForAllResults where
7748+ toJSON = const (Object mempty)
7749+
59447750-- | JSON template for an Analytics segment.
59457751--
59467752-- /See:/ 'segment' smart constructor.
@@ -6035,6 +7841,34 @@ segSegmentId :: Lens' Segment (Maybe Text)
60357841segSegmentId
60367842 = lens _segSegmentId (\ s a -> s{_segSegmentId = a})
60377843
7844+instance FromJSON Segment where
7845+ parseJSON
7846+ = withObject "Segment"
7847+ (\ o ->
7848+ Segment <$>
7849+ (o .:? "definition") <*>
7850+ (o .:? "kind" .!= "analytics#segment")
7851+ <*> (o .:? "created")
7852+ <*> (o .:? "selfLink")
7853+ <*> (o .:? "name")
7854+ <*> (o .:? "id")
7855+ <*> (o .:? "updated")
7856+ <*> (o .:? "type")
7857+ <*> (o .:? "segmentId"))
7858+
7859+instance ToJSON Segment where
7860+ toJSON Segment{..}
7861+ = object
7862+ (catMaybes
7863+ [("definition" .=) <$> _segDefinition,
7864+ Just ("kind" .= _segKind),
7865+ ("created" .=) <$> _segCreated,
7866+ ("selfLink" .=) <$> _segSelfLink,
7867+ ("name" .=) <$> _segName, ("id" .=) <$> _segId,
7868+ ("updated" .=) <$> _segUpdated,
7869+ ("type" .=) <$> _segType,
7870+ ("segmentId" .=) <$> _segSegmentId])
7871+
60387872-- | An segment collection lists Analytics segments that the user has access
60397873-- to. Each resource in the collection corresponds to a single Analytics
60407874-- segment.
@@ -6132,6 +7966,32 @@ sPreviousLink
61327966 = lens _sPreviousLink
61337967 (\ s a -> s{_sPreviousLink = a})
61347968
7969+instance FromJSON Segments where
7970+ parseJSON
7971+ = withObject "Segments"
7972+ (\ o ->
7973+ Segments <$>
7974+ (o .:? "nextLink") <*> (o .:? "itemsPerPage") <*>
7975+ (o .:? "kind" .!= "analytics#segments")
7976+ <*> (o .:? "username")
7977+ <*> (o .:? "items" .!= mempty)
7978+ <*> (o .:? "totalResults")
7979+ <*> (o .:? "startIndex")
7980+ <*> (o .:? "previousLink"))
7981+
7982+instance ToJSON Segments where
7983+ toJSON Segments{..}
7984+ = object
7985+ (catMaybes
7986+ [("nextLink" .=) <$> _sNextLink,
7987+ ("itemsPerPage" .=) <$> _sItemsPerPage,
7988+ Just ("kind" .= _sKind),
7989+ ("username" .=) <$> _sUsername,
7990+ ("items" .=) <$> _sItems,
7991+ ("totalResults" .=) <$> _sTotalResults,
7992+ ("startIndex" .=) <$> _sStartIndex,
7993+ ("previousLink" .=) <$> _sPreviousLink])
7994+
61357995-- | JSON template for Analytics unsampled report resource.
61367996--
61377997-- /See:/ 'unsampledReport' smart constructor.
@@ -6322,6 +8182,55 @@ unsStartDate :: Lens' UnsampledReport (Maybe Text)
63228182unsStartDate
63238183 = lens _unsStartDate (\ s a -> s{_unsStartDate = a})
63248184
8185+instance FromJSON UnsampledReport where
8186+ parseJSON
8187+ = withObject "UnsampledReport"
8188+ (\ o ->
8189+ UnsampledReport <$>
8190+ (o .:? "downloadType") <*> (o .:? "status") <*>
8191+ (o .:? "metrics")
8192+ <*> (o .:? "driveDownloadDetails")
8193+ <*> (o .:? "webPropertyId")
8194+ <*> (o .:? "kind" .!= "analytics#unsampledReport")
8195+ <*> (o .:? "created")
8196+ <*> (o .:? "filters")
8197+ <*> (o .:? "profileId")
8198+ <*> (o .:? "end-date")
8199+ <*> (o .:? "selfLink")
8200+ <*> (o .:? "accountId")
8201+ <*> (o .:? "id")
8202+ <*> (o .:? "updated")
8203+ <*> (o .:? "title")
8204+ <*> (o .:? "dimensions")
8205+ <*> (o .:? "segment")
8206+ <*> (o .:? "cloudStorageDownloadDetails")
8207+ <*> (o .:? "start-date"))
8208+
8209+instance ToJSON UnsampledReport where
8210+ toJSON UnsampledReport{..}
8211+ = object
8212+ (catMaybes
8213+ [("downloadType" .=) <$> _unsDownloadType,
8214+ ("status" .=) <$> _unsStatus,
8215+ ("metrics" .=) <$> _unsMetrics,
8216+ ("driveDownloadDetails" .=) <$>
8217+ _unsDriveDownloadDetails,
8218+ ("webPropertyId" .=) <$> _unsWebPropertyId,
8219+ Just ("kind" .= _unsKind),
8220+ ("created" .=) <$> _unsCreated,
8221+ ("filters" .=) <$> _unsFilters,
8222+ ("profileId" .=) <$> _unsProfileId,
8223+ ("end-date" .=) <$> _unsEndDate,
8224+ ("selfLink" .=) <$> _unsSelfLink,
8225+ ("accountId" .=) <$> _unsAccountId,
8226+ ("id" .=) <$> _unsId, ("updated" .=) <$> _unsUpdated,
8227+ ("title" .=) <$> _unsTitle,
8228+ ("dimensions" .=) <$> _unsDimensions,
8229+ ("segment" .=) <$> _unsSegment,
8230+ ("cloudStorageDownloadDetails" .=) <$>
8231+ _unsCloudStorageDownloadDetails,
8232+ ("start-date" .=) <$> _unsStartDate])
8233+
63258234-- | Download details for a file stored in Google Cloud Storage.
63268235--
63278236-- /See:/ 'unsampledReportCloudStorageDownloadDetails' smart constructor.
@@ -6357,6 +8266,23 @@ urcsddBucketId
63578266 = lens _urcsddBucketId
63588267 (\ s a -> s{_urcsddBucketId = a})
63598268
8269+instance FromJSON
8270+ UnsampledReportCloudStorageDownloadDetails where
8271+ parseJSON
8272+ = withObject
8273+ "UnsampledReportCloudStorageDownloadDetails"
8274+ (\ o ->
8275+ UnsampledReportCloudStorageDownloadDetails <$>
8276+ (o .:? "objectId") <*> (o .:? "bucketId"))
8277+
8278+instance ToJSON
8279+ UnsampledReportCloudStorageDownloadDetails where
8280+ toJSON UnsampledReportCloudStorageDownloadDetails{..}
8281+ = object
8282+ (catMaybes
8283+ [("objectId" .=) <$> _urcsddObjectId,
8284+ ("bucketId" .=) <$> _urcsddBucketId])
8285+
63608286-- | Download details for a file stored in Google Drive.
63618287--
63628288-- /See:/ 'unsampledReportDriveDownloadDetails' smart constructor.
@@ -6382,6 +8308,20 @@ urdddDocumentId
63828308 = lens _urdddDocumentId
63838309 (\ s a -> s{_urdddDocumentId = a})
63848310
8311+instance FromJSON UnsampledReportDriveDownloadDetails
8312+ where
8313+ parseJSON
8314+ = withObject "UnsampledReportDriveDownloadDetails"
8315+ (\ o ->
8316+ UnsampledReportDriveDownloadDetails <$>
8317+ (o .:? "documentId"))
8318+
8319+instance ToJSON UnsampledReportDriveDownloadDetails
8320+ where
8321+ toJSON UnsampledReportDriveDownloadDetails{..}
8322+ = object
8323+ (catMaybes [("documentId" .=) <$> _urdddDocumentId])
8324+
63858325-- | An unsampled report collection lists Analytics unsampled reports to
63868326-- which the user has access. Each view (profile) can have a set of
63878327-- unsampled reports. Each resource in the unsampled report collection
@@ -6480,6 +8420,32 @@ urPreviousLink
64808420 = lens _urPreviousLink
64818421 (\ s a -> s{_urPreviousLink = a})
64828422
8423+instance FromJSON UnsampledReports where
8424+ parseJSON
8425+ = withObject "UnsampledReports"
8426+ (\ o ->
8427+ UnsampledReports <$>
8428+ (o .:? "nextLink") <*> (o .:? "itemsPerPage") <*>
8429+ (o .:? "kind" .!= "analytics#unsampledReports")
8430+ <*> (o .:? "username")
8431+ <*> (o .:? "items" .!= mempty)
8432+ <*> (o .:? "totalResults")
8433+ <*> (o .:? "startIndex")
8434+ <*> (o .:? "previousLink"))
8435+
8436+instance ToJSON UnsampledReports where
8437+ toJSON UnsampledReports{..}
8438+ = object
8439+ (catMaybes
8440+ [("nextLink" .=) <$> _urNextLink,
8441+ ("itemsPerPage" .=) <$> _urItemsPerPage,
8442+ Just ("kind" .= _urKind),
8443+ ("username" .=) <$> _urUsername,
8444+ ("items" .=) <$> _urItems,
8445+ ("totalResults" .=) <$> _urTotalResults,
8446+ ("startIndex" .=) <$> _urStartIndex,
8447+ ("previousLink" .=) <$> _urPreviousLink])
8448+
64838449-- | Metadata returned for an upload operation.
64848450--
64858451-- /See:/ 'upload' smart constructor.
@@ -6551,6 +8517,28 @@ uplErrors
65518517 _Default
65528518 . _Coerce
65538519
8520+instance FromJSON Upload where
8521+ parseJSON
8522+ = withObject "Upload"
8523+ (\ o ->
8524+ Upload <$>
8525+ (o .:? "status") <*>
8526+ (o .:? "kind" .!= "analytics#upload")
8527+ <*> (o .:? "customDataSourceId")
8528+ <*> (o .:? "accountId")
8529+ <*> (o .:? "id")
8530+ <*> (o .:? "errors" .!= mempty))
8531+
8532+instance ToJSON Upload where
8533+ toJSON Upload{..}
8534+ = object
8535+ (catMaybes
8536+ [("status" .=) <$> _uplStatus,
8537+ Just ("kind" .= _uplKind),
8538+ ("customDataSourceId" .=) <$> _uplCustomDataSourceId,
8539+ ("accountId" .=) <$> _uplAccountId,
8540+ ("id" .=) <$> _uplId, ("errors" .=) <$> _uplErrors])
8541+
65548542-- | Upload collection lists Analytics uploads to which the user has access.
65558543-- Each custom data source can have a set of uploads. Each resource in the
65568544-- upload collection corresponds to a single Analytics data upload.
@@ -6639,6 +8627,29 @@ uPreviousLink
66398627 = lens _uPreviousLink
66408628 (\ s a -> s{_uPreviousLink = a})
66418629
8630+instance FromJSON Uploads where
8631+ parseJSON
8632+ = withObject "Uploads"
8633+ (\ o ->
8634+ Uploads <$>
8635+ (o .:? "nextLink") <*> (o .:? "itemsPerPage") <*>
8636+ (o .:? "kind" .!= "analytics#uploads")
8637+ <*> (o .:? "items" .!= mempty)
8638+ <*> (o .:? "totalResults")
8639+ <*> (o .:? "startIndex")
8640+ <*> (o .:? "previousLink"))
8641+
8642+instance ToJSON Uploads where
8643+ toJSON Uploads{..}
8644+ = object
8645+ (catMaybes
8646+ [("nextLink" .=) <$> _uNextLink,
8647+ ("itemsPerPage" .=) <$> _uItemsPerPage,
8648+ Just ("kind" .= _uKind), ("items" .=) <$> _uItems,
8649+ ("totalResults" .=) <$> _uTotalResults,
8650+ ("startIndex" .=) <$> _uStartIndex,
8651+ ("previousLink" .=) <$> _uPreviousLink])
8652+
66428653-- | JSON template for a user reference.
66438654--
66448655-- /See:/ 'userRef' smart constructor.
@@ -6677,6 +8688,22 @@ useKind = lens _useKind (\ s a -> s{_useKind = a})
66778688useId :: Lens' UserRef (Maybe Text)
66788689useId = lens _useId (\ s a -> s{_useId = a})
66798690
8691+instance FromJSON UserRef where
8692+ parseJSON
8693+ = withObject "UserRef"
8694+ (\ o ->
8695+ UserRef <$>
8696+ (o .:? "email") <*>
8697+ (o .:? "kind" .!= "analytics#userRef")
8698+ <*> (o .:? "id"))
8699+
8700+instance ToJSON UserRef where
8701+ toJSON UserRef{..}
8702+ = object
8703+ (catMaybes
8704+ [("email" .=) <$> _useEmail,
8705+ Just ("kind" .= _useKind), ("id" .=) <$> _useId])
8706+
66808707-- | JSON template for a web property reference.
66818708--
66828709-- /See:/ 'webPropertyRef' smart constructor.
@@ -6743,6 +8770,29 @@ wprInternalWebPropertyId
67438770wprId :: Lens' WebPropertyRef (Maybe Text)
67448771wprId = lens _wprId (\ s a -> s{_wprId = a})
67458772
8773+instance FromJSON WebPropertyRef where
8774+ parseJSON
8775+ = withObject "WebPropertyRef"
8776+ (\ o ->
8777+ WebPropertyRef <$>
8778+ (o .:? "kind" .!= "analytics#webPropertyRef") <*>
8779+ (o .:? "href")
8780+ <*> (o .:? "accountId")
8781+ <*> (o .:? "name")
8782+ <*> (o .:? "internalWebPropertyId")
8783+ <*> (o .:? "id"))
8784+
8785+instance ToJSON WebPropertyRef where
8786+ toJSON WebPropertyRef{..}
8787+ = object
8788+ (catMaybes
8789+ [Just ("kind" .= _wprKind), ("href" .=) <$> _wprHref,
8790+ ("accountId" .=) <$> _wprAccountId,
8791+ ("name" .=) <$> _wprName,
8792+ ("internalWebPropertyId" .=) <$>
8793+ _wprInternalWebPropertyId,
8794+ ("id" .=) <$> _wprId])
8795+
67468796-- | JSON template for an Analytics WebPropertySummary. WebPropertySummary
67478797-- returns basic information (i.e., summary) for a web property.
67488798--
@@ -6822,6 +8872,32 @@ wpsWebsiteUrl
68228872wpsLevel :: Lens' WebPropertySummary (Maybe Text)
68238873wpsLevel = lens _wpsLevel (\ s a -> s{_wpsLevel = a})
68248874
8875+instance FromJSON WebPropertySummary where
8876+ parseJSON
8877+ = withObject "WebPropertySummary"
8878+ (\ o ->
8879+ WebPropertySummary <$>
8880+ (o .:? "kind" .!= "analytics#webPropertySummary") <*>
8881+ (o .:? "profiles" .!= mempty)
8882+ <*> (o .:? "name")
8883+ <*> (o .:? "internalWebPropertyId")
8884+ <*> (o .:? "id")
8885+ <*> (o .:? "websiteUrl")
8886+ <*> (o .:? "level"))
8887+
8888+instance ToJSON WebPropertySummary where
8889+ toJSON WebPropertySummary{..}
8890+ = object
8891+ (catMaybes
8892+ [Just ("kind" .= _wpsKind),
8893+ ("profiles" .=) <$> _wpsProfiles,
8894+ ("name" .=) <$> _wpsName,
8895+ ("internalWebPropertyId" .=) <$>
8896+ _wpsInternalWebPropertyId,
8897+ ("id" .=) <$> _wpsId,
8898+ ("websiteUrl" .=) <$> _wpsWebsiteUrl,
8899+ ("level" .=) <$> _wpsLevel])
8900+
68258901-- | A web property collection lists Analytics web properties to which the
68268902-- user has access. Each resource in the collection corresponds to a single
68278903-- Analytics web property.
@@ -6921,6 +8997,32 @@ webPreviousLink
69218997 = lens _webPreviousLink
69228998 (\ s a -> s{_webPreviousLink = a})
69238999
9000+instance FromJSON Webproperties where
9001+ parseJSON
9002+ = withObject "Webproperties"
9003+ (\ o ->
9004+ Webproperties <$>
9005+ (o .:? "nextLink") <*> (o .:? "itemsPerPage") <*>
9006+ (o .:? "kind" .!= "analytics#webproperties")
9007+ <*> (o .:? "username")
9008+ <*> (o .:? "items" .!= mempty)
9009+ <*> (o .:? "totalResults")
9010+ <*> (o .:? "startIndex")
9011+ <*> (o .:? "previousLink"))
9012+
9013+instance ToJSON Webproperties where
9014+ toJSON Webproperties{..}
9015+ = object
9016+ (catMaybes
9017+ [("nextLink" .=) <$> _webNextLink,
9018+ ("itemsPerPage" .=) <$> _webItemsPerPage,
9019+ Just ("kind" .= _webKind),
9020+ ("username" .=) <$> _webUsername,
9021+ ("items" .=) <$> _webItems,
9022+ ("totalResults" .=) <$> _webTotalResults,
9023+ ("startIndex" .=) <$> _webStartIndex,
9024+ ("previousLink" .=) <$> _webPreviousLink])
9025+
69249026-- | JSON template for an Analytics web property.
69259027--
69269028-- /See:/ 'webproperty' smart constructor.
@@ -7080,6 +9182,48 @@ wIndustryVertical
70809182wLevel :: Lens' Webproperty (Maybe Text)
70819183wLevel = lens _wLevel (\ s a -> s{_wLevel = a})
70829184
9185+instance FromJSON Webproperty where
9186+ parseJSON
9187+ = withObject "Webproperty"
9188+ (\ o ->
9189+ Webproperty <$>
9190+ (o .:? "parentLink") <*> (o .:? "childLink") <*>
9191+ (o .:? "defaultProfileId")
9192+ <*> (o .:? "kind" .!= "analytics#webproperty")
9193+ <*> (o .:? "created")
9194+ <*> (o .:? "selfLink")
9195+ <*> (o .:? "accountId")
9196+ <*> (o .:? "name")
9197+ <*> (o .:? "internalWebPropertyId")
9198+ <*> (o .:? "id")
9199+ <*> (o .:? "updated")
9200+ <*> (o .:? "profileCount")
9201+ <*> (o .:? "permissions")
9202+ <*> (o .:? "websiteUrl")
9203+ <*> (o .:? "industryVertical")
9204+ <*> (o .:? "level"))
9205+
9206+instance ToJSON Webproperty where
9207+ toJSON Webproperty{..}
9208+ = object
9209+ (catMaybes
9210+ [("parentLink" .=) <$> _wParentLink,
9211+ ("childLink" .=) <$> _wChildLink,
9212+ ("defaultProfileId" .=) <$> _wDefaultProfileId,
9213+ Just ("kind" .= _wKind),
9214+ ("created" .=) <$> _wCreated,
9215+ ("selfLink" .=) <$> _wSelfLink,
9216+ ("accountId" .=) <$> _wAccountId,
9217+ ("name" .=) <$> _wName,
9218+ ("internalWebPropertyId" .=) <$>
9219+ _wInternalWebPropertyId,
9220+ ("id" .=) <$> _wId, ("updated" .=) <$> _wUpdated,
9221+ ("profileCount" .=) <$> _wProfileCount,
9222+ ("permissions" .=) <$> _wPermissions,
9223+ ("websiteUrl" .=) <$> _wWebsiteUrl,
9224+ ("industryVertical" .=) <$> _wIndustryVertical,
9225+ ("level" .=) <$> _wLevel])
9226+
70839227-- | Child link for this web property. Points to the list of views (profiles)
70849228-- for this web property.
70859229--
@@ -7112,6 +9256,21 @@ wclHref = lens _wclHref (\ s a -> s{_wclHref = a})
71129256wclType :: Lens' WebpropertyChildLink Text
71139257wclType = lens _wclType (\ s a -> s{_wclType = a})
71149258
9259+instance FromJSON WebpropertyChildLink where
9260+ parseJSON
9261+ = withObject "WebpropertyChildLink"
9262+ (\ o ->
9263+ WebpropertyChildLink <$>
9264+ (o .:? "href") <*>
9265+ (o .:? "type" .!= "analytics#profiles"))
9266+
9267+instance ToJSON WebpropertyChildLink where
9268+ toJSON WebpropertyChildLink{..}
9269+ = object
9270+ (catMaybes
9271+ [("href" .=) <$> _wclHref,
9272+ Just ("type" .= _wclType)])
9273+
71159274-- | Parent link for this web property. Points to the account to which this
71169275-- web property belongs.
71179276--
@@ -7144,6 +9303,21 @@ wplHref = lens _wplHref (\ s a -> s{_wplHref = a})
71449303wplType :: Lens' WebpropertyParentLink Text
71459304wplType = lens _wplType (\ s a -> s{_wplType = a})
71469305
9306+instance FromJSON WebpropertyParentLink where
9307+ parseJSON
9308+ = withObject "WebpropertyParentLink"
9309+ (\ o ->
9310+ WebpropertyParentLink <$>
9311+ (o .:? "href") <*>
9312+ (o .:? "type" .!= "analytics#account"))
9313+
9314+instance ToJSON WebpropertyParentLink where
9315+ toJSON WebpropertyParentLink{..}
9316+ = object
9317+ (catMaybes
9318+ [("href" .=) <$> _wplHref,
9319+ Just ("type" .= _wplType)])
9320+
71479321-- | Permissions the user has for this web property.
71489322--
71499323-- /See:/ 'webpropertyPermissions' smart constructor.
@@ -7171,3 +9345,15 @@ wpEffective
71719345 = lens _wpEffective (\ s a -> s{_wpEffective = a}) .
71729346 _Default
71739347 . _Coerce
9348+
9349+instance FromJSON WebpropertyPermissions where
9350+ parseJSON
9351+ = withObject "WebpropertyPermissions"
9352+ (\ o ->
9353+ WebpropertyPermissions <$>
9354+ (o .:? "effective" .!= mempty))
9355+
9356+instance ToJSON WebpropertyPermissions where
9357+ toJSON WebpropertyPermissions{..}
9358+ = object
9359+ (catMaybes [("effective" .=) <$> _wpEffective])