agentmail 0.4.3 → 0.4.4
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/cjs/BaseClient.js +2 -2
- package/dist/cjs/api/resources/domains/client/Client.d.ts +12 -0
- package/dist/cjs/api/resources/domains/client/Client.js +69 -0
- package/dist/cjs/api/resources/domains/types/UpdateDomainRequest.d.ts +4 -0
- package/dist/cjs/api/resources/domains/types/UpdateDomainRequest.js +3 -0
- package/dist/cjs/api/resources/domains/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/domains/types/index.js +1 -0
- package/dist/cjs/api/resources/inboxes/resources/drafts/client/Client.d.ts +9 -9
- package/dist/cjs/api/resources/inboxes/resources/drafts/client/Client.js +50 -50
- package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.d.ts +22 -15
- package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.js +71 -56
- package/dist/cjs/api/resources/lists/client/Client.d.ts +15 -15
- package/dist/cjs/api/resources/lists/client/Client.js +67 -67
- package/dist/cjs/api/resources/messages/types/RawMessageResponse.d.ts +14 -0
- package/dist/cjs/api/resources/messages/types/RawMessageResponse.js +3 -0
- package/dist/cjs/api/resources/messages/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/messages/types/index.js +1 -0
- package/dist/cjs/api/resources/pods/client/Client.d.ts +4 -4
- package/dist/cjs/api/resources/pods/client/Client.js +8 -8
- package/dist/cjs/api/resources/pods/resources/apiKeys/client/Client.d.ts +11 -11
- package/dist/cjs/api/resources/pods/resources/apiKeys/client/Client.js +42 -42
- package/dist/cjs/api/resources/pods/resources/domains/client/Client.d.ts +33 -3
- package/dist/cjs/api/resources/pods/resources/domains/client/Client.js +178 -6
- package/dist/cjs/api/resources/pods/resources/inboxes/client/Client.d.ts +15 -0
- package/dist/cjs/api/resources/pods/resources/inboxes/client/Client.js +72 -0
- package/dist/cjs/api/resources/pods/resources/lists/client/Client.d.ts +16 -16
- package/dist/cjs/api/resources/pods/resources/lists/client/Client.js +67 -67
- package/dist/cjs/api/resources/pods/resources/threads/client/Client.d.ts +15 -0
- package/dist/cjs/api/resources/pods/resources/threads/client/Client.js +61 -0
- package/dist/cjs/api/resources/pods/resources/threads/client/requests/DeleteThreadRequest.d.ts +8 -0
- package/dist/cjs/api/resources/pods/resources/threads/client/requests/DeleteThreadRequest.js +3 -0
- package/dist/cjs/api/resources/pods/resources/threads/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/threads/client/Client.d.ts +14 -0
- package/dist/cjs/api/resources/threads/client/Client.js +60 -0
- package/dist/cjs/api/resources/threads/client/requests/DeleteThreadRequest.d.ts +8 -0
- package/dist/cjs/api/resources/threads/client/requests/DeleteThreadRequest.js +3 -0
- package/dist/cjs/api/resources/threads/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/webhooks/client/Client.d.ts +13 -13
- package/dist/cjs/api/resources/webhooks/client/Client.js +31 -31
- package/dist/cjs/serialization/resources/domains/types/UpdateDomainRequest.d.ts +10 -0
- package/dist/cjs/serialization/resources/domains/types/UpdateDomainRequest.js +42 -0
- package/dist/cjs/serialization/resources/domains/types/index.d.ts +1 -0
- package/dist/cjs/serialization/resources/domains/types/index.js +1 -0
- package/dist/cjs/serialization/resources/messages/types/RawMessageResponse.d.ts +14 -0
- package/dist/cjs/serialization/resources/messages/types/RawMessageResponse.js +46 -0
- package/dist/cjs/serialization/resources/messages/types/index.d.ts +1 -0
- package/dist/cjs/serialization/resources/messages/types/index.js +1 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/api/resources/domains/client/Client.d.mts +12 -0
- package/dist/esm/api/resources/domains/client/Client.mjs +69 -0
- package/dist/esm/api/resources/domains/types/UpdateDomainRequest.d.mts +4 -0
- package/dist/esm/api/resources/domains/types/UpdateDomainRequest.mjs +2 -0
- package/dist/esm/api/resources/domains/types/index.d.mts +1 -0
- package/dist/esm/api/resources/domains/types/index.mjs +1 -0
- package/dist/esm/api/resources/inboxes/resources/drafts/client/Client.d.mts +9 -9
- package/dist/esm/api/resources/inboxes/resources/drafts/client/Client.mjs +50 -50
- package/dist/esm/api/resources/inboxes/resources/messages/client/Client.d.mts +22 -15
- package/dist/esm/api/resources/inboxes/resources/messages/client/Client.mjs +71 -56
- package/dist/esm/api/resources/lists/client/Client.d.mts +15 -15
- package/dist/esm/api/resources/lists/client/Client.mjs +67 -67
- package/dist/esm/api/resources/messages/types/RawMessageResponse.d.mts +14 -0
- package/dist/esm/api/resources/messages/types/RawMessageResponse.mjs +2 -0
- package/dist/esm/api/resources/messages/types/index.d.mts +1 -0
- package/dist/esm/api/resources/messages/types/index.mjs +1 -0
- package/dist/esm/api/resources/pods/client/Client.d.mts +4 -4
- package/dist/esm/api/resources/pods/client/Client.mjs +8 -8
- package/dist/esm/api/resources/pods/resources/apiKeys/client/Client.d.mts +11 -11
- package/dist/esm/api/resources/pods/resources/apiKeys/client/Client.mjs +42 -42
- package/dist/esm/api/resources/pods/resources/domains/client/Client.d.mts +33 -3
- package/dist/esm/api/resources/pods/resources/domains/client/Client.mjs +178 -6
- package/dist/esm/api/resources/pods/resources/inboxes/client/Client.d.mts +15 -0
- package/dist/esm/api/resources/pods/resources/inboxes/client/Client.mjs +72 -0
- package/dist/esm/api/resources/pods/resources/lists/client/Client.d.mts +16 -16
- package/dist/esm/api/resources/pods/resources/lists/client/Client.mjs +67 -67
- package/dist/esm/api/resources/pods/resources/threads/client/Client.d.mts +15 -0
- package/dist/esm/api/resources/pods/resources/threads/client/Client.mjs +61 -0
- package/dist/esm/api/resources/pods/resources/threads/client/requests/DeleteThreadRequest.d.mts +8 -0
- package/dist/esm/api/resources/pods/resources/threads/client/requests/DeleteThreadRequest.mjs +2 -0
- package/dist/esm/api/resources/pods/resources/threads/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/threads/client/Client.d.mts +14 -0
- package/dist/esm/api/resources/threads/client/Client.mjs +60 -0
- package/dist/esm/api/resources/threads/client/requests/DeleteThreadRequest.d.mts +8 -0
- package/dist/esm/api/resources/threads/client/requests/DeleteThreadRequest.mjs +2 -0
- package/dist/esm/api/resources/threads/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/webhooks/client/Client.d.mts +13 -13
- package/dist/esm/api/resources/webhooks/client/Client.mjs +31 -31
- package/dist/esm/serialization/resources/domains/types/UpdateDomainRequest.d.mts +10 -0
- package/dist/esm/serialization/resources/domains/types/UpdateDomainRequest.mjs +6 -0
- package/dist/esm/serialization/resources/domains/types/index.d.mts +1 -0
- package/dist/esm/serialization/resources/domains/types/index.mjs +1 -0
- package/dist/esm/serialization/resources/messages/types/RawMessageResponse.d.mts +14 -0
- package/dist/esm/serialization/resources/messages/types/RawMessageResponse.mjs +10 -0
- package/dist/esm/serialization/resources/messages/types/index.d.mts +1 -0
- package/dist/esm/serialization/resources/messages/types/index.mjs +1 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/dist/llms-full.txt +16825 -11774
- package/dist/llms.txt +94 -25
- package/package.json +1 -1
- package/reference.md +570 -117
|
@@ -269,7 +269,14 @@ class MessagesClient {
|
|
|
269
269
|
});
|
|
270
270
|
}
|
|
271
271
|
/**
|
|
272
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
273
|
+
* @param {AgentMail.MessageId} message_id
|
|
274
|
+
* @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
275
|
+
*
|
|
272
276
|
* @throws {@link AgentMail.NotFoundError}
|
|
277
|
+
*
|
|
278
|
+
* @example
|
|
279
|
+
* await client.inboxes.messages.getRaw("inbox_id", "message_id")
|
|
273
280
|
*/
|
|
274
281
|
getRaw(inbox_id, message_id, requestOptions) {
|
|
275
282
|
return core.HttpResponsePromise.fromPromise(this.__getRaw(inbox_id, message_id, requestOptions));
|
|
@@ -285,7 +292,6 @@ class MessagesClient {
|
|
|
285
292
|
method: "GET",
|
|
286
293
|
headers: _headers,
|
|
287
294
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
288
|
-
responseType: "binary-response",
|
|
289
295
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
290
296
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
291
297
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -293,7 +299,16 @@ class MessagesClient {
|
|
|
293
299
|
logging: this._options.logging,
|
|
294
300
|
});
|
|
295
301
|
if (_response.ok) {
|
|
296
|
-
return {
|
|
302
|
+
return {
|
|
303
|
+
data: serializers.RawMessageResponse.parseOrThrow(_response.body, {
|
|
304
|
+
unrecognizedObjectKeys: "passthrough",
|
|
305
|
+
allowUnrecognizedUnionMembers: true,
|
|
306
|
+
allowUnrecognizedEnumValues: true,
|
|
307
|
+
skipValidation: true,
|
|
308
|
+
breadcrumbsPrefix: ["response"],
|
|
309
|
+
}),
|
|
310
|
+
rawResponse: _response.rawResponse,
|
|
311
|
+
};
|
|
297
312
|
}
|
|
298
313
|
if (_response.error.reason === "status-code") {
|
|
299
314
|
switch (_response.error.statusCode) {
|
|
@@ -318,33 +333,33 @@ class MessagesClient {
|
|
|
318
333
|
}
|
|
319
334
|
/**
|
|
320
335
|
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
321
|
-
* @param {AgentMail.
|
|
336
|
+
* @param {AgentMail.MessageId} message_id
|
|
337
|
+
* @param {AgentMail.UpdateMessageRequest} request
|
|
322
338
|
* @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
323
339
|
*
|
|
324
340
|
* @throws {@link AgentMail.ValidationError}
|
|
325
341
|
* @throws {@link AgentMail.NotFoundError}
|
|
326
|
-
* @throws {@link AgentMail.MessageRejectedError}
|
|
327
342
|
*
|
|
328
343
|
* @example
|
|
329
|
-
* await client.inboxes.messages.
|
|
344
|
+
* await client.inboxes.messages.update("inbox_id", "message_id", {})
|
|
330
345
|
*/
|
|
331
|
-
|
|
332
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
346
|
+
update(inbox_id, message_id, request, requestOptions) {
|
|
347
|
+
return core.HttpResponsePromise.fromPromise(this.__update(inbox_id, message_id, request, requestOptions));
|
|
333
348
|
}
|
|
334
|
-
|
|
349
|
+
__update(inbox_id, message_id, request, requestOptions) {
|
|
335
350
|
return __awaiter(this, void 0, void 0, function* () {
|
|
336
351
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
337
352
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
338
353
|
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
339
354
|
const _response = yield core.fetcher({
|
|
340
355
|
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
|
|
341
|
-
.http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages
|
|
342
|
-
method: "
|
|
356
|
+
.http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(message_id, { omitUndefined: true }))}`),
|
|
357
|
+
method: "PATCH",
|
|
343
358
|
headers: _headers,
|
|
344
359
|
contentType: "application/json",
|
|
345
360
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
346
361
|
requestType: "json",
|
|
347
|
-
body: serializers.
|
|
362
|
+
body: serializers.UpdateMessageRequest.jsonOrThrow(request, {
|
|
348
363
|
unrecognizedObjectKeys: "strip",
|
|
349
364
|
omitUndefined: true,
|
|
350
365
|
}),
|
|
@@ -356,7 +371,7 @@ class MessagesClient {
|
|
|
356
371
|
});
|
|
357
372
|
if (_response.ok) {
|
|
358
373
|
return {
|
|
359
|
-
data: serializers.
|
|
374
|
+
data: serializers.Message.parseOrThrow(_response.body, {
|
|
360
375
|
unrecognizedObjectKeys: "passthrough",
|
|
361
376
|
allowUnrecognizedUnionMembers: true,
|
|
362
377
|
allowUnrecognizedEnumValues: true,
|
|
@@ -384,14 +399,6 @@ class MessagesClient {
|
|
|
384
399
|
skipValidation: true,
|
|
385
400
|
breadcrumbsPrefix: ["response"],
|
|
386
401
|
}), _response.rawResponse);
|
|
387
|
-
case 403:
|
|
388
|
-
throw new AgentMail.MessageRejectedError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
389
|
-
unrecognizedObjectKeys: "passthrough",
|
|
390
|
-
allowUnrecognizedUnionMembers: true,
|
|
391
|
-
allowUnrecognizedEnumValues: true,
|
|
392
|
-
skipValidation: true,
|
|
393
|
-
breadcrumbsPrefix: ["response"],
|
|
394
|
-
}), _response.rawResponse);
|
|
395
402
|
default:
|
|
396
403
|
throw new errors.AgentMailError({
|
|
397
404
|
statusCode: _response.error.statusCode,
|
|
@@ -400,13 +407,12 @@ class MessagesClient {
|
|
|
400
407
|
});
|
|
401
408
|
}
|
|
402
409
|
}
|
|
403
|
-
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "
|
|
410
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PATCH", "/v0/inboxes/{inbox_id}/messages/{message_id}");
|
|
404
411
|
});
|
|
405
412
|
}
|
|
406
413
|
/**
|
|
407
414
|
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
408
|
-
* @param {AgentMail.
|
|
409
|
-
* @param {AgentMail.ReplyToMessageRequest} request
|
|
415
|
+
* @param {AgentMail.SendMessageRequest} request
|
|
410
416
|
* @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
411
417
|
*
|
|
412
418
|
* @throws {@link AgentMail.ValidationError}
|
|
@@ -414,25 +420,25 @@ class MessagesClient {
|
|
|
414
420
|
* @throws {@link AgentMail.MessageRejectedError}
|
|
415
421
|
*
|
|
416
422
|
* @example
|
|
417
|
-
* await client.inboxes.messages.
|
|
423
|
+
* await client.inboxes.messages.send("inbox_id", {})
|
|
418
424
|
*/
|
|
419
|
-
|
|
420
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
425
|
+
send(inbox_id, request, requestOptions) {
|
|
426
|
+
return core.HttpResponsePromise.fromPromise(this.__send(inbox_id, request, requestOptions));
|
|
421
427
|
}
|
|
422
|
-
|
|
428
|
+
__send(inbox_id, request, requestOptions) {
|
|
423
429
|
return __awaiter(this, void 0, void 0, function* () {
|
|
424
430
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
425
431
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
426
432
|
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
427
433
|
const _response = yield core.fetcher({
|
|
428
434
|
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
|
|
429
|
-
.http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages
|
|
435
|
+
.http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/send`),
|
|
430
436
|
method: "POST",
|
|
431
437
|
headers: _headers,
|
|
432
438
|
contentType: "application/json",
|
|
433
439
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
434
440
|
requestType: "json",
|
|
435
|
-
body: serializers.
|
|
441
|
+
body: serializers.SendMessageRequest.jsonOrThrow(request, {
|
|
436
442
|
unrecognizedObjectKeys: "strip",
|
|
437
443
|
omitUndefined: true,
|
|
438
444
|
}),
|
|
@@ -488,13 +494,13 @@ class MessagesClient {
|
|
|
488
494
|
});
|
|
489
495
|
}
|
|
490
496
|
}
|
|
491
|
-
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/messages/
|
|
497
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/messages/send");
|
|
492
498
|
});
|
|
493
499
|
}
|
|
494
500
|
/**
|
|
495
501
|
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
496
502
|
* @param {AgentMail.MessageId} message_id
|
|
497
|
-
* @param {AgentMail.
|
|
503
|
+
* @param {AgentMail.ReplyToMessageRequest} request
|
|
498
504
|
* @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
499
505
|
*
|
|
500
506
|
* @throws {@link AgentMail.ValidationError}
|
|
@@ -502,25 +508,25 @@ class MessagesClient {
|
|
|
502
508
|
* @throws {@link AgentMail.MessageRejectedError}
|
|
503
509
|
*
|
|
504
510
|
* @example
|
|
505
|
-
* await client.inboxes.messages.
|
|
511
|
+
* await client.inboxes.messages.reply("inbox_id", "message_id", {})
|
|
506
512
|
*/
|
|
507
|
-
|
|
508
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
513
|
+
reply(inbox_id, message_id, request, requestOptions) {
|
|
514
|
+
return core.HttpResponsePromise.fromPromise(this.__reply(inbox_id, message_id, request, requestOptions));
|
|
509
515
|
}
|
|
510
|
-
|
|
516
|
+
__reply(inbox_id, message_id, request, requestOptions) {
|
|
511
517
|
return __awaiter(this, void 0, void 0, function* () {
|
|
512
518
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
513
519
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
514
520
|
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
515
521
|
const _response = yield core.fetcher({
|
|
516
522
|
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
|
|
517
|
-
.http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(message_id, { omitUndefined: true }))}/reply
|
|
523
|
+
.http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(message_id, { omitUndefined: true }))}/reply`),
|
|
518
524
|
method: "POST",
|
|
519
525
|
headers: _headers,
|
|
520
526
|
contentType: "application/json",
|
|
521
527
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
522
528
|
requestType: "json",
|
|
523
|
-
body: serializers.
|
|
529
|
+
body: serializers.ReplyToMessageRequest.jsonOrThrow(request, {
|
|
524
530
|
unrecognizedObjectKeys: "strip",
|
|
525
531
|
omitUndefined: true,
|
|
526
532
|
}),
|
|
@@ -576,13 +582,13 @@ class MessagesClient {
|
|
|
576
582
|
});
|
|
577
583
|
}
|
|
578
584
|
}
|
|
579
|
-
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/messages/{message_id}/reply
|
|
585
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/messages/{message_id}/reply");
|
|
580
586
|
});
|
|
581
587
|
}
|
|
582
588
|
/**
|
|
583
589
|
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
584
590
|
* @param {AgentMail.MessageId} message_id
|
|
585
|
-
* @param {AgentMail.
|
|
591
|
+
* @param {AgentMail.ReplyAllMessageRequest} request
|
|
586
592
|
* @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
587
593
|
*
|
|
588
594
|
* @throws {@link AgentMail.ValidationError}
|
|
@@ -590,25 +596,25 @@ class MessagesClient {
|
|
|
590
596
|
* @throws {@link AgentMail.MessageRejectedError}
|
|
591
597
|
*
|
|
592
598
|
* @example
|
|
593
|
-
* await client.inboxes.messages.
|
|
599
|
+
* await client.inboxes.messages.replyAll("inbox_id", "message_id", {})
|
|
594
600
|
*/
|
|
595
|
-
|
|
596
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
601
|
+
replyAll(inbox_id, message_id, request, requestOptions) {
|
|
602
|
+
return core.HttpResponsePromise.fromPromise(this.__replyAll(inbox_id, message_id, request, requestOptions));
|
|
597
603
|
}
|
|
598
|
-
|
|
604
|
+
__replyAll(inbox_id, message_id, request, requestOptions) {
|
|
599
605
|
return __awaiter(this, void 0, void 0, function* () {
|
|
600
606
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
601
607
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
602
608
|
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
603
609
|
const _response = yield core.fetcher({
|
|
604
610
|
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
|
|
605
|
-
.http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(message_id, { omitUndefined: true }))}/
|
|
611
|
+
.http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(message_id, { omitUndefined: true }))}/reply-all`),
|
|
606
612
|
method: "POST",
|
|
607
613
|
headers: _headers,
|
|
608
614
|
contentType: "application/json",
|
|
609
615
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
610
616
|
requestType: "json",
|
|
611
|
-
body: serializers.
|
|
617
|
+
body: serializers.ReplyAllMessageRequest.jsonOrThrow(request, {
|
|
612
618
|
unrecognizedObjectKeys: "strip",
|
|
613
619
|
omitUndefined: true,
|
|
614
620
|
}),
|
|
@@ -664,38 +670,39 @@ class MessagesClient {
|
|
|
664
670
|
});
|
|
665
671
|
}
|
|
666
672
|
}
|
|
667
|
-
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/messages/{message_id}/
|
|
673
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/messages/{message_id}/reply-all");
|
|
668
674
|
});
|
|
669
675
|
}
|
|
670
676
|
/**
|
|
671
677
|
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
672
678
|
* @param {AgentMail.MessageId} message_id
|
|
673
|
-
* @param {AgentMail.
|
|
679
|
+
* @param {AgentMail.SendMessageRequest} request
|
|
674
680
|
* @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
675
681
|
*
|
|
676
682
|
* @throws {@link AgentMail.ValidationError}
|
|
677
683
|
* @throws {@link AgentMail.NotFoundError}
|
|
684
|
+
* @throws {@link AgentMail.MessageRejectedError}
|
|
678
685
|
*
|
|
679
686
|
* @example
|
|
680
|
-
* await client.inboxes.messages.
|
|
687
|
+
* await client.inboxes.messages.forward("inbox_id", "message_id", {})
|
|
681
688
|
*/
|
|
682
|
-
|
|
683
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
689
|
+
forward(inbox_id, message_id, request, requestOptions) {
|
|
690
|
+
return core.HttpResponsePromise.fromPromise(this.__forward(inbox_id, message_id, request, requestOptions));
|
|
684
691
|
}
|
|
685
|
-
|
|
692
|
+
__forward(inbox_id, message_id, request, requestOptions) {
|
|
686
693
|
return __awaiter(this, void 0, void 0, function* () {
|
|
687
694
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
688
695
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
689
696
|
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
690
697
|
const _response = yield core.fetcher({
|
|
691
698
|
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
|
|
692
|
-
.http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(message_id, { omitUndefined: true }))}`),
|
|
693
|
-
method: "
|
|
699
|
+
.http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(message_id, { omitUndefined: true }))}/forward`),
|
|
700
|
+
method: "POST",
|
|
694
701
|
headers: _headers,
|
|
695
702
|
contentType: "application/json",
|
|
696
703
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
697
704
|
requestType: "json",
|
|
698
|
-
body: serializers.
|
|
705
|
+
body: serializers.SendMessageRequest.jsonOrThrow(request, {
|
|
699
706
|
unrecognizedObjectKeys: "strip",
|
|
700
707
|
omitUndefined: true,
|
|
701
708
|
}),
|
|
@@ -707,7 +714,7 @@ class MessagesClient {
|
|
|
707
714
|
});
|
|
708
715
|
if (_response.ok) {
|
|
709
716
|
return {
|
|
710
|
-
data: serializers.
|
|
717
|
+
data: serializers.SendMessageResponse.parseOrThrow(_response.body, {
|
|
711
718
|
unrecognizedObjectKeys: "passthrough",
|
|
712
719
|
allowUnrecognizedUnionMembers: true,
|
|
713
720
|
allowUnrecognizedEnumValues: true,
|
|
@@ -735,6 +742,14 @@ class MessagesClient {
|
|
|
735
742
|
skipValidation: true,
|
|
736
743
|
breadcrumbsPrefix: ["response"],
|
|
737
744
|
}), _response.rawResponse);
|
|
745
|
+
case 403:
|
|
746
|
+
throw new AgentMail.MessageRejectedError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
747
|
+
unrecognizedObjectKeys: "passthrough",
|
|
748
|
+
allowUnrecognizedUnionMembers: true,
|
|
749
|
+
allowUnrecognizedEnumValues: true,
|
|
750
|
+
skipValidation: true,
|
|
751
|
+
breadcrumbsPrefix: ["response"],
|
|
752
|
+
}), _response.rawResponse);
|
|
738
753
|
default:
|
|
739
754
|
throw new errors.AgentMailError({
|
|
740
755
|
statusCode: _response.error.statusCode,
|
|
@@ -743,7 +758,7 @@ class MessagesClient {
|
|
|
743
758
|
});
|
|
744
759
|
}
|
|
745
760
|
}
|
|
746
|
-
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "
|
|
761
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/messages/{message_id}/forward");
|
|
747
762
|
});
|
|
748
763
|
}
|
|
749
764
|
}
|
|
@@ -10,21 +10,6 @@ export declare namespace ListsClient {
|
|
|
10
10
|
export declare class ListsClient {
|
|
11
11
|
protected readonly _options: NormalizedClientOptionsWithAuth<ListsClient.Options>;
|
|
12
12
|
constructor(options?: ListsClient.Options);
|
|
13
|
-
/**
|
|
14
|
-
* @param {AgentMail.Direction} direction
|
|
15
|
-
* @param {AgentMail.ListType} type
|
|
16
|
-
* @param {AgentMail.CreateListEntryRequest} request
|
|
17
|
-
* @param {ListsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
18
|
-
*
|
|
19
|
-
* @throws {@link AgentMail.ValidationError}
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* await client.lists.create("send", "allow", {
|
|
23
|
-
* entry: "entry"
|
|
24
|
-
* })
|
|
25
|
-
*/
|
|
26
|
-
create(direction: AgentMail.Direction, type: AgentMail.ListType, request: AgentMail.CreateListEntryRequest, requestOptions?: ListsClient.RequestOptions): core.HttpResponsePromise<AgentMail.ListEntry>;
|
|
27
|
-
private __create;
|
|
28
13
|
/**
|
|
29
14
|
* @param {AgentMail.Direction} direction
|
|
30
15
|
* @param {AgentMail.ListType} type
|
|
@@ -49,6 +34,21 @@ export declare class ListsClient {
|
|
|
49
34
|
*/
|
|
50
35
|
get(direction: AgentMail.Direction, type: AgentMail.ListType, entry: string, requestOptions?: ListsClient.RequestOptions): core.HttpResponsePromise<AgentMail.ListEntry>;
|
|
51
36
|
private __get;
|
|
37
|
+
/**
|
|
38
|
+
* @param {AgentMail.Direction} direction
|
|
39
|
+
* @param {AgentMail.ListType} type
|
|
40
|
+
* @param {AgentMail.CreateListEntryRequest} request
|
|
41
|
+
* @param {ListsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
42
|
+
*
|
|
43
|
+
* @throws {@link AgentMail.ValidationError}
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* await client.lists.create("send", "allow", {
|
|
47
|
+
* entry: "entry"
|
|
48
|
+
* })
|
|
49
|
+
*/
|
|
50
|
+
create(direction: AgentMail.Direction, type: AgentMail.ListType, request: AgentMail.CreateListEntryRequest, requestOptions?: ListsClient.RequestOptions): core.HttpResponsePromise<AgentMail.ListEntry>;
|
|
51
|
+
private __create;
|
|
52
52
|
/**
|
|
53
53
|
* @param {AgentMail.Direction} direction
|
|
54
54
|
* @param {AgentMail.ListType} type
|
|
@@ -59,36 +59,31 @@ class ListsClient {
|
|
|
59
59
|
/**
|
|
60
60
|
* @param {AgentMail.Direction} direction
|
|
61
61
|
* @param {AgentMail.ListType} type
|
|
62
|
-
* @param {AgentMail.
|
|
62
|
+
* @param {AgentMail.ListListEntriesRequest} request
|
|
63
63
|
* @param {ListsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
64
64
|
*
|
|
65
|
-
* @throws {@link AgentMail.ValidationError}
|
|
66
|
-
*
|
|
67
65
|
* @example
|
|
68
|
-
* await client.lists.
|
|
69
|
-
* entry: "entry"
|
|
70
|
-
* })
|
|
66
|
+
* await client.lists.list("send", "allow")
|
|
71
67
|
*/
|
|
72
|
-
|
|
73
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
68
|
+
list(direction, type, request = {}, requestOptions) {
|
|
69
|
+
return core.HttpResponsePromise.fromPromise(this.__list(direction, type, request, requestOptions));
|
|
74
70
|
}
|
|
75
|
-
|
|
76
|
-
return __awaiter(this,
|
|
71
|
+
__list(direction_1, type_1) {
|
|
72
|
+
return __awaiter(this, arguments, void 0, function* (direction, type, request = {}, requestOptions) {
|
|
77
73
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
74
|
+
const { limit, pageToken } = request;
|
|
75
|
+
const _queryParams = {
|
|
76
|
+
limit,
|
|
77
|
+
page_token: pageToken,
|
|
78
|
+
};
|
|
78
79
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
79
80
|
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
80
81
|
const _response = yield core.fetcher({
|
|
81
82
|
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
|
|
82
83
|
.http, `/v0/lists/${core.url.encodePathParam(serializers.Direction.jsonOrThrow(direction, { omitUndefined: true }))}/${core.url.encodePathParam(serializers.ListType.jsonOrThrow(type, { omitUndefined: true }))}`),
|
|
83
|
-
method: "
|
|
84
|
+
method: "GET",
|
|
84
85
|
headers: _headers,
|
|
85
|
-
|
|
86
|
-
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
87
|
-
requestType: "json",
|
|
88
|
-
body: serializers.CreateListEntryRequest.jsonOrThrow(request, {
|
|
89
|
-
unrecognizedObjectKeys: "strip",
|
|
90
|
-
omitUndefined: true,
|
|
91
|
-
}),
|
|
86
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
92
87
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
93
88
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
94
89
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -97,7 +92,7 @@ class ListsClient {
|
|
|
97
92
|
});
|
|
98
93
|
if (_response.ok) {
|
|
99
94
|
return {
|
|
100
|
-
data: serializers.
|
|
95
|
+
data: serializers.ListListEntriesResponse.parseOrThrow(_response.body, {
|
|
101
96
|
unrecognizedObjectKeys: "passthrough",
|
|
102
97
|
allowUnrecognizedUnionMembers: true,
|
|
103
98
|
allowUnrecognizedEnumValues: true,
|
|
@@ -108,54 +103,40 @@ class ListsClient {
|
|
|
108
103
|
};
|
|
109
104
|
}
|
|
110
105
|
if (_response.error.reason === "status-code") {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
allowUnrecognizedEnumValues: true,
|
|
117
|
-
skipValidation: true,
|
|
118
|
-
breadcrumbsPrefix: ["response"],
|
|
119
|
-
}), _response.rawResponse);
|
|
120
|
-
default:
|
|
121
|
-
throw new errors.AgentMailError({
|
|
122
|
-
statusCode: _response.error.statusCode,
|
|
123
|
-
body: _response.error.body,
|
|
124
|
-
rawResponse: _response.rawResponse,
|
|
125
|
-
});
|
|
126
|
-
}
|
|
106
|
+
throw new errors.AgentMailError({
|
|
107
|
+
statusCode: _response.error.statusCode,
|
|
108
|
+
body: _response.error.body,
|
|
109
|
+
rawResponse: _response.rawResponse,
|
|
110
|
+
});
|
|
127
111
|
}
|
|
128
|
-
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "
|
|
112
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v0/lists/{direction}/{type}");
|
|
129
113
|
});
|
|
130
114
|
}
|
|
131
115
|
/**
|
|
132
116
|
* @param {AgentMail.Direction} direction
|
|
133
117
|
* @param {AgentMail.ListType} type
|
|
134
|
-
* @param {
|
|
118
|
+
* @param {string} entry - Email address or domain.
|
|
135
119
|
* @param {ListsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
136
120
|
*
|
|
121
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
122
|
+
*
|
|
137
123
|
* @example
|
|
138
|
-
* await client.lists.
|
|
124
|
+
* await client.lists.get("send", "allow", "entry")
|
|
139
125
|
*/
|
|
140
|
-
|
|
141
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
126
|
+
get(direction, type, entry, requestOptions) {
|
|
127
|
+
return core.HttpResponsePromise.fromPromise(this.__get(direction, type, entry, requestOptions));
|
|
142
128
|
}
|
|
143
|
-
|
|
144
|
-
return __awaiter(this,
|
|
129
|
+
__get(direction, type, entry, requestOptions) {
|
|
130
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
145
131
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
146
|
-
const { limit, pageToken } = request;
|
|
147
|
-
const _queryParams = {
|
|
148
|
-
limit,
|
|
149
|
-
page_token: pageToken,
|
|
150
|
-
};
|
|
151
132
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
152
133
|
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
153
134
|
const _response = yield core.fetcher({
|
|
154
135
|
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
|
|
155
|
-
.http, `/v0/lists/${core.url.encodePathParam(serializers.Direction.jsonOrThrow(direction, { omitUndefined: true }))}/${core.url.encodePathParam(serializers.ListType.jsonOrThrow(type, { omitUndefined: true }))}`),
|
|
136
|
+
.http, `/v0/lists/${core.url.encodePathParam(serializers.Direction.jsonOrThrow(direction, { omitUndefined: true }))}/${core.url.encodePathParam(serializers.ListType.jsonOrThrow(type, { omitUndefined: true }))}/${core.url.encodePathParam(entry)}`),
|
|
156
137
|
method: "GET",
|
|
157
138
|
headers: _headers,
|
|
158
|
-
queryParameters:
|
|
139
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
159
140
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
160
141
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
161
142
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -164,7 +145,7 @@ class ListsClient {
|
|
|
164
145
|
});
|
|
165
146
|
if (_response.ok) {
|
|
166
147
|
return {
|
|
167
|
-
data: serializers.
|
|
148
|
+
data: serializers.ListEntry.parseOrThrow(_response.body, {
|
|
168
149
|
unrecognizedObjectKeys: "passthrough",
|
|
169
150
|
allowUnrecognizedUnionMembers: true,
|
|
170
151
|
allowUnrecognizedEnumValues: true,
|
|
@@ -175,40 +156,59 @@ class ListsClient {
|
|
|
175
156
|
};
|
|
176
157
|
}
|
|
177
158
|
if (_response.error.reason === "status-code") {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
159
|
+
switch (_response.error.statusCode) {
|
|
160
|
+
case 404:
|
|
161
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
162
|
+
unrecognizedObjectKeys: "passthrough",
|
|
163
|
+
allowUnrecognizedUnionMembers: true,
|
|
164
|
+
allowUnrecognizedEnumValues: true,
|
|
165
|
+
skipValidation: true,
|
|
166
|
+
breadcrumbsPrefix: ["response"],
|
|
167
|
+
}), _response.rawResponse);
|
|
168
|
+
default:
|
|
169
|
+
throw new errors.AgentMailError({
|
|
170
|
+
statusCode: _response.error.statusCode,
|
|
171
|
+
body: _response.error.body,
|
|
172
|
+
rawResponse: _response.rawResponse,
|
|
173
|
+
});
|
|
174
|
+
}
|
|
183
175
|
}
|
|
184
|
-
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v0/lists/{direction}/{type}");
|
|
176
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v0/lists/{direction}/{type}/{entry}");
|
|
185
177
|
});
|
|
186
178
|
}
|
|
187
179
|
/**
|
|
188
180
|
* @param {AgentMail.Direction} direction
|
|
189
181
|
* @param {AgentMail.ListType} type
|
|
190
|
-
* @param {
|
|
182
|
+
* @param {AgentMail.CreateListEntryRequest} request
|
|
191
183
|
* @param {ListsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
192
184
|
*
|
|
193
|
-
* @throws {@link AgentMail.
|
|
185
|
+
* @throws {@link AgentMail.ValidationError}
|
|
194
186
|
*
|
|
195
187
|
* @example
|
|
196
|
-
* await client.lists.
|
|
188
|
+
* await client.lists.create("send", "allow", {
|
|
189
|
+
* entry: "entry"
|
|
190
|
+
* })
|
|
197
191
|
*/
|
|
198
|
-
|
|
199
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
192
|
+
create(direction, type, request, requestOptions) {
|
|
193
|
+
return core.HttpResponsePromise.fromPromise(this.__create(direction, type, request, requestOptions));
|
|
200
194
|
}
|
|
201
|
-
|
|
195
|
+
__create(direction, type, request, requestOptions) {
|
|
202
196
|
return __awaiter(this, void 0, void 0, function* () {
|
|
203
197
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
204
198
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
205
199
|
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
206
200
|
const _response = yield core.fetcher({
|
|
207
201
|
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
|
|
208
|
-
.http, `/v0/lists/${core.url.encodePathParam(serializers.Direction.jsonOrThrow(direction, { omitUndefined: true }))}/${core.url.encodePathParam(serializers.ListType.jsonOrThrow(type, { omitUndefined: true }))}
|
|
209
|
-
method: "
|
|
202
|
+
.http, `/v0/lists/${core.url.encodePathParam(serializers.Direction.jsonOrThrow(direction, { omitUndefined: true }))}/${core.url.encodePathParam(serializers.ListType.jsonOrThrow(type, { omitUndefined: true }))}`),
|
|
203
|
+
method: "POST",
|
|
210
204
|
headers: _headers,
|
|
205
|
+
contentType: "application/json",
|
|
211
206
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
207
|
+
requestType: "json",
|
|
208
|
+
body: serializers.CreateListEntryRequest.jsonOrThrow(request, {
|
|
209
|
+
unrecognizedObjectKeys: "strip",
|
|
210
|
+
omitUndefined: true,
|
|
211
|
+
}),
|
|
212
212
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
213
213
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
214
214
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -229,8 +229,8 @@ class ListsClient {
|
|
|
229
229
|
}
|
|
230
230
|
if (_response.error.reason === "status-code") {
|
|
231
231
|
switch (_response.error.statusCode) {
|
|
232
|
-
case
|
|
233
|
-
throw new AgentMail.
|
|
232
|
+
case 400:
|
|
233
|
+
throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
|
|
234
234
|
unrecognizedObjectKeys: "passthrough",
|
|
235
235
|
allowUnrecognizedUnionMembers: true,
|
|
236
236
|
allowUnrecognizedEnumValues: true,
|
|
@@ -245,7 +245,7 @@ class ListsClient {
|
|
|
245
245
|
});
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
|
-
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "
|
|
248
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/lists/{direction}/{type}");
|
|
249
249
|
});
|
|
250
250
|
}
|
|
251
251
|
/**
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type * as AgentMail from "../../../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Signed URL to download the raw .eml file. Uses CloudFront signing, same as attachments.
|
|
4
|
+
*/
|
|
5
|
+
export interface RawMessageResponse {
|
|
6
|
+
/** ID of the message. */
|
|
7
|
+
messageId: AgentMail.MessageId;
|
|
8
|
+
/** Size of the raw message in bytes. */
|
|
9
|
+
size: AgentMail.MessageSize;
|
|
10
|
+
/** Pre-signed CloudFront URL to download the raw message. Expires at expires_at. */
|
|
11
|
+
downloadUrl: string;
|
|
12
|
+
/** Time at which the download URL expires. */
|
|
13
|
+
expiresAt: Date;
|
|
14
|
+
}
|