-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtransports.d.ts
347 lines (345 loc) · 12.3 KB
/
transports.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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
import { A as ApiCallOptions } from './invoke-fetch-types-BXn-uSF5.js';
import './auth-types-PkN9CAF_.js';
type DeleteConfigNotFoundError = {
errors?: {
/** The error code. */
code: string;
/** Summary of the problem */
title: string;
}[];
};
/**
* An error object.
*/
type ErrorPublic = {
/** The error code. */
code: string;
/** Summary of the problem. */
title: string;
};
type ErrorsPublic = {
errors?: ErrorPublic[];
};
type SendTestMailConfigNotFoundError = {
errors?: {
/** The error code. */
code: string;
/** Summary of the problem */
title: string;
}[];
};
type TenantAdminError = {
errors?: {
/** The error code. */
code: string;
/** Summary of the problem */
title: string;
}[];
};
type UpdateEmailConfigError = {
errors?: {
/** The error code. */
code: string;
/** Summary of the problem */
title: string;
}[];
};
type VerifyConnectionConfigNotFoundError = {
errors?: {
/** The error code. */
code: string;
/** Summary of the problem */
title: string;
}[];
};
type Email = {
/** email body */
body?: string;
/** email recipient (email address) */
recipient?: string;
/** email subject */
subject?: string;
};
/**
* A JSON Patch document as defined in https://datatracker.ietf.org/doc/html/rfc6902.
*/
type EmailConfigFieldPatch = {
/** The operation to be performed. */
op: "replace, remove, add";
/** The path for the given resource field to patch. */
path: "/username" | "/serverAddress" | "/serverPort" | "/securityType" | "/emailAddress" | "/emailPassword";
/** The value to be used for this operation. */
value: string;
};
type EmailConfigPatch = EmailConfigFieldPatch[];
type GetBasicAuthConfig = {
/** The email address that should appear in From field when sending emails with this account */
emailAddress?: string;
/** The selected SMTP security mechanism. Could be either 'none', 'StartTLS' or 'SSL/TLS' */
securityType?: string;
/** domain name or IP address of SMTP server */
serverAddress?: string;
/** smtp server port */
serverPort?: number;
/** user name used for SMTP login */
username?: string;
};
type GetEmailConfig = {
/** Number of authentication failures */
authFailures?: number;
/** used for SMTP authentication */
emailAddress?: string;
/** Indicates error with this email configuration. OK means that no error is indicated. Possible values are OK, CONFIG_NOT_SET, INCOMPLETE_CONFIG, INVALID_CREDENTIALS, PROVIDER_ERROR */
errorCode?: string;
/** Is the configuration valid */
isValid?: boolean;
lastUpdated?: string;
/** Last modification time. Formatted as a ISO 8601 string. */
modificationTime?: string;
/** Indicates if password is defined for this smtp config. The password itself is not returned! */
passwordExists?: boolean;
providerConfig?: GetMicrosoft365Config | GetBasicAuthConfig;
/** one of none, StartTLS or SSL/TLS */
securityType?: string;
/** domain name or IP address of SMTP server */
serverAddress?: string;
/** smtp server listening port */
serverPort?: number;
/** Name of the service provider for authentication */
serviceProvider?: "Microsoft365" | "BasicAuth";
/** Contains statusCode and statusReason */
status?: SmtpConfigStatus;
/** The tenant Id */
tenantId?: string;
/** user name */
username?: string;
};
type GetMicrosoft365Config = {
/** Microsoft365 client identifier */
clientId?: string;
/** The email address that should appear in From field when sending emails with this account */
emailAddress?: string;
/** Microsoft365 tenant identifier */
providerTenantId?: string;
};
type SmtpCheck = {
/** Indicates error with this email configuration. OK means that no error is indicated. Possible values are OK, CONFIG_NOT_SET, INCOMPLETE_CONFIG, INVALID_CREDENTIALS, PROVIDER_ERROR */
errorCode?: string;
/** true if smtp config is correct and complete. Will return false if smtp-config does not exist at all */
isValid?: boolean;
};
/**
* Contains statusCode and statusReason
*/
type SmtpConfigStatus = {
/** Status code */
statusCode?: number;
/** Status reason */
statusReason?: string;
};
type SmtpResult = {
/** could not resolve domain name, connection refused, connection timed out, SSL mismatch */
connectionFailed?: boolean;
/** error message from SMTP middleware .. a bit technical but could be useful to administrator */
message?: string;
/** smtp result code string from the SMTP server. eg. "250 2.6.0" */
smtpResponseCode?: number;
/** was SMTP operation successful or not. Other fields herein provide more detail */
success?: boolean;
};
/**
* Deletes email configuration for a given tenant id (retrieved from JWT).
*
* @throws DeleteEmailConfigHttpError
*/
declare const deleteEmailConfig: (options?: ApiCallOptions) => Promise<DeleteEmailConfigHttpResponse>;
type DeleteEmailConfigHttpResponse = {
data: void;
headers: Headers;
status: 204;
};
type DeleteEmailConfigHttpError = DeleteEmailConfig403HttpError | DeleteEmailConfig404HttpError | DeleteEmailConfigdefaultHttpError;
type DeleteEmailConfig403HttpError = {
data: TenantAdminError;
headers: Headers;
status: 403;
};
type DeleteEmailConfig404HttpError = {
data: DeleteConfigNotFoundError;
headers: Headers;
status: 404;
};
type DeleteEmailConfigdefaultHttpError = {
data: ErrorsPublic;
headers: Headers;
status: "default";
};
/**
* Returns the email configuration for a given tenant id (retrieved from JWT).
*
* @throws GetEmailConfigHttpError
*/
declare const getEmailConfig: (options?: ApiCallOptions) => Promise<GetEmailConfigHttpResponse>;
type GetEmailConfigHttpResponse = {
data: GetEmailConfig;
headers: Headers;
status: 200;
};
type GetEmailConfigHttpError = GetEmailConfig403HttpError | GetEmailConfigdefaultHttpError;
type GetEmailConfig403HttpError = {
data: TenantAdminError;
headers: Headers;
status: 403;
};
type GetEmailConfigdefaultHttpError = {
data: ErrorsPublic;
headers: Headers;
status: "default";
};
/**
* Patch the email configuration for a given tenant id (retrieved from JWT).
*
* @param body an object with the body content
* @throws PatchEmailConfigHttpError
*/
declare const patchEmailConfig: (body: EmailConfigPatch, options?: ApiCallOptions) => Promise<PatchEmailConfigHttpResponse>;
type PatchEmailConfigHttpResponse = {
data: void;
headers: Headers;
status: 204;
};
type PatchEmailConfigHttpError = PatchEmailConfig400HttpError | PatchEmailConfig403HttpError | PatchEmailConfigdefaultHttpError;
type PatchEmailConfig400HttpError = {
data: UpdateEmailConfigError;
headers: Headers;
status: 400;
};
type PatchEmailConfig403HttpError = {
data: TenantAdminError;
headers: Headers;
status: 403;
};
type PatchEmailConfigdefaultHttpError = {
data: ErrorsPublic;
headers: Headers;
status: "default";
};
/**
* Send a test mail with the supplied email info (subject, body, recipient). Email config from database is used for the connection.
*
* @param body an object with the body content
* @throws SendTestEmailHttpError
*/
declare const sendTestEmail: (body: Email, options?: ApiCallOptions) => Promise<SendTestEmailHttpResponse>;
type SendTestEmailHttpResponse = {
data: SmtpResult;
headers: Headers;
status: 200;
};
type SendTestEmailHttpError = SendTestEmail403HttpError | SendTestEmail404HttpError | SendTestEmaildefaultHttpError;
type SendTestEmail403HttpError = {
data: TenantAdminError;
headers: Headers;
status: 403;
};
type SendTestEmail404HttpError = {
data: SendTestMailConfigNotFoundError;
headers: Headers;
status: 404;
};
type SendTestEmaildefaultHttpError = {
data: ErrorsPublic;
headers: Headers;
status: "default";
};
/**
* Returns the isValid value for the email configuration for the tenant. Will return false if no email configuration exists.
*
* @throws ValidateEmailConfigHttpError
*/
declare const validateEmailConfig: (options?: ApiCallOptions) => Promise<ValidateEmailConfigHttpResponse>;
type ValidateEmailConfigHttpResponse = {
data: SmtpCheck;
headers: Headers;
status: 200;
};
type ValidateEmailConfigHttpError = {
data: ErrorsPublic;
headers: Headers;
status: number;
};
/**
* Verifies connection to email server for tenant provided via JWT
*
* @throws VerifyEmailConfigConnectionHttpError
*/
declare const verifyEmailConfigConnection: (options?: ApiCallOptions) => Promise<VerifyEmailConfigConnectionHttpResponse>;
type VerifyEmailConfigConnectionHttpResponse = {
data: SmtpResult;
headers: Headers;
status: 200;
};
type VerifyEmailConfigConnectionHttpError = VerifyEmailConfigConnection404HttpError | VerifyEmailConfigConnectiondefaultHttpError;
type VerifyEmailConfigConnection404HttpError = {
data: VerifyConnectionConfigNotFoundError;
headers: Headers;
status: 404;
};
type VerifyEmailConfigConnectiondefaultHttpError = {
data: ErrorsPublic;
headers: Headers;
status: "default";
};
/**
* Clears the cache for transports api requests.
*/
declare function clearCache(): void;
interface TransportsAPI {
/**
* Deletes email configuration for a given tenant id (retrieved from JWT).
*
* @throws DeleteEmailConfigHttpError
*/
deleteEmailConfig: typeof deleteEmailConfig;
/**
* Returns the email configuration for a given tenant id (retrieved from JWT).
*
* @throws GetEmailConfigHttpError
*/
getEmailConfig: typeof getEmailConfig;
/**
* Patch the email configuration for a given tenant id (retrieved from JWT).
*
* @param body an object with the body content
* @throws PatchEmailConfigHttpError
*/
patchEmailConfig: typeof patchEmailConfig;
/**
* Send a test mail with the supplied email info (subject, body, recipient). Email config from database is used for the connection.
*
* @param body an object with the body content
* @throws SendTestEmailHttpError
*/
sendTestEmail: typeof sendTestEmail;
/**
* Returns the isValid value for the email configuration for the tenant. Will return false if no email configuration exists.
*
* @throws ValidateEmailConfigHttpError
*/
validateEmailConfig: typeof validateEmailConfig;
/**
* Verifies connection to email server for tenant provided via JWT
*
* @throws VerifyEmailConfigConnectionHttpError
*/
verifyEmailConfigConnection: typeof verifyEmailConfigConnection;
/**
* Clears the cache for transports api requests.
*/
clearCache: typeof clearCache;
}
/**
* Functions for the transports api
*/
declare const transportsExport: TransportsAPI;
export { type DeleteConfigNotFoundError, type DeleteEmailConfig403HttpError, type DeleteEmailConfig404HttpError, type DeleteEmailConfigHttpError, type DeleteEmailConfigHttpResponse, type DeleteEmailConfigdefaultHttpError, type Email, type EmailConfigFieldPatch, type EmailConfigPatch, type ErrorPublic, type ErrorsPublic, type GetBasicAuthConfig, type GetEmailConfig, type GetEmailConfig403HttpError, type GetEmailConfigHttpError, type GetEmailConfigHttpResponse, type GetEmailConfigdefaultHttpError, type GetMicrosoft365Config, type PatchEmailConfig400HttpError, type PatchEmailConfig403HttpError, type PatchEmailConfigHttpError, type PatchEmailConfigHttpResponse, type PatchEmailConfigdefaultHttpError, type SendTestEmail403HttpError, type SendTestEmail404HttpError, type SendTestEmailHttpError, type SendTestEmailHttpResponse, type SendTestEmaildefaultHttpError, type SendTestMailConfigNotFoundError, type SmtpCheck, type SmtpConfigStatus, type SmtpResult, type TenantAdminError, type TransportsAPI, type UpdateEmailConfigError, type ValidateEmailConfigHttpError, type ValidateEmailConfigHttpResponse, type VerifyConnectionConfigNotFoundError, type VerifyEmailConfigConnection404HttpError, type VerifyEmailConfigConnectionHttpError, type VerifyEmailConfigConnectionHttpResponse, type VerifyEmailConfigConnectiondefaultHttpError, clearCache, transportsExport as default, deleteEmailConfig, getEmailConfig, patchEmailConfig, sendTestEmail, validateEmailConfig, verifyEmailConfigConnection };