agentmail 0.2.6 → 0.2.8

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.
Files changed (34) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/events/types/InboxIds.d.ts +1 -1
  3. package/dist/cjs/api/resources/events/types/PodIds.d.ts +1 -1
  4. package/dist/cjs/api/resources/webhooks/client/Client.d.ts +13 -0
  5. package/dist/cjs/api/resources/webhooks/client/Client.js +77 -0
  6. package/dist/cjs/api/resources/webhooks/types/UpdateWebhookRequest.d.ts +11 -0
  7. package/dist/cjs/api/resources/webhooks/types/UpdateWebhookRequest.js +3 -0
  8. package/dist/cjs/api/resources/webhooks/types/index.d.ts +1 -0
  9. package/dist/cjs/api/resources/webhooks/types/index.js +1 -0
  10. package/dist/cjs/serialization/resources/webhooks/types/UpdateWebhookRequest.d.ts +14 -0
  11. package/dist/cjs/serialization/resources/webhooks/types/UpdateWebhookRequest.js +46 -0
  12. package/dist/cjs/serialization/resources/webhooks/types/index.d.ts +1 -0
  13. package/dist/cjs/serialization/resources/webhooks/types/index.js +1 -0
  14. package/dist/cjs/version.d.ts +1 -1
  15. package/dist/cjs/version.js +1 -1
  16. package/dist/esm/BaseClient.mjs +2 -2
  17. package/dist/esm/api/resources/events/types/InboxIds.d.mts +1 -1
  18. package/dist/esm/api/resources/events/types/PodIds.d.mts +1 -1
  19. package/dist/esm/api/resources/webhooks/client/Client.d.mts +13 -0
  20. package/dist/esm/api/resources/webhooks/client/Client.mjs +77 -0
  21. package/dist/esm/api/resources/webhooks/types/UpdateWebhookRequest.d.mts +11 -0
  22. package/dist/esm/api/resources/webhooks/types/UpdateWebhookRequest.mjs +2 -0
  23. package/dist/esm/api/resources/webhooks/types/index.d.mts +1 -0
  24. package/dist/esm/api/resources/webhooks/types/index.mjs +1 -0
  25. package/dist/esm/serialization/resources/webhooks/types/UpdateWebhookRequest.d.mts +14 -0
  26. package/dist/esm/serialization/resources/webhooks/types/UpdateWebhookRequest.mjs +10 -0
  27. package/dist/esm/serialization/resources/webhooks/types/index.d.mts +1 -0
  28. package/dist/esm/serialization/resources/webhooks/types/index.mjs +1 -0
  29. package/dist/esm/version.d.mts +1 -1
  30. package/dist/esm/version.mjs +1 -1
  31. package/dist/llms-full.txt +301 -20
  32. package/dist/llms.txt +1 -0
  33. package/package.json +1 -1
  34. package/reference.md +57 -0
@@ -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.6",
47
- "User-Agent": "agentmail/0.2.6",
46
+ "X-Fern-SDK-Version": "0.2.8",
47
+ "User-Agent": "agentmail/0.2.8",
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);
@@ -1,4 +1,4 @@
1
1
  /**
2
- * Inboxes for which to send events.
2
+ * Inboxes for which to send events. Maximum 10 per webhook.
3
3
  */
4
4
  export type InboxIds = string[];
@@ -1,4 +1,4 @@
1
1
  /**
2
- * Pods for which to send events.
2
+ * Pods for which to send events. Maximum 10 per webhook.
3
3
  */
4
4
  export type PodIds = string[];
@@ -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
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +1,7 @@
1
1
  export * from "./ClientId.js";
2
2
  export * from "./CreateWebhookRequest.js";
3
3
  export * from "./ListWebhooksResponse.js";
4
+ export * from "./UpdateWebhookRequest.js";
4
5
  export * from "./Url.js";
5
6
  export * from "./Webhook.js";
6
7
  export * from "./WebhookId.js";
