{-# 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.Indexing.Types.Product where
import Network.Google.Indexing.Types.Sum
import Network.Google.Prelude
newtype PublishURLNotificationResponse = PublishURLNotificationResponse'
{ _punrURLNotificationMetadata :: Maybe URLNotificationMetadata
} deriving (Eq,Show,Data,Typeable,Generic)
publishURLNotificationResponse
:: PublishURLNotificationResponse
publishURLNotificationResponse =
PublishURLNotificationResponse'
{ _punrURLNotificationMetadata = Nothing
}
punrURLNotificationMetadata :: Lens' PublishURLNotificationResponse (Maybe URLNotificationMetadata)
punrURLNotificationMetadata
= lens _punrURLNotificationMetadata
(\ s a -> s{_punrURLNotificationMetadata = a})
instance FromJSON PublishURLNotificationResponse
where
parseJSON
= withObject "PublishURLNotificationResponse"
(\ o ->
PublishURLNotificationResponse' <$>
(o .:? "urlNotificationMetadata"))
instance ToJSON PublishURLNotificationResponse where
toJSON PublishURLNotificationResponse'{..}
= object
(catMaybes
[("urlNotificationMetadata" .=) <$>
_punrURLNotificationMetadata])
data URLNotificationMetadata = URLNotificationMetadata'
{ _unmLatestUpdate :: !(Maybe URLNotification)
, _unmLatestRemove :: !(Maybe URLNotification)
, _unmURL :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
urlNotificationMetadata
:: URLNotificationMetadata
urlNotificationMetadata =
URLNotificationMetadata'
{ _unmLatestUpdate = Nothing
, _unmLatestRemove = Nothing
, _unmURL = Nothing
}
unmLatestUpdate :: Lens' URLNotificationMetadata (Maybe URLNotification)
unmLatestUpdate
= lens _unmLatestUpdate
(\ s a -> s{_unmLatestUpdate = a})
unmLatestRemove :: Lens' URLNotificationMetadata (Maybe URLNotification)
unmLatestRemove
= lens _unmLatestRemove
(\ s a -> s{_unmLatestRemove = a})
unmURL :: Lens' URLNotificationMetadata (Maybe Text)
unmURL = lens _unmURL (\ s a -> s{_unmURL = a})
instance FromJSON URLNotificationMetadata where
parseJSON
= withObject "URLNotificationMetadata"
(\ o ->
URLNotificationMetadata' <$>
(o .:? "latestUpdate") <*> (o .:? "latestRemove") <*>
(o .:? "url"))
instance ToJSON URLNotificationMetadata where
toJSON URLNotificationMetadata'{..}
= object
(catMaybes
[("latestUpdate" .=) <$> _unmLatestUpdate,
("latestRemove" .=) <$> _unmLatestRemove,
("url" .=) <$> _unmURL])
data URLNotification = URLNotification'
{ _unURL :: !(Maybe Text)
, _unNotifyTime :: !(Maybe DateTime')
, _unType :: !(Maybe URLNotificationType)
} deriving (Eq,Show,Data,Typeable,Generic)
urlNotification
:: URLNotification
urlNotification =
URLNotification'
{ _unURL = Nothing
, _unNotifyTime = Nothing
, _unType = Nothing
}
unURL :: Lens' URLNotification (Maybe Text)
unURL = lens _unURL (\ s a -> s{_unURL = a})
unNotifyTime :: Lens' URLNotification (Maybe UTCTime)
unNotifyTime
= lens _unNotifyTime (\ s a -> s{_unNotifyTime = a})
. mapping _DateTime
unType :: Lens' URLNotification (Maybe URLNotificationType)
unType = lens _unType (\ s a -> s{_unType = a})
instance FromJSON URLNotification where
parseJSON
= withObject "URLNotification"
(\ o ->
URLNotification' <$>
(o .:? "url") <*> (o .:? "notifyTime") <*>
(o .:? "type"))
instance ToJSON URLNotification where
toJSON URLNotification'{..}
= object
(catMaybes
[("url" .=) <$> _unURL,
("notifyTime" .=) <$> _unNotifyTime,
("type" .=) <$> _unType])