import { ComponentBase } from './base'; import { Device } from '../devices'; export interface ScriptAttributes { id: number; running: boolean; errors?: string[]; } export interface ScriptConfig { id: number; name: string; enable: boolean; } export interface ScriptConfigResponse { restart_required: boolean; } export interface ScriptList { scripts: Array<{ id: number; name: string; enable: boolean; running: boolean; }>; } export interface ScriptCreateResponse { id: number; } export interface ScriptStartStopResponse { was_running: boolean; } export interface ScriptPutCodeResponse { len: number; } export interface ScriptGetCodeResponse { data: string; left: number; } export interface ScriptEvalResponse { result: string; } /** * Handles scripts on a device. */ export declare class Script extends ComponentBase { constructor(device: Device); /** * Retrieves the status of a script. * @param id - The script ID. */ getStatus(id: number): PromiseLike; /** * Retrieves the configuration of a script. * @param id - The script ID. */ getConfig(id: number): PromiseLike; /** * Requests changes in the configuration of a script. * @param id - The script ID. * @param config - The configuration options to set. */ setConfig(id: number, config: Partial): PromiseLike; /** * Lists all scripts. */ list(): PromiseLike; /** * Creates a new script. * @param name - The name of the script. */ create(name: string): PromiseLike; /** * Removes a script. * @param id - The script ID. */ delete(id: number): PromiseLike; /** * Runs a script. * @param id - The script ID. */ start(id: number): PromiseLike; /** * Stops the execution of a script. * @param id - The script ID. */ stop(id: number): PromiseLike; /** * Uploads code to a script. * @param id - The script ID. * @param code - The code to upload. * @param append - Whether the code should be appended to the script or overwrite any existing code. */ putCode(id: number, code: string, append?: boolean): PromiseLike; /** * Downloads code from a script. * @param id - The script ID. * @param offset - The byte offset from the beginning. * @param len - The number of bytes to download. */ getCode(id: number, offset?: number, len?: number): PromiseLike; /** * Evaluates or executes code inside of a script. * @param id - The script ID. * @param code - The code to evaluate. */ eval(id: number, code: string): PromiseLike; } //# sourceMappingURL=script.d.ts.map