From b5f919ac8eb2a1c20e26582fdfd377d687710d8f Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 12 Jul 2019 11:39:58 +0200 Subject: WIP plugins: update plugin --- shared/extra-utils/server/plugins.ts | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'shared/extra-utils') diff --git a/shared/extra-utils/server/plugins.ts b/shared/extra-utils/server/plugins.ts index 6cd7cd17a..1da313ab7 100644 --- a/shared/extra-utils/server/plugins.ts +++ b/shared/extra-utils/server/plugins.ts @@ -85,7 +85,7 @@ function installPlugin (parameters: { npmName?: string expectedStatus?: number }) { - const { url, accessToken, npmName, path, expectedStatus = 204 } = parameters + const { url, accessToken, npmName, path, expectedStatus = 200 } = parameters const apiPath = '/api/v1/plugins/install' return makePostBodyRequest({ @@ -97,6 +97,25 @@ function installPlugin (parameters: { }) } +function updatePlugin (parameters: { + url: string, + accessToken: string, + path?: string, + npmName?: string + expectedStatus?: number +}) { + const { url, accessToken, npmName, path, expectedStatus = 200 } = parameters + const apiPath = '/api/v1/plugins/update' + + return makePostBodyRequest({ + url, + path: apiPath, + token: accessToken, + fields: { npmName, path }, + statusCodeExpected: expectedStatus + }) +} + function uninstallPlugin (parameters: { url: string, accessToken: string, @@ -118,6 +137,7 @@ function uninstallPlugin (parameters: { export { listPlugins, installPlugin, + updatePlugin, getPlugin, uninstallPlugin, getPluginSettings, -- cgit v1.2.3