UNPKG

3.13 kBTypeScriptView Raw
1/// <reference types="node" />
2import Client from "./client";
3import File from "./file";
4import FileSystemElement from "./fileSystemElement";
5export default class Folder implements FileSystemElement {
6 private client;
7 private memento;
8 constructor(client: Client, name: string, baseName: string, lastmod: string, id?: number);
9 get name(): string;
10 get baseName(): string;
11 get lastmod(): Date;
12 get id(): number;
13 /**
14 * @returns an array of subfolders
15 * @throws Error
16 */
17 getSubFolders(): Promise<Folder[]>;
18 /**
19 * returns true if the current folder has a subfolder with the given base name
20 * @param subFolderBaseName the base name of the subfolder like "products"
21 */
22 hasSubFolder(subFolderBaseName: string): Promise<boolean>;
23 /**
24 * @returns all files of the folder
25 */
26 getFiles(): Promise<File[]>;
27 /**
28 * creates a subfolder
29 * @param subFolderBaseName name of the subfolder basename
30 */
31 createSubFolder(subFolderBaseName: string): Promise<Folder>;
32 /**
33 * get a file by basename
34 * @param fileBaseName the base name of the file
35 * @returns the file of null
36 * @throws Error
37 */
38 getFile(fileBaseName: string): Promise<File | null>;
39 /**
40 * creates a file in the folder
41 * @param fileBaseName the base name of the file
42 * @param data the buffer with file content
43 * @returns the new file or null
44 * @throws Error
45 */
46 createFile(fileBaseName: string, data: Buffer): Promise<File>;
47 /**
48 * deletes the folder and the contained files
49 * @throws Error
50 */
51 delete(): Promise<void>;
52 /**
53 * renames or moves the current folder to the new location
54 * target folder must exists
55 * @param targetFolderName the name of the target folder /f1/f2/target
56 * @throws Error
57 */
58 move(targetFolderName: string): Promise<Folder>;
59 /**
60 * @returns the url of the folder
61 * @throws Error
62 */
63 getUrl(): string;
64 /**
65 * @returns the url of the folder in the UI
66 * @throws Error
67 */
68 getUIUrl(): string;
69 /**
70 * @returns true if the folder contains a file with the given basename
71 * @param fileBaseName file basename
72 * @throws Error
73 */
74 containsFile(fileBaseName: string): Promise<boolean>;
75 /**
76 * adds a tag name to the folder
77 * @param tagName name of the tag
78 */
79 addTag(tagName: string): Promise<void>;
80 /**
81 * get tag names
82 * @returns array of tag names
83 */
84 getTags(): Promise<string[]>;
85 /**
86 * removes a tag of the file
87 * @param tagName the name of the tag
88 */
89 removeTag(tagName: string): Promise<void>;
90 /**
91 * add comment to folder
92 * @param comment the comment
93 */
94 addComment(comment: string): Promise<void>;
95 /**
96 * get list of comments of folder
97 * @param top number of comments to return
98 * @param skip the offset
99 * @returns array of comment strings
100 * @throws Exception
101 */
102 getComments(top?: number, skip?: number): Promise<string[]>;
103 private assertExistence;
104}