agentmail 0.2.6 → 0.2.9
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/events/types/InboxIds.d.ts +1 -1
- package/dist/cjs/api/resources/events/types/PodIds.d.ts +1 -1
- package/dist/cjs/api/resources/inboxes/client/Client.js +4 -6
- package/dist/cjs/api/resources/webhooks/client/Client.d.ts +13 -0
- package/dist/cjs/api/resources/webhooks/client/Client.js +77 -0
- package/dist/cjs/api/resources/webhooks/types/UpdateWebhookRequest.d.ts +11 -0
- package/dist/cjs/api/resources/webhooks/types/UpdateWebhookRequest.js +3 -0
- package/dist/cjs/api/resources/webhooks/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/webhooks/types/index.js +1 -0
- package/dist/cjs/api/resources/websockets/client/Client.d.ts +2 -0
- package/dist/cjs/api/resources/websockets/client/Client.js +2 -2
- package/dist/cjs/serialization/resources/webhooks/types/UpdateWebhookRequest.d.ts +14 -0
- package/dist/cjs/serialization/resources/webhooks/types/UpdateWebhookRequest.js +46 -0
- package/dist/cjs/serialization/resources/webhooks/types/index.d.ts +1 -0
- package/dist/cjs/serialization/resources/webhooks/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/events/types/InboxIds.d.mts +1 -1
- package/dist/esm/api/resources/events/types/PodIds.d.mts +1 -1
- package/dist/esm/api/resources/inboxes/client/Client.mjs +4 -6
- package/dist/esm/api/resources/webhooks/client/Client.d.mts +13 -0
- package/dist/esm/api/resources/webhooks/client/Client.mjs +77 -0
- package/dist/esm/api/resources/webhooks/types/UpdateWebhookRequest.d.mts +11 -0
- package/dist/esm/api/resources/webhooks/types/UpdateWebhookRequest.mjs +2 -0
- package/dist/esm/api/resources/webhooks/types/index.d.mts +1 -0
- package/dist/esm/api/resources/webhooks/types/index.mjs +1 -0
- package/dist/esm/api/resources/websockets/client/Client.d.mts +2 -0
- package/dist/esm/api/resources/websockets/client/Client.mjs +2 -2
- package/dist/esm/serialization/resources/webhooks/types/UpdateWebhookRequest.d.mts +14 -0
- package/dist/esm/serialization/resources/webhooks/types/UpdateWebhookRequest.mjs +10 -0
- package/dist/esm/serialization/resources/webhooks/types/index.d.mts +1 -0
- package/dist/esm/serialization/resources/webhooks/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 +716 -20
- package/dist/llms.txt +3 -0
- package/package.json +1 -1
- package/reference.md +57 -0
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
|
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
44
|
"X-Fern-Language": "JavaScript",
|
|
45
45
|
"X-Fern-SDK-Name": "agentmail",
|
|
46
|
-
"X-Fern-SDK-Version": "0.2.
|
|
47
|
-
"User-Agent": "agentmail/0.2.
|
|
46
|
+
"X-Fern-SDK-Version": "0.2.9",
|
|
47
|
+
"User-Agent": "agentmail/0.2.9",
|
|
48
48
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
49
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
50
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -214,12 +214,10 @@ class InboxesClient {
|
|
|
214
214
|
contentType: "application/json",
|
|
215
215
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
216
216
|
requestType: "json",
|
|
217
|
-
body: request
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
})
|
|
222
|
-
: undefined,
|
|
217
|
+
body: serializers.inboxes.create.Request.jsonOrThrow(request, {
|
|
218
|
+
unrecognizedObjectKeys: "strip",
|
|
219
|
+
omitUndefined: true,
|
|
220
|
+
}),
|
|
223
221
|
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,
|
|
224
222
|
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,
|
|
225
223
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -30,6 +30,19 @@ export declare class WebhooksClient {
|
|
|
30
30
|
*/
|
|
31
31
|
get(webhook_id: AgentMail.webhooks.WebhookId, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentMail.webhooks.Webhook>;
|
|
32
32
|
private __get;
|
|
33
|
+
/**
|
|
34
|
+
* @param {AgentMail.webhooks.WebhookId} webhook_id
|
|
35
|
+
* @param {AgentMail.webhooks.UpdateWebhookRequest} request
|
|
36
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
37
|
+
*
|
|
38
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
39
|
+
* @throws {@link AgentMail.ValidationError}
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* await client.webhooks.update("webhook_id", {})
|
|
43
|
+
*/
|
|
44
|
+
update(webhook_id: AgentMail.webhooks.WebhookId, request: AgentMail.webhooks.UpdateWebhookRequest, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentMail.webhooks.Webhook>;
|
|
45
|
+
private __update;
|
|
33
46
|
/**
|
|
34
47
|
* @param {AgentMail.webhooks.CreateWebhookRequest} request
|
|
35
48
|
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -170,6 +170,83 @@ class WebhooksClient {
|
|
|
170
170
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v0/webhooks/{webhook_id}");
|
|
171
171
|
});
|
|
172
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* @param {AgentMail.webhooks.WebhookId} webhook_id
|
|
175
|
+
* @param {AgentMail.webhooks.UpdateWebhookRequest} request
|
|
176
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
177
|
+
*
|
|
178
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
179
|
+
* @throws {@link AgentMail.ValidationError}
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* await client.webhooks.update("webhook_id", {})
|
|
183
|
+
*/
|
|
184
|
+
update(webhook_id, request, requestOptions) {
|
|
185
|
+
return core.HttpResponsePromise.fromPromise(this.__update(webhook_id, request, requestOptions));
|
|
186
|
+
}
|
|
187
|
+
__update(webhook_id, request, requestOptions) {
|
|
188
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
189
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
190
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
191
|
+
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);
|
|
192
|
+
const _response = yield core.fetcher({
|
|
193
|
+
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.Production).http, `/v0/webhooks/${core.url.encodePathParam(serializers.webhooks.WebhookId.jsonOrThrow(webhook_id, { omitUndefined: true }))}`),
|
|
194
|
+
method: "PATCH",
|
|
195
|
+
headers: _headers,
|
|
196
|
+
contentType: "application/json",
|
|
197
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
198
|
+
requestType: "json",
|
|
199
|
+
body: serializers.webhooks.UpdateWebhookRequest.jsonOrThrow(request, {
|
|
200
|
+
unrecognizedObjectKeys: "strip",
|
|
201
|
+
omitUndefined: true,
|
|
202
|
+
}),
|
|
203
|
+
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,
|
|
204
|
+
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,
|
|
205
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
206
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
207
|
+
logging: this._options.logging,
|
|
208
|
+
});
|
|
209
|
+
if (_response.ok) {
|
|
210
|
+
return {
|
|
211
|
+
data: serializers.webhooks.Webhook.parseOrThrow(_response.body, {
|
|
212
|
+
unrecognizedObjectKeys: "passthrough",
|
|
213
|
+
allowUnrecognizedUnionMembers: true,
|
|
214
|
+
allowUnrecognizedEnumValues: true,
|
|
215
|
+
skipValidation: true,
|
|
216
|
+
breadcrumbsPrefix: ["response"],
|
|
217
|
+
}),
|
|
218
|
+
rawResponse: _response.rawResponse,
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
if (_response.error.reason === "status-code") {
|
|
222
|
+
switch (_response.error.statusCode) {
|
|
223
|
+
case 404:
|
|
224
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
225
|
+
unrecognizedObjectKeys: "passthrough",
|
|
226
|
+
allowUnrecognizedUnionMembers: true,
|
|
227
|
+
allowUnrecognizedEnumValues: true,
|
|
228
|
+
skipValidation: true,
|
|
229
|
+
breadcrumbsPrefix: ["response"],
|
|
230
|
+
}), _response.rawResponse);
|
|
231
|
+
case 400:
|
|
232
|
+
throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
|
|
233
|
+
unrecognizedObjectKeys: "passthrough",
|
|
234
|
+
allowUnrecognizedUnionMembers: true,
|
|
235
|
+
allowUnrecognizedEnumValues: true,
|
|
236
|
+
skipValidation: true,
|
|
237
|
+
breadcrumbsPrefix: ["response"],
|
|
238
|
+
}), _response.rawResponse);
|
|
239
|
+
default:
|
|
240
|
+
throw new errors.AgentMailError({
|
|
241
|
+
statusCode: _response.error.statusCode,
|
|
242
|
+
body: _response.error.body,
|
|
243
|
+
rawResponse: _response.rawResponse,
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PATCH", "/v0/webhooks/{webhook_id}");
|
|
248
|
+
});
|
|
249
|
+
}
|
|
173
250
|
/**
|
|
174
251
|
* @param {AgentMail.webhooks.CreateWebhookRequest} request
|
|
175
252
|
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type * as AgentMail from "../../../index.js";
|
|
2
|
+
export interface UpdateWebhookRequest {
|
|
3
|
+
/** Inbox IDs to subscribe to the webhook. */
|
|
4
|
+
addInboxIds?: AgentMail.InboxIds;
|
|
5
|
+
/** Inbox IDs to unsubscribe from the webhook. */
|
|
6
|
+
removeInboxIds?: AgentMail.InboxIds;
|
|
7
|
+
/** Pod IDs to subscribe to the webhook. */
|
|
8
|
+
addPodIds?: AgentMail.PodIds;
|
|
9
|
+
/** Pod IDs to unsubscribe from the webhook. */
|
|
10
|
+
removePodIds?: AgentMail.PodIds;
|
|
11
|
+
}
|
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./ClientId.js"), exports);
|
|
18
18
|
__exportStar(require("./CreateWebhookRequest.js"), exports);
|
|
19
19
|
__exportStar(require("./ListWebhooksResponse.js"), exports);
|
|
20
|
+
__exportStar(require("./UpdateWebhookRequest.js"), exports);
|
|
20
21
|
__exportStar(require("./Url.js"), exports);
|
|
21
22
|
__exportStar(require("./Webhook.js"), exports);
|
|
22
23
|
__exportStar(require("./WebhookId.js"), exports);
|
|
@@ -5,6 +5,8 @@ export declare namespace WebsocketsClient {
|
|
|
5
5
|
type Options = BaseClientOptions;
|
|
6
6
|
interface ConnectArgs {
|
|
7
7
|
authToken?: string;
|
|
8
|
+
/** Additional query parameters to send with the websocket connect request. */
|
|
9
|
+
queryParams?: Record<string, unknown>;
|
|
8
10
|
/** Arbitrary headers to send with the websocket connect request. */
|
|
9
11
|
headers?: Record<string, string>;
|
|
10
12
|
/** Enable debug mode on the websocket. Defaults to false. */
|
|
@@ -56,7 +56,7 @@ class WebsocketsClient {
|
|
|
56
56
|
connect() {
|
|
57
57
|
return __awaiter(this, arguments, void 0, function* (args = {}) {
|
|
58
58
|
var _a, _b;
|
|
59
|
-
const { authToken, headers, debug, reconnectAttempts } = args;
|
|
59
|
+
const { authToken, queryParams, headers, debug, reconnectAttempts } = args;
|
|
60
60
|
const _queryParams = {
|
|
61
61
|
auth_token: authToken,
|
|
62
62
|
};
|
|
@@ -65,7 +65,7 @@ class WebsocketsClient {
|
|
|
65
65
|
const socket = new core.ReconnectingWebSocket({
|
|
66
66
|
url: core.url.join((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : ((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Production).websockets, "/v0"),
|
|
67
67
|
protocols: [],
|
|
68
|
-
queryParameters: _queryParams,
|
|
68
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), queryParams),
|
|
69
69
|
headers: _headers,
|
|
70
70
|
options: { debug: debug !== null && debug !== void 0 ? debug : false, maxRetries: reconnectAttempts !== null && reconnectAttempts !== void 0 ? reconnectAttempts : 30 },
|
|
71
71
|
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type * as AgentMail from "../../../../api/index.js";
|
|
2
|
+
import * as core from "../../../../core/index.js";
|
|
3
|
+
import type * as serializers from "../../../index.js";
|
|
4
|
+
import { InboxIds } from "../../events/types/InboxIds.js";
|
|
5
|
+
import { PodIds } from "../../events/types/PodIds.js";
|
|
6
|
+
export declare const UpdateWebhookRequest: core.serialization.ObjectSchema<serializers.webhooks.UpdateWebhookRequest.Raw, AgentMail.webhooks.UpdateWebhookRequest>;
|
|
7
|
+
export declare namespace UpdateWebhookRequest {
|
|
8
|
+
interface Raw {
|
|
9
|
+
add_inbox_ids?: InboxIds.Raw | null;
|
|
10
|
+
remove_inbox_ids?: InboxIds.Raw | null;
|
|
11
|
+
add_pod_ids?: PodIds.Raw | null;
|
|
12
|
+
remove_pod_ids?: PodIds.Raw | null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.UpdateWebhookRequest = void 0;
|
|
38
|
+
const core = __importStar(require("../../../../core/index.js"));
|
|
39
|
+
const InboxIds_js_1 = require("../../events/types/InboxIds.js");
|
|
40
|
+
const PodIds_js_1 = require("../../events/types/PodIds.js");
|
|
41
|
+
exports.UpdateWebhookRequest = core.serialization.object({
|
|
42
|
+
addInboxIds: core.serialization.property("add_inbox_ids", InboxIds_js_1.InboxIds.optional()),
|
|
43
|
+
removeInboxIds: core.serialization.property("remove_inbox_ids", InboxIds_js_1.InboxIds.optional()),
|
|
44
|
+
addPodIds: core.serialization.property("add_pod_ids", PodIds_js_1.PodIds.optional()),
|
|
45
|
+
removePodIds: core.serialization.property("remove_pod_ids", PodIds_js_1.PodIds.optional()),
|
|
46
|
+
});
|
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./ClientId.js"), exports);
|
|
18
18
|
__exportStar(require("./CreateWebhookRequest.js"), exports);
|
|
19
19
|
__exportStar(require("./ListWebhooksResponse.js"), exports);
|
|
20
|
+
__exportStar(require("./UpdateWebhookRequest.js"), exports);
|
|
20
21
|
__exportStar(require("./Url.js"), exports);
|
|
21
22
|
__exportStar(require("./Webhook.js"), exports);
|
|
22
23
|
__exportStar(require("./WebhookId.js"), exports);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.2.
|
|
1
|
+
export declare const SDK_VERSION = "0.2.9";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/BaseClient.mjs
CHANGED
|
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
|
|
|
6
6
|
const headers = mergeHeaders({
|
|
7
7
|
"X-Fern-Language": "JavaScript",
|
|
8
8
|
"X-Fern-SDK-Name": "agentmail",
|
|
9
|
-
"X-Fern-SDK-Version": "0.2.
|
|
10
|
-
"User-Agent": "agentmail/0.2.
|
|
9
|
+
"X-Fern-SDK-Version": "0.2.9",
|
|
10
|
+
"User-Agent": "agentmail/0.2.9",
|
|
11
11
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
12
12
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
13
13
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -178,12 +178,10 @@ export class InboxesClient {
|
|
|
178
178
|
contentType: "application/json",
|
|
179
179
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
180
180
|
requestType: "json",
|
|
181
|
-
body: request
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
})
|
|
186
|
-
: undefined,
|
|
181
|
+
body: serializers.inboxes.create.Request.jsonOrThrow(request, {
|
|
182
|
+
unrecognizedObjectKeys: "strip",
|
|
183
|
+
omitUndefined: true,
|
|
184
|
+
}),
|
|
187
185
|
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,
|
|
188
186
|
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,
|
|
189
187
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -30,6 +30,19 @@ export declare class WebhooksClient {
|
|
|
30
30
|
*/
|
|
31
31
|
get(webhook_id: AgentMail.webhooks.WebhookId, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentMail.webhooks.Webhook>;
|
|
32
32
|
private __get;
|
|
33
|
+
/**
|
|
34
|
+
* @param {AgentMail.webhooks.WebhookId} webhook_id
|
|
35
|
+
* @param {AgentMail.webhooks.UpdateWebhookRequest} request
|
|
36
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
37
|
+
*
|
|
38
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
39
|
+
* @throws {@link AgentMail.ValidationError}
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* await client.webhooks.update("webhook_id", {})
|
|
43
|
+
*/
|
|
44
|
+
update(webhook_id: AgentMail.webhooks.WebhookId, request: AgentMail.webhooks.UpdateWebhookRequest, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentMail.webhooks.Webhook>;
|
|
45
|
+
private __update;
|
|
33
46
|
/**
|
|
34
47
|
* @param {AgentMail.webhooks.CreateWebhookRequest} request
|
|
35
48
|
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -134,6 +134,83 @@ export class WebhooksClient {
|
|
|
134
134
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/webhooks/{webhook_id}");
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* @param {AgentMail.webhooks.WebhookId} webhook_id
|
|
139
|
+
* @param {AgentMail.webhooks.UpdateWebhookRequest} request
|
|
140
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
141
|
+
*
|
|
142
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
143
|
+
* @throws {@link AgentMail.ValidationError}
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* await client.webhooks.update("webhook_id", {})
|
|
147
|
+
*/
|
|
148
|
+
update(webhook_id, request, requestOptions) {
|
|
149
|
+
return core.HttpResponsePromise.fromPromise(this.__update(webhook_id, request, requestOptions));
|
|
150
|
+
}
|
|
151
|
+
__update(webhook_id, request, requestOptions) {
|
|
152
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
153
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
154
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
155
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
156
|
+
const _response = yield core.fetcher({
|
|
157
|
+
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.Production).http, `/v0/webhooks/${core.url.encodePathParam(serializers.webhooks.WebhookId.jsonOrThrow(webhook_id, { omitUndefined: true }))}`),
|
|
158
|
+
method: "PATCH",
|
|
159
|
+
headers: _headers,
|
|
160
|
+
contentType: "application/json",
|
|
161
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
162
|
+
requestType: "json",
|
|
163
|
+
body: serializers.webhooks.UpdateWebhookRequest.jsonOrThrow(request, {
|
|
164
|
+
unrecognizedObjectKeys: "strip",
|
|
165
|
+
omitUndefined: true,
|
|
166
|
+
}),
|
|
167
|
+
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,
|
|
168
|
+
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,
|
|
169
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
170
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
171
|
+
logging: this._options.logging,
|
|
172
|
+
});
|
|
173
|
+
if (_response.ok) {
|
|
174
|
+
return {
|
|
175
|
+
data: serializers.webhooks.Webhook.parseOrThrow(_response.body, {
|
|
176
|
+
unrecognizedObjectKeys: "passthrough",
|
|
177
|
+
allowUnrecognizedUnionMembers: true,
|
|
178
|
+
allowUnrecognizedEnumValues: true,
|
|
179
|
+
skipValidation: true,
|
|
180
|
+
breadcrumbsPrefix: ["response"],
|
|
181
|
+
}),
|
|
182
|
+
rawResponse: _response.rawResponse,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
if (_response.error.reason === "status-code") {
|
|
186
|
+
switch (_response.error.statusCode) {
|
|
187
|
+
case 404:
|
|
188
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
189
|
+
unrecognizedObjectKeys: "passthrough",
|
|
190
|
+
allowUnrecognizedUnionMembers: true,
|
|
191
|
+
allowUnrecognizedEnumValues: true,
|
|
192
|
+
skipValidation: true,
|
|
193
|
+
breadcrumbsPrefix: ["response"],
|
|
194
|
+
}), _response.rawResponse);
|
|
195
|
+
case 400:
|
|
196
|
+
throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
|
|
197
|
+
unrecognizedObjectKeys: "passthrough",
|
|
198
|
+
allowUnrecognizedUnionMembers: true,
|
|
199
|
+
allowUnrecognizedEnumValues: true,
|
|
200
|
+
skipValidation: true,
|
|
201
|
+
breadcrumbsPrefix: ["response"],
|
|
202
|
+
}), _response.rawResponse);
|
|
203
|
+
default:
|
|
204
|
+
throw new errors.AgentMailError({
|
|
205
|
+
statusCode: _response.error.statusCode,
|
|
206
|
+
body: _response.error.body,
|
|
207
|
+
rawResponse: _response.rawResponse,
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PATCH", "/v0/webhooks/{webhook_id}");
|
|
212
|
+
});
|
|
213
|
+
}
|
|
137
214
|
/**
|
|
138
215
|
* @param {AgentMail.webhooks.CreateWebhookRequest} request
|
|
139
216
|
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type * as AgentMail from "../../../index.mjs";
|
|
2
|
+
export interface UpdateWebhookRequest {
|
|
3
|
+
/** Inbox IDs to subscribe to the webhook. */
|
|
4
|
+
addInboxIds?: AgentMail.InboxIds;
|
|
5
|
+
/** Inbox IDs to unsubscribe from the webhook. */
|
|
6
|
+
removeInboxIds?: AgentMail.InboxIds;
|
|
7
|
+
/** Pod IDs to subscribe to the webhook. */
|
|
8
|
+
addPodIds?: AgentMail.PodIds;
|
|
9
|
+
/** Pod IDs to unsubscribe from the webhook. */
|
|
10
|
+
removePodIds?: AgentMail.PodIds;
|
|
11
|
+
}
|
|
@@ -5,6 +5,8 @@ export declare namespace WebsocketsClient {
|
|
|
5
5
|
type Options = BaseClientOptions;
|
|
6
6
|
interface ConnectArgs {
|
|
7
7
|
authToken?: string;
|
|
8
|
+
/** Additional query parameters to send with the websocket connect request. */
|
|
9
|
+
queryParams?: Record<string, unknown>;
|
|
8
10
|
/** Arbitrary headers to send with the websocket connect request. */
|
|
9
11
|
headers?: Record<string, string>;
|
|
10
12
|
/** Enable debug mode on the websocket. Defaults to false. */
|
|
@@ -20,7 +20,7 @@ export class WebsocketsClient {
|
|
|
20
20
|
connect() {
|
|
21
21
|
return __awaiter(this, arguments, void 0, function* (args = {}) {
|
|
22
22
|
var _a, _b;
|
|
23
|
-
const { authToken, headers, debug, reconnectAttempts } = args;
|
|
23
|
+
const { authToken, queryParams, headers, debug, reconnectAttempts } = args;
|
|
24
24
|
const _queryParams = {
|
|
25
25
|
auth_token: authToken,
|
|
26
26
|
};
|
|
@@ -29,7 +29,7 @@ export class WebsocketsClient {
|
|
|
29
29
|
const socket = new core.ReconnectingWebSocket({
|
|
30
30
|
url: core.url.join((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : ((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Production).websockets, "/v0"),
|
|
31
31
|
protocols: [],
|
|
32
|
-
queryParameters: _queryParams,
|
|
32
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), queryParams),
|
|
33
33
|
headers: _headers,
|
|
34
34
|
options: { debug: debug !== null && debug !== void 0 ? debug : false, maxRetries: reconnectAttempts !== null && reconnectAttempts !== void 0 ? reconnectAttempts : 30 },
|
|
35
35
|
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type * as AgentMail from "../../../../api/index.mjs";
|
|
2
|
+
import * as core from "../../../../core/index.mjs";
|
|
3
|
+
import type * as serializers from "../../../index.mjs";
|
|
4
|
+
import { InboxIds } from "../../events/types/InboxIds.mjs";
|
|
5
|
+
import { PodIds } from "../../events/types/PodIds.mjs";
|
|
6
|
+
export declare const UpdateWebhookRequest: core.serialization.ObjectSchema<serializers.webhooks.UpdateWebhookRequest.Raw, AgentMail.webhooks.UpdateWebhookRequest>;
|
|
7
|
+
export declare namespace UpdateWebhookRequest {
|
|
8
|
+
interface Raw {
|
|
9
|
+
add_inbox_ids?: InboxIds.Raw | null;
|
|
10
|
+
remove_inbox_ids?: InboxIds.Raw | null;
|
|
11
|
+
add_pod_ids?: PodIds.Raw | null;
|
|
12
|
+
remove_pod_ids?: PodIds.Raw | null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
import * as core from "../../../../core/index.mjs";
|
|
3
|
+
import { InboxIds } from "../../events/types/InboxIds.mjs";
|
|
4
|
+
import { PodIds } from "../../events/types/PodIds.mjs";
|
|
5
|
+
export const UpdateWebhookRequest = core.serialization.object({
|
|
6
|
+
addInboxIds: core.serialization.property("add_inbox_ids", InboxIds.optional()),
|
|
7
|
+
removeInboxIds: core.serialization.property("remove_inbox_ids", InboxIds.optional()),
|
|
8
|
+
addPodIds: core.serialization.property("add_pod_ids", PodIds.optional()),
|
|
9
|
+
removePodIds: core.serialization.property("remove_pod_ids", PodIds.optional()),
|
|
10
|
+
});
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.2.
|
|
1
|
+
export declare const SDK_VERSION = "0.2.9";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.2.
|
|
1
|
+
export const SDK_VERSION = "0.2.9";
|