@@ -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);
@@ -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
+ });
@@ -1,6 +1,7 @@
1
1
  export * from "./ClientId.js";
2
2
  export * from "./CreateWebhookRequest.js";
3
3
  export * from "./ListWebhooksResponse.js";
4
+ export * from "./UpdateWebhookRequest.js";
4
5
  export * from "./Url.js";
5
6
  export * from "./Webhook.js";
6
7
  export * from "./WebhookId.js";
@@ -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);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.2.6";
1
+ export declare const SDK_VERSION = "0.2.8";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "0.2.6";
4
+ exports.SDK_VERSION = "0.2.8";
@@ -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.6",
10
- "User-Agent": "agentmail/0.2.6",
9
+ "X-Fern-SDK-Version": "0.2.8",
10
+ "User-Agent": "agentmail/0.2.8",
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);
@@ -1,4 +1,4 @@
1
1
  /**
2
- * Inboxes for which to send events.
2
+ * Inboxes for which to send events. Maximum 10 per webhook.
3
3
  */
4
4
  export type InboxIds = string[];
@@ -1,4 +1,4 @@
1
1
  /**
2
- * Pods for which to send events.
2
+ * Pods for which to send events. Maximum 10 per webhook.
3
3
  */
4
4
  export type PodIds = string[];
@@ -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
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -1,6 +1,7 @@
1
1
  export * from "./ClientId.mjs";
2
2
  export * from "./CreateWebhookRequest.mjs";
3
3
  export * from "./ListWebhooksResponse.mjs";
4
+ export * from "./UpdateWebhookRequest.mjs";
4
5
  export * from "./Url.mjs";
5
6
  export * from "./Webhook.mjs";
6
7
  export * from "./WebhookId.mjs";
@@ -1,6 +1,7 @@
1
1
  export * from "./ClientId.mjs";
2
2
  export * from "./CreateWebhookRequest.mjs";
3
3
  export * from "./ListWebhooksResponse.mjs";
4
+ export * from "./UpdateWebhookRequest.mjs";
4
5
  export * from "./Url.mjs";
5
6
  export * from "./Webhook.mjs";
6
7
  export * from "./WebhookId.mjs";
@@ -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
+ });
@@ -1,6 +1,7 @@
1
1
  export * from "./ClientId.mjs";
2
2
  export * from "./CreateWebhookRequest.mjs";
3
3
  export * from "./ListWebhooksResponse.mjs";
4
+ export * from "./UpdateWebhookRequest.mjs";
4
5
  export * from "./Url.mjs";
5
6
  export * from "./Webhook.mjs";
6
7
  export * from "./WebhookId.mjs";
@@ -1,6 +1,7 @@
1
1
  export * from "./ClientId.mjs";
2
2
  export * from "./CreateWebhookRequest.mjs";
3
3
  export * from "./ListWebhooksResponse.mjs";
4
+ export * from "./UpdateWebhookRequest.mjs";
4
5
  export * from "./Url.mjs";
5
6
  export * from "./Webhook.mjs";
6
7
  export * from "./WebhookId.mjs";
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.2.6";
1
+ export declare const SDK_VERSION = "0.2.8";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.2.6";
1
+ export const SDK_VERSION = "0.2.8";
@@ -11498,8 +11498,6 @@ components:
11498
11498
  - value: attachment
11499
11499
  type_attachments:AttachmentContentId:
11500
11500
  type: string
11501
- type_attachments:AttachmentContent:
11502
- type: string
11503
11501
  type_attachments:SendAttachment:
11504
11502
  type: object
11505
11503
  properties:
@@ -11512,9 +11510,11 @@ components:
11512
11510
  content_id:
11513
11511
  $ref: '#/components/schemas/type_attachments:AttachmentContentId'
11514
11512
  content:
11515
- $ref: '#/components/schemas/type_attachments:AttachmentContent'
11516
- required:
11517
- - content
11513
+ type: string
11514
+ description: Base64 encoded content of attachment.
11515
+ url:
11516
+ type: string
11517
+ description: URL to the attachment.
11518
11518
  type_messages:SendMessageAttachments:
