-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.d.ts
99 lines (89 loc) · 2.15 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
interface GlobalError {
err: boolean,
endpoint: string,
code: number,
is_admin?: boolean
error: string,
exists?: boolean
time: number
// Properties that *can* be returned but never will be in this situation
url?: never,
deletion_url?: never,
key?: never,
iterations?: never,
filename?: never,
method?: never,
old_name?: never,
new_name?: never,
filesize?: never,
uploaded_time?: never,
endpoints?: never,
keyspace?: never,
name_length?: never,
allowed_extensions?: never,
allowed_characters?: never,
custom_names?: never,
files_count?: never,
files?: never
}
interface Response {
err: boolean,
api_version: string,
endpoint: string,
code: number,
time: number
}
interface UploadResponse extends Response {
url: string,
deletion_url: string,
key: string,
iterations: number,
}
interface DeletionResponse extends Response {
filename: string,
method: string
}
interface RenameResponse extends Response {
old_name: string,
new_name: string,
url: string,
deletion_url: string,
key: string,
iterations: number
}
interface InfoResponse extends Response {
is_admin: boolean,
filename: string,
filesize: number,
url: string,
deletion_url: string,
key: string,
exists: number,
uploaded_time: number
}
interface GlobalInfoResponse extends Response {
is_admin: boolean,
endpoints: string[],
keyspace: string,
name_length: number,
allowed_extensions: string[],
allowed_characters: string[],
custom_names: boolean,
files_count: number,
files: string[]
}
export default class ShareXenJS {
token: string;
dest: string;
login(dest: string, token: string): void;
upload(): GlobalError;
upload(file: string | Buffer): UploadResponse;
delete(): GlobalError
delete(file: string): DeletionResponse;
rename(): GlobalError;
rename(file: String): GlobalError;
rename(newfilename: String): GlobalError;
rename(file: string, newfilename: string): RenameResponse;
info(): GlobalInfoResponse
info(file: string): InfoResponse
}