UNPKG

2.41 kBTypeScriptView Raw
1import { DataConnector } from '@jupyterlab/statedb';
2import { ReadonlyPartialJSONObject } from '@lumino/coreutils';
3import { ServerConnection } from '../serverconnection';
4/**
5 * The workspaces API service manager.
6 */
7export declare class WorkspaceManager extends DataConnector<Workspace.IWorkspace> {
8 /**
9 * Create a new workspace manager.
10 */
11 constructor(options?: WorkspaceManager.IOptions);
12 /**
13 * The server settings used to make API requests.
14 */
15 readonly serverSettings: ServerConnection.ISettings;
16 /**
17 * Fetch a workspace.
18 *
19 * @param id - The workspace's ID.
20 *
21 * @returns A promise that resolves if successful.
22 */
23 fetch(id: string): Promise<Workspace.IWorkspace>;
24 /**
25 * Fetch the list of workspace IDs that exist on the server.
26 *
27 * @returns A promise that resolves if successful.
28 */
29 list(): Promise<{
30 ids: string[];
31 values: Workspace.IWorkspace[];
32 }>;
33 /**
34 * Remove a workspace from the server.
35 *
36 * @param id - The workspaces's ID.
37 *
38 * @returns A promise that resolves if successful.
39 */
40 remove(id: string): Promise<void>;
41 /**
42 * Save a workspace.
43 *
44 * @param id - The workspace's ID.
45 *
46 * @param workspace - The workspace being saved.
47 *
48 * @returns A promise that resolves if successful.
49 */
50 save(id: string, workspace: Workspace.IWorkspace): Promise<void>;
51}
52/**
53 * A namespace for `WorkspaceManager` statics.
54 */
55export declare namespace WorkspaceManager {
56 /**
57 * The instantiation options for a workspace manager.
58 */
59 interface IOptions {
60 /**
61 * The server settings used to make API requests.
62 */
63 serverSettings?: ServerConnection.ISettings;
64 }
65}
66/**
67 * A namespace for workspace API interfaces.
68 */
69export declare namespace Workspace {
70 /**
71 * The interface for the workspace API manager.
72 */
73 interface IManager extends WorkspaceManager {
74 }
75 /**
76 * The interface describing a workspace API response.
77 */
78 interface IWorkspace {
79 /**
80 * The workspace data.
81 */
82 data: ReadonlyPartialJSONObject;
83 /**
84 * The metadata for a workspace.
85 */
86 metadata: {
87 /**
88 * The workspace ID.
89 */
90 id: string;
91 };
92 }
93}