@fett/synology-api 0.0.2-beta.2 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/core.d.ts +23 -1
- package/lib/core.js +53 -20
- package/lib/errorcodes.d.ts +21 -4
- package/lib/errorcodes.js +27 -6
- package/lib/helpers.js +5 -8
- package/lib/modules/Api/Auth.js +13 -8
- package/lib/modules/Api/Info.js +4 -4
- package/lib/modules/AudioStation/Album.d.ts +17 -0
- package/lib/modules/AudioStation/Album.js +17 -0
- package/lib/modules/AudioStation/Artist.d.ts +16 -0
- package/lib/modules/AudioStation/Artist.js +16 -0
- package/lib/modules/AudioStation/Folder.d.ts +14 -0
- package/lib/modules/AudioStation/Folder.js +14 -0
- package/lib/modules/AudioStation/index.d.ts +4 -0
- package/lib/modules/AudioStation/index.js +6 -0
- package/lib/modules/Auth/AuthKey.js +2 -2
- package/lib/modules/Auth/Encryption.d.ts +8 -0
- package/lib/modules/Auth/Encryption.js +10 -0
- package/lib/modules/Auth/index.d.ts +2 -0
- package/lib/modules/Auth/index.js +3 -1
- package/lib/modules/Core/System.d.ts +159 -0
- package/lib/modules/Core/System.js +42 -0
- package/lib/modules/Core/User.d.ts +51 -0
- package/lib/modules/Core/User.js +33 -0
- package/lib/modules/Core/index.d.ts +14 -0
- package/lib/modules/Core/index.js +15 -0
- package/lib/modules/Docker/Container.d.ts +43 -0
- package/lib/modules/Docker/Container.js +13 -0
- package/lib/modules/Docker/Network.d.ts +0 -0
- package/lib/modules/Docker/Network.js +0 -0
- package/lib/modules/Docker/Project.d.ts +0 -0
- package/lib/modules/Docker/Project.js +0 -0
- package/lib/modules/Docker/Registry.d.ts +0 -0
- package/lib/modules/Docker/Registry.js +0 -0
- package/lib/modules/Docker/index.d.ts +7 -0
- package/lib/modules/Docker/index.js +8 -0
- package/lib/modules/FileStation/BackgroundTask.d.ts +50 -0
- package/lib/modules/FileStation/BackgroundTask.js +22 -0
- package/lib/modules/FileStation/CheckPermission.d.ts +10 -0
- package/lib/modules/FileStation/CheckPermission.js +13 -0
- package/lib/modules/FileStation/CopyMove.d.ts +33 -0
- package/lib/modules/FileStation/CopyMove.js +28 -0
- package/lib/modules/FileStation/CreateFolder.d.ts +15 -0
- package/lib/modules/FileStation/CreateFolder.js +12 -0
- package/lib/modules/FileStation/Delete.d.ts +54 -0
- package/lib/modules/FileStation/Delete.js +35 -0
- package/lib/modules/FileStation/DirSize.d.ts +20 -0
- package/lib/modules/FileStation/DirSize.js +28 -0
- package/lib/modules/FileStation/Download.d.ts +7 -0
- package/lib/modules/FileStation/Download.js +19 -0
- package/lib/modules/FileStation/Extract.d.ts +1 -0
- package/lib/modules/FileStation/Extract.js +1 -0
- package/lib/modules/FileStation/Favorite.d.ts +45 -0
- package/lib/modules/FileStation/Favorite.js +60 -0
- package/lib/modules/FileStation/List.d.ts +39 -11
- package/lib/modules/FileStation/List.js +14 -6
- package/lib/modules/FileStation/MD5.d.ts +15 -0
- package/lib/modules/FileStation/MD5.js +29 -0
- package/lib/modules/FileStation/Rename.d.ts +38 -0
- package/lib/modules/FileStation/Rename.js +14 -0
- package/lib/modules/FileStation/Search.d.ts +40 -0
- package/lib/modules/FileStation/Search.js +49 -0
- package/lib/modules/FileStation/Sharing.d.ts +69 -0
- package/lib/modules/FileStation/Sharing.js +64 -0
- package/lib/modules/FileStation/Thumb.d.ts +18 -0
- package/lib/modules/FileStation/Thumb.js +18 -0
- package/lib/modules/FileStation/Upload.d.ts +21 -0
- package/lib/modules/FileStation/Upload.js +44 -0
- package/lib/modules/FileStation/index.d.ts +52 -2
- package/lib/modules/FileStation/index.js +53 -3
- package/lib/modules/VideoStation/Library.d.ts +4 -5
- package/lib/modules/VideoStation/Streaming.d.ts +5 -6
- package/lib/modules/VideoStation/Streaming.js +39 -13
- package/lib/modules/VideoStation/index.js +1 -1
- package/lib/modules/index.d.ts +12 -10
- package/lib/modules/index.js +13 -12
- package/lib/types/apiInfo.d.ts +55 -4
- package/lib/types/apiInfo.js +62 -9
- package/lib/{utils.js → utils/common.js} +1 -1
- package/lib/utils/encryption.d.ts +12 -0
- package/lib/utils/encryption.js +38 -0
- package/lib/utils/env.d.ts +2 -0
- package/lib/utils/env.js +2 -0
- package/lib/utils/formData.d.ts +2 -0
- package/lib/utils/formData.js +19 -0
- package/lib/utils/index.d.ts +4 -0
- package/lib/utils/index.js +4 -0
- package/package.json +7 -2
- package/lib/modules/VideoStation/HomeVideo.d.ts +0 -6
- package/lib/modules/VideoStation/HomeVideo.js +0 -10
- /package/lib/modules/{FileStation/File.d.ts → Docker/Image.d.ts} +0 -0
- /package/lib/modules/{FileStation/File.js → Docker/Image.js} +0 -0
- /package/lib/{utils.d.ts → utils/common.d.ts} +0 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { SynologyApiResponse } from "../../types/index.js";
|
|
2
|
+
export type SystemStatusResponse = SynologyApiResponse<{
|
|
3
|
+
is_system_crashed: boolean;
|
|
4
|
+
upgrade_ready: boolean;
|
|
5
|
+
}>;
|
|
6
|
+
export declare function getSystemStatus(): Promise<SystemStatusResponse>;
|
|
7
|
+
export type SystemInfoResponse = SynologyApiResponse<{
|
|
8
|
+
cpu_clock_speed: number;
|
|
9
|
+
cpu_cores: string;
|
|
10
|
+
cpu_family: string;
|
|
11
|
+
cpu_series: string;
|
|
12
|
+
cpu_vendor: string;
|
|
13
|
+
enabled_ntp: boolean;
|
|
14
|
+
external_pci_slot_info: Array<any>;
|
|
15
|
+
firmware_date: string;
|
|
16
|
+
firmware_ver: string;
|
|
17
|
+
model: string;
|
|
18
|
+
ntp_server: string;
|
|
19
|
+
ram_size: number;
|
|
20
|
+
sata_dev: Array<any>;
|
|
21
|
+
serial: string;
|
|
22
|
+
support_esata: string;
|
|
23
|
+
sys_temp: number;
|
|
24
|
+
sys_tempwarn: boolean;
|
|
25
|
+
systempwarn: boolean;
|
|
26
|
+
temperature_warning: boolean;
|
|
27
|
+
time: string;
|
|
28
|
+
time_zone: string;
|
|
29
|
+
time_zone_desc: string;
|
|
30
|
+
up_time: string;
|
|
31
|
+
usb_dev: Array<any>;
|
|
32
|
+
}>;
|
|
33
|
+
export declare function getSystemInfo(): Promise<SystemInfoResponse>;
|
|
34
|
+
export type SystemStorageInfoResponse = SynologyApiResponse<{
|
|
35
|
+
hdd_info: Array<{
|
|
36
|
+
capacity: string;
|
|
37
|
+
diskPath: string;
|
|
38
|
+
diskType: string;
|
|
39
|
+
diskno: string;
|
|
40
|
+
ebox_order: number;
|
|
41
|
+
model: string;
|
|
42
|
+
order: number;
|
|
43
|
+
overview_status: string;
|
|
44
|
+
pciSlot: number;
|
|
45
|
+
portType: string;
|
|
46
|
+
status: string;
|
|
47
|
+
summary_status_category: string;
|
|
48
|
+
summary_status_key: string;
|
|
49
|
+
temp: number;
|
|
50
|
+
testing_progress: string;
|
|
51
|
+
testing_type: string;
|
|
52
|
+
volume: string;
|
|
53
|
+
}>;
|
|
54
|
+
vol_info: Array<{
|
|
55
|
+
desc: string;
|
|
56
|
+
inode_free: string;
|
|
57
|
+
inode_total: string;
|
|
58
|
+
name: string;
|
|
59
|
+
status: string;
|
|
60
|
+
total_size: string;
|
|
61
|
+
used_size: string;
|
|
62
|
+
vol_desc: string;
|
|
63
|
+
volume: string;
|
|
64
|
+
}>;
|
|
65
|
+
}>;
|
|
66
|
+
export declare function getSystemStorageInfo(): Promise<SystemStorageInfoResponse>;
|
|
67
|
+
export type SystemHealthResponse = SynologyApiResponse<{
|
|
68
|
+
hostname: string;
|
|
69
|
+
interfaces: Array<{
|
|
70
|
+
id: string;
|
|
71
|
+
ip: string;
|
|
72
|
+
type: string;
|
|
73
|
+
}>;
|
|
74
|
+
rule: {
|
|
75
|
+
description: {
|
|
76
|
+
description_format: string;
|
|
77
|
+
description_params: Array<string>;
|
|
78
|
+
description_use_formatted: boolean;
|
|
79
|
+
};
|
|
80
|
+
id: string;
|
|
81
|
+
priority: number;
|
|
82
|
+
type: number;
|
|
83
|
+
};
|
|
84
|
+
uptime: string;
|
|
85
|
+
}>;
|
|
86
|
+
export declare function getSystemHealth(): Promise<SystemHealthResponse>;
|
|
87
|
+
export type CoreSystemUtilizationResponse = SynologyApiResponse<{
|
|
88
|
+
cpu: {
|
|
89
|
+
"15min_load": number;
|
|
90
|
+
"1min_load": number;
|
|
91
|
+
"5min_load": number;
|
|
92
|
+
device: string;
|
|
93
|
+
other_load: number;
|
|
94
|
+
system_load: number;
|
|
95
|
+
user_load: number;
|
|
96
|
+
};
|
|
97
|
+
disk: {
|
|
98
|
+
disk: Array<{
|
|
99
|
+
device: string;
|
|
100
|
+
display_name: string;
|
|
101
|
+
read_access: number;
|
|
102
|
+
read_byte: number;
|
|
103
|
+
type: string;
|
|
104
|
+
utilization: number;
|
|
105
|
+
write_access: number;
|
|
106
|
+
write_byte: number;
|
|
107
|
+
}>;
|
|
108
|
+
total: {
|
|
109
|
+
device: string;
|
|
110
|
+
read_access: number;
|
|
111
|
+
read_byte: number;
|
|
112
|
+
utilization: number;
|
|
113
|
+
write_access: number;
|
|
114
|
+
write_byte: number;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
lun: Array<any>;
|
|
118
|
+
memory: {
|
|
119
|
+
avail_real: number;
|
|
120
|
+
avail_swap: number;
|
|
121
|
+
buffer: number;
|
|
122
|
+
cached: number;
|
|
123
|
+
device: string;
|
|
124
|
+
memory_size: number;
|
|
125
|
+
real_usage: number;
|
|
126
|
+
si_disk: number;
|
|
127
|
+
so_disk: number;
|
|
128
|
+
swap_usage: number;
|
|
129
|
+
total_real: number;
|
|
130
|
+
total_swap: number;
|
|
131
|
+
};
|
|
132
|
+
network: Array<{
|
|
133
|
+
device: string;
|
|
134
|
+
rx: number;
|
|
135
|
+
tx: number;
|
|
136
|
+
}>;
|
|
137
|
+
nfs: Array<any>;
|
|
138
|
+
space: {
|
|
139
|
+
total: {
|
|
140
|
+
device: string;
|
|
141
|
+
read_access: number;
|
|
142
|
+
read_byte: number;
|
|
143
|
+
utilization: number;
|
|
144
|
+
write_access: number;
|
|
145
|
+
write_byte: number;
|
|
146
|
+
};
|
|
147
|
+
volume: Array<{
|
|
148
|
+
device: string;
|
|
149
|
+
display_name: string;
|
|
150
|
+
read_access: number;
|
|
151
|
+
read_byte: number;
|
|
152
|
+
utilization: number;
|
|
153
|
+
write_access: number;
|
|
154
|
+
write_byte: number;
|
|
155
|
+
}>;
|
|
156
|
+
};
|
|
157
|
+
time: number;
|
|
158
|
+
}>;
|
|
159
|
+
export declare function getSystemUtilization(): Promise<CoreSystemUtilizationResponse>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { CoreApi } from "../../types/index.js";
|
|
2
|
+
export async function getSystemStatus() {
|
|
3
|
+
const res = await this.run(CoreApi.SystemStatus, {
|
|
4
|
+
params: {
|
|
5
|
+
method: "get",
|
|
6
|
+
},
|
|
7
|
+
});
|
|
8
|
+
return res;
|
|
9
|
+
}
|
|
10
|
+
export async function getSystemInfo() {
|
|
11
|
+
const res = await this.run(CoreApi.System, {
|
|
12
|
+
params: {
|
|
13
|
+
method: "info",
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
return res;
|
|
17
|
+
}
|
|
18
|
+
export async function getSystemStorageInfo() {
|
|
19
|
+
const res = await this.run(CoreApi.System, {
|
|
20
|
+
params: {
|
|
21
|
+
method: "info",
|
|
22
|
+
type: "storage",
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
return res;
|
|
26
|
+
}
|
|
27
|
+
export async function getSystemHealth() {
|
|
28
|
+
const res = await this.run(CoreApi.SystemHealth, {
|
|
29
|
+
params: {
|
|
30
|
+
method: "get",
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
return res;
|
|
34
|
+
}
|
|
35
|
+
export async function getSystemUtilization() {
|
|
36
|
+
const res = await this.run(CoreApi.SystemUtilization, {
|
|
37
|
+
params: {
|
|
38
|
+
method: "get",
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
return res;
|
|
42
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { SynologyApiResponse } from "../../types/index.js";
|
|
2
|
+
export type UserListParams = {
|
|
3
|
+
offset?: number;
|
|
4
|
+
limit?: number;
|
|
5
|
+
sort_by?: string;
|
|
6
|
+
sort_direction?: "ASC" | "DESC";
|
|
7
|
+
additional?: Array<"description" | "email" | "expired" | "cannot_chg_passwd" | "passwd_never_expire" | "password_last_change" | "groups" | "2fa_status">;
|
|
8
|
+
};
|
|
9
|
+
export type UserListResponse = SynologyApiResponse<{
|
|
10
|
+
offset: number;
|
|
11
|
+
total: number;
|
|
12
|
+
users: Array<{
|
|
13
|
+
description: string;
|
|
14
|
+
email: string;
|
|
15
|
+
expired: string;
|
|
16
|
+
name: string;
|
|
17
|
+
passwd_never_expire: boolean;
|
|
18
|
+
}>;
|
|
19
|
+
}>;
|
|
20
|
+
export declare function getUserList(params?: UserListParams): Promise<UserListResponse>;
|
|
21
|
+
export type UserInfoParams = {
|
|
22
|
+
name: string;
|
|
23
|
+
additional?: Array<"description" | "email" | "expired" | "cannot_chg_passwd" | "passwd_never_expire" | "password_last_change">;
|
|
24
|
+
};
|
|
25
|
+
export type UserInfoResponse = SynologyApiResponse<{
|
|
26
|
+
offset: number;
|
|
27
|
+
total: number;
|
|
28
|
+
users: Array<{
|
|
29
|
+
description: string;
|
|
30
|
+
email: string;
|
|
31
|
+
expired: string;
|
|
32
|
+
name: string;
|
|
33
|
+
passwd_never_expire: boolean;
|
|
34
|
+
}>;
|
|
35
|
+
}>;
|
|
36
|
+
export declare function getUserInfo(params: UserInfoParams): Promise<UserInfoResponse>;
|
|
37
|
+
export type CreateUserParams = {
|
|
38
|
+
name: string;
|
|
39
|
+
description: string;
|
|
40
|
+
email: string;
|
|
41
|
+
expired?: string;
|
|
42
|
+
cannot_chg_passwd?: boolean;
|
|
43
|
+
passwd_never_expire?: boolean;
|
|
44
|
+
notify_by_email?: boolean;
|
|
45
|
+
send_password?: boolean;
|
|
46
|
+
};
|
|
47
|
+
export type CreateUserResponse = SynologyApiResponse<{
|
|
48
|
+
uid: number;
|
|
49
|
+
name: string;
|
|
50
|
+
}>;
|
|
51
|
+
export declare function createUser(params: CreateUserParams): Promise<CreateUserResponse>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { CoreApi } from "../../types/index.js";
|
|
2
|
+
export async function getUserList(params) {
|
|
3
|
+
const { additional = ["email", "description", "expired"] } = params || {};
|
|
4
|
+
const res = await this.run(CoreApi.User, {
|
|
5
|
+
params: {
|
|
6
|
+
...params,
|
|
7
|
+
method: "list",
|
|
8
|
+
additional: JSON.stringify(additional),
|
|
9
|
+
},
|
|
10
|
+
});
|
|
11
|
+
return res;
|
|
12
|
+
}
|
|
13
|
+
export async function getUserInfo(params) {
|
|
14
|
+
const { additional = [] } = params;
|
|
15
|
+
const res = await this.run(CoreApi.User, {
|
|
16
|
+
params: {
|
|
17
|
+
...params,
|
|
18
|
+
method: "get",
|
|
19
|
+
type: "local",
|
|
20
|
+
additional: JSON.stringify(additional),
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
return res;
|
|
24
|
+
}
|
|
25
|
+
export async function createUser(params) {
|
|
26
|
+
const res = await this.run(CoreApi.User, {
|
|
27
|
+
params: {
|
|
28
|
+
method: "create",
|
|
29
|
+
...params,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
return res;
|
|
33
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { getSystemStatus, getSystemInfo, getSystemStorageInfo, getSystemHealth, getSystemUtilization } from "./System.js";
|
|
2
|
+
import { getUserList, getUserInfo } from "./User.js";
|
|
3
|
+
export declare const METHODS: {
|
|
4
|
+
getSystemStorageInfo: typeof getSystemStorageInfo;
|
|
5
|
+
getSystemHealth: typeof getSystemHealth;
|
|
6
|
+
getSystemUtilization: typeof getSystemUtilization;
|
|
7
|
+
getSystemInfo: typeof getSystemInfo;
|
|
8
|
+
getSystemStatus: typeof getSystemStatus;
|
|
9
|
+
getUserList: typeof getUserList;
|
|
10
|
+
getUserInfo: typeof getUserInfo;
|
|
11
|
+
};
|
|
12
|
+
export declare const KEY = "Core";
|
|
13
|
+
export declare const ALIAS_KEY = "co";
|
|
14
|
+
export type TMethods = typeof METHODS;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { getSystemStatus, getSystemInfo, getSystemStorageInfo, getSystemHealth, getSystemUtilization, } from "./System.js";
|
|
2
|
+
import { getUserList, getUserInfo } from "./User.js";
|
|
3
|
+
// methods
|
|
4
|
+
export const METHODS = {
|
|
5
|
+
getSystemStorageInfo,
|
|
6
|
+
getSystemHealth,
|
|
7
|
+
getSystemUtilization,
|
|
8
|
+
getSystemInfo,
|
|
9
|
+
getSystemStatus,
|
|
10
|
+
getUserList,
|
|
11
|
+
getUserInfo,
|
|
12
|
+
};
|
|
13
|
+
// name space
|
|
14
|
+
export const KEY = "Core";
|
|
15
|
+
export const ALIAS_KEY = "co";
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { SynologyApiResponse } from "../../types/index.js";
|
|
2
|
+
export type DockerContainerListParams = {
|
|
3
|
+
type: string;
|
|
4
|
+
limit: number;
|
|
5
|
+
offset: number;
|
|
6
|
+
};
|
|
7
|
+
export type DockerContainerListResponse = SynologyApiResponse<{
|
|
8
|
+
containers: Array<{
|
|
9
|
+
State: {
|
|
10
|
+
Dead: boolean;
|
|
11
|
+
Error: string;
|
|
12
|
+
ExitCode: number;
|
|
13
|
+
FinishedAt: string;
|
|
14
|
+
FinishedTs: number;
|
|
15
|
+
OOMKilled: boolean;
|
|
16
|
+
Paused: boolean;
|
|
17
|
+
Pid: number;
|
|
18
|
+
Restarting: boolean;
|
|
19
|
+
Running: boolean;
|
|
20
|
+
StartedAt: string;
|
|
21
|
+
StartedTs: number;
|
|
22
|
+
Status: string;
|
|
23
|
+
};
|
|
24
|
+
cmd: string;
|
|
25
|
+
created: number;
|
|
26
|
+
enable_service_portal: boolean;
|
|
27
|
+
exporting: boolean;
|
|
28
|
+
finish_time: number;
|
|
29
|
+
id: string;
|
|
30
|
+
image: string;
|
|
31
|
+
is_ddsm: boolean;
|
|
32
|
+
is_package: boolean;
|
|
33
|
+
name: string;
|
|
34
|
+
services: any;
|
|
35
|
+
status: string;
|
|
36
|
+
up_status: string;
|
|
37
|
+
up_time: number;
|
|
38
|
+
}>;
|
|
39
|
+
limit: number;
|
|
40
|
+
offset: number;
|
|
41
|
+
total: number;
|
|
42
|
+
}>;
|
|
43
|
+
export declare function getContainerList(params?: DockerContainerListParams): Promise<DockerContainerListResponse>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DockerApi } from "../../types/index.js";
|
|
2
|
+
export async function getContainerList(params) {
|
|
3
|
+
const { type = "all", limit = -1, offset = 0 } = params || {};
|
|
4
|
+
const res = await this.run(DockerApi.Container, {
|
|
5
|
+
params: {
|
|
6
|
+
method: "list",
|
|
7
|
+
type,
|
|
8
|
+
limit,
|
|
9
|
+
offset,
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
return res;
|
|
13
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { SynologyApiResponse } from "../../types/index.js";
|
|
2
|
+
export type BackgroundTaskListParams = {
|
|
3
|
+
limit?: number;
|
|
4
|
+
offset?: number;
|
|
5
|
+
sort_by?: string;
|
|
6
|
+
sort_direction?: "ASC" | "DESC";
|
|
7
|
+
api_filter?: string[];
|
|
8
|
+
};
|
|
9
|
+
export type BackgroundTask = {
|
|
10
|
+
api: string;
|
|
11
|
+
crtime: number;
|
|
12
|
+
finished: boolean;
|
|
13
|
+
method: string;
|
|
14
|
+
params: {
|
|
15
|
+
accurate_progress: boolean;
|
|
16
|
+
dest_folder_path: string;
|
|
17
|
+
overwrite: boolean;
|
|
18
|
+
path: Array<string>;
|
|
19
|
+
remove_src: boolean;
|
|
20
|
+
};
|
|
21
|
+
path: string;
|
|
22
|
+
processed_size: number;
|
|
23
|
+
processing_path: string;
|
|
24
|
+
progress: number;
|
|
25
|
+
taskid: string;
|
|
26
|
+
total: number;
|
|
27
|
+
version: number;
|
|
28
|
+
};
|
|
29
|
+
export type BackgroundTaskListResponse = SynologyApiResponse<{
|
|
30
|
+
offset: number;
|
|
31
|
+
total: number;
|
|
32
|
+
tasks: Array<BackgroundTask>;
|
|
33
|
+
}>;
|
|
34
|
+
/**
|
|
35
|
+
* get background task list
|
|
36
|
+
*/
|
|
37
|
+
export declare function getBackgroundTaskList(params?: BackgroundTaskListParams): Promise<BackgroundTaskListResponse>;
|
|
38
|
+
/**
|
|
39
|
+
* Delete all finished background tasks.
|
|
40
|
+
*/
|
|
41
|
+
export type ClearFinishedBackgroundTaskParams = {
|
|
42
|
+
/**
|
|
43
|
+
* Unique IDs of finished copy, move, delete,
|
|
44
|
+
* compress or extract tasks. Specify multiple task
|
|
45
|
+
* IDs by "," and around brackets. If it's not given, all
|
|
46
|
+
* finished tasks are deleted.
|
|
47
|
+
*/
|
|
48
|
+
taskid?: string;
|
|
49
|
+
};
|
|
50
|
+
export declare function clearFinishedBackgroundTasks(params?: ClearFinishedBackgroundTaskParams): Promise<SynologyApiResponse<any>>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FileStationApi } from "../../types/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* get background task list
|
|
4
|
+
*/
|
|
5
|
+
export async function getBackgroundTaskList(params) {
|
|
6
|
+
const res = await this.run(FileStationApi.BackgroundTask, {
|
|
7
|
+
params: {
|
|
8
|
+
method: "list",
|
|
9
|
+
...(params ?? {}),
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
return res;
|
|
13
|
+
}
|
|
14
|
+
export async function clearFinishedBackgroundTasks(params) {
|
|
15
|
+
const res = await this.run(FileStationApi.BackgroundTask, {
|
|
16
|
+
params: {
|
|
17
|
+
method: "clear_finished",
|
|
18
|
+
...params,
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
return res;
|
|
22
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SynologyApiResponse } from "../../types/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Check if a logged-in user has write permission to create new files/folders in a given folder.
|
|
4
|
+
*/
|
|
5
|
+
export declare function checkPermission(params: {
|
|
6
|
+
path: string;
|
|
7
|
+
filename: string;
|
|
8
|
+
overwrite: boolean;
|
|
9
|
+
create_only: boolean;
|
|
10
|
+
}): Promise<SynologyApiResponse<any>>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FileStationApi } from "../../types/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Check if a logged-in user has write permission to create new files/folders in a given folder.
|
|
4
|
+
*/
|
|
5
|
+
export async function checkPermission(params) {
|
|
6
|
+
const res = await this.run(FileStationApi.CheckPermission, {
|
|
7
|
+
params: {
|
|
8
|
+
method: "write",
|
|
9
|
+
...params,
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
return res;
|
|
13
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { SynologyApiResponse } from "../../types/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Copy/move file(s)/folder(s).
|
|
4
|
+
* This is a non-blocking API. You need to start to copy/move files with start method. Then, you should poll
|
|
5
|
+
* requests with status method to get the progress status, or make a request with stop method to cancel the
|
|
6
|
+
* operation
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
export type CopyMoveParams = {
|
|
10
|
+
path: string;
|
|
11
|
+
dest_folder_path: string;
|
|
12
|
+
overwrite?: boolean;
|
|
13
|
+
remove_src?: boolean;
|
|
14
|
+
search_taskid?: string;
|
|
15
|
+
accurate_progress?: boolean;
|
|
16
|
+
};
|
|
17
|
+
export declare function startCopyMove(params: CopyMoveParams): Promise<SynologyApiResponse<{
|
|
18
|
+
taskid: string;
|
|
19
|
+
}>>;
|
|
20
|
+
export type CopyMoveStatusResponse = SynologyApiResponse<{
|
|
21
|
+
finished: boolean;
|
|
22
|
+
path: string;
|
|
23
|
+
processed_size: number;
|
|
24
|
+
progress: number;
|
|
25
|
+
total: number;
|
|
26
|
+
dest_folder_path: string;
|
|
27
|
+
}>;
|
|
28
|
+
export declare function getCopyMoveStatus(params: {
|
|
29
|
+
taskid: string;
|
|
30
|
+
}): Promise<CopyMoveStatusResponse>;
|
|
31
|
+
export declare function stopCopyMove(params: {
|
|
32
|
+
taskid: string;
|
|
33
|
+
}): Promise<SynologyApiResponse<any>>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { FileStationApi } from "../../types/index.js";
|
|
2
|
+
export async function startCopyMove(params) {
|
|
3
|
+
const res = await this.run(FileStationApi.CopyMove, {
|
|
4
|
+
params: {
|
|
5
|
+
method: "start",
|
|
6
|
+
...params,
|
|
7
|
+
},
|
|
8
|
+
});
|
|
9
|
+
return res;
|
|
10
|
+
}
|
|
11
|
+
export async function getCopyMoveStatus(params) {
|
|
12
|
+
const res = await this.run(FileStationApi.CopyMove, {
|
|
13
|
+
params: {
|
|
14
|
+
method: "status",
|
|
15
|
+
taskid: params.taskid,
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
return res;
|
|
19
|
+
}
|
|
20
|
+
export async function stopCopyMove(params) {
|
|
21
|
+
const res = await this.run(FileStationApi.CopyMove, {
|
|
22
|
+
params: {
|
|
23
|
+
method: "stop",
|
|
24
|
+
taskid: params.taskid,
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
return res;
|
|
28
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SynologyApiResponse } from "../../types/index.js";
|
|
2
|
+
export type CreateFolderParams = {
|
|
3
|
+
folder_path: string;
|
|
4
|
+
name: string;
|
|
5
|
+
force_parent?: boolean;
|
|
6
|
+
additional: Array<"real_path" | "size" | "owner" | "time" | "perm" | "type">;
|
|
7
|
+
};
|
|
8
|
+
export type CreateFolderResponse = SynologyApiResponse<{
|
|
9
|
+
folders: Array<{
|
|
10
|
+
isdir: boolean;
|
|
11
|
+
name: string;
|
|
12
|
+
path: string;
|
|
13
|
+
}>;
|
|
14
|
+
}>;
|
|
15
|
+
export declare function createFolder(params: CreateFolderParams): Promise<CreateFolderResponse>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FileStationApi } from "../../types/index.js";
|
|
2
|
+
export async function createFolder(params) {
|
|
3
|
+
const { additional = [] } = params;
|
|
4
|
+
const res = await this.run(FileStationApi.CreateFolder, {
|
|
5
|
+
params: {
|
|
6
|
+
method: "create",
|
|
7
|
+
...params,
|
|
8
|
+
additional: JSON.stringify(additional),
|
|
9
|
+
},
|
|
10
|
+
});
|
|
11
|
+
return res;
|
|
12
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { SynologyApiResponse } from "../../types/index.js";
|
|
2
|
+
export type DeleteFileParams = {
|
|
3
|
+
/**
|
|
4
|
+
* One or more copied/moved
|
|
5
|
+
file/folder path(s) starting with a
|
|
6
|
+
shared folder, separated by
|
|
7
|
+
commas "," and around brackets.
|
|
8
|
+
*/
|
|
9
|
+
path: string | string[];
|
|
10
|
+
/**
|
|
11
|
+
* true : calculate the
|
|
12
|
+
progress by each moved/copied file
|
|
13
|
+
within sub-folder. false : calculate
|
|
14
|
+
the progress by files which you give
|
|
15
|
+
in path parameters. This calculates
|
|
16
|
+
the progr
|
|
17
|
+
*/
|
|
18
|
+
accurate_progress?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* true : delete
|
|
21
|
+
recursively. false : delete
|
|
22
|
+
non-empty folder.
|
|
23
|
+
*/
|
|
24
|
+
recursive?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* A unique ID for the search
|
|
27
|
+
task which is obtained from start
|
|
28
|
+
method. It's used to delete the file in
|
|
29
|
+
the search result
|
|
30
|
+
*/
|
|
31
|
+
search_taskid?: string;
|
|
32
|
+
};
|
|
33
|
+
export type DeleteFileResponse = SynologyApiResponse<{
|
|
34
|
+
taskid: string;
|
|
35
|
+
}>;
|
|
36
|
+
export declare function startDeleteFile(params: DeleteFileParams): Promise<DeleteFileResponse>;
|
|
37
|
+
export declare function stopDeleteFile(params: {
|
|
38
|
+
taskid: string;
|
|
39
|
+
}): Promise<SynologyApiResponse<any>>;
|
|
40
|
+
export type DeleteFileStatusResponse = SynologyApiResponse<{
|
|
41
|
+
finished: boolean;
|
|
42
|
+
found_dir_num: number;
|
|
43
|
+
found_file_num: number;
|
|
44
|
+
found_file_size: number;
|
|
45
|
+
has_dir: boolean;
|
|
46
|
+
path: string;
|
|
47
|
+
processed_num: number;
|
|
48
|
+
processing_path: string;
|
|
49
|
+
progress: number;
|
|
50
|
+
total: number;
|
|
51
|
+
}>;
|
|
52
|
+
export declare function getDeleteFileStatus(params: {
|
|
53
|
+
taskid: string;
|
|
54
|
+
}): Promise<DeleteFileResponse>;
|