UNPKG

30.5 kBTypeScriptView Raw
1import { ModelDB } from '@jupyterlab/observables';
2import { IDisposable } from '@lumino/disposable';
3import { ISignal } from '@lumino/signaling';
4import { ServerConnection } from '..';
5/**
6 * A namespace for contents interfaces.
7 */
8export declare namespace Contents {
9 /**
10 * A contents model.
11 */
12 interface IModel {
13 /**
14 * Name of the contents file.
15 *
16 * #### Notes
17 * Equivalent to the last part of the `path` field.
18 */
19 readonly name: string;
20 /**
21 * The full file path.
22 *
23 * #### Notes
24 * It will *not* start with `/`, and it will be `/`-delimited.
25 */
26 readonly path: string;
27 /**
28 * The type of file.
29 */
30 readonly type: ContentType;
31 /**
32 * Whether the requester has permission to edit the file.
33 */
34 readonly writable: boolean;
35 /**
36 * File creation timestamp.
37 */
38 readonly created: string;
39 /**
40 * Last modified timestamp.
41 */
42 readonly last_modified: string;
43 /**
44 * Specify the mime-type of file contents.
45 *
46 * #### Notes
47 * Only non-`null` when `content` is present and `type` is `"file"`.
48 */
49 readonly mimetype: string;
50 /**
51 * The optional file content.
52 */
53 readonly content: any;
54 /**
55 * The chunk of the file upload.
56 */
57 readonly chunk?: number;
58 /**
59 * The format of the file `content`.
60 *
61 * #### Notes
62 * Only relevant for type: 'file'
63 */
64 readonly format: FileFormat;
65 /**
66 * The size of then file in bytes.
67 */
68 readonly size?: number;
69 /**
70 * The indices of the matched characters in the name.
71 */
72 indices?: ReadonlyArray<number> | null;
73 }
74 /**
75 * Validates an IModel, throwing an error if it does not pass.
76 */
77 function validateContentsModel(contents: IModel): void;
78 /**
79 * A contents file type.
80 */
81 type ContentType = 'notebook' | 'file' | 'directory';
82 /**
83 * A contents file format.
84 */
85 type FileFormat = 'json' | 'text' | 'base64' | null;
86 /**
87 * The options used to fetch a file.
88 */
89 interface IFetchOptions {
90 /**
91 * The override file type for the request.
92 */
93 type?: ContentType;
94 /**
95 * The override file format for the request.
96 */
97 format?: FileFormat;
98 /**
99 * Whether to include the file content.
100 *
101 * The default is `true`.
102 */
103 content?: boolean;
104 }
105 /**
106 * The options used to create a file.
107 */
108 interface ICreateOptions {
109 /**
110 * The directory in which to create the file.
111 */
112 path?: string;
113 /**
114 * The optional file extension for the new file (e.g. `".txt"`).
115 *
116 * #### Notes
117 * This ignored if `type` is `'notebook'`.
118 */
119 ext?: string;
120 /**
121 * The file type.
122 */
123 type?: ContentType;
124 }
125 /**
126 * Checkpoint model.
127 */
128 interface ICheckpointModel {
129 /**
130 * The unique identifier for the checkpoint.
131 */
132 readonly id: string;
133 /**
134 * Last modified timestamp.
135 */
136 readonly last_modified: string;
137 }
138 /**
139 * Validates an ICheckpointModel, throwing an error if it does not pass.
140 */
141 function validateCheckpointModel(checkpoint: ICheckpointModel): void;
142 /**
143 * The change args for a file change.
144 */
145 interface IChangedArgs {
146 /**
147 * The type of change.
148 */
149 type: 'new' | 'delete' | 'rename' | 'save';
150 /**
151 * The new contents.
152 */
153 oldValue: Partial<IModel> | null;
154 /**
155 * The old contents.
156 */
157 newValue: Partial<IModel> | null;
158 }
159 /**
160 * The interface for a contents manager.
161 */
162 interface IManager extends IDisposable {
163 /**
164 * A signal emitted when a file operation takes place.
165 */
166 readonly fileChanged: ISignal<IManager, IChangedArgs>;
167 /**
168 * The server settings associated with the manager.
169 */
170 readonly serverSettings: ServerConnection.ISettings;
171 /**
172 * Add an `IDrive` to the manager.
173 */
174 addDrive(drive: IDrive): void;
175 /**
176 * Given a path of the form `drive:local/portion/of/it.txt`
177 * get the local part of it.
178 *
179 * @param path: the path.
180 *
181 * @returns The local part of the path.
182 */
183 localPath(path: string): string;
184 /**
185 * Normalize a global path. Reduces '..' and '.' parts, and removes
186 * leading slashes from the local part of the path, while retaining
187 * the drive name if it exists.
188 *
189 * @param path: the path.
190 *
191 * @returns The normalized path.
192 */
193 normalize(path: string): string;
194 /**
195 * Resolve a global path, starting from the root path. Behaves like
196 * posix-path.resolve, with 3 differences:
197 * - will never prepend cwd
198 * - if root has a drive name, the result is prefixed with "<drive>:"
199 * - before adding drive name, leading slashes are removed
200 *
201 * @param path: the path.
202 *
203 * @returns The normalized path.
204 */
205 resolvePath(root: string, path: string): string;
206 /**
207 * Given a path of the form `drive:local/portion/of/it.txt`
208 * get the name of the drive. If the path is missing
209 * a drive portion, returns an empty string.
210 *
211 * @param path: the path.
212 *
213 * @returns The drive name for the path, or the empty string.
214 */
215 driveName(path: string): string;
216 /**
217 * Given a path, get a ModelDB.IFactory from the
218 * relevant backend. Returns `null` if the backend
219 * does not provide one.
220 */
221 getModelDBFactory(path: string): ModelDB.IFactory | null;
222 /**
223 * Get a file or directory.
224 *
225 * @param path: The path to the file.
226 *
227 * @param options: The options used to fetch the file.
228 *
229 * @returns A promise which resolves with the file content.
230 */
231 get(path: string, options?: IFetchOptions): Promise<IModel>;
232 /**
233 * Get an encoded download url given a file path.
234 *
235 * @param A promise which resolves with the absolute POSIX
236 * file path on the server.
237 *
238 * #### Notes
239 * The returned URL may include a query parameter.
240 */
241 getDownloadUrl(path: string): Promise<string>;
242 /**
243 * Create a new untitled file or directory in the specified directory path.
244 *
245 * @param options: The options used to create the file.
246 *
247 * @returns A promise which resolves with the created file content when the
248 * file is created.
249 */
250 newUntitled(options?: ICreateOptions): Promise<IModel>;
251 /**
252 * Delete a file.
253 *
254 * @param path - The path to the file.
255 *
256 * @returns A promise which resolves when the file is deleted.
257 */
258 delete(path: string): Promise<void>;
259 /**
260 * Rename a file or directory.
261 *
262 * @param path - The original file path.
263 *
264 * @param newPath - The new file path.
265 *
266 * @returns A promise which resolves with the new file content model when the
267 * file is renamed.
268 */
269 rename(path: string, newPath: string): Promise<IModel>;
270 /**
271 * Save a file.
272 *
273 * @param path - The desired file path.
274 *
275 * @param options - Optional overrides to the model.
276 *
277 * @returns A promise which resolves with the file content model when the
278 * file is saved.
279 */
280 save(path: string, options?: Partial<IModel>): Promise<IModel>;
281 /**
282 * Copy a file into a given directory.
283 *
284 * @param path - The original file path.
285 *
286 * @param toDir - The destination directory path.
287 *
288 * @returns A promise which resolves with the new content model when the
289 * file is copied.
290 */
291 copy(path: string, toDir: string): Promise<IModel>;
292 /**
293 * Create a checkpoint for a file.
294 *
295 * @param path - The path of the file.
296 *
297 * @returns A promise which resolves with the new checkpoint model when the
298 * checkpoint is created.
299 */
300 createCheckpoint(path: string): Promise<ICheckpointModel>;
301 /**
302 * List available checkpoints for a file.
303 *
304 * @param path - The path of the file.
305 *
306 * @returns A promise which resolves with a list of checkpoint models for
307 * the file.
308 */
309 listCheckpoints(path: string): Promise<ICheckpointModel[]>;
310 /**
311 * Restore a file to a known checkpoint state.
312 *
313 * @param path - The path of the file.
314 *
315 * @param checkpointID - The id of the checkpoint to restore.
316 *
317 * @returns A promise which resolves when the checkpoint is restored.
318 */
319 restoreCheckpoint(path: string, checkpointID: string): Promise<void>;
320 /**
321 * Delete a checkpoint for a file.
322 *
323 * @param path - The path of the file.
324 *
325 * @param checkpointID - The id of the checkpoint to delete.
326 *
327 * @returns A promise which resolves when the checkpoint is deleted.
328 */
329 deleteCheckpoint(path: string, checkpointID: string): Promise<void>;
330 }
331 /**
332 * The interface for a network drive that can be mounted
333 * in the contents manager.
334 */
335 interface IDrive extends IDisposable {
336 /**
337 * The name of the drive, which is used at the leading
338 * component of file paths.
339 */
340 readonly name: string;
341 /**
342 * The server settings of the manager.
343 */
344 readonly serverSettings: ServerConnection.ISettings;
345 /**
346 * An optional ModelDB.IFactory instance for the
347 * drive.
348 */
349 readonly modelDBFactory?: ModelDB.IFactory;
350 /**
351 * A signal emitted when a file operation takes place.
352 */
353 fileChanged: ISignal<IDrive, IChangedArgs>;
354 /**
355 * Get a file or directory.
356 *
357 * @param localPath: The path to the file.
358 *
359 * @param options: The options used to fetch the file.
360 *
361 * @returns A promise which resolves with the file content.
362 */
363 get(localPath: string, options?: IFetchOptions): Promise<IModel>;
364 /**
365 * Get an encoded download url given a file path.
366 *
367 * @param A promise which resolves with the absolute POSIX
368 * file path on the server.
369 *
370 * #### Notes
371 * The returned URL may include a query parameter.
372 */
373 getDownloadUrl(localPath: string): Promise<string>;
374 /**
375 * Create a new untitled file or directory in the specified directory path.
376 *
377 * @param options: The options used to create the file.
378 *
379 * @returns A promise which resolves with the created file content when the
380 * file is created.
381 */
382 newUntitled(options?: ICreateOptions): Promise<IModel>;
383 /**
384 * Delete a file.
385 *
386 * @param localPath - The path to the file.
387 *
388 * @returns A promise which resolves when the file is deleted.
389 */
390 delete(localPath: string): Promise<void>;
391 /**
392 * Rename a file or directory.
393 *
394 * @param oldLocalPath - The original file path.
395 *
396 * @param newLocalPath - The new file path.
397 *
398 * @returns A promise which resolves with the new file content model when the
399 * file is renamed.
400 */
401 rename(oldLocalPath: string, newLocalPath: string): Promise<IModel>;
402 /**
403 * Save a file.
404 *
405 * @param localPath - The desired file path.
406 *
407 * @param options - Optional overrides to the model.
408 *
409 * @returns A promise which resolves with the file content model when the
410 * file is saved.
411 */
412 save(localPath: string, options?: Partial<IModel>): Promise<IModel>;
413 /**
414 * Copy a file into a given directory.
415 *
416 * @param localPath - The original file path.
417 *
418 * @param toLocalDir - The destination directory path.
419 *
420 * @returns A promise which resolves with the new content model when the
421 * file is copied.
422 */
423 copy(localPath: string, toLocalDir: string): Promise<IModel>;
424 /**
425 * Create a checkpoint for a file.
426 *
427 * @param localPath - The path of the file.
428 *
429 * @returns A promise which resolves with the new checkpoint model when the
430 * checkpoint is created.
431 */
432 createCheckpoint(localPath: string): Promise<ICheckpointModel>;
433 /**
434 * List available checkpoints for a file.
435 *
436 * @param localPath - The path of the file.
437 *
438 * @returns A promise which resolves with a list of checkpoint models for
439 * the file.
440 */
441 listCheckpoints(localPath: string): Promise<ICheckpointModel[]>;
442 /**
443 * Restore a file to a known checkpoint state.
444 *
445 * @param localPath - The path of the file.
446 *
447 * @param checkpointID - The id of the checkpoint to restore.
448 *
449 * @returns A promise which resolves when the checkpoint is restored.
450 */
451 restoreCheckpoint(localPath: string, checkpointID: string): Promise<void>;
452 /**
453 * Delete a checkpoint for a file.
454 *
455 * @param localPath - The path of the file.
456 *
457 * @param checkpointID - The id of the checkpoint to delete.
458 *
459 * @returns A promise which resolves when the checkpoint is deleted.
460 */
461 deleteCheckpoint(localPath: string, checkpointID: string): Promise<void>;
462 }
463}
464/**
465 * A contents manager that passes file operations to the server.
466 * Multiple servers implementing the `IDrive` interface can be
467 * attached to the contents manager, so that the same session can
468 * perform file operations on multiple backends.
469 *
470 * This includes checkpointing with the normal file operations.
471 */
472export declare class ContentsManager implements Contents.IManager {
473 /**
474 * Construct a new contents manager object.
475 *
476 * @param options - The options used to initialize the object.
477 */
478 constructor(options?: ContentsManager.IOptions);
479 /**
480 * The server settings associated with the manager.
481 */
482 readonly serverSettings: ServerConnection.ISettings;
483 /**
484 * A signal emitted when a file operation takes place.
485 */
486 get fileChanged(): ISignal<this, Contents.IChangedArgs>;
487 /**
488 * Test whether the manager has been disposed.
489 */
490 get isDisposed(): boolean;
491 /**
492 * Dispose of the resources held by the manager.
493 */
494 dispose(): void;
495 /**
496 * Add an `IDrive` to the manager.
497 */
498 addDrive(drive: Contents.IDrive): void;
499 /**
500 * Given a path, get a ModelDB.IFactory from the
501 * relevant backend. Returns `undefined` if the backend
502 * does not provide one.
503 */
504 getModelDBFactory(path: string): ModelDB.IFactory | null;
505 /**
506 * Given a path of the form `drive:local/portion/of/it.txt`
507 * get the local part of it.
508 *
509 * @param path: the path.
510 *
511 * @returns The local part of the path.
512 */
513 localPath(path: string): string;
514 /**
515 * Normalize a global path. Reduces '..' and '.' parts, and removes
516 * leading slashes from the local part of the path, while retaining
517 * the drive name if it exists.
518 *
519 * @param path: the path.
520 *
521 * @returns The normalized path.
522 */
523 normalize(path: string): string;
524 /**
525 * Resolve a global path, starting from the root path. Behaves like
526 * posix-path.resolve, with 3 differences:
527 * - will never prepend cwd
528 * - if root has a drive name, the result is prefixed with "<drive>:"
529 * - before adding drive name, leading slashes are removed
530 *
531 * @param path: the path.
532 *
533 * @returns The normalized path.
534 */
535 resolvePath(root: string, path: string): string;
536 /**
537 * Given a path of the form `drive:local/portion/of/it.txt`
538 * get the name of the drive. If the path is missing
539 * a drive portion, returns an empty string.
540 *
541 * @param path: the path.
542 *
543 * @returns The drive name for the path, or the empty string.
544 */
545 driveName(path: string): string;
546 /**
547 * Get a file or directory.
548 *
549 * @param path: The path to the file.
550 *
551 * @param options: The options used to fetch the file.
552 *
553 * @returns A promise which resolves with the file content.
554 */
555 get(path: string, options?: Contents.IFetchOptions): Promise<Contents.IModel>;
556 /**
557 * Get an encoded download url given a file path.
558 *
559 * @param path - An absolute POSIX file path on the server.
560 *
561 * #### Notes
562 * It is expected that the path contains no relative paths.
563 *
564 * The returned URL may include a query parameter.
565 */
566 getDownloadUrl(path: string): Promise<string>;
567 /**
568 * Create a new untitled file or directory in the specified directory path.
569 *
570 * @param options: The options used to create the file.
571 *
572 * @returns A promise which resolves with the created file content when the
573 * file is created.
574 */
575 newUntitled(options?: Contents.ICreateOptions): Promise<Contents.IModel>;
576 /**
577 * Delete a file.
578 *
579 * @param path - The path to the file.
580 *
581 * @returns A promise which resolves when the file is deleted.
582 */
583 delete(path: string): Promise<void>;
584 /**
585 * Rename a file or directory.
586 *
587 * @param path - The original file path.
588 *
589 * @param newPath - The new file path.
590 *
591 * @returns A promise which resolves with the new file contents model when
592 * the file is renamed.
593 */
594 rename(path: string, newPath: string): Promise<Contents.IModel>;
595 /**
596 * Save a file.
597 *
598 * @param path - The desired file path.
599 *
600 * @param options - Optional overrides to the model.
601 *
602 * @returns A promise which resolves with the file content model when the
603 * file is saved.
604 *
605 * #### Notes
606 * Ensure that `model.content` is populated for the file.
607 */
608 save(path: string, options?: Partial<Contents.IModel>): Promise<Contents.IModel>;
609 /**
610 * Copy a file into a given directory.
611 *
612 * @param path - The original file path.
613 *
614 * @param toDir - The destination directory path.
615 *
616 * @returns A promise which resolves with the new contents model when the
617 * file is copied.
618 *
619 * #### Notes
620 * The server will select the name of the copied file.
621 */
622 copy(fromFile: string, toDir: string): Promise<Contents.IModel>;
623 /**
624 * Create a checkpoint for a file.
625 *
626 * @param path - The path of the file.
627 *
628 * @returns A promise which resolves with the new checkpoint model when the
629 * checkpoint is created.
630 */
631 createCheckpoint(path: string): Promise<Contents.ICheckpointModel>;
632 /**
633 * List available checkpoints for a file.
634 *
635 * @param path - The path of the file.
636 *
637 * @returns A promise which resolves with a list of checkpoint models for
638 * the file.
639 */
640 listCheckpoints(path: string): Promise<Contents.ICheckpointModel[]>;
641 /**
642 * Restore a file to a known checkpoint state.
643 *
644 * @param path - The path of the file.
645 *
646 * @param checkpointID - The id of the checkpoint to restore.
647 *
648 * @returns A promise which resolves when the checkpoint is restored.
649 */
650 restoreCheckpoint(path: string, checkpointID: string): Promise<void>;
651 /**
652 * Delete a checkpoint for a file.
653 *
654 * @param path - The path of the file.
655 *
656 * @param checkpointID - The id of the checkpoint to delete.
657 *
658 * @returns A promise which resolves when the checkpoint is deleted.
659 */
660 deleteCheckpoint(path: string, checkpointID: string): Promise<void>;
661 /**
662 * Given a drive and a local path, construct a fully qualified
663 * path. The inverse of `_driveForPath`.
664 *
665 * @param drive: an `IDrive`.
666 *
667 * @param localPath: the local path on the drive.
668 *
669 * @returns the fully qualified path.
670 */
671 private _toGlobalPath;
672 /**
673 * Given a path, get the `IDrive to which it refers,
674 * where the path satisfies the pattern
675 * `'driveName:path/to/file'`. If there is no `driveName`
676 * prepended to the path, it returns the default drive.
677 *
678 * @param path: a path to a file.
679 *
680 * @returns A tuple containing an `IDrive` object for the path,
681 * and a local path for that drive.
682 */
683 private _driveForPath;
684 /**
685 * Respond to fileChanged signals from the drives attached to
686 * the manager. This prepends the drive name to the path if necessary,
687 * and then forwards the signal.
688 */
689 private _onFileChanged;
690 private _isDisposed;
691 private _additionalDrives;
692 private _defaultDrive;
693 private _fileChanged;
694}
695/**
696 * A default implementation for an `IDrive`, talking to the
697 * server using the Jupyter REST API.
698 */
699export declare class Drive implements Contents.IDrive {
700 /**
701 * Construct a new contents manager object.
702 *
703 * @param options - The options used to initialize the object.
704 */
705 constructor(options?: Drive.IOptions);
706 /**
707 * The name of the drive, which is used at the leading
708 * component of file paths.
709 */
710 readonly name: string;
711 /**
712 * A signal emitted when a file operation takes place.
713 */
714 get fileChanged(): ISignal<this, Contents.IChangedArgs>;
715 /**
716 * The server settings of the drive.
717 */
718 readonly serverSettings: ServerConnection.ISettings;
719 /**
720 * Test whether the manager has been disposed.
721 */
722 get isDisposed(): boolean;
723 /**
724 * Dispose of the resources held by the manager.
725 */
726 dispose(): void;
727 /**
728 * Get a file or directory.
729 *
730 * @param localPath: The path to the file.
731 *
732 * @param options: The options used to fetch the file.
733 *
734 * @returns A promise which resolves with the file content.
735 *
736 * Uses the [Jupyter Notebook API](http://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter/notebook/master/notebook/services/api/api.yaml#!/contents) and validates the response model.
737 */
738 get(localPath: string, options?: Contents.IFetchOptions): Promise<Contents.IModel>;
739 /**
740 * Get an encoded download url given a file path.
741 *
742 * @param localPath - An absolute POSIX file path on the server.
743 *
744 * #### Notes
745 * It is expected that the path contains no relative paths.
746 *
747 * The returned URL may include a query parameter.
748 */
749 getDownloadUrl(localPath: string): Promise<string>;
750 /**
751 * Create a new untitled file or directory in the specified directory path.
752 *
753 * @param options: The options used to create the file.
754 *
755 * @returns A promise which resolves with the created file content when the
756 * file is created.
757 *
758 * #### Notes
759 * Uses the [Jupyter Notebook API](http://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter/notebook/master/notebook/services/api/api.yaml#!/contents) and validates the response model.
760 */
761 newUntitled(options?: Contents.ICreateOptions): Promise<Contents.IModel>;
762 /**
763 * Delete a file.
764 *
765 * @param localPath - The path to the file.
766 *
767 * @returns A promise which resolves when the file is deleted.
768 *
769 * #### Notes
770 * Uses the [Jupyter Notebook API](http://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter/notebook/master/notebook/services/api/api.yaml#!/contents).
771 */
772 delete(localPath: string): Promise<void>;
773 /**
774 * Rename a file or directory.
775 *
776 * @param oldLocalPath - The original file path.
777 *
778 * @param newLocalPath - The new file path.
779 *
780 * @returns A promise which resolves with the new file contents model when
781 * the file is renamed.
782 *
783 * #### Notes
784 * Uses the [Jupyter Notebook API](http://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter/notebook/master/notebook/services/api/api.yaml#!/contents) and validates the response model.
785 */
786 rename(oldLocalPath: string, newLocalPath: string): Promise<Contents.IModel>;
787 /**
788 * Save a file.
789 *
790 * @param localPath - The desired file path.
791 *
792 * @param options - Optional overrides to the model.
793 *
794 * @returns A promise which resolves with the file content model when the
795 * file is saved.
796 *
797 * #### Notes
798 * Ensure that `model.content` is populated for the file.
799 *
800 * Uses the [Jupyter Notebook API](http://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter/notebook/master/notebook/services/api/api.yaml#!/contents) and validates the response model.
801 */
802 save(localPath: string, options?: Partial<Contents.IModel>): Promise<Contents.IModel>;
803 /**
804 * Copy a file into a given directory.
805 *
806 * @param localPath - The original file path.
807 *
808 * @param toDir - The destination directory path.
809 *
810 * @returns A promise which resolves with the new contents model when the
811 * file is copied.
812 *
813 * #### Notes
814 * The server will select the name of the copied file.
815 *
816 * Uses the [Jupyter Notebook API](http://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter/notebook/master/notebook/services/api/api.yaml#!/contents) and validates the response model.
817 */
818 copy(fromFile: string, toDir: string): Promise<Contents.IModel>;
819 /**
820 * Create a checkpoint for a file.
821 *
822 * @param localPath - The path of the file.
823 *
824 * @returns A promise which resolves with the new checkpoint model when the
825 * checkpoint is created.
826 *
827 * #### Notes
828 * Uses the [Jupyter Notebook API](http://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter/notebook/master/notebook/services/api/api.yaml#!/contents) and validates the response model.
829 */
830 createCheckpoint(localPath: string): Promise<Contents.ICheckpointModel>;
831 /**
832 * List available checkpoints for a file.
833 *
834 * @param localPath - The path of the file.
835 *
836 * @returns A promise which resolves with a list of checkpoint models for
837 * the file.
838 *
839 * #### Notes
840 * Uses the [Jupyter Notebook API](http://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter/notebook/master/notebook/services/api/api.yaml#!/contents) and validates the response model.
841 */
842 listCheckpoints(localPath: string): Promise<Contents.ICheckpointModel[]>;
843 /**
844 * Restore a file to a known checkpoint state.
845 *
846 * @param localPath - The path of the file.
847 *
848 * @param checkpointID - The id of the checkpoint to restore.
849 *
850 * @returns A promise which resolves when the checkpoint is restored.
851 *
852 * #### Notes
853 * Uses the [Jupyter Notebook API](http://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter/notebook/master/notebook/services/api/api.yaml#!/contents).
854 */
855 restoreCheckpoint(localPath: string, checkpointID: string): Promise<void>;
856 /**
857 * Delete a checkpoint for a file.
858 *
859 * @param localPath - The path of the file.
860 *
861 * @param checkpointID - The id of the checkpoint to delete.
862 *
863 * @returns A promise which resolves when the checkpoint is deleted.
864 *
865 * #### Notes
866 * Uses the [Jupyter Notebook API](http://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter/notebook/master/notebook/services/api/api.yaml#!/contents).
867 */
868 deleteCheckpoint(localPath: string, checkpointID: string): Promise<void>;
869 /**
870 * Get a REST url for a file given a path.
871 */
872 private _getUrl;
873 private _apiEndpoint;
874 private _isDisposed;
875 private _fileChanged;
876}
877/**
878 * A namespace for ContentsManager statics.
879 */
880export declare namespace ContentsManager {
881 /**
882 * The options used to initialize a contents manager.
883 */
884 interface IOptions {
885 /**
886 * The default drive backend for the contents manager.
887 */
888 defaultDrive?: Contents.IDrive;
889 /**
890 * The server settings associated with the manager.
891 */
892 serverSettings?: ServerConnection.ISettings;
893 }
894}
895/**
896 * A namespace for Drive statics.
897 */
898export declare namespace Drive {
899 /**
900 * The options used to initialize a `Drive`.
901 */
902 interface IOptions {
903 /**
904 * The name for the `Drive`, which is used in file
905 * paths to disambiguate it from other drives.
906 */
907 name?: string;
908 /**
909 * The server settings for the server.
910 */
911 serverSettings?: ServerConnection.ISettings;
912 /**
913 * A REST endpoint for drive requests.
914 * If not given, defaults to the Jupyter
915 * REST API given by [Jupyter Notebook API](http://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter/notebook/master/notebook/services/api/api.yaml#!/contents).
916 */
917 apiEndpoint?: string;
918 }
919}
920
\No newline at end of file