-
Notifications
You must be signed in to change notification settings - Fork 0
/
mail.ts
95 lines (83 loc) · 3.08 KB
/
mail.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
import { BegetRequest } from '../beget-request';
import { Methods } from '../types/controller.interface';
import * as Mail from '../types/mail.interface';
export class MailEndpoint {
constructor(private readonly client: BegetRequest) {}
/**
* @private
*/
private method<T>(method: Methods['mail'], data?: object): Promise<T> {
return this.client.api('mail', method, data);
}
/**
* Method returns all mailboxes on given domain.
*/
getMailboxList(params: Pick<Mail.Mailbox, 'domain'>): Promise<Mail.GetMailbox[]> {
return this.method('getMailboxList', params);
}
/**
* Method changes password to given mailbox.
* @returns Returns property of successful or unsuccessful execution.
*/
changeMailboxPassword(params: Mail.SetMailbox): Promise<boolean> {
return this.method('changeMailboxPassword', params);
}
/**
* Method creates mailbox on given domain.
* @returns Returns property of successful or unsuccessful execution.
*/
createMailbox(params: Mail.SetMailbox): Promise<boolean> {
return this.method('createMailbox', params);
}
/**
* Method deletes mailbox on given domain.
* @returns Returns property of successful or unsuccessful execution.
*/
dropMailbox(params: Pick<Mail.Mailbox, 'domain' | 'mailbox'>): Promise<boolean> {
return this.method('dropMailbox', params);
}
/**
* Method sets options for mailbox.
* @returns Returns property of successful or unsuccessful execution.
*/
changeMailboxSettings(params: Mail.MailboxSettings): Promise<boolean> {
return this.method('changeMailboxSettings', params);
}
/**
* Method will add mailbox to list of mailboxes for forwarding.
* @returns Returns property of successful or unsuccessful execution.
*/
forwardListAddMailbox(params: Mail.ForwardList): Promise<boolean> {
return this.method('forwardListAddMailbox', params);
}
/**
* Method deletes mailbox from list of mailboxes for forwarding.
* @returns Returns property of successful or unsuccessful execution.
*
*/
forwardListDeleteMailbox(params: Mail.ForwardList): Promise<boolean> {
return this.method('forwardListDeleteMailbox', params);
}
/**
* Method returns forwarding list for indicated mailbox.
*/
forwardListShow(
params: Pick<Mail.Mailbox, 'domain' | 'mailbox'>
): Promise<Pick<Mail.Mailbox, 'forward_mailbox'>[]> {
return this.method('forwardListShow', params);
}
/**
* Method sets up domain mail.
* @returns Returns property of successful or unsuccessful execution.
*/
setDomainMail(params: Pick<Mail.Mailbox, 'domain' | 'domain_mailbox'>): Promise<boolean> {
return this.method('setDomainMail', params);
}
/**
* Method resets domain mail.
* @returns Returns property of successful or unsuccessful execution.
*/
clearDomainMail(params: Pick<Mail.Mailbox, 'domain'>): Promise<boolean> {
return this.method('clearDomainMail', params);
}
}