agentmail 0.0.22 → 0.0.23
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/api/resources/inboxes/client/Client.js +3 -3
- package/api/resources/index.d.ts +1 -0
- package/api/resources/index.js +1 -0
- package/api/resources/messages/client/Client.d.ts +2 -0
- package/api/resources/messages/client/Client.js +26 -12
- package/api/resources/messages/client/requests/ListMessagesRequest.d.ts +1 -2
- package/api/resources/messages/errors/MessageRejectedError.d.ts +8 -0
- package/{dist/serialization/resources/webhooks/types/Payload.js → api/resources/messages/errors/MessageRejectedError.js} +13 -8
- package/api/resources/messages/errors/index.d.ts +1 -0
- package/api/resources/messages/errors/index.js +17 -0
- package/api/resources/messages/index.d.ts +1 -0
- package/api/resources/messages/index.js +1 -0
- package/api/resources/messages/types/SendMessageResponse.d.ts +1 -0
- package/api/resources/threads/client/Client.js +7 -9
- package/api/resources/threads/client/requests/ListThreadsRequest.d.ts +1 -2
- package/api/resources/webhooks/client/Client.js +4 -4
- package/api/resources/webhooks/types/MessageReceivedPayload.d.ts +3 -1
- package/api/resources/webhooks/types/index.d.ts +0 -1
- package/api/resources/webhooks/types/index.js +0 -1
- package/api/types/{Sent.d.ts → Labels.d.ts} +2 -2
- package/api/types/index.d.ts +1 -2
- package/api/types/index.js +1 -2
- package/dist/api/resources/inboxes/client/Client.js +3 -3
- package/dist/api/resources/index.d.ts +1 -0
- package/dist/api/resources/index.js +1 -0
- package/dist/api/resources/messages/client/Client.d.ts +2 -0
- package/dist/api/resources/messages/client/Client.js +26 -12
- package/dist/api/resources/messages/client/requests/ListMessagesRequest.d.ts +1 -2
- package/dist/api/resources/messages/errors/MessageRejectedError.d.ts +8 -0
- package/dist/{serialization/types/Sent.js → api/resources/messages/errors/MessageRejectedError.js} +13 -3
- package/dist/api/resources/messages/errors/index.d.ts +1 -0
- package/dist/api/resources/messages/errors/index.js +17 -0
- package/dist/api/resources/messages/index.d.ts +1 -0
- package/dist/api/resources/messages/index.js +1 -0
- package/dist/api/resources/messages/types/SendMessageResponse.d.ts +1 -0
- package/dist/api/resources/threads/client/Client.js +7 -9
- package/dist/api/resources/threads/client/requests/ListThreadsRequest.d.ts +1 -2
- package/dist/api/resources/webhooks/client/Client.js +4 -4
- package/dist/api/resources/webhooks/types/MessageReceivedPayload.d.ts +3 -1
- package/dist/api/resources/webhooks/types/index.d.ts +0 -1
- package/dist/api/resources/webhooks/types/index.js +0 -1
- package/dist/api/types/{Sent.d.ts → Labels.d.ts} +2 -2
- package/dist/api/types/index.d.ts +1 -2
- package/dist/api/types/index.js +1 -2
- package/dist/serialization/resources/messages/types/SendMessageResponse.d.ts +2 -0
- package/dist/serialization/resources/messages/types/SendMessageResponse.js +2 -0
- package/dist/serialization/resources/webhooks/types/MessageReceivedPayload.d.ts +5 -2
- package/dist/serialization/resources/webhooks/types/MessageReceivedPayload.js +6 -5
- package/dist/serialization/resources/webhooks/types/index.d.ts +0 -1
- package/dist/serialization/resources/webhooks/types/index.js +0 -1
- package/{serialization/types/Sent.d.ts → dist/serialization/types/Labels.d.ts} +3 -3
- package/{serialization/types/Received.js → dist/serialization/types/Labels.js} +2 -2
- package/dist/serialization/types/index.d.ts +1 -2
- package/dist/serialization/types/index.js +1 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/serialization/resources/messages/types/SendMessageResponse.d.ts +2 -0
- package/serialization/resources/messages/types/SendMessageResponse.js +2 -0
- package/serialization/resources/webhooks/types/MessageReceivedPayload.d.ts +5 -2
- package/serialization/resources/webhooks/types/MessageReceivedPayload.js +6 -5
- package/serialization/resources/webhooks/types/index.d.ts +0 -1
- package/serialization/resources/webhooks/types/index.js +0 -1
- package/{dist/serialization/types/Sent.d.ts → serialization/types/Labels.d.ts} +3 -3
- package/{dist/serialization/types/Received.js → serialization/types/Labels.js} +2 -2
- package/serialization/types/index.d.ts +1 -2
- package/serialization/types/index.js +1 -2
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/api/resources/webhooks/types/Payload.d.ts +0 -8
- package/api/types/Received.d.ts +0 -7
- package/api/types/Sent.js +0 -5
- package/dist/api/resources/webhooks/types/Payload.d.ts +0 -8
- package/dist/api/resources/webhooks/types/Payload.js +0 -5
- package/dist/api/types/Received.d.ts +0 -7
- package/dist/api/types/Received.js +0 -5
- package/dist/api/types/Sent.js +0 -5
- package/dist/serialization/resources/webhooks/types/Payload.d.ts +0 -15
- package/dist/serialization/types/Received.d.ts +0 -10
- package/serialization/resources/webhooks/types/Payload.d.ts +0 -15
- package/serialization/resources/webhooks/types/Payload.js +0 -46
- package/serialization/types/Received.d.ts +0 -10
- package/serialization/types/Sent.js +0 -41
- /package/api/{resources/webhooks/types/Payload.js → types/Labels.js} +0 -0
- /package/{api/types/Received.js → dist/api/types/Labels.js} +0 -0
|
@@ -53,6 +53,7 @@ const environments = __importStar(require("../../../../environments"));
|
|
|
53
53
|
const core = __importStar(require("../../../../core"));
|
|
54
54
|
const AgentMail = __importStar(require("../../../index"));
|
|
55
55
|
const serializers = __importStar(require("../../../../serialization/index"));
|
|
56
|
+
const json_1 = require("../../../../core/json");
|
|
56
57
|
const url_join_1 = __importDefault(require("url-join"));
|
|
57
58
|
const errors = __importStar(require("../../../../errors/index"));
|
|
58
59
|
class Messages {
|
|
@@ -74,24 +75,21 @@ class Messages {
|
|
|
74
75
|
list(inboxId_1) {
|
|
75
76
|
return __awaiter(this, arguments, void 0, function* (inboxId, request = {}, requestOptions) {
|
|
76
77
|
var _a, _b;
|
|
77
|
-
const {
|
|
78
|
+
const { limit, lastKey, labels } = request;
|
|
78
79
|
const _queryParams = {};
|
|
79
|
-
if (received != null) {
|
|
80
|
-
_queryParams["received"] = received.toString();
|
|
81
|
-
}
|
|
82
|
-
if (sent != null) {
|
|
83
|
-
_queryParams["sent"] = sent.toString();
|
|
84
|
-
}
|
|
85
80
|
if (limit != null) {
|
|
86
81
|
_queryParams["limit"] = limit.toString();
|
|
87
82
|
}
|
|
88
83
|
if (lastKey != null) {
|
|
89
84
|
_queryParams["last_key"] = lastKey;
|
|
90
85
|
}
|
|
86
|
+
if (labels != null) {
|
|
87
|
+
_queryParams["labels"] = (0, json_1.toJson)(serializers.Labels.jsonOrThrow(labels, { unrecognizedObjectKeys: "strip" }));
|
|
88
|
+
}
|
|
91
89
|
const _response = yield core.fetcher({
|
|
92
90
|
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Production, `/v0/inboxes/${encodeURIComponent(serializers.InboxId.jsonOrThrow(inboxId))}/messages`),
|
|
93
91
|
method: "GET",
|
|
94
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.
|
|
92
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.23", "User-Agent": "agentmail/0.0.23", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
95
93
|
contentType: "application/json",
|
|
96
94
|
queryParameters: _queryParams,
|
|
97
95
|
requestType: "json",
|
|
@@ -154,7 +152,7 @@ class Messages {
|
|
|
154
152
|
const _response = yield core.fetcher({
|
|
155
153
|
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Production, `/v0/inboxes/${encodeURIComponent(serializers.InboxId.jsonOrThrow(inboxId))}/messages/${encodeURIComponent(serializers.MessageId.jsonOrThrow(messageId))}`),
|
|
156
154
|
method: "GET",
|
|
157
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.
|
|
155
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.23", "User-Agent": "agentmail/0.0.23", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
158
156
|
contentType: "application/json",
|
|
159
157
|
requestType: "json",
|
|
160
158
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -209,7 +207,7 @@ class Messages {
|
|
|
209
207
|
const _response = yield core.fetcher({
|
|
210
208
|
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Production, `/v0/inboxes/${encodeURIComponent(serializers.InboxId.jsonOrThrow(inboxId))}/messages/${encodeURIComponent(serializers.MessageId.jsonOrThrow(messageId))}/attachments/${encodeURIComponent(serializers.AttachmentId.jsonOrThrow(attachmentId))}`),
|
|
211
209
|
method: "GET",
|
|
212
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.
|
|
210
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.23", "User-Agent": "agentmail/0.0.23", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
213
211
|
contentType: "application/json",
|
|
214
212
|
requestType: "json",
|
|
215
213
|
responseType: "streaming",
|
|
@@ -258,6 +256,7 @@ class Messages {
|
|
|
258
256
|
*
|
|
259
257
|
* @throws {@link AgentMail.NotFoundError}
|
|
260
258
|
* @throws {@link AgentMail.ValidationError}
|
|
259
|
+
* @throws {@link AgentMail.MessageRejectedError}
|
|
261
260
|
*
|
|
262
261
|
* @example
|
|
263
262
|
* await client.messages.send("yourinbox@agentmail.to", {
|
|
@@ -275,7 +274,7 @@ class Messages {
|
|
|
275
274
|
const _response = yield core.fetcher({
|
|
276
275
|
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Production, `/v0/inboxes/${encodeURIComponent(serializers.InboxId.jsonOrThrow(inboxId))}/messages/send`),
|
|
277
276
|
method: "POST",
|
|
278
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.
|
|
277
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.23", "User-Agent": "agentmail/0.0.23", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
279
278
|
contentType: "application/json",
|
|
280
279
|
requestType: "json",
|
|
281
280
|
body: serializers.SendMessageRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -307,6 +306,13 @@ class Messages {
|
|
|
307
306
|
allowUnrecognizedEnumValues: true,
|
|
308
307
|
breadcrumbsPrefix: ["response"],
|
|
309
308
|
}));
|
|
309
|
+
case 403:
|
|
310
|
+
throw new AgentMail.MessageRejectedError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
311
|
+
unrecognizedObjectKeys: "passthrough",
|
|
312
|
+
allowUnrecognizedUnionMembers: true,
|
|
313
|
+
allowUnrecognizedEnumValues: true,
|
|
314
|
+
breadcrumbsPrefix: ["response"],
|
|
315
|
+
}));
|
|
310
316
|
default:
|
|
311
317
|
throw new errors.AgentMailError({
|
|
312
318
|
statusCode: _response.error.statusCode,
|
|
@@ -337,6 +343,7 @@ class Messages {
|
|
|
337
343
|
*
|
|
338
344
|
* @throws {@link AgentMail.NotFoundError}
|
|
339
345
|
* @throws {@link AgentMail.ValidationError}
|
|
346
|
+
* @throws {@link AgentMail.MessageRejectedError}
|
|
340
347
|
*
|
|
341
348
|
* @example
|
|
342
349
|
* await client.messages.reply("yourinbox@agentmail.to", "msg_123", {
|
|
@@ -352,7 +359,7 @@ class Messages {
|
|
|
352
359
|
const _response = yield core.fetcher({
|
|
353
360
|
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Production, `/v0/inboxes/${encodeURIComponent(serializers.InboxId.jsonOrThrow(inboxId))}/messages/${encodeURIComponent(serializers.MessageId.jsonOrThrow(messageId))}/reply`),
|
|
354
361
|
method: "POST",
|
|
355
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.
|
|
362
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.23", "User-Agent": "agentmail/0.0.23", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
356
363
|
contentType: "application/json",
|
|
357
364
|
requestType: "json",
|
|
358
365
|
body: serializers.ReplyToMessageRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -384,6 +391,13 @@ class Messages {
|
|
|
384
391
|
allowUnrecognizedEnumValues: true,
|
|
385
392
|
breadcrumbsPrefix: ["response"],
|
|
386
393
|
}));
|
|
394
|
+
case 403:
|
|
395
|
+
throw new AgentMail.MessageRejectedError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
396
|
+
unrecognizedObjectKeys: "passthrough",
|
|
397
|
+
allowUnrecognizedUnionMembers: true,
|
|
398
|
+
allowUnrecognizedEnumValues: true,
|
|
399
|
+
breadcrumbsPrefix: ["response"],
|
|
400
|
+
}));
|
|
387
401
|
default:
|
|
388
402
|
throw new errors.AgentMailError({
|
|
389
403
|
statusCode: _response.error.statusCode,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as errors from "../../../../errors/index";
|
|
5
|
+
import * as AgentMail from "../../../index";
|
|
6
|
+
export declare class MessageRejectedError extends errors.AgentMailError {
|
|
7
|
+
constructor(body: AgentMail.ErrorResponse);
|
|
8
|
+
}
|
package/dist/{serialization/types/Sent.js → api/resources/messages/errors/MessageRejectedError.js}
RENAMED
|
@@ -36,6 +36,16 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
};
|
|
37
37
|
})();
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
40
|
-
const
|
|
41
|
-
|
|
39
|
+
exports.MessageRejectedError = void 0;
|
|
40
|
+
const errors = __importStar(require("../../../../errors/index"));
|
|
41
|
+
class MessageRejectedError extends errors.AgentMailError {
|
|
42
|
+
constructor(body) {
|
|
43
|
+
super({
|
|
44
|
+
message: "MessageRejectedError",
|
|
45
|
+
statusCode: 403,
|
|
46
|
+
body: body,
|
|
47
|
+
});
|
|
48
|
+
Object.setPrototypeOf(this, MessageRejectedError.prototype);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.MessageRejectedError = MessageRejectedError;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./MessageRejectedError";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./MessageRejectedError"), exports);
|
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./types"), exports);
|
|
18
|
+
__exportStar(require("./errors"), exports);
|
|
18
19
|
__exportStar(require("./client"), exports);
|
|
@@ -53,6 +53,7 @@ const environments = __importStar(require("../../../../environments"));
|
|
|
53
53
|
const core = __importStar(require("../../../../core"));
|
|
54
54
|
const AgentMail = __importStar(require("../../../index"));
|
|
55
55
|
const serializers = __importStar(require("../../../../serialization/index"));
|
|
56
|
+
const json_1 = require("../../../../core/json");
|
|
56
57
|
const url_join_1 = __importDefault(require("url-join"));
|
|
57
58
|
const errors = __importStar(require("../../../../errors/index"));
|
|
58
59
|
class Threads {
|
|
@@ -74,24 +75,21 @@ class Threads {
|
|
|
74
75
|
list(inboxId_1) {
|
|
75
76
|
return __awaiter(this, arguments, void 0, function* (inboxId, request = {}, requestOptions) {
|
|
76
77
|
var _a, _b;
|
|
77
|
-
const {
|
|
78
|
+
const { limit, lastKey, labels } = request;
|
|
78
79
|
const _queryParams = {};
|
|
79
|
-
if (received != null) {
|
|
80
|
-
_queryParams["received"] = received.toString();
|
|
81
|
-
}
|
|
82
|
-
if (sent != null) {
|
|
83
|
-
_queryParams["sent"] = sent.toString();
|
|
84
|
-
}
|
|
85
80
|
if (limit != null) {
|
|
86
81
|
_queryParams["limit"] = limit.toString();
|
|
87
82
|
}
|
|
88
83
|
if (lastKey != null) {
|
|
89
84
|
_queryParams["last_key"] = lastKey;
|
|
90
85
|
}
|
|
86
|
+
if (labels != null) {
|
|
87
|
+
_queryParams["labels"] = (0, json_1.toJson)(serializers.Labels.jsonOrThrow(labels, { unrecognizedObjectKeys: "strip" }));
|
|
88
|
+
}
|
|
91
89
|
const _response = yield core.fetcher({
|
|
92
90
|
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Production, `/v0/inboxes/${encodeURIComponent(serializers.InboxId.jsonOrThrow(inboxId))}/threads`),
|
|
93
91
|
method: "GET",
|
|
94
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.
|
|
92
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.23", "User-Agent": "agentmail/0.0.23", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
95
93
|
contentType: "application/json",
|
|
96
94
|
queryParameters: _queryParams,
|
|
97
95
|
requestType: "json",
|
|
@@ -154,7 +152,7 @@ class Threads {
|
|
|
154
152
|
const _response = yield core.fetcher({
|
|
155
153
|
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Production, `/v0/inboxes/${encodeURIComponent(serializers.InboxId.jsonOrThrow(inboxId))}/threads/${encodeURIComponent(serializers.ThreadId.jsonOrThrow(threadId))}`),
|
|
156
154
|
method: "GET",
|
|
157
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.
|
|
155
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.23", "User-Agent": "agentmail/0.0.23", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
158
156
|
contentType: "application/json",
|
|
159
157
|
requestType: "json",
|
|
160
158
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -80,7 +80,7 @@ class Webhooks {
|
|
|
80
80
|
const _response = yield core.fetcher({
|
|
81
81
|
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Production, "/v0/webhooks"),
|
|
82
82
|
method: "GET",
|
|
83
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.
|
|
83
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.23", "User-Agent": "agentmail/0.0.23", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
84
84
|
contentType: "application/json",
|
|
85
85
|
queryParameters: _queryParams,
|
|
86
86
|
requestType: "json",
|
|
@@ -132,7 +132,7 @@ class Webhooks {
|
|
|
132
132
|
const _response = yield core.fetcher({
|
|
133
133
|
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Production, `/v0/webhooks/${encodeURIComponent(serializers.WebhookId.jsonOrThrow(webhookId))}`),
|
|
134
134
|
method: "GET",
|
|
135
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.
|
|
135
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.23", "User-Agent": "agentmail/0.0.23", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
136
136
|
contentType: "application/json",
|
|
137
137
|
requestType: "json",
|
|
138
138
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -197,7 +197,7 @@ class Webhooks {
|
|
|
197
197
|
const _response = yield core.fetcher({
|
|
198
198
|
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Production, "/v0/webhooks"),
|
|
199
199
|
method: "POST",
|
|
200
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.
|
|
200
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.23", "User-Agent": "agentmail/0.0.23", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
201
201
|
contentType: "application/json",
|
|
202
202
|
requestType: "json",
|
|
203
203
|
body: serializers.CreateWebhookRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -259,7 +259,7 @@ class Webhooks {
|
|
|
259
259
|
const _response = yield core.fetcher({
|
|
260
260
|
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Production, `/v0/webhooks/${encodeURIComponent(serializers.WebhookId.jsonOrThrow(webhookId))}`),
|
|
261
261
|
method: "DELETE",
|
|
262
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.
|
|
262
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "agentmail", "X-Fern-SDK-Version": "0.0.23", "User-Agent": "agentmail/0.0.23", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
263
263
|
contentType: "application/json",
|
|
264
264
|
requestType: "json",
|
|
265
265
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
4
|
import * as AgentMail from "../../../index";
|
|
5
|
-
export interface MessageReceivedPayload
|
|
5
|
+
export interface MessageReceivedPayload {
|
|
6
|
+
eventType: AgentMail.EventType;
|
|
7
|
+
eventId: AgentMail.EventId;
|
|
6
8
|
message: AgentMail.Message;
|
|
7
9
|
}
|
|
@@ -7,7 +7,6 @@ export * from "./Webhook";
|
|
|
7
7
|
export * from "./ListWebhooksResponse";
|
|
8
8
|
export * from "./CreateWebhookRequest";
|
|
9
9
|
export * from "./EventId";
|
|
10
|
-
export * from "./Payload";
|
|
11
10
|
export * from "./MessageReceivedPayload";
|
|
12
11
|
export * from "./SvixId";
|
|
13
12
|
export * from "./SvixTimestamp";
|
|
@@ -23,7 +23,6 @@ __exportStar(require("./Webhook"), exports);
|
|
|
23
23
|
__exportStar(require("./ListWebhooksResponse"), exports);
|
|
24
24
|
__exportStar(require("./CreateWebhookRequest"), exports);
|
|
25
25
|
__exportStar(require("./EventId"), exports);
|
|
26
|
-
__exportStar(require("./Payload"), exports);
|
|
27
26
|
__exportStar(require("./MessageReceivedPayload"), exports);
|
|
28
27
|
__exportStar(require("./SvixId"), exports);
|
|
29
28
|
__exportStar(require("./SvixTimestamp"), exports);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
export * from "./Received";
|
|
2
|
-
export * from "./Sent";
|
|
3
1
|
export * from "./Limit";
|
|
4
2
|
export * from "./Count";
|
|
5
3
|
export * from "./LastKey";
|
|
4
|
+
export * from "./Labels";
|
|
6
5
|
export * from "./OrganizationId";
|
|
7
6
|
export * from "./ErrorName";
|
|
8
7
|
export * from "./ErrorResponse";
|
package/dist/api/types/index.js
CHANGED
|
@@ -14,11 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./Received"), exports);
|
|
18
|
-
__exportStar(require("./Sent"), exports);
|
|
19
17
|
__exportStar(require("./Limit"), exports);
|
|
20
18
|
__exportStar(require("./Count"), exports);
|
|
21
19
|
__exportStar(require("./LastKey"), exports);
|
|
20
|
+
__exportStar(require("./Labels"), exports);
|
|
22
21
|
__exportStar(require("./OrganizationId"), exports);
|
|
23
22
|
__exportStar(require("./ErrorName"), exports);
|
|
24
23
|
__exportStar(require("./ErrorResponse"), exports);
|
|
@@ -5,9 +5,11 @@ import * as serializers from "../../../index";
|
|
|
5
5
|
import * as AgentMail from "../../../../api/index";
|
|
6
6
|
import * as core from "../../../../core";
|
|
7
7
|
import { MessageId } from "./MessageId";
|
|
8
|
+
import { ThreadId } from "../../threads/types/ThreadId";
|
|
8
9
|
export declare const SendMessageResponse: core.serialization.ObjectSchema<serializers.SendMessageResponse.Raw, AgentMail.SendMessageResponse>;
|
|
9
10
|
export declare namespace SendMessageResponse {
|
|
10
11
|
interface Raw {
|
|
11
12
|
message_id: MessageId.Raw;
|
|
13
|
+
thread_id: ThreadId.Raw;
|
|
12
14
|
}
|
|
13
15
|
}
|
|
@@ -39,6 +39,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.SendMessageResponse = void 0;
|
|
40
40
|
const core = __importStar(require("../../../../core"));
|
|
41
41
|
const MessageId_1 = require("./MessageId");
|
|
42
|
+
const ThreadId_1 = require("../../threads/types/ThreadId");
|
|
42
43
|
exports.SendMessageResponse = core.serialization.object({
|
|
43
44
|
messageId: core.serialization.property("message_id", MessageId_1.MessageId),
|
|
45
|
+
threadId: core.serialization.property("thread_id", ThreadId_1.ThreadId),
|
|
44
46
|
});
|
|
@@ -4,11 +4,14 @@
|
|
|
4
4
|
import * as serializers from "../../../index";
|
|
5
5
|
import * as AgentMail from "../../../../api/index";
|
|
6
6
|
import * as core from "../../../../core";
|
|
7
|
+
import { EventType } from "./EventType";
|
|
8
|
+
import { EventId } from "./EventId";
|
|
7
9
|
import { Message } from "../../messages/types/Message";
|
|
8
|
-
import { Payload } from "./Payload";
|
|
9
10
|
export declare const MessageReceivedPayload: core.serialization.ObjectSchema<serializers.MessageReceivedPayload.Raw, AgentMail.MessageReceivedPayload>;
|
|
10
11
|
export declare namespace MessageReceivedPayload {
|
|
11
|
-
interface Raw
|
|
12
|
+
interface Raw {
|
|
13
|
+
event_type: EventType.Raw;
|
|
14
|
+
event_id: EventId.Raw;
|
|
12
15
|
message: Message.Raw;
|
|
13
16
|
}
|
|
14
17
|
}
|
|
@@ -38,10 +38,11 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.MessageReceivedPayload = void 0;
|
|
40
40
|
const core = __importStar(require("../../../../core"));
|
|
41
|
+
const EventType_1 = require("./EventType");
|
|
42
|
+
const EventId_1 = require("./EventId");
|
|
41
43
|
const Message_1 = require("../../messages/types/Message");
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
.
|
|
44
|
+
exports.MessageReceivedPayload = core.serialization.object({
|
|
45
|
+
eventType: core.serialization.property("event_type", EventType_1.EventType),
|
|
46
|
+
eventId: core.serialization.property("event_id", EventId_1.EventId),
|
|
45
47
|
message: Message_1.Message,
|
|
46
|
-
})
|
|
47
|
-
.extend(Payload_1.Payload);
|
|
48
|
+
});
|
|
@@ -7,7 +7,6 @@ export * from "./Webhook";
|
|
|
7
7
|
export * from "./ListWebhooksResponse";
|
|
8
8
|
export * from "./CreateWebhookRequest";
|
|
9
9
|
export * from "./EventId";
|
|
10
|
-
export * from "./Payload";
|
|
11
10
|
export * from "./MessageReceivedPayload";
|
|
12
11
|
export * from "./SvixId";
|
|
13
12
|
export * from "./SvixTimestamp";
|
|
@@ -23,7 +23,6 @@ __exportStar(require("./Webhook"), exports);
|
|
|
23
23
|
__exportStar(require("./ListWebhooksResponse"), exports);
|
|
24
24
|
__exportStar(require("./CreateWebhookRequest"), exports);
|
|
25
25
|
__exportStar(require("./EventId"), exports);
|
|
26
|
-
__exportStar(require("./Payload"), exports);
|
|
27
26
|
__exportStar(require("./MessageReceivedPayload"), exports);
|
|
28
27
|
__exportStar(require("./SvixId"), exports);
|
|
29
28
|
__exportStar(require("./SvixTimestamp"), exports);
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import * as serializers from "../index";
|
|
5
5
|
import * as AgentMail from "../../api/index";
|
|
6
6
|
import * as core from "../../core";
|
|
7
|
-
export declare const
|
|
8
|
-
export declare namespace
|
|
9
|
-
type Raw =
|
|
7
|
+
export declare const Labels: core.serialization.Schema<serializers.Labels.Raw, AgentMail.Labels>;
|
|
8
|
+
export declare namespace Labels {
|
|
9
|
+
type Raw = string[];
|
|
10
10
|
}
|
|
@@ -36,6 +36,6 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
};
|
|
37
37
|
})();
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
39
|
+
exports.Labels = void 0;
|
|
40
40
|
const core = __importStar(require("../../core"));
|
|
41
|
-
exports.
|
|
41
|
+
exports.Labels = core.serialization.list(core.serialization.string());
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
export * from "./Received";
|
|
2
|
-
export * from "./Sent";
|
|
3
1
|
export * from "./Limit";
|
|
4
2
|
export * from "./Count";
|
|
5
3
|
export * from "./LastKey";
|
|
4
|
+
export * from "./Labels";
|
|
6
5
|
export * from "./OrganizationId";
|
|
7
6
|
export * from "./ErrorName";
|
|
8
7
|
export * from "./ErrorResponse";
|
|
@@ -14,11 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./Received"), exports);
|
|
18
|
-
__exportStar(require("./Sent"), exports);
|
|
19
17
|
__exportStar(require("./Limit"), exports);
|
|
20
18
|
__exportStar(require("./Count"), exports);
|
|
21
19
|
__exportStar(require("./LastKey"), exports);
|
|
20
|
+
__exportStar(require("./Labels"), exports);
|
|
22
21
|
__exportStar(require("./OrganizationId"), exports);
|
|
23
22
|
__exportStar(require("./ErrorName"), exports);
|
|
24
23
|
__exportStar(require("./ErrorResponse"), exports);
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.0.
|
|
1
|
+
export declare const SDK_VERSION = "0.0.23";
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -5,9 +5,11 @@ import * as serializers from "../../../index";
|
|
|
5
5
|
import * as AgentMail from "../../../../api/index";
|
|
6
6
|
import * as core from "../../../../core";
|
|
7
7
|
import { MessageId } from "./MessageId";
|
|
8
|
+
import { ThreadId } from "../../threads/types/ThreadId";
|
|
8
9
|
export declare const SendMessageResponse: core.serialization.ObjectSchema<serializers.SendMessageResponse.Raw, AgentMail.SendMessageResponse>;
|
|
9
10
|
export declare namespace SendMessageResponse {
|
|
10
11
|
interface Raw {
|
|
11
12
|
message_id: MessageId.Raw;
|
|
13
|
+
thread_id: ThreadId.Raw;
|
|
12
14
|
}
|
|
13
15
|
}
|
|
@@ -39,6 +39,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.SendMessageResponse = void 0;
|
|
40
40
|
const core = __importStar(require("../../../../core"));
|
|
41
41
|
const MessageId_1 = require("./MessageId");
|
|
42
|
+
const ThreadId_1 = require("../../threads/types/ThreadId");
|
|
42
43
|
exports.SendMessageResponse = core.serialization.object({
|
|
43
44
|
messageId: core.serialization.property("message_id", MessageId_1.MessageId),
|
|
45
|
+
threadId: core.serialization.property("thread_id", ThreadId_1.ThreadId),
|
|
44
46
|
});
|
|
@@ -4,11 +4,14 @@
|
|
|
4
4
|
import * as serializers from "../../../index";
|
|
5
5
|
import * as AgentMail from "../../../../api/index";
|
|
6
6
|
import * as core from "../../../../core";
|
|
7
|
+
import { EventType } from "./EventType";
|
|
8
|
+
import { EventId } from "./EventId";
|
|
7
9
|
import { Message } from "../../messages/types/Message";
|
|
8
|
-
import { Payload } from "./Payload";
|
|
9
10
|
export declare const MessageReceivedPayload: core.serialization.ObjectSchema<serializers.MessageReceivedPayload.Raw, AgentMail.MessageReceivedPayload>;
|
|
10
11
|
export declare namespace MessageReceivedPayload {
|
|
11
|
-
interface Raw
|
|
12
|
+
interface Raw {
|
|
13
|
+
event_type: EventType.Raw;
|
|
14
|
+
event_id: EventId.Raw;
|
|
12
15
|
message: Message.Raw;
|
|
13
16
|
}
|
|
14
17
|
}
|
|
@@ -38,10 +38,11 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.MessageReceivedPayload = void 0;
|
|
40
40
|
const core = __importStar(require("../../../../core"));
|
|
41
|
+
const EventType_1 = require("./EventType");
|
|
42
|
+
const EventId_1 = require("./EventId");
|
|
41
43
|
const Message_1 = require("../../messages/types/Message");
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
.
|
|
44
|
+
exports.MessageReceivedPayload = core.serialization.object({
|
|
45
|
+
eventType: core.serialization.property("event_type", EventType_1.EventType),
|
|
46
|
+
eventId: core.serialization.property("event_id", EventId_1.EventId),
|
|
45
47
|
message: Message_1.Message,
|
|
46
|
-
})
|
|
47
|
-
.extend(Payload_1.Payload);
|
|
48
|
+
});
|
|
@@ -7,7 +7,6 @@ export * from "./Webhook";
|
|
|
7
7
|
export * from "./ListWebhooksResponse";
|
|
8
8
|
export * from "./CreateWebhookRequest";
|
|
9
9
|
export * from "./EventId";
|
|
10
|
-
export * from "./Payload";
|
|
11
10
|
export * from "./MessageReceivedPayload";
|
|
12
11
|
export * from "./SvixId";
|
|
13
12
|
export * from "./SvixTimestamp";
|
|
@@ -23,7 +23,6 @@ __exportStar(require("./Webhook"), exports);
|
|
|
23
23
|
__exportStar(require("./ListWebhooksResponse"), exports);
|
|
24
24
|
__exportStar(require("./CreateWebhookRequest"), exports);
|
|
25
25
|
__exportStar(require("./EventId"), exports);
|
|
26
|
-
__exportStar(require("./Payload"), exports);
|
|
27
26
|
__exportStar(require("./MessageReceivedPayload"), exports);
|
|
28
27
|
__exportStar(require("./SvixId"), exports);
|
|
29
28
|
__exportStar(require("./SvixTimestamp"), exports);
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import * as serializers from "../index";
|
|
5
5
|
import * as AgentMail from "../../api/index";
|
|
6
6
|
import * as core from "../../core";
|
|
7
|
-
export declare const
|
|
8
|
-
export declare namespace
|
|
9
|
-
type Raw =
|
|
7
|
+
export declare const Labels: core.serialization.Schema<serializers.Labels.Raw, AgentMail.Labels>;
|
|
8
|
+
export declare namespace Labels {
|
|
9
|
+
type Raw = string[];
|
|
10
10
|
}
|