From af73b96313c4d31da917ec46cbee390c7bbb32e9 Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Tue, 3 Nov 2020 21:49:10 -0500 Subject: [PATCH] routes/apps.ts: Add example output --- src/node/routes/apps.ts | 2 ++ typings/pluginapi.d.ts | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/node/routes/apps.ts b/src/node/routes/apps.ts index c678f2fee..4298fb392 100644 --- a/src/node/routes/apps.ts +++ b/src/node/routes/apps.ts @@ -3,6 +3,8 @@ import { PluginAPI } from "../plugin" /** * Implements the /api/applications endpoint + * + * See typings/pluginapi.d.ts for details. */ export function router(papi: PluginAPI): express.Router { const router = express.Router() diff --git a/typings/pluginapi.d.ts b/typings/pluginapi.d.ts index 3ce5e5d0c..94819bd3c 100644 --- a/typings/pluginapi.d.ts +++ b/typings/pluginapi.d.ts @@ -42,12 +42,38 @@ import * as express from "express" * * If two plugins are found with the exact same name, then code-server will * use the first one and emit a warning. + * + */ + +/* Programmability * * There is also a /api/applications endpoint to allow programmatic access to all * available applications. It could be used to create a custom application dashboard * for example. An important difference with the API is that all application paths * will be absolute (i.e have the plugin path prepended) so that they may be used * directly. + * + * Example output: + * + * [ + * { + * "name": "Test App", + * "version": "4.0.0", + * "iconPath": "/test-plugin/test-app/icon.svg", + * "path": "/test-plugin/test-app", + * "description": "This app does XYZ.", + * "homepageURL": "https://example.com", + * "plugin": { + * "name": "test-plugin", + * "version": "1.0.0", + * "modulePath": "/Users/nhooyr/src/cdr/code-server/test/test-plugin", + * "displayName": "Test Plugin", + * "description": "Plugin used in code-server tests.", + * "routerPath": "/test-plugin", + * "homepageURL": "https://example.com" + * } + * } + * ] */ /**