UNPKG

@jupyterlab/services

Version:

Client APIs for the Jupyter services REST APIs

95 lines (94 loc) 2.78 kB
import { ServerConnection } from '../serverconnection'; import { ITerminal, ITerminalAPIClient } from './terminal'; /** * The url for the terminal service. */ export declare const TERMINAL_SERVICE_URL = "api/terminals"; /** * Whether the terminal service is available. */ export declare function isAvailable(): boolean; /** * The server model for a terminal session. */ export interface IModel { /** * The name of the terminal session. */ readonly name: string; } /** * Start a new terminal session. * * @param settings - The server settings to use. * * @param name - The name of the target terminal. * * @param cwd - The path in which the terminal will start. * * @returns A promise that resolves with the session model. */ export declare function startNew(settings?: ServerConnection.ISettings, name?: string, cwd?: string): Promise<IModel>; /** * List the running terminal sessions. * * @param settings - The server settings to use. * * @returns A promise that resolves with the list of running session models. */ export declare function listRunning(settings?: ServerConnection.ISettings): Promise<IModel[]>; /** * Shut down a terminal session by name. * * @param name - The name of the target session. * * @param settings - The server settings to use. * * @returns A promise that resolves when the session is shut down. */ export declare function shutdownTerminal(name: string, settings?: ServerConnection.ISettings): Promise<void>; /** * The Terminal API client. * * #### Notes * Use this class to interact with the Jupyter Server Terminal API. * This class adheres to the Jupyter Server API endpoints. */ export declare class TerminalAPIClient implements ITerminalAPIClient { /** * Create a new Terminal API client. */ constructor(options?: { serverSettings?: ServerConnection.ISettings; }); /** * The server settings for the client. */ readonly serverSettings: ServerConnection.ISettings; /** * Whether terminals are available. */ get isAvailable(): boolean; /** * Start a new terminal session. * * @param options - The options used to create the terminal. * * @returns A promise that resolves with the terminal session model. */ startNew(options?: ITerminal.IOptions): Promise<IModel>; /** * List the running terminal sessions. * * @returns A promise that resolves with the list of running session models. */ listRunning(): Promise<IModel[]>; /** * Shut down a terminal session by name. * * @param name - The name of the target session. * * @returns A promise that resolves when the session is shut down. */ shutdown(name: string): Promise<void>; }