11519
11519
  type: array
11520
11520
  items:
@@ -11810,8 +11810,6 @@ components:
11810
11810
  - value: attachment
11811
11811
  type_attachments:AttachmentContentId:
11812
11812
  type: string
11813
- type_attachments:AttachmentContent:
11814
- type: string
11815
11813
  type_attachments:SendAttachment:
11816
11814
  type: object
11817
11815
  properties:
@@ -11824,9 +11822,11 @@ components:
11824
11822
  content_id:
11825
11823
  $ref: '#/components/schemas/type_attachments:AttachmentContentId'
11826
11824
  content:
11827
- $ref: '#/components/schemas/type_attachments:AttachmentContent'
11828
- required:
11829
- - content
11825
+ type: string
11826
+ description: Base64 encoded content of attachment.
11827
+ url:
11828
+ type: string
11829
+ description: URL to the attachment.
11830
11830
  type_messages:SendMessageAttachments:
11831
11831
  type: array
11832
11832
  items:
@@ -12113,8 +12113,6 @@ components:
12113
12113
  - value: attachment
12114
12114
  type_attachments:AttachmentContentId:
12115
12115
  type: string
12116
- type_attachments:AttachmentContent:
12117
- type: string
12118
12116
  type_attachments:SendAttachment:
12119
12117
  type: object
12120
12118
  properties:
@@ -12127,9 +12125,11 @@ components:
12127
12125
  content_id:
12128
12126
  $ref: '#/components/schemas/type_attachments:AttachmentContentId'
12129
12127
  content:
12130
- $ref: '#/components/schemas/type_attachments:AttachmentContent'
12131
- required:
12132
- - content
12128
+ type: string
12129
+ description: Base64 encoded content of attachment.
12130
+ url:
12131
+ type: string
12132
+ description: URL to the attachment.
12133
12133
  type_messages:SendMessageAttachments:
12134
12134
  type: array
12135
12135
  items:
@@ -12416,8 +12416,6 @@ components:
12416
12416
  - value: attachment
12417
12417
  type_attachments:AttachmentContentId:
12418
12418
  type: string
12419
- type_attachments:AttachmentContent:
12420
- type: string
12421
12419
  type_attachments:SendAttachment:
12422
12420
  type: object
12423
12421
  properties:
@@ -12430,9 +12428,11 @@ components:
12430
12428
  content_id:
12431
12429
  $ref: '#/components/schemas/type_attachments:AttachmentContentId'
12432
12430
  content:
12433
- $ref: '#/components/schemas/type_attachments:AttachmentContent'
12434
- required:
12435
- - content
12431
+ type: string
12432
+ description: Base64 encoded content of attachment.
12433
+ url:
12434
+ type: string
12435
+ description: URL to the attachment.
12436
12436
  type_messages:SendMessageAttachments:
12437
12437
  type: array
12438
12438
  items:
