UNPKG

@inweb/client

Version:

JavaScript REST API client for the Open Cloud Server

142 lines (141 loc) 4.24 kB
import { IHttpClient } from "./IHttpClient"; import { Endpoint } from "./Endpoint"; /** * Provides properties and methods for obtaining information about a server plugin on the Open Cloud * Server and managing its data. */ export declare class Plugin extends Endpoint { private _data; /** * @param data - Raw plugin data received from the server. For more information, see * {@link https://cloud.opendesign.com/docs//pages/server/api.html#Plugin | Open Cloud Plugins API}. * @param httpClient - HTTP client instance used to send requests to the REST API server. */ constructor(data: any, httpClient: IHttpClient); /** * Plugin author information. The `author` is an object with a `name` field and optionally `url` and * `email`. Or it can be shorten that all into a single string. * * @readonly */ get author(): any; /** * Raw plugin data received from the server. For more information, see * {@link https://cloud.opendesign.com/docs//pages/server/api.html#Plugin | Open Cloud Plugins API}. */ get data(): any; set data(value: any); /** * Short description of the plugin. * * @readonly */ get description(): string; /** * Plugin state. * * @readonly */ get enabled(): boolean; /** * The URL to the plugin homepage. * * @readonly */ get homepage(): string; /** * Unique plugin ID. * * @readonly */ get id(): string; /** * A license for the plugin. * * @readonly */ get license(): string; /** * Plugin name. * * @readonly */ get name(): string; /** * API permissions required. * * @readonly */ get permissions(): string[]; /** * Plugin type. Can be set of: * * - `app` - Viewer plugin, the client‑side web app that the server hosts and serves as static content. * - `server` - Binary dll that extends server functionality. * - `jobrunner` - Binary dll that adds a new Job Runner on the server. * * @readonly */ get pluginType(): string[]; /** * {@link https://semver.org/ | SemVer} compatible version of the plugin. * * @readonly */ get version(): number; /** * Reloads plugin data from the server. */ checkout(): Promise<this>; /** * Uninstalls and deletes a plugin from the server. * * @returns Returns the raw data of a deleted plugin. For more information, see * {@link https://cloud.opendesign.com/docs//pages/server/api.html#Plugin | Open Cloud Plugins API}. */ delete(): Promise<any>; /** * Enables a plugin. */ enable(): Promise<this>; /** * Disables a plugin. */ disable(): Promise<this>; /** * Downloads the plugins package from the server. * * @param onProgress - Download progress callback. * @param signal - An * {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController} signal. Allows * to communicate with a fetch request and abort it if desired. */ download(onProgress?: (progress: number) => void, signal?: AbortSignal): Promise<ArrayBuffer>; /** * Returns a plugin manfest. */ getManifest(): Promise<any>; /** * Returns the plugin settings. * * @returns Returns an object with plugin settings. */ getSettings(): Promise<any>; /** * Changes the plugin settings. * * @param settings - An object with the new plugin settings or part of the settings. * @returns Returns an object with updated plugin settings. */ updateSettings(settings: any): Promise<any>; /** * Executes a plugin command. * * This method executes the command for the current version of the plugin. To execute a command for the * latest installed version of the plugin, use the {@link Client.executePluginCommand}. * * @param command - Command to execute. * @param parameters - Command parameters. Command-dependent. */ executeCommand(command: string, parameters?: BodyInit | object): Promise<any>; }