forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
maildev.d.ts
155 lines (134 loc) · 3.6 KB
/
maildev.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
// Type definitions for maildev 0.11.0
// Project: https://github.com/djfarrelly/maildev
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../node/node.d.ts"/>
/**
* Interface for {@link MailDev} options.
*/
interface MailDevOptions {
/**
* SMTP host for outgoing emails
*
* @type {string}
*/
outgoingHost?: string;
/**
* SMTP password for outgoing emails
*
* @type {string}
*/
outgoingPass?: string;
/**
* SMTP port for outgoing emails.
*
* @type {number}
*/
outgoingPort?: number;
/**
* SMTP user for outgoing emails
*
* @type {string}
*/
outgoingUser?: string;
/**
* SMTP port to catch emails.
*
* @type {number}
*/
smtp?: number;
}
/**
* Interface for mail.
*/
interface Mail {
/**
* Identifier.
*/
id?: string;
/**
* Client.
*/
envelope?: Object;
}
declare module "maildev" {
import fs = require("fs");
/**
* Interface for {@link MailDev}.
*/
class MailDev {
/**
* Constructor.
*
* @public
* @param {MailDevOptions} options The options.
*/
constructor(options: MailDevOptions);
/**
* Deletes a given email by identifier.
*
* @public
* @param {string} id The email identifier.
* @param {Function} callback The error callback.
*/
deleteEmail(id: string, callback?: (error: Error) => void): void;
/**
* Deletes all email and their attachments.
*
* @public
* @param {Function} callback The error callback.
*/
deleteAllEmail(callback?: (error: Error) => void): void;
/**
* Stops the SMTP server.
*
* @public
* @param {Function} callback The error callback.
*/
end(callback?: (error: Error) => void): void;
/**
* Accepts e-mail identifier, returns email object.
*
* @public
* @param {string} id The e-mail identifier.
* @param {Function} callback The error callback.
*/
getEmail(id: string, callback?: (error: Error) => void): void;
/**
* Returns a readable stream of the raw e-mail.
*
* @public
* @param {string} id The e-mail identifier.
*/
getRawEmail(id: string, callback?: (error: Error, readStream: fs.ReadStream) => void): void;
/**
* Returns array of all e-mail.
* @public
*/
getAllEmail(done: (error: Error, emails: Array<Object>) => void): void;
/**
* Starts the SMTP server.
*
* @public
* @param {Function} callback The error callback.
*/
listen(callback?: (error: Error) => void): void;
/**
* Event called when a new e-mail is received. Callback receives single mail object.
*
* @public
* @param {string} eventName The event name.
* @param {Function} email The email.
*/
on(eventName: string, callback: (email: Object) => void): void;
/**
* Relay the e-mail.
*
* @param {string} idOrMailObject The identifier or mail object.
* @param {Function} done The callback.
*/
relayMail(idOrMailObject: string, done: (error: Error) => void): void;
}
var out: typeof MailDev;
export = out;
}