-
Notifications
You must be signed in to change notification settings - Fork 0
/
ftp.ts
45 lines (39 loc) · 1.37 KB
/
ftp.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
import { BegetRequest } from '../beget-request';
import { Methods } from '../types/controller.interface';
import { Account, AddAccount } from '../types/ftp.interface';
export class FtpEndpoint {
constructor(private readonly client: BegetRequest) {}
/**
* @private
*/
private method<T>(method: Methods['ftp'], data?: object): Promise<T> {
return this.client.api('ftp', method, data);
}
/**
* Method returns list of additional FTP accounts with their home directories.
*/
getList(): Promise<Account[]> {
return this.method('getList');
}
/**
* Method adds new FTP account.
* @returns Returns property of successful or unsuccessful execution.
*/
add(params: AddAccount): Promise<boolean> {
return this.method('add', params);
}
/**
* Method performs password change for additional FTP account.
* @returns Returns property of successful or unsuccessful execution.
*/
changePassword(params: Pick<Account, 'suffix' | 'password'>): Promise<boolean> {
return this.method('changePassword', params);
}
/**
* Method deletes additional FTP account with given suffix.
* @returns Returns property of successful or unsuccessful execution.
*/
delete(params: Pick<Account, 'suffix'>): Promise<boolean> {
return this.method('delete', params);
}
}