adds minCompanion to json

This commit is contained in:
Keagan McClelland
2020-02-18 11:27:26 -07:00
parent e8cf9cbe04
commit 76766e5f94

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