budibase/packages/frontend-core/src/api/plugins.js

45 lines
875 B
JavaScript
Raw Normal View History

export const buildPluginEndpoints = API => ({
/**
* Uploads a plugin tarball bundle
* @param data the plugin tarball bundle to upload
*/
uploadPlugin: async data => {
return await API.post({
url: `/api/plugin/upload`,
body: data,
json: false,
})
},
2022-08-30 22:37:08 +02:00
/**
* Creates a plugin from URL, Github or NPM
*/
createPlugin: async data => {
return await API.post({
url: `/api/plugin`,
body: data,
})
},
/**
* Gets a list of all plugins
*/
getPlugins: async () => {
return await API.get({
url: "/api/plugin",
})
},
2022-08-30 11:49:19 +02:00
/**
2022-08-30 11:50:25 +02:00
* Deletes a plugin.
* @param pluginId the ID of the plugin to delete
*
* * @param pluginId the revision of the plugin to delete
*/
deletePlugin: async pluginId => {
2022-08-30 11:49:19 +02:00
return await API.delete({
url: `/api/plugin/${pluginId}`,
2022-08-30 11:49:19 +02:00
})
},
})