UNPKG

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