adds minCompanion to json

This commit is contained in:
Keagan McClelland
2020-02-18 11:27:26 -07:00
parent 1e5e31942f
commit 35c1d686b5

View File

@@ -14,7 +14,10 @@ data AppVersionRes = AppVersionRes
, appVersionMinCompanion :: Maybe AppVersion
} deriving (Eq, Show)
instance ToJSON AppVersionRes where
toJSON AppVersionRes{ appVersionVersion } = object ["version" .= appVersionVersion]
toJSON AppVersionRes{ appVersionVersion, appVersionMinCompanion } = object $
["version" .= appVersionVersion] <> case appVersionMinCompanion of
Nothing -> []
Just x -> ["minCompanion" .= x]
instance ToContent AppVersionRes where
toContent = toContent . toJSON