{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module Network.Google.YouTubeAnalytics.Types.Product where
import Network.Google.Prelude
import Network.Google.YouTubeAnalytics.Types.Sum
data GroupContentDetails = GroupContentDetails'
{ _gcdItemType :: !(Maybe Text)
, _gcdItemCount :: !(Maybe (Textual Word64))
} deriving (Eq,Show,Data,Typeable,Generic)
groupContentDetails
:: GroupContentDetails
groupContentDetails =
GroupContentDetails'
{ _gcdItemType = Nothing
, _gcdItemCount = Nothing
}
gcdItemType :: Lens' GroupContentDetails (Maybe Text)
gcdItemType
= lens _gcdItemType (\ s a -> s{_gcdItemType = a})
gcdItemCount :: Lens' GroupContentDetails (Maybe Word64)
gcdItemCount
= lens _gcdItemCount (\ s a -> s{_gcdItemCount = a})
. mapping _Coerce
instance FromJSON GroupContentDetails where
parseJSON
= withObject "GroupContentDetails"
(\ o ->
GroupContentDetails' <$>
(o .:? "itemType") <*> (o .:? "itemCount"))
instance ToJSON GroupContentDetails where
toJSON GroupContentDetails'{..}
= object
(catMaybes
[("itemType" .=) <$> _gcdItemType,
("itemCount" .=) <$> _gcdItemCount])
data Group = Group'
{ _gEtag :: !(Maybe Text)
, _gSnippet :: !(Maybe GroupSnippet)
, _gKind :: !(Maybe Text)
, _gContentDetails :: !(Maybe GroupContentDetails)
, _gId :: !(Maybe Text)
, _gErrors :: !(Maybe Errors)
} deriving (Eq,Show,Data,Typeable,Generic)
group'
:: Group
group' =
Group'
{ _gEtag = Nothing
, _gSnippet = Nothing
, _gKind = Nothing
, _gContentDetails = Nothing
, _gId = Nothing
, _gErrors = Nothing
}
gEtag :: Lens' Group (Maybe Text)
gEtag = lens _gEtag (\ s a -> s{_gEtag = a})
gSnippet :: Lens' Group (Maybe GroupSnippet)
gSnippet = lens _gSnippet (\ s a -> s{_gSnippet = a})
gKind :: Lens' Group (Maybe Text)
gKind = lens _gKind (\ s a -> s{_gKind = a})
gContentDetails :: Lens' Group (Maybe GroupContentDetails)
gContentDetails
= lens _gContentDetails
(\ s a -> s{_gContentDetails = a})
gId :: Lens' Group (Maybe Text)
gId = lens _gId (\ s a -> s{_gId = a})
gErrors :: Lens' Group (Maybe Errors)
gErrors = lens _gErrors (\ s a -> s{_gErrors = a})
instance FromJSON Group where
parseJSON
= withObject "Group"
(\ o ->
Group' <$>
(o .:? "etag") <*> (o .:? "snippet") <*>
(o .:? "kind")
<*> (o .:? "contentDetails")
<*> (o .:? "id")
<*> (o .:? "errors"))
instance ToJSON Group where
toJSON Group'{..}
= object
(catMaybes
[("etag" .=) <$> _gEtag,
("snippet" .=) <$> _gSnippet, ("kind" .=) <$> _gKind,
("contentDetails" .=) <$> _gContentDetails,
("id" .=) <$> _gId, ("errors" .=) <$> _gErrors])
data ListGroupsResponse = ListGroupsResponse'
{ _lgrEtag :: !(Maybe Text)
, _lgrNextPageToken :: !(Maybe Text)
, _lgrKind :: !(Maybe Text)
, _lgrItems :: !(Maybe [Group])
, _lgrErrors :: !(Maybe Errors)
} deriving (Eq,Show,Data,Typeable,Generic)
listGroupsResponse
:: ListGroupsResponse
listGroupsResponse =
ListGroupsResponse'
{ _lgrEtag = Nothing
, _lgrNextPageToken = Nothing
, _lgrKind = Nothing
, _lgrItems = Nothing
, _lgrErrors = Nothing
}
lgrEtag :: Lens' ListGroupsResponse (Maybe Text)
lgrEtag = lens _lgrEtag (\ s a -> s{_lgrEtag = a})
lgrNextPageToken :: Lens' ListGroupsResponse (Maybe Text)
lgrNextPageToken
= lens _lgrNextPageToken
(\ s a -> s{_lgrNextPageToken = a})
lgrKind :: Lens' ListGroupsResponse (Maybe Text)
lgrKind = lens _lgrKind (\ s a -> s{_lgrKind = a})
lgrItems :: Lens' ListGroupsResponse [Group]
lgrItems
= lens _lgrItems (\ s a -> s{_lgrItems = a}) .
_Default
. _Coerce
lgrErrors :: Lens' ListGroupsResponse (Maybe Errors)
lgrErrors
= lens _lgrErrors (\ s a -> s{_lgrErrors = a})
instance FromJSON ListGroupsResponse where
parseJSON
= withObject "ListGroupsResponse"
(\ o ->
ListGroupsResponse' <$>
(o .:? "etag") <*> (o .:? "nextPageToken") <*>
(o .:? "kind")
<*> (o .:? "items" .!= mempty)
<*> (o .:? "errors"))
instance ToJSON ListGroupsResponse where
toJSON ListGroupsResponse'{..}
= object
(catMaybes
[("etag" .=) <$> _lgrEtag,
("nextPageToken" .=) <$> _lgrNextPageToken,
("kind" .=) <$> _lgrKind, ("items" .=) <$> _lgrItems,
("errors" .=) <$> _lgrErrors])
data ListGroupItemsResponse = ListGroupItemsResponse'
{ _lgirEtag :: !(Maybe Text)
, _lgirKind :: !(Maybe Text)
, _lgirItems :: !(Maybe [GroupItem])
, _lgirErrors :: !(Maybe Errors)
} deriving (Eq,Show,Data,Typeable,Generic)
listGroupItemsResponse
:: ListGroupItemsResponse
listGroupItemsResponse =
ListGroupItemsResponse'
{ _lgirEtag = Nothing
, _lgirKind = Nothing
, _lgirItems = Nothing
, _lgirErrors = Nothing
}
lgirEtag :: Lens' ListGroupItemsResponse (Maybe Text)
lgirEtag = lens _lgirEtag (\ s a -> s{_lgirEtag = a})
lgirKind :: Lens' ListGroupItemsResponse (Maybe Text)
lgirKind = lens _lgirKind (\ s a -> s{_lgirKind = a})
lgirItems :: Lens' ListGroupItemsResponse [GroupItem]
lgirItems
= lens _lgirItems (\ s a -> s{_lgirItems = a}) .
_Default
. _Coerce
lgirErrors :: Lens' ListGroupItemsResponse (Maybe Errors)
lgirErrors
= lens _lgirErrors (\ s a -> s{_lgirErrors = a})
instance FromJSON ListGroupItemsResponse where
parseJSON
= withObject "ListGroupItemsResponse"
(\ o ->
ListGroupItemsResponse' <$>
(o .:? "etag") <*> (o .:? "kind") <*>
(o .:? "items" .!= mempty)
<*> (o .:? "errors"))
instance ToJSON ListGroupItemsResponse where
toJSON ListGroupItemsResponse'{..}
= object
(catMaybes
[("etag" .=) <$> _lgirEtag,
("kind" .=) <$> _lgirKind,
("items" .=) <$> _lgirItems,
("errors" .=) <$> _lgirErrors])
data GroupItemResource = GroupItemResource'
{ _girKind :: !(Maybe Text)
, _girId :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
groupItemResource
:: GroupItemResource
groupItemResource =
GroupItemResource'
{ _girKind = Nothing
, _girId = Nothing
}
girKind :: Lens' GroupItemResource (Maybe Text)
girKind = lens _girKind (\ s a -> s{_girKind = a})
girId :: Lens' GroupItemResource (Maybe Text)
girId = lens _girId (\ s a -> s{_girId = a})
instance FromJSON GroupItemResource where
parseJSON
= withObject "GroupItemResource"
(\ o ->
GroupItemResource' <$>
(o .:? "kind") <*> (o .:? "id"))
instance ToJSON GroupItemResource where
toJSON GroupItemResource'{..}
= object
(catMaybes
[("kind" .=) <$> _girKind, ("id" .=) <$> _girId])
data GroupSnippet = GroupSnippet'
{ _gsPublishedAt :: !(Maybe DateTime')
, _gsTitle :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
groupSnippet
:: GroupSnippet
groupSnippet =
GroupSnippet'
{ _gsPublishedAt = Nothing
, _gsTitle = Nothing
}
gsPublishedAt :: Lens' GroupSnippet (Maybe UTCTime)
gsPublishedAt
= lens _gsPublishedAt
(\ s a -> s{_gsPublishedAt = a})
. mapping _DateTime
gsTitle :: Lens' GroupSnippet (Maybe Text)
gsTitle = lens _gsTitle (\ s a -> s{_gsTitle = a})
instance FromJSON GroupSnippet where
parseJSON
= withObject "GroupSnippet"
(\ o ->
GroupSnippet' <$>
(o .:? "publishedAt") <*> (o .:? "title"))
instance ToJSON GroupSnippet where
toJSON GroupSnippet'{..}
= object
(catMaybes
[("publishedAt" .=) <$> _gsPublishedAt,
("title" .=) <$> _gsTitle])
data GroupItem = GroupItem'
{ _giEtag :: !(Maybe Text)
, _giKind :: !(Maybe Text)
, _giResource :: !(Maybe GroupItemResource)
, _giGroupId :: !(Maybe Text)
, _giId :: !(Maybe Text)
, _giErrors :: !(Maybe Errors)
} deriving (Eq,Show,Data,Typeable,Generic)
groupItem
:: GroupItem
groupItem =
GroupItem'
{ _giEtag = Nothing
, _giKind = Nothing
, _giResource = Nothing
, _giGroupId = Nothing
, _giId = Nothing
, _giErrors = Nothing
}
giEtag :: Lens' GroupItem (Maybe Text)
giEtag = lens _giEtag (\ s a -> s{_giEtag = a})
giKind :: Lens' GroupItem (Maybe Text)
giKind = lens _giKind (\ s a -> s{_giKind = a})
giResource :: Lens' GroupItem (Maybe GroupItemResource)
giResource
= lens _giResource (\ s a -> s{_giResource = a})
giGroupId :: Lens' GroupItem (Maybe Text)
giGroupId
= lens _giGroupId (\ s a -> s{_giGroupId = a})
giId :: Lens' GroupItem (Maybe Text)
giId = lens _giId (\ s a -> s{_giId = a})
giErrors :: Lens' GroupItem (Maybe Errors)
giErrors = lens _giErrors (\ s a -> s{_giErrors = a})
instance FromJSON GroupItem where
parseJSON
= withObject "GroupItem"
(\ o ->
GroupItem' <$>
(o .:? "etag") <*> (o .:? "kind") <*>
(o .:? "resource")
<*> (o .:? "groupId")
<*> (o .:? "id")
<*> (o .:? "errors"))
instance ToJSON GroupItem where
toJSON GroupItem'{..}
= object
(catMaybes
[("etag" .=) <$> _giEtag, ("kind" .=) <$> _giKind,
("resource" .=) <$> _giResource,
("groupId" .=) <$> _giGroupId, ("id" .=) <$> _giId,
("errors" .=) <$> _giErrors])
data Errors = Errors'
{ _eRequestId :: !(Maybe Text)
, _eError :: !(Maybe [ErrorProto])
, _eCode :: !(Maybe ErrorsCode)
} deriving (Eq,Show,Data,Typeable,Generic)
errors
:: Errors
errors =
Errors'
{ _eRequestId = Nothing
, _eError = Nothing
, _eCode = Nothing
}
eRequestId :: Lens' Errors (Maybe Text)
eRequestId
= lens _eRequestId (\ s a -> s{_eRequestId = a})
eError :: Lens' Errors [ErrorProto]
eError
= lens _eError (\ s a -> s{_eError = a}) . _Default .
_Coerce
eCode :: Lens' Errors (Maybe ErrorsCode)
eCode = lens _eCode (\ s a -> s{_eCode = a})
instance FromJSON Errors where
parseJSON
= withObject "Errors"
(\ o ->
Errors' <$>
(o .:? "requestId") <*> (o .:? "error" .!= mempty)
<*> (o .:? "code"))
instance ToJSON Errors where
toJSON Errors'{..}
= object
(catMaybes
[("requestId" .=) <$> _eRequestId,
("error" .=) <$> _eError, ("code" .=) <$> _eCode])
data ResultTableColumnHeader = ResultTableColumnHeader'
{ _rtchColumnType :: !(Maybe Text)
, _rtchName :: !(Maybe Text)
, _rtchDataType :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
resultTableColumnHeader
:: ResultTableColumnHeader
resultTableColumnHeader =
ResultTableColumnHeader'
{ _rtchColumnType = Nothing
, _rtchName = Nothing
, _rtchDataType = Nothing
}
rtchColumnType :: Lens' ResultTableColumnHeader (Maybe Text)
rtchColumnType
= lens _rtchColumnType
(\ s a -> s{_rtchColumnType = a})
rtchName :: Lens' ResultTableColumnHeader (Maybe Text)
rtchName = lens _rtchName (\ s a -> s{_rtchName = a})
rtchDataType :: Lens' ResultTableColumnHeader (Maybe Text)
rtchDataType
= lens _rtchDataType (\ s a -> s{_rtchDataType = a})
instance FromJSON ResultTableColumnHeader where
parseJSON
= withObject "ResultTableColumnHeader"
(\ o ->
ResultTableColumnHeader' <$>
(o .:? "columnType") <*> (o .:? "name") <*>
(o .:? "dataType"))
instance ToJSON ResultTableColumnHeader where
toJSON ResultTableColumnHeader'{..}
= object
(catMaybes
[("columnType" .=) <$> _rtchColumnType,
("name" .=) <$> _rtchName,
("dataType" .=) <$> _rtchDataType])
data ErrorProto = ErrorProto'
{ _epDebugInfo :: !(Maybe Text)
, _epLocation :: !(Maybe Text)
, _epDomain :: !(Maybe Text)
, _epArgument :: !(Maybe [Text])
, _epExternalErrorMessage :: !(Maybe Text)
, _epCode :: !(Maybe Text)
, _epLocationType :: !(Maybe ErrorProtoLocationType)
} deriving (Eq,Show,Data,Typeable,Generic)
errorProto
:: ErrorProto
errorProto =
ErrorProto'
{ _epDebugInfo = Nothing
, _epLocation = Nothing
, _epDomain = Nothing
, _epArgument = Nothing
, _epExternalErrorMessage = Nothing
, _epCode = Nothing
, _epLocationType = Nothing
}
epDebugInfo :: Lens' ErrorProto (Maybe Text)
epDebugInfo
= lens _epDebugInfo (\ s a -> s{_epDebugInfo = a})
epLocation :: Lens' ErrorProto (Maybe Text)
epLocation
= lens _epLocation (\ s a -> s{_epLocation = a})
epDomain :: Lens' ErrorProto (Maybe Text)
epDomain = lens _epDomain (\ s a -> s{_epDomain = a})
epArgument :: Lens' ErrorProto [Text]
epArgument
= lens _epArgument (\ s a -> s{_epArgument = a}) .
_Default
. _Coerce
epExternalErrorMessage :: Lens' ErrorProto (Maybe Text)
epExternalErrorMessage
= lens _epExternalErrorMessage
(\ s a -> s{_epExternalErrorMessage = a})
epCode :: Lens' ErrorProto (Maybe Text)
epCode = lens _epCode (\ s a -> s{_epCode = a})
epLocationType :: Lens' ErrorProto (Maybe ErrorProtoLocationType)
epLocationType
= lens _epLocationType
(\ s a -> s{_epLocationType = a})
instance FromJSON ErrorProto where
parseJSON
= withObject "ErrorProto"
(\ o ->
ErrorProto' <$>
(o .:? "debugInfo") <*> (o .:? "location") <*>
(o .:? "domain")
<*> (o .:? "argument" .!= mempty)
<*> (o .:? "externalErrorMessage")
<*> (o .:? "code")
<*> (o .:? "locationType"))
instance ToJSON ErrorProto where
toJSON ErrorProto'{..}
= object
(catMaybes
[("debugInfo" .=) <$> _epDebugInfo,
("location" .=) <$> _epLocation,
("domain" .=) <$> _epDomain,
("argument" .=) <$> _epArgument,
("externalErrorMessage" .=) <$>
_epExternalErrorMessage,
("code" .=) <$> _epCode,
("locationType" .=) <$> _epLocationType])
newtype EmptyResponse = EmptyResponse'
{ _erErrors :: Maybe Errors
} deriving (Eq,Show,Data,Typeable,Generic)
emptyResponse
:: EmptyResponse
emptyResponse =
EmptyResponse'
{ _erErrors = Nothing
}
erErrors :: Lens' EmptyResponse (Maybe Errors)
erErrors = lens _erErrors (\ s a -> s{_erErrors = a})
instance FromJSON EmptyResponse where
parseJSON
= withObject "EmptyResponse"
(\ o -> EmptyResponse' <$> (o .:? "errors"))
instance ToJSON EmptyResponse where
toJSON EmptyResponse'{..}
= object (catMaybes [("errors" .=) <$> _erErrors])
data QueryResponse = QueryResponse'
{ _qrKind :: !(Maybe Text)
, _qrRows :: !(Maybe [[JSONValue]])
, _qrColumnHeaders :: !(Maybe [ResultTableColumnHeader])
, _qrErrors :: !(Maybe Errors)
} deriving (Eq,Show,Data,Typeable,Generic)
queryResponse
:: QueryResponse
queryResponse =
QueryResponse'
{ _qrKind = Nothing
, _qrRows = Nothing
, _qrColumnHeaders = Nothing
, _qrErrors = Nothing
}
qrKind :: Lens' QueryResponse (Maybe Text)
qrKind = lens _qrKind (\ s a -> s{_qrKind = a})
qrRows :: Lens' QueryResponse [[JSONValue]]
qrRows
= lens _qrRows (\ s a -> s{_qrRows = a}) . _Default .
_Coerce
qrColumnHeaders :: Lens' QueryResponse [ResultTableColumnHeader]
qrColumnHeaders
= lens _qrColumnHeaders
(\ s a -> s{_qrColumnHeaders = a})
. _Default
. _Coerce
qrErrors :: Lens' QueryResponse (Maybe Errors)
qrErrors = lens _qrErrors (\ s a -> s{_qrErrors = a})
instance FromJSON QueryResponse where
parseJSON
= withObject "QueryResponse"
(\ o ->
QueryResponse' <$>
(o .:? "kind") <*> (o .:? "rows" .!= mempty) <*>
(o .:? "columnHeaders" .!= mempty)
<*> (o .:? "errors"))
instance ToJSON QueryResponse where
toJSON QueryResponse'{..}
= object
(catMaybes
[("kind" .=) <$> _qrKind, ("rows" .=) <$> _qrRows,
("columnHeaders" .=) <$> _qrColumnHeaders,
("errors" .=) <$> _qrErrors])