Get more done on packageserver

This commit is contained in:
2025-07-12 03:33:45 -05:00
parent 35960d5db0
commit 92f21917b1
7 changed files with 137 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
func Pages.API.Index()
{
var pages=[{
active = true,
route = "/api",
text = "API Home"
}];
var html = <null>
<h1>API Home</h1>
<ul>
<li><a href="./api-v1">v1</a></li>
</ul></null>;
return Shell("CPKG API Home", pages,html);
}

View File

@@ -0,0 +1,34 @@
func Pages.API.V1()
{
var pages=[{
active = false,
route = "/api",
text = "API Home"
}];
var html = <null>
<h1>API v1</h1>
<ul>
<li>
GET /api/v1/package_icon.png?name=PACKAGENAME&version=1.0.0.0-prod<br>
Gets the package icon for the package<br>
<br>
query:<br>
<code>name</code>: the name of the package<br>
<code>version</code>: the version of the package<br>
<br>
response: image/png of package
</li>
<li>
GET /api/v1/latest?name=PACKAGENAME<br>
Gets the latest version of a package<br>
<br>
query:<br>
<code>name</code>: the name of the package<br>
<br>
response: json dictionary with a single key <code>version</code> with the string value of the latest version<br>
</li>
</ul>
</null>;
return Shell("CPKG API v1", pages,html);
}