@internxt/sdk 1.15.10 → 1.15.12
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/dist/mail/api.d.ts +66 -1
- package/dist/mail/api.js +99 -12
- package/dist/mail/mail.d.ts +59 -1
- package/dist/mail/mail.js +80 -0
- package/dist/mail/schema.d.ts +128 -0
- package/dist/mail/types.d.ts +19 -0
- package/package.json +2 -2
package/dist/mail/api.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ApiSecurity, ApiUrl, AppDetails } from '../shared';
|
|
2
2
|
import { EncryptedKeystore, KeystoreType, HybridEncryptedEmail, PwdProtectedEmail, RecipientWithPublicKey, EmailPublicParameters } from 'internxt-crypto';
|
|
3
|
-
import { MailboxResponse, EmailListResponse, EmailResponse, EmailCreatedResponse, SendEmailRequest, DraftEmailRequest, UpdateEmailRequest, ListEmailsQuery } from './types';
|
|
3
|
+
import { MailboxResponse, EmailListResponse, EmailResponse, EmailCreatedResponse, SendEmailRequest, DraftEmailRequest, UpdateEmailRequest, ListEmailsQuery, EmailDomainsResponse, SetupMailAccountPayload, SearchFiltersQuery, MailAccountKeysResponse } from './types';
|
|
4
4
|
export declare class MailApi {
|
|
5
5
|
private readonly client;
|
|
6
6
|
private readonly appDetails;
|
|
@@ -46,13 +46,78 @@ export declare class MailApi {
|
|
|
46
46
|
* @returns Server response
|
|
47
47
|
*/
|
|
48
48
|
sendE2EPasswordProtectedEmail(email: PwdProtectedEmail, params: EmailPublicParameters): Promise<void>;
|
|
49
|
+
search(filters: SearchFiltersQuery): Promise<EmailListResponse>;
|
|
50
|
+
/**
|
|
51
|
+
* Gets the mailboxes of the user
|
|
52
|
+
*
|
|
53
|
+
* @returns The mailboxes of the user - `MailboxResponse[]`
|
|
54
|
+
*/
|
|
49
55
|
getMailboxes(): Promise<MailboxResponse[]>;
|
|
56
|
+
/**
|
|
57
|
+
* Lists emails of the user
|
|
58
|
+
*
|
|
59
|
+
* @param query - The query to filter emails (e.g. mailbox, limit, etc.)
|
|
60
|
+
* @returns The list of emails - `EmailListResponse`
|
|
61
|
+
*/
|
|
50
62
|
listEmails(query?: ListEmailsQuery): Promise<EmailListResponse>;
|
|
63
|
+
/**
|
|
64
|
+
* Gets the email with the corresponding id
|
|
65
|
+
*
|
|
66
|
+
* @param id - The id of the email
|
|
67
|
+
* @returns The email with the corresponding id - `EmailResponse`
|
|
68
|
+
*/
|
|
51
69
|
getEmail(id: string): Promise<EmailResponse>;
|
|
70
|
+
/**
|
|
71
|
+
* Deletes the email with the corresponding id
|
|
72
|
+
*
|
|
73
|
+
* @param id - The id of the email to delete
|
|
74
|
+
* @returns A promise that resolves when the email is deleted
|
|
75
|
+
*/
|
|
52
76
|
deleteEmail(id: string): Promise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* Updates the email with the corresponding id
|
|
79
|
+
*
|
|
80
|
+
* @param id - The id of the email to update
|
|
81
|
+
* @param body - The new body of the email
|
|
82
|
+
* @returns A promise that resolves when the email is updated
|
|
83
|
+
*/
|
|
53
84
|
updateEmail(id: string, body: UpdateEmailRequest): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* Sends an email to the specified recipients
|
|
87
|
+
*
|
|
88
|
+
* @param body - The body of the email to send
|
|
89
|
+
* @returns The created email
|
|
90
|
+
*/
|
|
54
91
|
sendEmail(body: SendEmailRequest): Promise<EmailCreatedResponse>;
|
|
92
|
+
/**
|
|
93
|
+
* Saves a draft email
|
|
94
|
+
*
|
|
95
|
+
* @param body - The body of the draft email to save
|
|
96
|
+
* @returns The created email - `EmailCreatedResponse`
|
|
97
|
+
*/
|
|
55
98
|
saveDraft(body: DraftEmailRequest): Promise<EmailCreatedResponse>;
|
|
99
|
+
/**
|
|
100
|
+
* Returns the list of active domains for the email gateway
|
|
101
|
+
*
|
|
102
|
+
* @returns The list of active domains - `ActiveDomainsResponse`
|
|
103
|
+
*/
|
|
104
|
+
getActiveDomains(): Promise<EmailDomainsResponse>;
|
|
105
|
+
/**
|
|
106
|
+
* Sets up a mail account for the user
|
|
107
|
+
*
|
|
108
|
+
* @param payload - Set of details for mail account setup
|
|
109
|
+
* @returns A promise that resolves with the created mail account address
|
|
110
|
+
*/
|
|
111
|
+
setupMailAccount(payload: SetupMailAccountPayload): Promise<{
|
|
112
|
+
address: string;
|
|
113
|
+
}>;
|
|
114
|
+
/**
|
|
115
|
+
* Gets the mail account keys for the given address
|
|
116
|
+
*
|
|
117
|
+
* @param address - The mail address whose keys should be retrieved
|
|
118
|
+
* @returns The public, encrypted private and recovery keys plus the salt
|
|
119
|
+
*/
|
|
120
|
+
getMailAccountKeys(address: string): Promise<MailAccountKeysResponse>;
|
|
56
121
|
/**
|
|
57
122
|
* Returns the needed headers for the module requests
|
|
58
123
|
* @private
|
package/dist/mail/api.js
CHANGED
|
@@ -59,7 +59,7 @@ var MailApi = /** @class */ (function () {
|
|
|
59
59
|
MailApi.prototype.uploadKeystore = function (keystore) {
|
|
60
60
|
return __awaiter(this, void 0, void 0, function () {
|
|
61
61
|
return __generator(this, function (_a) {
|
|
62
|
-
return [2 /*return*/, this.client.post(
|
|
62
|
+
return [2 /*return*/, this.client.post('/keystore', { encryptedKeystore: keystore }, this.headers())];
|
|
63
63
|
});
|
|
64
64
|
});
|
|
65
65
|
};
|
|
@@ -73,7 +73,7 @@ var MailApi = /** @class */ (function () {
|
|
|
73
73
|
MailApi.prototype.downloadKeystore = function (userEmail, keystoreType) {
|
|
74
74
|
return __awaiter(this, void 0, void 0, function () {
|
|
75
75
|
return __generator(this, function (_a) {
|
|
76
|
-
return [2 /*return*/, this.client.getWithParams(
|
|
76
|
+
return [2 /*return*/, this.client.getWithParams('/user/keystore', { userEmail: userEmail, keystoreType: keystoreType }, this.headers())];
|
|
77
77
|
});
|
|
78
78
|
});
|
|
79
79
|
};
|
|
@@ -89,7 +89,7 @@ var MailApi = /** @class */ (function () {
|
|
|
89
89
|
var _this = this;
|
|
90
90
|
return __generator(this, function (_a) {
|
|
91
91
|
switch (_a.label) {
|
|
92
|
-
case 0: return [4 /*yield*/, this.client.post(
|
|
92
|
+
case 0: return [4 /*yield*/, this.client.post('/users/public-keys', { emails: emails }, this.headers())];
|
|
93
93
|
case 1:
|
|
94
94
|
response = _a.sent();
|
|
95
95
|
return [4 /*yield*/, Promise.all(response.map(function (item) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -116,7 +116,7 @@ var MailApi = /** @class */ (function () {
|
|
|
116
116
|
MailApi.prototype.sendE2EEmails = function (emails, params) {
|
|
117
117
|
return __awaiter(this, void 0, void 0, function () {
|
|
118
118
|
return __generator(this, function (_a) {
|
|
119
|
-
return [2 /*return*/, this.client.post(
|
|
119
|
+
return [2 /*return*/, this.client.post('/emails', { emails: emails, params: params }, this.headers())];
|
|
120
120
|
});
|
|
121
121
|
});
|
|
122
122
|
};
|
|
@@ -130,56 +130,143 @@ var MailApi = /** @class */ (function () {
|
|
|
130
130
|
MailApi.prototype.sendE2EPasswordProtectedEmail = function (email, params) {
|
|
131
131
|
return __awaiter(this, void 0, void 0, function () {
|
|
132
132
|
return __generator(this, function (_a) {
|
|
133
|
-
return [2 /*return*/, this.client.post(
|
|
133
|
+
return [2 /*return*/, this.client.post('/emails', { email: email, params: params }, this.headers())];
|
|
134
134
|
});
|
|
135
135
|
});
|
|
136
136
|
};
|
|
137
|
+
MailApi.prototype.search = function (filters) {
|
|
138
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
139
|
+
return __generator(this, function (_a) {
|
|
140
|
+
return [2 /*return*/, this.client.post('/email/search', filters, this.headers())];
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* Gets the mailboxes of the user
|
|
146
|
+
*
|
|
147
|
+
* @returns The mailboxes of the user - `MailboxResponse[]`
|
|
148
|
+
*/
|
|
137
149
|
MailApi.prototype.getMailboxes = function () {
|
|
138
150
|
return __awaiter(this, void 0, void 0, function () {
|
|
139
151
|
return __generator(this, function (_a) {
|
|
140
|
-
return [2 /*return*/, this.client.get(
|
|
152
|
+
return [2 /*return*/, this.client.get('/email/mailboxes', this.headers())];
|
|
141
153
|
});
|
|
142
154
|
});
|
|
143
155
|
};
|
|
156
|
+
/**
|
|
157
|
+
* Lists emails of the user
|
|
158
|
+
*
|
|
159
|
+
* @param query - The query to filter emails (e.g. mailbox, limit, etc.)
|
|
160
|
+
* @returns The list of emails - `EmailListResponse`
|
|
161
|
+
*/
|
|
144
162
|
MailApi.prototype.listEmails = function (query) {
|
|
145
163
|
return __awaiter(this, void 0, void 0, function () {
|
|
146
164
|
return __generator(this, function (_a) {
|
|
147
|
-
return [2 /*return*/, this.client.getWithParams(
|
|
165
|
+
return [2 /*return*/, this.client.getWithParams('/email', query !== null && query !== void 0 ? query : {}, this.headers())];
|
|
148
166
|
});
|
|
149
167
|
});
|
|
150
168
|
};
|
|
169
|
+
/**
|
|
170
|
+
* Gets the email with the corresponding id
|
|
171
|
+
*
|
|
172
|
+
* @param id - The id of the email
|
|
173
|
+
* @returns The email with the corresponding id - `EmailResponse`
|
|
174
|
+
*/
|
|
151
175
|
MailApi.prototype.getEmail = function (id) {
|
|
152
176
|
return __awaiter(this, void 0, void 0, function () {
|
|
153
177
|
return __generator(this, function (_a) {
|
|
154
|
-
return [2 /*return*/, this.client.get("
|
|
178
|
+
return [2 /*return*/, this.client.get("/email/".concat(id), this.headers())];
|
|
155
179
|
});
|
|
156
180
|
});
|
|
157
181
|
};
|
|
182
|
+
/**
|
|
183
|
+
* Deletes the email with the corresponding id
|
|
184
|
+
*
|
|
185
|
+
* @param id - The id of the email to delete
|
|
186
|
+
* @returns A promise that resolves when the email is deleted
|
|
187
|
+
*/
|
|
158
188
|
MailApi.prototype.deleteEmail = function (id) {
|
|
159
189
|
return __awaiter(this, void 0, void 0, function () {
|
|
160
190
|
return __generator(this, function (_a) {
|
|
161
|
-
return [2 /*return*/, this.client.delete("
|
|
191
|
+
return [2 /*return*/, this.client.delete("/email/".concat(id), this.headers())];
|
|
162
192
|
});
|
|
163
193
|
});
|
|
164
194
|
};
|
|
195
|
+
/**
|
|
196
|
+
* Updates the email with the corresponding id
|
|
197
|
+
*
|
|
198
|
+
* @param id - The id of the email to update
|
|
199
|
+
* @param body - The new body of the email
|
|
200
|
+
* @returns A promise that resolves when the email is updated
|
|
201
|
+
*/
|
|
165
202
|
MailApi.prototype.updateEmail = function (id, body) {
|
|
166
203
|
return __awaiter(this, void 0, void 0, function () {
|
|
167
204
|
return __generator(this, function (_a) {
|
|
168
|
-
return [2 /*return*/, this.client.patch("
|
|
205
|
+
return [2 /*return*/, this.client.patch("/email/".concat(id), body, this.headers())];
|
|
169
206
|
});
|
|
170
207
|
});
|
|
171
208
|
};
|
|
209
|
+
/**
|
|
210
|
+
* Sends an email to the specified recipients
|
|
211
|
+
*
|
|
212
|
+
* @param body - The body of the email to send
|
|
213
|
+
* @returns The created email
|
|
214
|
+
*/
|
|
172
215
|
MailApi.prototype.sendEmail = function (body) {
|
|
173
216
|
return __awaiter(this, void 0, void 0, function () {
|
|
174
217
|
return __generator(this, function (_a) {
|
|
175
|
-
return [2 /*return*/, this.client.post(
|
|
218
|
+
return [2 /*return*/, this.client.post('/email/send', body, this.headers())];
|
|
176
219
|
});
|
|
177
220
|
});
|
|
178
221
|
};
|
|
222
|
+
/**
|
|
223
|
+
* Saves a draft email
|
|
224
|
+
*
|
|
225
|
+
* @param body - The body of the draft email to save
|
|
226
|
+
* @returns The created email - `EmailCreatedResponse`
|
|
227
|
+
*/
|
|
179
228
|
MailApi.prototype.saveDraft = function (body) {
|
|
180
229
|
return __awaiter(this, void 0, void 0, function () {
|
|
181
230
|
return __generator(this, function (_a) {
|
|
182
|
-
return [2 /*return*/, this.client.post(
|
|
231
|
+
return [2 /*return*/, this.client.post('/email/drafts', body, this.headers())];
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
};
|
|
235
|
+
/**
|
|
236
|
+
* Returns the list of active domains for the email gateway
|
|
237
|
+
*
|
|
238
|
+
* @returns The list of active domains - `ActiveDomainsResponse`
|
|
239
|
+
*/
|
|
240
|
+
MailApi.prototype.getActiveDomains = function () {
|
|
241
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
242
|
+
return __generator(this, function (_a) {
|
|
243
|
+
return [2 /*return*/, this.client.get('/email/domains', this.headers())];
|
|
244
|
+
});
|
|
245
|
+
});
|
|
246
|
+
};
|
|
247
|
+
/**
|
|
248
|
+
* Sets up a mail account for the user
|
|
249
|
+
*
|
|
250
|
+
* @param payload - Set of details for mail account setup
|
|
251
|
+
* @returns A promise that resolves with the created mail account address
|
|
252
|
+
*/
|
|
253
|
+
MailApi.prototype.setupMailAccount = function (payload) {
|
|
254
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
255
|
+
return __generator(this, function (_a) {
|
|
256
|
+
return [2 /*return*/, this.client.post('/users/me/mail-account', payload, this.headers())];
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
};
|
|
260
|
+
/**
|
|
261
|
+
* Gets the mail account keys for the given address
|
|
262
|
+
*
|
|
263
|
+
* @param address - The mail address whose keys should be retrieved
|
|
264
|
+
* @returns The public, encrypted private and recovery keys plus the salt
|
|
265
|
+
*/
|
|
266
|
+
MailApi.prototype.getMailAccountKeys = function (address) {
|
|
267
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
268
|
+
return __generator(this, function (_a) {
|
|
269
|
+
return [2 /*return*/, this.client.getWithParams('/users/me/mail-account/keys', { address: address }, this.headers())];
|
|
183
270
|
});
|
|
184
271
|
});
|
|
185
272
|
};
|
package/dist/mail/mail.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ApiSecurity, ApiUrl, AppDetails } from '../shared';
|
|
2
2
|
import { EncryptedKeystore, KeystoreType, HybridEncryptedEmail, PwdProtectedEmail, HybridKeyPair, Email, RecipientWithPublicKey, EmailPublicParameters } from 'internxt-crypto';
|
|
3
|
-
import { MailboxResponse, EmailListResponse, EmailResponse, EmailCreatedResponse, SendEmailRequest, DraftEmailRequest, UpdateEmailRequest, ListEmailsQuery } from './types';
|
|
3
|
+
import { MailboxResponse, EmailListResponse, EmailResponse, EmailCreatedResponse, SendEmailRequest, DraftEmailRequest, UpdateEmailRequest, ListEmailsQuery, SearchFiltersQuery, EmailDomainsResponse, SetupMailAccountPayload, MailAccountKeysResponse } from './types';
|
|
4
4
|
export declare class Mail {
|
|
5
5
|
private readonly api;
|
|
6
6
|
static client(apiUrl: ApiUrl, appDetails: AppDetails, apiSecurity: ApiSecurity): Mail;
|
|
@@ -94,11 +94,69 @@ export declare class Mail {
|
|
|
94
94
|
* @returns Server response
|
|
95
95
|
*/
|
|
96
96
|
e2ePasswordProtectAndSendEmail(email: Email, pwd: string, aux?: string): Promise<void>;
|
|
97
|
+
/**
|
|
98
|
+
* Gets the mailboxes of the user
|
|
99
|
+
*
|
|
100
|
+
* @returns The mailboxes of the user
|
|
101
|
+
*/
|
|
97
102
|
getMailboxes(): Promise<MailboxResponse[]>;
|
|
103
|
+
/**
|
|
104
|
+
* Lists emails of the user
|
|
105
|
+
*
|
|
106
|
+
* @param query - The query to filter emails
|
|
107
|
+
* @returns The list of emails
|
|
108
|
+
*/
|
|
98
109
|
listEmails(query?: ListEmailsQuery): Promise<EmailListResponse>;
|
|
110
|
+
/**
|
|
111
|
+
* Gets the email with the corresponding id
|
|
112
|
+
*
|
|
113
|
+
* @param id - The id of the email
|
|
114
|
+
* @returns The email with the corresponding id
|
|
115
|
+
*/
|
|
99
116
|
getEmail(id: string): Promise<EmailResponse>;
|
|
117
|
+
/**
|
|
118
|
+
* Deletes the email with the corresponding id
|
|
119
|
+
*
|
|
120
|
+
* @param id - The id of the email to delete
|
|
121
|
+
*/
|
|
100
122
|
deleteEmail(id: string): Promise<void>;
|
|
123
|
+
/**
|
|
124
|
+
* Updates the email with the corresponding id
|
|
125
|
+
*
|
|
126
|
+
* @param id - The id of the email to update
|
|
127
|
+
* @param body - The new body of the email
|
|
128
|
+
*/
|
|
101
129
|
updateEmail(id: string, body: UpdateEmailRequest): Promise<void>;
|
|
130
|
+
/**
|
|
131
|
+
* Sends an email to the specified recipients
|
|
132
|
+
*
|
|
133
|
+
* @param body - The body of the email to send
|
|
134
|
+
* @returns The created email
|
|
135
|
+
*/
|
|
102
136
|
sendEmail(body: SendEmailRequest): Promise<EmailCreatedResponse>;
|
|
137
|
+
/**
|
|
138
|
+
* Saves a draft email.
|
|
139
|
+
*
|
|
140
|
+
* @param body - The body of the email to save as a draft
|
|
141
|
+
* @returns The created email
|
|
142
|
+
*/
|
|
103
143
|
saveDraft(body: DraftEmailRequest): Promise<EmailCreatedResponse>;
|
|
144
|
+
search(filters: SearchFiltersQuery): Promise<EmailListResponse>;
|
|
145
|
+
getActiveDomains(): Promise<EmailDomainsResponse>;
|
|
146
|
+
/**
|
|
147
|
+
* Sets up a mail account for the user
|
|
148
|
+
*
|
|
149
|
+
* @param payload - Set of details for mail account setup
|
|
150
|
+
* @returns A promise that resolves with the created mail account address
|
|
151
|
+
*/
|
|
152
|
+
setupMailAccount(payload: SetupMailAccountPayload): Promise<{
|
|
153
|
+
address: string;
|
|
154
|
+
}>;
|
|
155
|
+
/**
|
|
156
|
+
* Gets the mail account keys for the given address
|
|
157
|
+
*
|
|
158
|
+
* @param address - The mail address whose keys should be retrieved
|
|
159
|
+
* @returns The public, encrypted private and recovery keys plus the salt
|
|
160
|
+
*/
|
|
161
|
+
getMailAccountKeys(address: string): Promise<MailAccountKeysResponse>;
|
|
104
162
|
}
|
package/dist/mail/mail.js
CHANGED
|
@@ -248,6 +248,11 @@ var Mail = /** @class */ (function () {
|
|
|
248
248
|
});
|
|
249
249
|
});
|
|
250
250
|
};
|
|
251
|
+
/**
|
|
252
|
+
* Gets the mailboxes of the user
|
|
253
|
+
*
|
|
254
|
+
* @returns The mailboxes of the user
|
|
255
|
+
*/
|
|
251
256
|
Mail.prototype.getMailboxes = function () {
|
|
252
257
|
return __awaiter(this, void 0, void 0, function () {
|
|
253
258
|
return __generator(this, function (_a) {
|
|
@@ -255,6 +260,12 @@ var Mail = /** @class */ (function () {
|
|
|
255
260
|
});
|
|
256
261
|
});
|
|
257
262
|
};
|
|
263
|
+
/**
|
|
264
|
+
* Lists emails of the user
|
|
265
|
+
*
|
|
266
|
+
* @param query - The query to filter emails
|
|
267
|
+
* @returns The list of emails
|
|
268
|
+
*/
|
|
258
269
|
Mail.prototype.listEmails = function (query) {
|
|
259
270
|
return __awaiter(this, void 0, void 0, function () {
|
|
260
271
|
return __generator(this, function (_a) {
|
|
@@ -262,6 +273,12 @@ var Mail = /** @class */ (function () {
|
|
|
262
273
|
});
|
|
263
274
|
});
|
|
264
275
|
};
|
|
276
|
+
/**
|
|
277
|
+
* Gets the email with the corresponding id
|
|
278
|
+
*
|
|
279
|
+
* @param id - The id of the email
|
|
280
|
+
* @returns The email with the corresponding id
|
|
281
|
+
*/
|
|
265
282
|
Mail.prototype.getEmail = function (id) {
|
|
266
283
|
return __awaiter(this, void 0, void 0, function () {
|
|
267
284
|
return __generator(this, function (_a) {
|
|
@@ -269,6 +286,11 @@ var Mail = /** @class */ (function () {
|
|
|
269
286
|
});
|
|
270
287
|
});
|
|
271
288
|
};
|
|
289
|
+
/**
|
|
290
|
+
* Deletes the email with the corresponding id
|
|
291
|
+
*
|
|
292
|
+
* @param id - The id of the email to delete
|
|
293
|
+
*/
|
|
272
294
|
Mail.prototype.deleteEmail = function (id) {
|
|
273
295
|
return __awaiter(this, void 0, void 0, function () {
|
|
274
296
|
return __generator(this, function (_a) {
|
|
@@ -276,6 +298,12 @@ var Mail = /** @class */ (function () {
|
|
|
276
298
|
});
|
|
277
299
|
});
|
|
278
300
|
};
|
|
301
|
+
/**
|
|
302
|
+
* Updates the email with the corresponding id
|
|
303
|
+
*
|
|
304
|
+
* @param id - The id of the email to update
|
|
305
|
+
* @param body - The new body of the email
|
|
306
|
+
*/
|
|
279
307
|
Mail.prototype.updateEmail = function (id, body) {
|
|
280
308
|
return __awaiter(this, void 0, void 0, function () {
|
|
281
309
|
return __generator(this, function (_a) {
|
|
@@ -283,6 +311,12 @@ var Mail = /** @class */ (function () {
|
|
|
283
311
|
});
|
|
284
312
|
});
|
|
285
313
|
};
|
|
314
|
+
/**
|
|
315
|
+
* Sends an email to the specified recipients
|
|
316
|
+
*
|
|
317
|
+
* @param body - The body of the email to send
|
|
318
|
+
* @returns The created email
|
|
319
|
+
*/
|
|
286
320
|
Mail.prototype.sendEmail = function (body) {
|
|
287
321
|
return __awaiter(this, void 0, void 0, function () {
|
|
288
322
|
return __generator(this, function (_a) {
|
|
@@ -290,6 +324,12 @@ var Mail = /** @class */ (function () {
|
|
|
290
324
|
});
|
|
291
325
|
});
|
|
292
326
|
};
|
|
327
|
+
/**
|
|
328
|
+
* Saves a draft email.
|
|
329
|
+
*
|
|
330
|
+
* @param body - The body of the email to save as a draft
|
|
331
|
+
* @returns The created email
|
|
332
|
+
*/
|
|
293
333
|
Mail.prototype.saveDraft = function (body) {
|
|
294
334
|
return __awaiter(this, void 0, void 0, function () {
|
|
295
335
|
return __generator(this, function (_a) {
|
|
@@ -297,6 +337,46 @@ var Mail = /** @class */ (function () {
|
|
|
297
337
|
});
|
|
298
338
|
});
|
|
299
339
|
};
|
|
340
|
+
Mail.prototype.search = function (filters) {
|
|
341
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
342
|
+
return __generator(this, function (_a) {
|
|
343
|
+
return [2 /*return*/, this.api.search(filters)];
|
|
344
|
+
});
|
|
345
|
+
});
|
|
346
|
+
};
|
|
347
|
+
Mail.prototype.getActiveDomains = function () {
|
|
348
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
349
|
+
return __generator(this, function (_a) {
|
|
350
|
+
return [2 /*return*/, this.api.getActiveDomains()];
|
|
351
|
+
});
|
|
352
|
+
});
|
|
353
|
+
};
|
|
354
|
+
/**
|
|
355
|
+
* Sets up a mail account for the user
|
|
356
|
+
*
|
|
357
|
+
* @param payload - Set of details for mail account setup
|
|
358
|
+
* @returns A promise that resolves with the created mail account address
|
|
359
|
+
*/
|
|
360
|
+
Mail.prototype.setupMailAccount = function (payload) {
|
|
361
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
362
|
+
return __generator(this, function (_a) {
|
|
363
|
+
return [2 /*return*/, this.api.setupMailAccount(payload)];
|
|
364
|
+
});
|
|
365
|
+
});
|
|
366
|
+
};
|
|
367
|
+
/**
|
|
368
|
+
* Gets the mail account keys for the given address
|
|
369
|
+
*
|
|
370
|
+
* @param address - The mail address whose keys should be retrieved
|
|
371
|
+
* @returns The public, encrypted private and recovery keys plus the salt
|
|
372
|
+
*/
|
|
373
|
+
Mail.prototype.getMailAccountKeys = function (address) {
|
|
374
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
375
|
+
return __generator(this, function (_a) {
|
|
376
|
+
return [2 /*return*/, this.api.getMailAccountKeys(address)];
|
|
377
|
+
});
|
|
378
|
+
});
|
|
379
|
+
};
|
|
300
380
|
return Mail;
|
|
301
381
|
}());
|
|
302
382
|
exports.Mail = Mail;
|
package/dist/mail/schema.d.ts
CHANGED
|
@@ -19,6 +19,26 @@ export interface paths {
|
|
|
19
19
|
patch?: never;
|
|
20
20
|
trace?: never;
|
|
21
21
|
};
|
|
22
|
+
'/email/domains': {
|
|
23
|
+
parameters: {
|
|
24
|
+
query?: never;
|
|
25
|
+
header?: never;
|
|
26
|
+
path?: never;
|
|
27
|
+
cookie?: never;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* List domains
|
|
31
|
+
* @description Returns every domain for the authenticated user.
|
|
32
|
+
*/
|
|
33
|
+
get: operations['EmailController_getDomains'];
|
|
34
|
+
put?: never;
|
|
35
|
+
post?: never;
|
|
36
|
+
delete?: never;
|
|
37
|
+
options?: never;
|
|
38
|
+
head?: never;
|
|
39
|
+
patch?: never;
|
|
40
|
+
trace?: never;
|
|
41
|
+
};
|
|
22
42
|
'/email/mailboxes': {
|
|
23
43
|
parameters: {
|
|
24
44
|
query?: never;
|
|
@@ -59,6 +79,26 @@ export interface paths {
|
|
|
59
79
|
patch?: never;
|
|
60
80
|
trace?: never;
|
|
61
81
|
};
|
|
82
|
+
'/email/search': {
|
|
83
|
+
parameters: {
|
|
84
|
+
query?: never;
|
|
85
|
+
header?: never;
|
|
86
|
+
path?: never;
|
|
87
|
+
cookie?: never;
|
|
88
|
+
};
|
|
89
|
+
get?: never;
|
|
90
|
+
put?: never;
|
|
91
|
+
/**
|
|
92
|
+
* Search emails
|
|
93
|
+
* @description Search emails by text, sender, recipient, date range, read status or attachment.
|
|
94
|
+
*/
|
|
95
|
+
post: operations['EmailController_search'];
|
|
96
|
+
delete?: never;
|
|
97
|
+
options?: never;
|
|
98
|
+
head?: never;
|
|
99
|
+
patch?: never;
|
|
100
|
+
trace?: never;
|
|
101
|
+
};
|
|
62
102
|
'/email/{id}': {
|
|
63
103
|
parameters: {
|
|
64
104
|
query?: never;
|
|
@@ -199,6 +239,18 @@ export interface paths {
|
|
|
199
239
|
export type webhooks = Record<string, never>;
|
|
200
240
|
export interface components {
|
|
201
241
|
schemas: {
|
|
242
|
+
MailDomainDto: {
|
|
243
|
+
/** @example f3a1b2c4-… */
|
|
244
|
+
id: string;
|
|
245
|
+
/** @example active */
|
|
246
|
+
status: string;
|
|
247
|
+
/** @example internxt.me */
|
|
248
|
+
domain: string;
|
|
249
|
+
/** @example 2025-06-15T10:29:55Z */
|
|
250
|
+
createdAt: string;
|
|
251
|
+
/** @example 2025-06-15T10:29:55Z */
|
|
252
|
+
updatedAt: string;
|
|
253
|
+
};
|
|
202
254
|
MailboxResponseDto: {
|
|
203
255
|
/** @example f3a1b2c4-… */
|
|
204
256
|
id: string;
|
|
@@ -269,6 +321,38 @@ export interface components {
|
|
|
269
321
|
/** @example Ma1f09b… */
|
|
270
322
|
nextAnchor?: string;
|
|
271
323
|
};
|
|
324
|
+
SearchEmailQueryDto: {
|
|
325
|
+
/** @description Full-text search */
|
|
326
|
+
text?: string;
|
|
327
|
+
/** @example 20 */
|
|
328
|
+
limit?: number;
|
|
329
|
+
/** @example 0 */
|
|
330
|
+
position?: number;
|
|
331
|
+
/**
|
|
332
|
+
* @description Filter by sender
|
|
333
|
+
* @example [
|
|
334
|
+
* "a@inxt.eu",
|
|
335
|
+
* "b@inxt.me"
|
|
336
|
+
* ]
|
|
337
|
+
*/
|
|
338
|
+
from?: string[];
|
|
339
|
+
/**
|
|
340
|
+
* @description Filter by recipient
|
|
341
|
+
* @example [
|
|
342
|
+
* "a@inxt.eu",
|
|
343
|
+
* "b@inxt.me"
|
|
344
|
+
* ]
|
|
345
|
+
*/
|
|
346
|
+
to?: string[];
|
|
347
|
+
/** @description ISO 8601 date — emails received after this date */
|
|
348
|
+
after?: string;
|
|
349
|
+
/** @description ISO 8601 date — emails received before this date */
|
|
350
|
+
before?: string;
|
|
351
|
+
/** @description Filter by read status */
|
|
352
|
+
unread?: boolean;
|
|
353
|
+
/** @description Filter by attachment presence */
|
|
354
|
+
hasAttachment?: boolean;
|
|
355
|
+
};
|
|
272
356
|
EmailResponseDto: {
|
|
273
357
|
/** @example Ma1f09b… */
|
|
274
358
|
id: string;
|
|
@@ -412,6 +496,25 @@ export interface operations {
|
|
|
412
496
|
};
|
|
413
497
|
};
|
|
414
498
|
};
|
|
499
|
+
EmailController_getDomains: {
|
|
500
|
+
parameters: {
|
|
501
|
+
query?: never;
|
|
502
|
+
header?: never;
|
|
503
|
+
path?: never;
|
|
504
|
+
cookie?: never;
|
|
505
|
+
};
|
|
506
|
+
requestBody?: never;
|
|
507
|
+
responses: {
|
|
508
|
+
200: {
|
|
509
|
+
headers: {
|
|
510
|
+
[name: string]: unknown;
|
|
511
|
+
};
|
|
512
|
+
content: {
|
|
513
|
+
'application/json': components['schemas']['MailDomainDto'][];
|
|
514
|
+
};
|
|
515
|
+
};
|
|
516
|
+
};
|
|
517
|
+
};
|
|
415
518
|
EmailController_getMailboxes: {
|
|
416
519
|
parameters: {
|
|
417
520
|
query?: never;
|
|
@@ -442,6 +545,8 @@ export interface operations {
|
|
|
442
545
|
position?: number;
|
|
443
546
|
/** @description Anchor ID for pagination. */
|
|
444
547
|
anchorId?: string;
|
|
548
|
+
/** @description Filter by read status. */
|
|
549
|
+
unread?: boolean;
|
|
445
550
|
};
|
|
446
551
|
header?: never;
|
|
447
552
|
path?: never;
|
|
@@ -459,6 +564,29 @@ export interface operations {
|
|
|
459
564
|
};
|
|
460
565
|
};
|
|
461
566
|
};
|
|
567
|
+
EmailController_search: {
|
|
568
|
+
parameters: {
|
|
569
|
+
query?: never;
|
|
570
|
+
header?: never;
|
|
571
|
+
path?: never;
|
|
572
|
+
cookie?: never;
|
|
573
|
+
};
|
|
574
|
+
requestBody: {
|
|
575
|
+
content: {
|
|
576
|
+
'application/json': components['schemas']['SearchEmailQueryDto'];
|
|
577
|
+
};
|
|
578
|
+
};
|
|
579
|
+
responses: {
|
|
580
|
+
200: {
|
|
581
|
+
headers: {
|
|
582
|
+
[name: string]: unknown;
|
|
583
|
+
};
|
|
584
|
+
content: {
|
|
585
|
+
'application/json': components['schemas']['EmailListResponseDto'];
|
|
586
|
+
};
|
|
587
|
+
};
|
|
588
|
+
};
|
|
589
|
+
};
|
|
462
590
|
EmailController_get: {
|
|
463
591
|
parameters: {
|
|
464
592
|
query?: never;
|
package/dist/mail/types.d.ts
CHANGED
|
@@ -9,3 +9,22 @@ export type DraftEmailRequest = components['schemas']['DraftEmailRequestDto'];
|
|
|
9
9
|
export type UpdateEmailRequest = components['schemas']['UpdateEmailRequestDto'];
|
|
10
10
|
export type EmailAddress = components['schemas']['EmailAddressDto'];
|
|
11
11
|
export type ListEmailsQuery = operations['EmailController_list']['parameters']['query'];
|
|
12
|
+
export type SearchFiltersQuery = operations['EmailController_search']['requestBody']['content']['application/json'];
|
|
13
|
+
export type EmailDomainsResponse = components['schemas']['MailDomainDto'][];
|
|
14
|
+
export type SetupMailAccountPayload = {
|
|
15
|
+
address: string;
|
|
16
|
+
domain: string;
|
|
17
|
+
displayName: string;
|
|
18
|
+
password: string;
|
|
19
|
+
keys: {
|
|
20
|
+
publicKey: string;
|
|
21
|
+
encryptionPrivateKey: string;
|
|
22
|
+
recoveryPrivateKey: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export type MailAccountKeysResponse = {
|
|
26
|
+
address: string;
|
|
27
|
+
publicKey: string;
|
|
28
|
+
encryptionPrivateKey: string;
|
|
29
|
+
recoveryPrivateKey: string;
|
|
30
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@internxt/sdk",
|
|
3
3
|
"author": "Internxt <hello@internxt.com>",
|
|
4
|
-
"version": "1.15.
|
|
4
|
+
"version": "1.15.12",
|
|
5
5
|
"description": "An sdk for interacting with Internxt's services",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -51,4 +51,4 @@
|
|
|
51
51
|
"prettier --write"
|
|
52
52
|
]
|
|
53
53
|
}
|
|
54
|
-
}
|
|
54
|
+
}
|