MCPcopy Create free account
hub / github.com/cppla/ServerStatus / api_schema

Function api_schema

server/manage_api.py:277–306  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

275
276
277def api_schema():
278 return {
279 "auth": {
280 "type": "bearer",
281 "header": "Authorization: Bearer <ADMIN_TOKEN>",
282 "enabled": bool(ADMIN_TOKEN),
283 },
284 "endpoints": [
285 {"method": "GET", "path": "/api/health", "auth": False},
286 {"method": "GET", "path": "/api/schema", "auth": False},
287 {"method": "GET", "path": "/api/config", "auth": True},
288 {"method": "PUT", "path": "/api/config", "auth": True, "body": "full config JSON"},
289 {"method": "GET", "path": "/api/servers", "auth": True},
290 {"method": "POST", "path": "/api/servers", "auth": True, "body": "server JSON"},
291 {"method": "PUT", "path": "/api/servers/{username}", "auth": True, "body": "server JSON"},
292 {"method": "DELETE", "path": "/api/servers/{username}", "auth": True},
293 *collection_routes(),
294 {"method": "POST", "path": "/api/reload", "auth": True},
295 {"method": "POST", "path": "/api/restart", "auth": True},
296 ],
297 "collections": {
298 key: {
299 "item": meta["item"],
300 "idField": meta["id_field"],
301 "required": meta["required"],
302 "optional": meta["optional"],
303 }
304 for key, meta in COLLECTIONS.items()
305 },
306 }
307
308
309class Handler(BaseHTTPRequestHandler):

Callers 1

routeMethod · 0.85

Calls 1

collection_routesFunction · 0.85

Tested by

no test coverage detected