mirror of
https://github.com/Start9Labs/registry.git
synced 2026-03-26 02:11:53 +00:00
rewire the api to be clean and consistent
fix route documentation fix sorting scheme to be more clear for release notes
This commit is contained in:
@@ -1,14 +1,18 @@
|
||||
/eos/latest EosVersionR GET -- get eos information
|
||||
/eos/eos.img EosR GET -- get eos.img
|
||||
/latest-version VersionLatestR GET -- get latest version of apps in query param id
|
||||
!/package/#S9PK AppR GET -- get most recent appId at appversion spec, defaults to >=0.0.0 -- ?spec={semver-spec}
|
||||
/package/data InfoR GET -- get all marketplace categories
|
||||
/package/index PackageListR GET -- filter marketplace services by various query params
|
||||
/package/manifest/#PkgId AppManifestR GET -- get app manifest from appmgr -- ?version={semver-spec}
|
||||
/package/release-notes ReleaseNotesR GET -- get release notes for package - expects query param of id=<pacakge-id>
|
||||
/package/icon/#PkgId IconsR GET -- get icons - can specify version with ?spec=<emver>
|
||||
/package/license/#PkgId LicenseR GET -- get icons - can specify version with ?spec=<emver>
|
||||
/package/instructions/#PkgId InstructionsR GET -- get icons - can specify version with ?spec=<emver>
|
||||
/package/version/#PkgId PkgVersionR GET -- get most recent appId version
|
||||
-- EOS API V0
|
||||
/eos/v0/latest EosVersionR GET -- get eos information
|
||||
/eos/v0/eos.img EosR GET -- get eos.img
|
||||
|
||||
/support/error-logs ErrorLogsR POST
|
||||
-- PACKAGE API V0
|
||||
/package/v0/info InfoR GET -- get all marketplace categories
|
||||
/package/v0/index PackageListR GET -- filter marketplace services by various query params
|
||||
/package/v0/latest VersionLatestR GET -- get latest version of apps in query param id
|
||||
!/package/v0/#S9PK AppR GET -- get most recent appId at appversion spec, defaults to >=0.0.0 -- ?spec=<emver>
|
||||
/package/v0/manifest/#PkgId AppManifestR GET -- get app manifest from appmgr -- ?spec=<emver>
|
||||
/package/v0/release-notes/#PkgId ReleaseNotesR GET -- get release notes for all versions of a package
|
||||
/package/v0/icon/#PkgId IconsR GET -- get icons - can specify version with ?spec=<emver>
|
||||
/package/v0/license/#PkgId LicenseR GET -- get license - can specify version with ?spec=<emver>
|
||||
/package/v0/instructions/#PkgId InstructionsR GET -- get instructions - can specify version with ?spec=<emver>
|
||||
/package/v0/version/#PkgId PkgVersionR GET -- get most recent appId version
|
||||
|
||||
-- SUPPORT API V0
|
||||
/support/v0/error-logs ErrorLogsR POST
|
||||
@@ -87,8 +87,7 @@ import Lib.PkgRepository ( PkgRepo
|
||||
, getIcon
|
||||
, getManifest
|
||||
)
|
||||
import Lib.Types.AppIndex ( PkgId(PkgId) )
|
||||
import Lib.Types.AppIndex ( )
|
||||
import Lib.Types.AppIndex ( PkgId )
|
||||
import Lib.Types.Category ( CategoryTitle(..) )
|
||||
import Lib.Types.Emver ( Version
|
||||
, VersionRange
|
||||
@@ -167,19 +166,19 @@ getEosVersionR = do
|
||||
, eosResReleaseNotes = mappedVersions
|
||||
}
|
||||
|
||||
getReleaseNotesR :: Handler ReleaseNotes
|
||||
getReleaseNotesR = do
|
||||
getParameters <- reqGetParams <$> getRequest
|
||||
case lookup "id" getParameters of
|
||||
Nothing -> sendResponseStatus status400 (InvalidParamsE "get:id" "<MISSING>")
|
||||
Just package -> do
|
||||
getReleaseNotesR :: PkgId -> Handler ReleaseNotes
|
||||
getReleaseNotesR pkg = do
|
||||
appConnPool <- appConnPool <$> getYesod
|
||||
versionRecords <- runDB $ fetchAllAppVersions appConnPool (PkgId package)
|
||||
versionRecords <- runDB $ fetchAllAppVersions appConnPool pkg
|
||||
pure $ constructReleaseNotesApiRes versionRecords
|
||||
where
|
||||
constructReleaseNotesApiRes :: [VersionRecord] -> ReleaseNotes
|
||||
constructReleaseNotesApiRes vers = do
|
||||
ReleaseNotes $ HM.fromList $ sortOn Down $ (versionRecordNumber &&& versionRecordReleaseNotes) <$> vers
|
||||
ReleaseNotes
|
||||
$ HM.fromList
|
||||
$ sortOn (Down . fst)
|
||||
$ (versionRecordNumber &&& versionRecordReleaseNotes)
|
||||
<$> vers
|
||||
|
||||
getEosR :: Handler TypedContent
|
||||
getEosR = do
|
||||
|
||||
@@ -68,7 +68,7 @@ instance FromJSON PackageRes where
|
||||
packageResDependencies <- o .: "dependency-metadata"
|
||||
pure PackageRes { .. }
|
||||
data DependencyRes = DependencyRes
|
||||
{ dependencyResTitle :: Text -- TODO switch to `Text` to display actual title in Marketplace. Confirm with FE that this will not break loading. Perhaps return title and id?
|
||||
{ dependencyResTitle :: Text
|
||||
, dependencyResIcon :: Text
|
||||
}
|
||||
deriving (Eq, Show)
|
||||
|
||||
Reference in New Issue
Block a user