module Network.Google.FirebaseRules.Types.Product where
import Network.Google.FirebaseRules.Types.Sum
import Network.Google.Prelude
data SourcePosition = SourcePosition'
{ _spLine :: !(Maybe (Textual Int32))
, _spColumn :: !(Maybe (Textual Int32))
, _spFileName :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
sourcePosition
:: SourcePosition
sourcePosition =
SourcePosition'
{ _spLine = Nothing
, _spColumn = Nothing
, _spFileName = Nothing
}
spLine :: Lens' SourcePosition (Maybe Int32)
spLine
= lens _spLine (\ s a -> s{_spLine = a}) .
mapping _Coerce
spColumn :: Lens' SourcePosition (Maybe Int32)
spColumn
= lens _spColumn (\ s a -> s{_spColumn = a}) .
mapping _Coerce
spFileName :: Lens' SourcePosition (Maybe Text)
spFileName
= lens _spFileName (\ s a -> s{_spFileName = a})
instance FromJSON SourcePosition where
parseJSON
= withObject "SourcePosition"
(\ o ->
SourcePosition' <$>
(o .:? "line") <*> (o .:? "column") <*>
(o .:? "fileName"))
instance ToJSON SourcePosition where
toJSON SourcePosition'{..}
= object
(catMaybes
[("line" .=) <$> _spLine,
("column" .=) <$> _spColumn,
("fileName" .=) <$> _spFileName])
data Empty =
Empty'
deriving (Eq,Show,Data,Typeable,Generic)
empty
:: Empty
empty = Empty'
instance FromJSON Empty where
parseJSON = withObject "Empty" (\ o -> pure Empty')
instance ToJSON Empty where
toJSON = const emptyObject
data ListReleasesResponse = ListReleasesResponse'
{ _lrrNextPageToken :: !(Maybe Text)
, _lrrReleases :: !(Maybe [Release])
} deriving (Eq,Show,Data,Typeable,Generic)
listReleasesResponse
:: ListReleasesResponse
listReleasesResponse =
ListReleasesResponse'
{ _lrrNextPageToken = Nothing
, _lrrReleases = Nothing
}
lrrNextPageToken :: Lens' ListReleasesResponse (Maybe Text)
lrrNextPageToken
= lens _lrrNextPageToken
(\ s a -> s{_lrrNextPageToken = a})
lrrReleases :: Lens' ListReleasesResponse [Release]
lrrReleases
= lens _lrrReleases (\ s a -> s{_lrrReleases = a}) .
_Default
. _Coerce
instance FromJSON ListReleasesResponse where
parseJSON
= withObject "ListReleasesResponse"
(\ o ->
ListReleasesResponse' <$>
(o .:? "nextPageToken") <*>
(o .:? "releases" .!= mempty))
instance ToJSON ListReleasesResponse where
toJSON ListReleasesResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _lrrNextPageToken,
("releases" .=) <$> _lrrReleases])
newtype TestRulesetResponse = TestRulesetResponse'
{ _trrIssues :: Maybe [Issue]
} deriving (Eq,Show,Data,Typeable,Generic)
testRulesetResponse
:: TestRulesetResponse
testRulesetResponse =
TestRulesetResponse'
{ _trrIssues = Nothing
}
trrIssues :: Lens' TestRulesetResponse [Issue]
trrIssues
= lens _trrIssues (\ s a -> s{_trrIssues = a}) .
_Default
. _Coerce
instance FromJSON TestRulesetResponse where
parseJSON
= withObject "TestRulesetResponse"
(\ o ->
TestRulesetResponse' <$> (o .:? "issues" .!= mempty))
instance ToJSON TestRulesetResponse where
toJSON TestRulesetResponse'{..}
= object (catMaybes [("issues" .=) <$> _trrIssues])
data Release = Release'
{ _rRulesetName :: !(Maybe Text)
, _rUpdateTime :: !(Maybe DateTime')
, _rName :: !(Maybe Text)
, _rCreateTime :: !(Maybe DateTime')
} deriving (Eq,Show,Data,Typeable,Generic)
release
:: Release
release =
Release'
{ _rRulesetName = Nothing
, _rUpdateTime = Nothing
, _rName = Nothing
, _rCreateTime = Nothing
}
rRulesetName :: Lens' Release (Maybe Text)
rRulesetName
= lens _rRulesetName (\ s a -> s{_rRulesetName = a})
rUpdateTime :: Lens' Release (Maybe UTCTime)
rUpdateTime
= lens _rUpdateTime (\ s a -> s{_rUpdateTime = a}) .
mapping _DateTime
rName :: Lens' Release (Maybe Text)
rName = lens _rName (\ s a -> s{_rName = a})
rCreateTime :: Lens' Release (Maybe UTCTime)
rCreateTime
= lens _rCreateTime (\ s a -> s{_rCreateTime = a}) .
mapping _DateTime
instance FromJSON Release where
parseJSON
= withObject "Release"
(\ o ->
Release' <$>
(o .:? "rulesetName") <*> (o .:? "updateTime") <*>
(o .:? "name")
<*> (o .:? "createTime"))
instance ToJSON Release where
toJSON Release'{..}
= object
(catMaybes
[("rulesetName" .=) <$> _rRulesetName,
("updateTime" .=) <$> _rUpdateTime,
("name" .=) <$> _rName,
("createTime" .=) <$> _rCreateTime])
data Ruleset = Ruleset'
{ _rulName :: !(Maybe Text)
, _rulSource :: !(Maybe Source)
, _rulCreateTime :: !(Maybe DateTime')
} deriving (Eq,Show,Data,Typeable,Generic)
ruleset
:: Ruleset
ruleset =
Ruleset'
{ _rulName = Nothing
, _rulSource = Nothing
, _rulCreateTime = Nothing
}
rulName :: Lens' Ruleset (Maybe Text)
rulName = lens _rulName (\ s a -> s{_rulName = a})
rulSource :: Lens' Ruleset (Maybe Source)
rulSource
= lens _rulSource (\ s a -> s{_rulSource = a})
rulCreateTime :: Lens' Ruleset (Maybe UTCTime)
rulCreateTime
= lens _rulCreateTime
(\ s a -> s{_rulCreateTime = a})
. mapping _DateTime
instance FromJSON Ruleset where
parseJSON
= withObject "Ruleset"
(\ o ->
Ruleset' <$>
(o .:? "name") <*> (o .:? "source") <*>
(o .:? "createTime"))
instance ToJSON Ruleset where
toJSON Ruleset'{..}
= object
(catMaybes
[("name" .=) <$> _rulName,
("source" .=) <$> _rulSource,
("createTime" .=) <$> _rulCreateTime])
newtype Source = Source'
{ _sFiles :: Maybe [File]
} deriving (Eq,Show,Data,Typeable,Generic)
source
:: Source
source =
Source'
{ _sFiles = Nothing
}
sFiles :: Lens' Source [File]
sFiles
= lens _sFiles (\ s a -> s{_sFiles = a}) . _Default .
_Coerce
instance FromJSON Source where
parseJSON
= withObject "Source"
(\ o -> Source' <$> (o .:? "files" .!= mempty))
instance ToJSON Source where
toJSON Source'{..}
= object (catMaybes [("files" .=) <$> _sFiles])
newtype TestRulesetRequest = TestRulesetRequest'
{ _trrSource :: Maybe Source
} deriving (Eq,Show,Data,Typeable,Generic)
testRulesetRequest
:: TestRulesetRequest
testRulesetRequest =
TestRulesetRequest'
{ _trrSource = Nothing
}
trrSource :: Lens' TestRulesetRequest (Maybe Source)
trrSource
= lens _trrSource (\ s a -> s{_trrSource = a})
instance FromJSON TestRulesetRequest where
parseJSON
= withObject "TestRulesetRequest"
(\ o -> TestRulesetRequest' <$> (o .:? "source"))
instance ToJSON TestRulesetRequest where
toJSON TestRulesetRequest'{..}
= object (catMaybes [("source" .=) <$> _trrSource])
data File = File'
{ _fFingerprint :: !(Maybe Bytes)
, _fContent :: !(Maybe Text)
, _fName :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
file
:: File
file =
File'
{ _fFingerprint = Nothing
, _fContent = Nothing
, _fName = Nothing
}
fFingerprint :: Lens' File (Maybe ByteString)
fFingerprint
= lens _fFingerprint (\ s a -> s{_fFingerprint = a})
. mapping _Bytes
fContent :: Lens' File (Maybe Text)
fContent = lens _fContent (\ s a -> s{_fContent = a})
fName :: Lens' File (Maybe Text)
fName = lens _fName (\ s a -> s{_fName = a})
instance FromJSON File where
parseJSON
= withObject "File"
(\ o ->
File' <$>
(o .:? "fingerprint") <*> (o .:? "content") <*>
(o .:? "name"))
instance ToJSON File where
toJSON File'{..}
= object
(catMaybes
[("fingerprint" .=) <$> _fFingerprint,
("content" .=) <$> _fContent,
("name" .=) <$> _fName])
data ListRulesetsResponse = ListRulesetsResponse'
{ _lRulesets :: !(Maybe [Ruleset])
, _lNextPageToken :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
listRulesetsResponse
:: ListRulesetsResponse
listRulesetsResponse =
ListRulesetsResponse'
{ _lRulesets = Nothing
, _lNextPageToken = Nothing
}
lRulesets :: Lens' ListRulesetsResponse [Ruleset]
lRulesets
= lens _lRulesets (\ s a -> s{_lRulesets = a}) .
_Default
. _Coerce
lNextPageToken :: Lens' ListRulesetsResponse (Maybe Text)
lNextPageToken
= lens _lNextPageToken
(\ s a -> s{_lNextPageToken = a})
instance FromJSON ListRulesetsResponse where
parseJSON
= withObject "ListRulesetsResponse"
(\ o ->
ListRulesetsResponse' <$>
(o .:? "rulesets" .!= mempty) <*>
(o .:? "nextPageToken"))
instance ToJSON ListRulesetsResponse where
toJSON ListRulesetsResponse'{..}
= object
(catMaybes
[("rulesets" .=) <$> _lRulesets,
("nextPageToken" .=) <$> _lNextPageToken])
data Issue = Issue'
{ _iSourcePosition :: !(Maybe SourcePosition)
, _iSeverity :: !(Maybe IssueSeverity)
, _iDescription :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
issue
:: Issue
issue =
Issue'
{ _iSourcePosition = Nothing
, _iSeverity = Nothing
, _iDescription = Nothing
}
iSourcePosition :: Lens' Issue (Maybe SourcePosition)
iSourcePosition
= lens _iSourcePosition
(\ s a -> s{_iSourcePosition = a})
iSeverity :: Lens' Issue (Maybe IssueSeverity)
iSeverity
= lens _iSeverity (\ s a -> s{_iSeverity = a})
iDescription :: Lens' Issue (Maybe Text)
iDescription
= lens _iDescription (\ s a -> s{_iDescription = a})
instance FromJSON Issue where
parseJSON
= withObject "Issue"
(\ o ->
Issue' <$>
(o .:? "sourcePosition") <*> (o .:? "severity") <*>
(o .:? "description"))
instance ToJSON Issue where
toJSON Issue'{..}
= object
(catMaybes
[("sourcePosition" .=) <$> _iSourcePosition,
("severity" .=) <$> _iSeverity,
("description" .=) <$> _iDescription])