@@ -18641,6 +18641,287 @@ let dataTask = session.dataTask(with: request as URLRequest, completionHandler:
18641
18641
  dataTask.resume()
18642
18642
  ```
18643
18643
 
18644
+ # Update Webhook
18645
+
18646
+ PATCH https://api.agentmail.to/v0/webhooks/{webhook_id}
18647
+ Content-Type: application/json
18648
+
18649
+ Reference: https://docs.agentmail.to/api-reference/webhooks/update
18650
+
18651
+ ## OpenAPI Specification
18652
+
18653
+ ```yaml
18654
+ openapi: 3.1.1
18655
+ info:
18656
+ title: Update Webhook
18657
+ version: endpoint_webhooks.update
18658
+ paths:
18659
+ /v0/webhooks/{webhook_id}:
18660
+ patch:
18661
+ operationId: update
18662
+ summary: Update Webhook
18663
+ tags:
18664
+ - - subpackage_webhooks
18665
+ parameters:
18666
+ - name: webhook_id
18667
+ in: path
18668
+ required: true
18669
+ schema:
18670
+ $ref: '#/components/schemas/type_webhooks:WebhookId'
18671
+ - name: Authorization
18672
+ in: header
18673
+ description: >-
18674
+ Bearer authentication of the form `Bearer <token>`, where token is
18675
+ your auth token.
18676
+ required: true
18677
+ schema:
18678
+ type: string
18679
+ responses:
18680
+ '200':
18681
+ description: Response with status 200
18682
+ content:
18683
+ application/json:
18684
+ schema:
18685
+ $ref: '#/components/schemas/type_webhooks:Webhook'
18686
+ '400':
18687
+ description: Error response with status 400
18688
+ content: {}
18689
+ '404':
18690
+ description: Error response with status 404
18691
+ content: {}
18692
+ requestBody:
18693
+ content:
18694
+ application/json:
18695
+ schema:
18696
+ $ref: '#/components/schemas/type_webhooks:UpdateWebhookRequest'
18697
+ components:
18698
+ schemas:
18699
+ type_webhooks:WebhookId:
18700
+ type: string
18701
+ type_events:InboxIds:
18702
+ type: array
18703
+ items:
18704
+ type: string
18705
+ type_events:PodIds:
18706
+ type: array
18707
+ items:
18708
+ type: string
18709
+ type_webhooks:UpdateWebhookRequest:
18710
+ type: object
18711
+ properties:
18712
+ add_inbox_ids:
18713
+ $ref: '#/components/schemas/type_events:InboxIds'
18714
+ description: Inbox IDs to subscribe to the webhook.
18715
+ remove_inbox_ids:
18716
+ $ref: '#/components/schemas/type_events:InboxIds'
18717
+ description: Inbox IDs to unsubscribe from the webhook.
18718
+ add_pod_ids:
18719
+ $ref: '#/components/schemas/type_events:PodIds'
18720
+ description: Pod IDs to subscribe to the webhook.
18721
+ remove_pod_ids:
18722
+ $ref: '#/components/schemas/type_events:PodIds'
18723
+ description: Pod IDs to unsubscribe from the webhook.
18724
+ type_webhooks:Url:
18725
+ type: string
18726
+ type_events:EventType:
18727
+ type: string
18728
+ enum:
18729
+ - value: message.received
18730
+ - value: message.sent
18731
+ - value: message.delivered
18732
+ - value: message.bounced
18733
+ - value: message.complained
18734
+ - value: message.rejected
18735
+ - value: domain.verified
18736
+ type_events:EventTypes:
18737
+ type: array
18738
+ items:
18739
+ $ref: '#/components/schemas/type_events:EventType'
18740
+ type_webhooks:ClientId:
18741
+ type: string
18742
+ type_webhooks:Webhook:
18743
+ type: object
18744
+ properties:
18745
+ webhook_id:
18746
+ $ref: '#/components/schemas/type_webhooks:WebhookId'
18747
+ url:
18748
+ $ref: '#/components/schemas/type_webhooks:Url'
18749
+ event_types:
18750
+ $ref: '#/components/schemas/type_events:EventTypes'
18751
+ pod_ids:
18752
+ $ref: '#/components/schemas/type_events:PodIds'
18753
+ inbox_ids:
18754
+ $ref: '#/components/schemas/type_events:InboxIds'
18755
+ secret:
18756
+ type: string
18757
+ description: Secret for webhook signature verification.
18758
+ enabled:
18759
+ type: boolean
18760
+ description: Webhook is enabled.
18761
+ updated_at:
18762
+ type: string
18763
+ format: date-time
18764
+ description: Time at which webhook was last updated.
18765
+ created_at:
18766
+ type: string
18767
+ format: date-time
18768
+ description: Time at which webhook was created.
18769
+ client_id:
18770
+ $ref: '#/components/schemas/type_webhooks:ClientId'
18771
+ required:
18772
+ - webhook_id
18773
+ - url
18774
+ - secret
18775
+ - enabled
18776
+ - updated_at
18777
+ - created_at
18778
+
18779
+ ```
18780
+
18781
+ ## SDK Code Examples
18782
+
18783
+ ```typescript
18784
+ import { AgentMailClient } from "agentmail";
18785
+
18786
+ async function main() {
18787
+ const client = new AgentMailClient({
18788
+ environment: "https://api.agentmail.to",
18789
+ apiKey: "YOUR_TOKEN_HERE",
18790
+ });
18791
+ await client.webhooks.update("webhook_id", {});
18792
+ }
18793
+ main();
18794
+
18795
+ ```
18796
+
18797
+ ```python
18798
+ from agentmail import AgentMail
18799
+
18800
+ client = AgentMail(
18801
+ base_url="https://api.agentmail.to",
18802
+ api_key="YOUR_TOKEN_HERE"
18803
+ )
18804
+
18805
+ client.webhooks.update(
18806
+ webhook_id="webhook_id"
18807
+ )
18808
+
18809
+ ```
18810
+
18811
+ ```go
18812
+ package main
18813
+
18814
+ import (
18815
+ "fmt"
18816
+ "strings"
18817
+ "net/http"
18818
+ "io"
18819
+ )
18820
+
18821
+ func main() {
18822
+
18823
+ url := "https://api.agentmail.to/v0/webhooks/webhook_id"
18824
+
18825
+ payload := strings.NewReader("{}")
18826
+
18827
+ req, _ := http.NewRequest("PATCH", url, payload)
18828
+
18829
+ req.Header.Add("Authorization", "Bearer <api_key>")
18830
+ req.Header.Add("Content-Type", "application/json")
18831
+
18832
+ res, _ := http.DefaultClient.Do(req)
18833
+
18834
+ defer res.Body.Close()
18835
+ body, _ := io.ReadAll(res.Body)
18836
+
18837
+ fmt.Println(res)
18838
+ fmt.Println(string(body))
18839
+
18840
+ }
18841
+ ```
18842
+
18843
+ ```ruby
18844
+ require 'uri'
18845
+ require 'net/http'
18846
+
18847
+ url = URI("https://api.agentmail.to/v0/webhooks/webhook_id")
18848
+
18849
+ http = Net::HTTP.new(url.host, url.port)
18850
+ http.use_ssl = true
18851
+
18852
+ request = Net::HTTP::Patch.new(url)
18853
+ request["Authorization"] = 'Bearer <api_key>'
18854
+ request["Content-Type"] = 'application/json'
18855
+ request.body = "{}"
18856
+
18857
+ response = http.request(request)
18858
+ puts response.read_body
18859
+ ```
18860
+
18861
+ ```java
18862
+ HttpResponse<String> response = Unirest.patch("https://api.agentmail.to/v0/webhooks/webhook_id")
18863
+ .header("Authorization", "Bearer <api_key>")
18864
+ .header("Content-Type", "application/json")
18865
+ .body("{}")
18866
+ .asString();
18867
+ ```
18868
+
18869
+ ```php
18870
+ <?php
18871
+
18872
+ $client = new \GuzzleHttp\Client();
18873
+
18874
+ $response = $client->request('PATCH', 'https://api.agentmail.to/v0/webhooks/webhook_id', [
18875
+ 'body' => '{}',
18876
+ 'headers' => [
18877
+ 'Authorization' => 'Bearer <api_key>',
18878
+ 'Content-Type' => 'application/json',
18879
+ ],
18880
+ ]);
18881
+
18882
+ echo $response->getBody();
18883
+ ```
18884
+
18885
+ ```csharp
18886
+ var client = new RestClient("https://api.agentmail.to/v0/webhooks/webhook_id");
18887
+ var request = new RestRequest(Method.PATCH);
18888
+ request.AddHeader("Authorization", "Bearer <api_key>");
18889
+ request.AddHeader("Content-Type", "application/json");
18890
+ request.AddParameter("application/json", "{}", ParameterType.RequestBody);
18891
+ IRestResponse response = client.Execute(request);
18892
+ ```
18893
+
18894
+ ```swift
18895
+ import Foundation
18896
+
18897
+ let headers = [
18898
+ "Authorization": "Bearer <api_key>",
18899
+ "Content-Type": "application/json"
18900
+ ]
18901
+ let parameters = [] as [String : Any]
18902
+
18903
+ let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
18904
+
18905
+ let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/webhooks/webhook_id")! as URL,
18906
+ cachePolicy: .useProtocolCachePolicy,
18907
+ timeoutInterval: 10.0)
18908
+ request.httpMethod = "PATCH"
18909
+ request.allHTTPHeaderFields = headers
18910
+ request.httpBody = postData as Data
18911
+
18912
+ let session = URLSession.shared
18913
+ let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
18914
+ if (error != nil) {
18915
+ print(error as Any)
18916
+ } else {
18917
+ let httpResponse = response as? HTTPURLResponse
18918
+ print(httpResponse)
18919
+ }
18920
+ })
18921
+
18922
+ dataTask.resume()
18923
+ ```
18924
+
18644
18925
  # Create Webhook
18645
18926
 
18646
18927
  POST https://api.agentmail.to/v0/webhooks
package/dist/llms.txt CHANGED
@@ -79,6 +79,7 @@
79
79
  - API Reference > Domains [Verify Domain](https://docs.agentmail.to/api-reference/domains/verify.mdx)
80
80
  - API Reference > Webhooks [List Webhooks](https://docs.agentmail.to/api-reference/webhooks/list.mdx)
81
81
  - API Reference > Webhooks [Get Webhook](https://docs.agentmail.to/api-reference/webhooks/get.mdx)
82
+ - API Reference > Webhooks [Update Webhook](https://docs.agentmail.to/api-reference/webhooks/update.mdx)
82
83
  - API Reference > Webhooks [Create Webhook](https://docs.agentmail.to/api-reference/webhooks/create.mdx)
83
84
  - API Reference > Webhooks [Delete Webhook](https://docs.agentmail.to/api-reference/webhooks/delete.mdx)
84
85
  - API Reference > Webhooks > Events [Message Received](https://docs.agentmail.to/api-reference/webhooks/events/message-received.mdx)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentmail",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
package/reference.md CHANGED
@@ -547,6 +547,63 @@ await client.webhooks.get("webhook_id");
547
547
  </dl>
548
548
 
549
549
 
550
+ </dd>
551
+ </dl>
552
+ </details>
553
+
554
+ <details><summary><code>client.webhooks.<a href="/src/api/resources/webhooks/client/Client.ts">update</a>(webhook_id, { ...params }) -> AgentMail.Webhook</code></summary>
555
+ <dl>
556
+ <dd>
557
+
558
+ #### 🔌 Usage
559
+
560
+ <dl>
561
+ <dd>
562
+
563
+ <dl>
564
+ <dd>
565
+
566
+ ```typescript
567
+ await client.webhooks.update("webhook_id", {});
568
+
569
+ ```
570
+ </dd>
571
+ </dl>
572
+ </dd>
573
+ </dl>
574
+
575
+ #### ⚙️ Parameters
576
+
577
+ <dl>
578
+ <dd>
579
+
580
+ <dl>
581
+ <dd>
582
+
583
+ **webhook_id:** `AgentMail.WebhookId`
584
+
585
+ </dd>
586
+ </dl>
587
+
588
+ <dl>
589
+ <dd>
590
+
591
+ **request:** `AgentMail.UpdateWebhookRequest`
592
+
593
+ </dd>
594
+ </dl>
595
+
596
+ <dl>
597
+ <dd>
598
+
599
+ **requestOptions:** `WebhooksClient.RequestOptions`
600
+
601
+ </dd>
602
+ </dl>
603
+ </dd>
604
+ </dl>
605
+
606
+
550
607
  </dd>
551
608
  </dl>
552
609
  </details>