agentmail 0.5.12 → 0.5.14
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.d.ts +3 -0
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/api/errors/ConflictError.d.ts +6 -0
- package/dist/cjs/api/errors/ConflictError.js +54 -0
- package/dist/cjs/api/errors/index.d.ts +1 -0
- package/dist/cjs/api/errors/index.js +1 -0
- package/dist/cjs/api/resources/drafts/types/CreateDraftForwardRequest.d.ts +21 -0
- package/dist/cjs/api/resources/drafts/types/CreateDraftForwardRequest.js +3 -0
- package/dist/cjs/api/resources/drafts/types/CreateDraftReplyAllRequest.d.ts +17 -0
- package/dist/cjs/api/resources/drafts/types/CreateDraftReplyAllRequest.js +3 -0
- package/dist/cjs/api/resources/drafts/types/CreateDraftReplyRequest.d.ts +22 -0
- package/dist/cjs/api/resources/drafts/types/CreateDraftReplyRequest.js +3 -0
- package/dist/cjs/api/resources/drafts/types/Draft.d.ts +1 -0
- package/dist/cjs/api/resources/drafts/types/DraftForwardOf.d.ts +4 -0
- package/dist/cjs/api/resources/drafts/types/DraftForwardOf.js +3 -0
- package/dist/cjs/api/resources/drafts/types/DraftItem.d.ts +1 -0
- package/dist/cjs/api/resources/drafts/types/DraftReplyAll.d.ts +4 -0
- package/dist/cjs/api/resources/drafts/types/DraftReplyAll.js +3 -0
- package/dist/cjs/api/resources/drafts/types/index.d.ts +5 -0
- package/dist/cjs/api/resources/drafts/types/index.js +5 -0
- package/dist/cjs/api/resources/inboxes/client/Client.d.ts +3 -0
- package/dist/cjs/api/resources/inboxes/client/Client.js +5 -0
- package/dist/cjs/api/resources/inboxes/resources/drafts/client/Client.d.ts +6 -3
- package/dist/cjs/api/resources/inboxes/resources/drafts/client/Client.js +11 -2
- package/dist/cjs/api/resources/inboxes/resources/index.d.ts +2 -0
- package/dist/cjs/api/resources/inboxes/resources/index.js +3 -1
- package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.d.ts +84 -9
- package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.js +308 -8
- package/dist/cjs/api/resources/inboxes/resources/webhooks/client/Client.d.ts +103 -0
- package/dist/cjs/api/resources/inboxes/resources/webhooks/client/Client.js +411 -0
- package/dist/cjs/api/resources/inboxes/resources/webhooks/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/inboxes/resources/webhooks/client/index.js +17 -0
- package/dist/cjs/api/resources/inboxes/resources/webhooks/client/requests/InboxListWebhooksRequest.d.ts +10 -0
- package/dist/cjs/api/resources/inboxes/resources/webhooks/client/requests/InboxListWebhooksRequest.js +3 -0
- package/dist/cjs/api/resources/inboxes/resources/webhooks/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/inboxes/resources/webhooks/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/inboxes/resources/webhooks/exports.d.ts +2 -0
- package/dist/cjs/api/resources/inboxes/resources/webhooks/exports.js +21 -0
- package/dist/cjs/api/resources/inboxes/resources/webhooks/index.d.ts +1 -0
- package/dist/cjs/api/resources/inboxes/resources/webhooks/index.js +17 -0
- package/dist/cjs/api/resources/pods/client/Client.d.ts +3 -0
- package/dist/cjs/api/resources/pods/client/Client.js +5 -0
- package/dist/cjs/api/resources/pods/resources/index.d.ts +2 -0
- package/dist/cjs/api/resources/pods/resources/index.js +3 -1
- package/dist/cjs/api/resources/pods/resources/webhooks/client/Client.d.ts +103 -0
- package/dist/cjs/api/resources/pods/resources/webhooks/client/Client.js +411 -0
- package/dist/cjs/api/resources/pods/resources/webhooks/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/pods/resources/webhooks/client/index.js +17 -0
- package/dist/cjs/api/resources/pods/resources/webhooks/client/requests/PodListWebhooksRequest.d.ts +10 -0
- package/dist/cjs/api/resources/pods/resources/webhooks/client/requests/PodListWebhooksRequest.js +3 -0
- package/dist/cjs/api/resources/pods/resources/webhooks/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/pods/resources/webhooks/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/pods/resources/webhooks/exports.d.ts +2 -0
- package/dist/cjs/api/resources/pods/resources/webhooks/exports.js +21 -0
- package/dist/cjs/api/resources/pods/resources/webhooks/index.d.ts +1 -0
- package/dist/cjs/api/resources/pods/resources/webhooks/index.js +17 -0
- package/dist/cjs/api/resources/webhooks/types/CreateInboxWebhookRequest.d.ts +10 -0
- package/dist/cjs/api/resources/webhooks/types/CreateInboxWebhookRequest.js +3 -0
- package/dist/cjs/api/resources/webhooks/types/CreatePodWebhookRequest.d.ts +9 -0
- package/dist/cjs/api/resources/webhooks/types/CreatePodWebhookRequest.js +3 -0
- package/dist/cjs/api/resources/webhooks/types/CreateWebhookEventTypes.d.ts +7 -0
- package/dist/cjs/api/resources/webhooks/types/CreateWebhookEventTypes.js +3 -0
- package/dist/cjs/api/resources/webhooks/types/CreateWebhookRequest.d.ts +1 -10
- package/dist/cjs/api/resources/webhooks/types/UpdateInboxWebhookRequest.d.ts +7 -0
- package/dist/cjs/api/resources/webhooks/types/UpdateInboxWebhookRequest.js +3 -0
- package/dist/cjs/api/resources/webhooks/types/UpdatePodWebhookRequest.d.ts +11 -0
- package/dist/cjs/api/resources/webhooks/types/UpdatePodWebhookRequest.js +3 -0
- package/dist/cjs/api/resources/webhooks/types/UpdateWebhookEventTypes.d.ts +10 -0
- package/dist/cjs/api/resources/webhooks/types/UpdateWebhookEventTypes.js +3 -0
- package/dist/cjs/api/resources/webhooks/types/UpdateWebhookRequest.d.ts +1 -14
- package/dist/cjs/api/resources/webhooks/types/index.d.ts +6 -0
- package/dist/cjs/api/resources/webhooks/types/index.js +6 -0
- package/dist/cjs/serialization/resources/drafts/types/CreateDraftForwardRequest.d.ts +30 -0
- package/dist/cjs/serialization/resources/drafts/types/CreateDraftForwardRequest.js +62 -0
- package/dist/cjs/serialization/resources/drafts/types/CreateDraftReplyAllRequest.d.ts +24 -0
- package/dist/cjs/serialization/resources/drafts/types/CreateDraftReplyAllRequest.js +56 -0
- package/dist/cjs/serialization/resources/drafts/types/CreateDraftReplyRequest.d.ts +32 -0
- package/dist/cjs/serialization/resources/drafts/types/CreateDraftReplyRequest.js +64 -0
- package/dist/cjs/serialization/resources/drafts/types/Draft.d.ts +2 -0
- package/dist/cjs/serialization/resources/drafts/types/Draft.js +2 -0
- package/dist/cjs/serialization/resources/drafts/types/DraftForwardOf.d.ts +7 -0
- package/dist/cjs/serialization/resources/drafts/types/DraftForwardOf.js +39 -0
- package/dist/cjs/serialization/resources/drafts/types/DraftItem.d.ts +2 -0
- package/dist/cjs/serialization/resources/drafts/types/DraftItem.js +2 -0
- package/dist/cjs/serialization/resources/drafts/types/DraftReplyAll.d.ts +7 -0
- package/dist/cjs/serialization/resources/drafts/types/DraftReplyAll.js +39 -0
- package/dist/cjs/serialization/resources/drafts/types/index.d.ts +5 -0
- package/dist/cjs/serialization/resources/drafts/types/index.js +5 -0
- package/dist/cjs/serialization/resources/webhooks/types/CreateInboxWebhookRequest.d.ts +14 -0
- package/dist/cjs/serialization/resources/webhooks/types/CreateInboxWebhookRequest.js +46 -0
- package/dist/cjs/serialization/resources/webhooks/types/CreatePodWebhookRequest.d.ts +11 -0
- package/dist/cjs/serialization/resources/webhooks/types/CreatePodWebhookRequest.js +45 -0
- package/dist/cjs/serialization/resources/webhooks/types/CreateWebhookEventTypes.d.ts +8 -0
- package/dist/cjs/serialization/resources/webhooks/types/CreateWebhookEventTypes.js +6 -0
- package/dist/cjs/serialization/resources/webhooks/types/CreateWebhookRequest.d.ts +2 -9
- package/dist/cjs/serialization/resources/webhooks/types/CreateWebhookRequest.js +5 -10
- package/dist/cjs/serialization/resources/webhooks/types/UpdateInboxWebhookRequest.d.ts +10 -0
- package/dist/cjs/serialization/resources/webhooks/types/UpdateInboxWebhookRequest.js +42 -0
- package/dist/cjs/serialization/resources/webhooks/types/UpdatePodWebhookRequest.d.ts +12 -0
- package/dist/cjs/serialization/resources/webhooks/types/UpdatePodWebhookRequest.js +46 -0
- package/dist/cjs/serialization/resources/webhooks/types/UpdateWebhookEventTypes.d.ts +8 -0
- package/dist/cjs/serialization/resources/webhooks/types/UpdateWebhookEventTypes.js +6 -0
- package/dist/cjs/serialization/resources/webhooks/types/UpdateWebhookRequest.d.ts +2 -6
- package/dist/cjs/serialization/resources/webhooks/types/UpdateWebhookRequest.js +5 -7
- package/dist/cjs/serialization/resources/webhooks/types/index.d.ts +6 -0
- package/dist/cjs/serialization/resources/webhooks/types/index.js +6 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.d.mts +3 -0
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/api/errors/ConflictError.d.mts +6 -0
- package/dist/esm/api/errors/ConflictError.mjs +17 -0
- package/dist/esm/api/errors/index.d.mts +1 -0
- package/dist/esm/api/errors/index.mjs +1 -0
- package/dist/esm/api/resources/drafts/types/CreateDraftForwardRequest.d.mts +21 -0
- package/dist/esm/api/resources/drafts/types/CreateDraftForwardRequest.mjs +2 -0
- package/dist/esm/api/resources/drafts/types/CreateDraftReplyAllRequest.d.mts +17 -0
- package/dist/esm/api/resources/drafts/types/CreateDraftReplyAllRequest.mjs +2 -0
- package/dist/esm/api/resources/drafts/types/CreateDraftReplyRequest.d.mts +22 -0
- package/dist/esm/api/resources/drafts/types/CreateDraftReplyRequest.mjs +2 -0
- package/dist/esm/api/resources/drafts/types/Draft.d.mts +1 -0
- package/dist/esm/api/resources/drafts/types/DraftForwardOf.d.mts +4 -0
- package/dist/esm/api/resources/drafts/types/DraftForwardOf.mjs +2 -0
- package/dist/esm/api/resources/drafts/types/DraftItem.d.mts +1 -0
- package/dist/esm/api/resources/drafts/types/DraftReplyAll.d.mts +4 -0
- package/dist/esm/api/resources/drafts/types/DraftReplyAll.mjs +2 -0
- package/dist/esm/api/resources/drafts/types/index.d.mts +5 -0
- package/dist/esm/api/resources/drafts/types/index.mjs +5 -0
- package/dist/esm/api/resources/inboxes/client/Client.d.mts +3 -0
- package/dist/esm/api/resources/inboxes/client/Client.mjs +5 -0
- package/dist/esm/api/resources/inboxes/resources/drafts/client/Client.d.mts +6 -3
- package/dist/esm/api/resources/inboxes/resources/drafts/client/Client.mjs +12 -3
- package/dist/esm/api/resources/inboxes/resources/index.d.mts +2 -0
- package/dist/esm/api/resources/inboxes/resources/index.mjs +2 -0
- package/dist/esm/api/resources/inboxes/resources/messages/client/Client.d.mts +84 -9
- package/dist/esm/api/resources/inboxes/resources/messages/client/Client.mjs +309 -9
- package/dist/esm/api/resources/inboxes/resources/webhooks/client/Client.d.mts +103 -0
- package/dist/esm/api/resources/inboxes/resources/webhooks/client/Client.mjs +374 -0
- package/dist/esm/api/resources/inboxes/resources/webhooks/client/index.d.mts +1 -0
- package/dist/esm/api/resources/inboxes/resources/webhooks/client/index.mjs +1 -0
- package/dist/esm/api/resources/inboxes/resources/webhooks/client/requests/InboxListWebhooksRequest.d.mts +10 -0
- package/dist/esm/api/resources/inboxes/resources/webhooks/client/requests/InboxListWebhooksRequest.mjs +2 -0
- package/dist/esm/api/resources/inboxes/resources/webhooks/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/inboxes/resources/webhooks/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/inboxes/resources/webhooks/exports.d.mts +2 -0
- package/dist/esm/api/resources/inboxes/resources/webhooks/exports.mjs +3 -0
- package/dist/esm/api/resources/inboxes/resources/webhooks/index.d.mts +1 -0
- package/dist/esm/api/resources/inboxes/resources/webhooks/index.mjs +1 -0
- package/dist/esm/api/resources/pods/client/Client.d.mts +3 -0
- package/dist/esm/api/resources/pods/client/Client.mjs +5 -0
- package/dist/esm/api/resources/pods/resources/index.d.mts +2 -0
- package/dist/esm/api/resources/pods/resources/index.mjs +2 -0
- package/dist/esm/api/resources/pods/resources/webhooks/client/Client.d.mts +103 -0
- package/dist/esm/api/resources/pods/resources/webhooks/client/Client.mjs +374 -0
- package/dist/esm/api/resources/pods/resources/webhooks/client/index.d.mts +1 -0
- package/dist/esm/api/resources/pods/resources/webhooks/client/index.mjs +1 -0
- package/dist/esm/api/resources/pods/resources/webhooks/client/requests/PodListWebhooksRequest.d.mts +10 -0
- package/dist/esm/api/resources/pods/resources/webhooks/client/requests/PodListWebhooksRequest.mjs +2 -0
- package/dist/esm/api/resources/pods/resources/webhooks/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/pods/resources/webhooks/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/pods/resources/webhooks/exports.d.mts +2 -0
- package/dist/esm/api/resources/pods/resources/webhooks/exports.mjs +3 -0
- package/dist/esm/api/resources/pods/resources/webhooks/index.d.mts +1 -0
- package/dist/esm/api/resources/pods/resources/webhooks/index.mjs +1 -0
- package/dist/esm/api/resources/webhooks/types/CreateInboxWebhookRequest.d.mts +10 -0
- package/dist/esm/api/resources/webhooks/types/CreateInboxWebhookRequest.mjs +2 -0
- package/dist/esm/api/resources/webhooks/types/CreatePodWebhookRequest.d.mts +9 -0
- package/dist/esm/api/resources/webhooks/types/CreatePodWebhookRequest.mjs +2 -0
- package/dist/esm/api/resources/webhooks/types/CreateWebhookEventTypes.d.mts +7 -0
- package/dist/esm/api/resources/webhooks/types/CreateWebhookEventTypes.mjs +2 -0
- package/dist/esm/api/resources/webhooks/types/CreateWebhookRequest.d.mts +1 -10
- package/dist/esm/api/resources/webhooks/types/UpdateInboxWebhookRequest.d.mts +7 -0
- package/dist/esm/api/resources/webhooks/types/UpdateInboxWebhookRequest.mjs +2 -0
- package/dist/esm/api/resources/webhooks/types/UpdatePodWebhookRequest.d.mts +11 -0
- package/dist/esm/api/resources/webhooks/types/UpdatePodWebhookRequest.mjs +2 -0
- package/dist/esm/api/resources/webhooks/types/UpdateWebhookEventTypes.d.mts +10 -0
- package/dist/esm/api/resources/webhooks/types/UpdateWebhookEventTypes.mjs +2 -0
- package/dist/esm/api/resources/webhooks/types/UpdateWebhookRequest.d.mts +1 -14
- package/dist/esm/api/resources/webhooks/types/index.d.mts +6 -0
- package/dist/esm/api/resources/webhooks/types/index.mjs +6 -0
- package/dist/esm/serialization/resources/drafts/types/CreateDraftForwardRequest.d.mts +30 -0
- package/dist/esm/serialization/resources/drafts/types/CreateDraftForwardRequest.mjs +26 -0
- package/dist/esm/serialization/resources/drafts/types/CreateDraftReplyAllRequest.d.mts +24 -0
- package/dist/esm/serialization/resources/drafts/types/CreateDraftReplyAllRequest.mjs +20 -0
- package/dist/esm/serialization/resources/drafts/types/CreateDraftReplyRequest.d.mts +32 -0
- package/dist/esm/serialization/resources/drafts/types/CreateDraftReplyRequest.mjs +28 -0
- package/dist/esm/serialization/resources/drafts/types/Draft.d.mts +2 -0
- package/dist/esm/serialization/resources/drafts/types/Draft.mjs +2 -0
- package/dist/esm/serialization/resources/drafts/types/DraftForwardOf.d.mts +7 -0
- package/dist/esm/serialization/resources/drafts/types/DraftForwardOf.mjs +3 -0
- package/dist/esm/serialization/resources/drafts/types/DraftItem.d.mts +2 -0
- package/dist/esm/serialization/resources/drafts/types/DraftItem.mjs +2 -0
- package/dist/esm/serialization/resources/drafts/types/DraftReplyAll.d.mts +7 -0
- package/dist/esm/serialization/resources/drafts/types/DraftReplyAll.mjs +3 -0
- package/dist/esm/serialization/resources/drafts/types/index.d.mts +5 -0
- package/dist/esm/serialization/resources/drafts/types/index.mjs +5 -0
- package/dist/esm/serialization/resources/webhooks/types/CreateInboxWebhookRequest.d.mts +14 -0
- package/dist/esm/serialization/resources/webhooks/types/CreateInboxWebhookRequest.mjs +10 -0
- package/dist/esm/serialization/resources/webhooks/types/CreatePodWebhookRequest.d.mts +11 -0
- package/dist/esm/serialization/resources/webhooks/types/CreatePodWebhookRequest.mjs +9 -0
- package/dist/esm/serialization/resources/webhooks/types/CreateWebhookEventTypes.d.mts +8 -0
- package/dist/esm/serialization/resources/webhooks/types/CreateWebhookEventTypes.mjs +3 -0
- package/dist/esm/serialization/resources/webhooks/types/CreateWebhookRequest.d.mts +2 -9
- package/dist/esm/serialization/resources/webhooks/types/CreateWebhookRequest.mjs +5 -10
- package/dist/esm/serialization/resources/webhooks/types/UpdateInboxWebhookRequest.d.mts +10 -0
- package/dist/esm/serialization/resources/webhooks/types/UpdateInboxWebhookRequest.mjs +6 -0
- package/dist/esm/serialization/resources/webhooks/types/UpdatePodWebhookRequest.d.mts +12 -0
- package/dist/esm/serialization/resources/webhooks/types/UpdatePodWebhookRequest.mjs +10 -0
- package/dist/esm/serialization/resources/webhooks/types/UpdateWebhookEventTypes.d.mts +8 -0
- package/dist/esm/serialization/resources/webhooks/types/UpdateWebhookEventTypes.mjs +3 -0
- package/dist/esm/serialization/resources/webhooks/types/UpdateWebhookRequest.d.mts +2 -6
- package/dist/esm/serialization/resources/webhooks/types/UpdateWebhookRequest.mjs +5 -7
- package/dist/esm/serialization/resources/webhooks/types/index.d.mts +6 -0
- package/dist/esm/serialization/resources/webhooks/types/index.mjs +6 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/dist/llms.txt +21 -4
- package/package.json +23 -1
- package/reference.md +1466 -440
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
import { normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.mjs";
|
|
12
|
+
import { mergeHeaders } from "../../../../../../core/headers.mjs";
|
|
13
|
+
import * as core from "../../../../../../core/index.mjs";
|
|
14
|
+
import * as environments from "../../../../../../environments.mjs";
|
|
15
|
+
import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.mjs";
|
|
16
|
+
import * as errors from "../../../../../../errors/index.mjs";
|
|
17
|
+
import * as serializers from "../../../../../../serialization/index.mjs";
|
|
18
|
+
import * as AgentMail from "../../../../../index.mjs";
|
|
19
|
+
export class WebhooksClient {
|
|
20
|
+
constructor(options = {}) {
|
|
21
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* **CLI:**
|
|
25
|
+
* ```bash
|
|
26
|
+
* agentmail inboxes:webhooks list --inbox-id <inbox_id>
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
30
|
+
* @param {AgentMail.inboxes.InboxListWebhooksRequest} request
|
|
31
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* await client.inboxes.webhooks.list("inbox_id")
|
|
35
|
+
*/
|
|
36
|
+
list(inbox_id, request = {}, requestOptions) {
|
|
37
|
+
return core.HttpResponsePromise.fromPromise(this.__list(inbox_id, request, requestOptions));
|
|
38
|
+
}
|
|
39
|
+
__list(inbox_id_1) {
|
|
40
|
+
return __awaiter(this, arguments, void 0, function* (inbox_id, request = {}, requestOptions) {
|
|
41
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
42
|
+
const { limit, pageToken, ascending } = request;
|
|
43
|
+
const _queryParams = {
|
|
44
|
+
limit,
|
|
45
|
+
page_token: pageToken,
|
|
46
|
+
ascending,
|
|
47
|
+
};
|
|
48
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
49
|
+
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);
|
|
50
|
+
const _response = yield core.fetcher({
|
|
51
|
+
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
|
|
52
|
+
.http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/webhooks`),
|
|
53
|
+
method: "GET",
|
|
54
|
+
headers: _headers,
|
|
55
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
56
|
+
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,
|
|
57
|
+
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,
|
|
58
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
59
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
60
|
+
logging: this._options.logging,
|
|
61
|
+
});
|
|
62
|
+
if (_response.ok) {
|
|
63
|
+
return {
|
|
64
|
+
data: serializers.webhooks.ListWebhooksResponse.parseOrThrow(_response.body, {
|
|
65
|
+
unrecognizedObjectKeys: "passthrough",
|
|
66
|
+
allowUnrecognizedUnionMembers: true,
|
|
67
|
+
allowUnrecognizedEnumValues: true,
|
|
68
|
+
skipValidation: true,
|
|
69
|
+
breadcrumbsPrefix: ["response"],
|
|
70
|
+
}),
|
|
71
|
+
rawResponse: _response.rawResponse,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
if (_response.error.reason === "status-code") {
|
|
75
|
+
throw new errors.AgentMailError({
|
|
76
|
+
statusCode: _response.error.statusCode,
|
|
77
|
+
body: _response.error.body,
|
|
78
|
+
rawResponse: _response.rawResponse,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/inboxes/{inbox_id}/webhooks");
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* **CLI:**
|
|
86
|
+
* ```bash
|
|
87
|
+
* agentmail inboxes:webhooks get --inbox-id <inbox_id> --webhook-id <webhook_id>
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
90
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
91
|
+
* @param {AgentMail.webhooks.WebhookId} webhook_id
|
|
92
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
93
|
+
*
|
|
94
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* await client.inboxes.webhooks.get("inbox_id", "webhook_id")
|
|
98
|
+
*/
|
|
99
|
+
get(inbox_id, webhook_id, requestOptions) {
|
|
100
|
+
return core.HttpResponsePromise.fromPromise(this.__get(inbox_id, webhook_id, requestOptions));
|
|
101
|
+
}
|
|
102
|
+
__get(inbox_id, webhook_id, requestOptions) {
|
|
103
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
104
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
105
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
106
|
+
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);
|
|
107
|
+
const _response = yield core.fetcher({
|
|
108
|
+
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
|
|
109
|
+
.http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/webhooks/${core.url.encodePathParam(serializers.webhooks.WebhookId.jsonOrThrow(webhook_id, { omitUndefined: true }))}`),
|
|
110
|
+
method: "GET",
|
|
111
|
+
headers: _headers,
|
|
112
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
113
|
+
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,
|
|
114
|
+
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,
|
|
115
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
116
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
117
|
+
logging: this._options.logging,
|
|
118
|
+
});
|
|
119
|
+
if (_response.ok) {
|
|
120
|
+
return {
|
|
121
|
+
data: serializers.webhooks.Webhook.parseOrThrow(_response.body, {
|
|
122
|
+
unrecognizedObjectKeys: "passthrough",
|
|
123
|
+
allowUnrecognizedUnionMembers: true,
|
|
124
|
+
allowUnrecognizedEnumValues: true,
|
|
125
|
+
skipValidation: true,
|
|
126
|
+
breadcrumbsPrefix: ["response"],
|
|
127
|
+
}),
|
|
128
|
+
rawResponse: _response.rawResponse,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
if (_response.error.reason === "status-code") {
|
|
132
|
+
switch (_response.error.statusCode) {
|
|
133
|
+
case 404:
|
|
134
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
135
|
+
unrecognizedObjectKeys: "passthrough",
|
|
136
|
+
allowUnrecognizedUnionMembers: true,
|
|
137
|
+
allowUnrecognizedEnumValues: true,
|
|
138
|
+
skipValidation: true,
|
|
139
|
+
breadcrumbsPrefix: ["response"],
|
|
140
|
+
}), _response.rawResponse);
|
|
141
|
+
default:
|
|
142
|
+
throw new errors.AgentMailError({
|
|
143
|
+
statusCode: _response.error.statusCode,
|
|
144
|
+
body: _response.error.body,
|
|
145
|
+
rawResponse: _response.rawResponse,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/inboxes/{inbox_id}/webhooks/{webhook_id}");
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Create a webhook scoped to this inbox.
|
|
154
|
+
*
|
|
155
|
+
* **CLI:**
|
|
156
|
+
* ```bash
|
|
157
|
+
* agentmail inboxes:webhooks create --inbox-id <inbox_id> --url https://example.com/webhook --event-type message.received
|
|
158
|
+
* ```
|
|
159
|
+
*
|
|
160
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
161
|
+
* @param {AgentMail.webhooks.CreateInboxWebhookRequest} request
|
|
162
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
163
|
+
*
|
|
164
|
+
* @throws {@link AgentMail.ValidationError}
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* await client.inboxes.webhooks.create("inbox_id", {
|
|
168
|
+
* url: "url",
|
|
169
|
+
* eventTypes: ["message.received", "message.received"]
|
|
170
|
+
* })
|
|
171
|
+
*/
|
|
172
|
+
create(inbox_id, request, requestOptions) {
|
|
173
|
+
return core.HttpResponsePromise.fromPromise(this.__create(inbox_id, request, requestOptions));
|
|
174
|
+
}
|
|
175
|
+
__create(inbox_id, request, requestOptions) {
|
|
176
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
177
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
178
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
179
|
+
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);
|
|
180
|
+
const _response = yield core.fetcher({
|
|
181
|
+
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
|
|
182
|
+
.http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/webhooks`),
|
|
183
|
+
method: "POST",
|
|
184
|
+
headers: _headers,
|
|
185
|
+
contentType: "application/json",
|
|
186
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
187
|
+
requestType: "json",
|
|
188
|
+
body: serializers.webhooks.CreateInboxWebhookRequest.jsonOrThrow(request, {
|
|
189
|
+
unrecognizedObjectKeys: "strip",
|
|
190
|
+
omitUndefined: true,
|
|
191
|
+
}),
|
|
192
|
+
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,
|
|
193
|
+
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,
|
|
194
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
195
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
196
|
+
logging: this._options.logging,
|
|
197
|
+
});
|
|
198
|
+
if (_response.ok) {
|
|
199
|
+
return {
|
|
200
|
+
data: serializers.webhooks.Webhook.parseOrThrow(_response.body, {
|
|
201
|
+
unrecognizedObjectKeys: "passthrough",
|
|
202
|
+
allowUnrecognizedUnionMembers: true,
|
|
203
|
+
allowUnrecognizedEnumValues: true,
|
|
204
|
+
skipValidation: true,
|
|
205
|
+
breadcrumbsPrefix: ["response"],
|
|
206
|
+
}),
|
|
207
|
+
rawResponse: _response.rawResponse,
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
if (_response.error.reason === "status-code") {
|
|
211
|
+
switch (_response.error.statusCode) {
|
|
212
|
+
case 400:
|
|
213
|
+
throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
|
|
214
|
+
unrecognizedObjectKeys: "passthrough",
|
|
215
|
+
allowUnrecognizedUnionMembers: true,
|
|
216
|
+
allowUnrecognizedEnumValues: true,
|
|
217
|
+
skipValidation: true,
|
|
218
|
+
breadcrumbsPrefix: ["response"],
|
|
219
|
+
}), _response.rawResponse);
|
|
220
|
+
default:
|
|
221
|
+
throw new errors.AgentMailError({
|
|
222
|
+
statusCode: _response.error.statusCode,
|
|
223
|
+
body: _response.error.body,
|
|
224
|
+
rawResponse: _response.rawResponse,
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/webhooks");
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* **CLI:**
|
|
233
|
+
* ```bash
|
|
234
|
+
* agentmail inboxes:webhooks update --inbox-id <inbox_id> --webhook-id <webhook_id> --event-type message.received
|
|
235
|
+
* ```
|
|
236
|
+
*
|
|
237
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
238
|
+
* @param {AgentMail.webhooks.WebhookId} webhook_id
|
|
239
|
+
* @param {AgentMail.webhooks.UpdateInboxWebhookRequest} request
|
|
240
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
241
|
+
*
|
|
242
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
243
|
+
* @throws {@link AgentMail.ValidationError}
|
|
244
|
+
*
|
|
245
|
+
* @example
|
|
246
|
+
* await client.inboxes.webhooks.update("inbox_id", "webhook_id", {})
|
|
247
|
+
*/
|
|
248
|
+
update(inbox_id, webhook_id, request, requestOptions) {
|
|
249
|
+
return core.HttpResponsePromise.fromPromise(this.__update(inbox_id, webhook_id, request, requestOptions));
|
|
250
|
+
}
|
|
251
|
+
__update(inbox_id, webhook_id, request, requestOptions) {
|
|
252
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
253
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
254
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
255
|
+
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);
|
|
256
|
+
const _response = yield core.fetcher({
|
|
257
|
+
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
|
|
258
|
+
.http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/webhooks/${core.url.encodePathParam(serializers.webhooks.WebhookId.jsonOrThrow(webhook_id, { omitUndefined: true }))}`),
|
|
259
|
+
method: "PATCH",
|
|
260
|
+
headers: _headers,
|
|
261
|
+
contentType: "application/json",
|
|
262
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
263
|
+
requestType: "json",
|
|
264
|
+
body: serializers.webhooks.UpdateInboxWebhookRequest.jsonOrThrow(request, {
|
|
265
|
+
unrecognizedObjectKeys: "strip",
|
|
266
|
+
omitUndefined: true,
|
|
267
|
+
}),
|
|
268
|
+
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,
|
|
269
|
+
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,
|
|
270
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
271
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
272
|
+
logging: this._options.logging,
|
|
273
|
+
});
|
|
274
|
+
if (_response.ok) {
|
|
275
|
+
return {
|
|
276
|
+
data: serializers.webhooks.Webhook.parseOrThrow(_response.body, {
|
|
277
|
+
unrecognizedObjectKeys: "passthrough",
|
|
278
|
+
allowUnrecognizedUnionMembers: true,
|
|
279
|
+
allowUnrecognizedEnumValues: true,
|
|
280
|
+
skipValidation: true,
|
|
281
|
+
breadcrumbsPrefix: ["response"],
|
|
282
|
+
}),
|
|
283
|
+
rawResponse: _response.rawResponse,
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
if (_response.error.reason === "status-code") {
|
|
287
|
+
switch (_response.error.statusCode) {
|
|
288
|
+
case 404:
|
|
289
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
290
|
+
unrecognizedObjectKeys: "passthrough",
|
|
291
|
+
allowUnrecognizedUnionMembers: true,
|
|
292
|
+
allowUnrecognizedEnumValues: true,
|
|
293
|
+
skipValidation: true,
|
|
294
|
+
breadcrumbsPrefix: ["response"],
|
|
295
|
+
}), _response.rawResponse);
|
|
296
|
+
case 400:
|
|
297
|
+
throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
|
|
298
|
+
unrecognizedObjectKeys: "passthrough",
|
|
299
|
+
allowUnrecognizedUnionMembers: true,
|
|
300
|
+
allowUnrecognizedEnumValues: true,
|
|
301
|
+
skipValidation: true,
|
|
302
|
+
breadcrumbsPrefix: ["response"],
|
|
303
|
+
}), _response.rawResponse);
|
|
304
|
+
default:
|
|
305
|
+
throw new errors.AgentMailError({
|
|
306
|
+
statusCode: _response.error.statusCode,
|
|
307
|
+
body: _response.error.body,
|
|
308
|
+
rawResponse: _response.rawResponse,
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PATCH", "/v0/inboxes/{inbox_id}/webhooks/{webhook_id}");
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* **CLI:**
|
|
317
|
+
* ```bash
|
|
318
|
+
* agentmail inboxes:webhooks delete --inbox-id <inbox_id> --webhook-id <webhook_id>
|
|
319
|
+
* ```
|
|
320
|
+
*
|
|
321
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
322
|
+
* @param {AgentMail.webhooks.WebhookId} webhook_id
|
|
323
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
324
|
+
*
|
|
325
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
326
|
+
*
|
|
327
|
+
* @example
|
|
328
|
+
* await client.inboxes.webhooks.delete("inbox_id", "webhook_id")
|
|
329
|
+
*/
|
|
330
|
+
delete(inbox_id, webhook_id, requestOptions) {
|
|
331
|
+
return core.HttpResponsePromise.fromPromise(this.__delete(inbox_id, webhook_id, requestOptions));
|
|
332
|
+
}
|
|
333
|
+
__delete(inbox_id, webhook_id, requestOptions) {
|
|
334
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
335
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
336
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
337
|
+
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);
|
|
338
|
+
const _response = yield core.fetcher({
|
|
339
|
+
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
|
|
340
|
+
.http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/webhooks/${core.url.encodePathParam(serializers.webhooks.WebhookId.jsonOrThrow(webhook_id, { omitUndefined: true }))}`),
|
|
341
|
+
method: "DELETE",
|
|
342
|
+
headers: _headers,
|
|
343
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
344
|
+
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,
|
|
345
|
+
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,
|
|
346
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
347
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
348
|
+
logging: this._options.logging,
|
|
349
|
+
});
|
|
350
|
+
if (_response.ok) {
|
|
351
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
352
|
+
}
|
|
353
|
+
if (_response.error.reason === "status-code") {
|
|
354
|
+
switch (_response.error.statusCode) {
|
|
355
|
+
case 404:
|
|
356
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
357
|
+
unrecognizedObjectKeys: "passthrough",
|
|
358
|
+
allowUnrecognizedUnionMembers: true,
|
|
359
|
+
allowUnrecognizedEnumValues: true,
|
|
360
|
+
skipValidation: true,
|
|
361
|
+
breadcrumbsPrefix: ["response"],
|
|
362
|
+
}), _response.rawResponse);
|
|
363
|
+
default:
|
|
364
|
+
throw new errors.AgentMailError({
|
|
365
|
+
statusCode: _response.error.statusCode,
|
|
366
|
+
body: _response.error.body,
|
|
367
|
+
rawResponse: _response.rawResponse,
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v0/inboxes/{inbox_id}/webhooks/{webhook_id}");
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { InboxListWebhooksRequest } from "./InboxListWebhooksRequest.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client/index.mjs";
|
|
@@ -9,6 +9,7 @@ import { InboxesClient } from "../resources/inboxes/client/Client.mjs";
|
|
|
9
9
|
import { ListsClient } from "../resources/lists/client/Client.mjs";
|
|
10
10
|
import { MetricsClient } from "../resources/metrics/client/Client.mjs";
|
|
11
11
|
import { ThreadsClient } from "../resources/threads/client/Client.mjs";
|
|
12
|
+
import { WebhooksClient } from "../resources/webhooks/client/Client.mjs";
|
|
12
13
|
export declare namespace PodsClient {
|
|
13
14
|
type Options = BaseClientOptions;
|
|
14
15
|
interface RequestOptions extends BaseRequestOptions {
|
|
@@ -19,6 +20,7 @@ export declare class PodsClient {
|
|
|
19
20
|
protected _inboxes: InboxesClient | undefined;
|
|
20
21
|
protected _threads: ThreadsClient | undefined;
|
|
21
22
|
protected _drafts: DraftsClient | undefined;
|
|
23
|
+
protected _webhooks: WebhooksClient | undefined;
|
|
22
24
|
protected _domains: DomainsClient | undefined;
|
|
23
25
|
protected _lists: ListsClient | undefined;
|
|
24
26
|
protected _metrics: MetricsClient | undefined;
|
|
@@ -27,6 +29,7 @@ export declare class PodsClient {
|
|
|
27
29
|
get inboxes(): InboxesClient;
|
|
28
30
|
get threads(): ThreadsClient;
|
|
29
31
|
get drafts(): DraftsClient;
|
|
32
|
+
get webhooks(): WebhooksClient;
|
|
30
33
|
get domains(): DomainsClient;
|
|
31
34
|
get lists(): ListsClient;
|
|
32
35
|
get metrics(): MetricsClient;
|
|
@@ -23,6 +23,7 @@ import { InboxesClient } from "../resources/inboxes/client/Client.mjs";
|
|
|
23
23
|
import { ListsClient } from "../resources/lists/client/Client.mjs";
|
|
24
24
|
import { MetricsClient } from "../resources/metrics/client/Client.mjs";
|
|
25
25
|
import { ThreadsClient } from "../resources/threads/client/Client.mjs";
|
|
26
|
+
import { WebhooksClient } from "../resources/webhooks/client/Client.mjs";
|
|
26
27
|
export class PodsClient {
|
|
27
28
|
constructor(options = {}) {
|
|
28
29
|
this._options = normalizeClientOptionsWithAuth(options);
|
|
@@ -39,6 +40,10 @@ export class PodsClient {
|
|
|
39
40
|
var _a;
|
|
40
41
|
return ((_a = this._drafts) !== null && _a !== void 0 ? _a : (this._drafts = new DraftsClient(this._options)));
|
|
41
42
|
}
|
|
43
|
+
get webhooks() {
|
|
44
|
+
var _a;
|
|
45
|
+
return ((_a = this._webhooks) !== null && _a !== void 0 ? _a : (this._webhooks = new WebhooksClient(this._options)));
|
|
46
|
+
}
|
|
42
47
|
get domains() {
|
|
43
48
|
var _a;
|
|
44
49
|
return ((_a = this._domains) !== null && _a !== void 0 ? _a : (this._domains = new DomainsClient(this._options)));
|
|
@@ -12,3 +12,5 @@ export * from "./metrics/client/requests/index.mjs";
|
|
|
12
12
|
export * as metrics from "./metrics/index.mjs";
|
|
13
13
|
export * from "./threads/client/requests/index.mjs";
|
|
14
14
|
export * as threads from "./threads/index.mjs";
|
|
15
|
+
export * from "./webhooks/client/requests/index.mjs";
|
|
16
|
+
export * as webhooks from "./webhooks/index.mjs";
|
|
@@ -12,3 +12,5 @@ export * from "./metrics/client/requests/index.mjs";
|
|
|
12
12
|
export * as metrics from "./metrics/index.mjs";
|
|
13
13
|
export * from "./threads/client/requests/index.mjs";
|
|
14
14
|
export * as threads from "./threads/index.mjs";
|
|
15
|
+
export * from "./webhooks/client/requests/index.mjs";
|
|
16
|
+
export * as webhooks from "./webhooks/index.mjs";
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../BaseClient.mjs";
|
|
2
|
+
import { type NormalizedClientOptionsWithAuth } from "../../../../../../BaseClient.mjs";
|
|
3
|
+
import * as core from "../../../../../../core/index.mjs";
|
|
4
|
+
import * as AgentMail from "../../../../../index.mjs";
|
|
5
|
+
export declare namespace WebhooksClient {
|
|
6
|
+
type Options = BaseClientOptions;
|
|
7
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare class WebhooksClient {
|
|
11
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<WebhooksClient.Options>;
|
|
12
|
+
constructor(options?: WebhooksClient.Options);
|
|
13
|
+
/**
|
|
14
|
+
* **CLI:**
|
|
15
|
+
* ```bash
|
|
16
|
+
* agentmail pods:webhooks list --pod-id <pod_id>
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @param {AgentMail.pods.PodId} pod_id
|
|
20
|
+
* @param {AgentMail.pods.PodListWebhooksRequest} request
|
|
21
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* await client.pods.webhooks.list("pod_id")
|
|
25
|
+
*/
|
|
26
|
+
list(pod_id: AgentMail.pods.PodId, request?: AgentMail.pods.PodListWebhooksRequest, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentMail.webhooks.ListWebhooksResponse>;
|
|
27
|
+
private __list;
|
|
28
|
+
/**
|
|
29
|
+
* **CLI:**
|
|
30
|
+
* ```bash
|
|
31
|
+
* agentmail pods:webhooks get --pod-id <pod_id> --webhook-id <webhook_id>
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @param {AgentMail.pods.PodId} pod_id
|
|
35
|
+
* @param {AgentMail.webhooks.WebhookId} webhook_id
|
|
36
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
37
|
+
*
|
|
38
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* await client.pods.webhooks.get("pod_id", "webhook_id")
|
|
42
|
+
*/
|
|
43
|
+
get(pod_id: AgentMail.pods.PodId, webhook_id: AgentMail.webhooks.WebhookId, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentMail.webhooks.Webhook>;
|
|
44
|
+
private __get;
|
|
45
|
+
/**
|
|
46
|
+
* Create a webhook scoped to this pod.
|
|
47
|
+
*
|
|
48
|
+
* **CLI:**
|
|
49
|
+
* ```bash
|
|
50
|
+
* agentmail pods:webhooks create --pod-id <pod_id> --url https://example.com/webhook --event-type message.received
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* @param {AgentMail.pods.PodId} pod_id
|
|
54
|
+
* @param {AgentMail.webhooks.CreatePodWebhookRequest} request
|
|
55
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
56
|
+
*
|
|
57
|
+
* @throws {@link AgentMail.ValidationError}
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* await client.pods.webhooks.create("pod_id", {
|
|
61
|
+
* url: "url",
|
|
62
|
+
* eventTypes: ["message.received", "message.received"]
|
|
63
|
+
* })
|
|
64
|
+
*/
|
|
65
|
+
create(pod_id: AgentMail.pods.PodId, request: AgentMail.webhooks.CreatePodWebhookRequest, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentMail.webhooks.Webhook>;
|
|
66
|
+
private __create;
|
|
67
|
+
/**
|
|
68
|
+
* **CLI:**
|
|
69
|
+
* ```bash
|
|
70
|
+
* agentmail pods:webhooks update --pod-id <pod_id> --webhook-id <webhook_id> --add-inbox-id <inbox_id>
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* @param {AgentMail.pods.PodId} pod_id
|
|
74
|
+
* @param {AgentMail.webhooks.WebhookId} webhook_id
|
|
75
|
+
* @param {AgentMail.webhooks.UpdatePodWebhookRequest} request
|
|
76
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
77
|
+
*
|
|
78
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
79
|
+
* @throws {@link AgentMail.ValidationError}
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* await client.pods.webhooks.update("pod_id", "webhook_id", {})
|
|
83
|
+
*/
|
|
84
|
+
update(pod_id: AgentMail.pods.PodId, webhook_id: AgentMail.webhooks.WebhookId, request: AgentMail.webhooks.UpdatePodWebhookRequest, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentMail.webhooks.Webhook>;
|
|
85
|
+
private __update;
|
|
86
|
+
/**
|
|
87
|
+
* **CLI:**
|
|
88
|
+
* ```bash
|
|
89
|
+
* agentmail pods:webhooks delete --pod-id <pod_id> --webhook-id <webhook_id>
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* @param {AgentMail.pods.PodId} pod_id
|
|
93
|
+
* @param {AgentMail.webhooks.WebhookId} webhook_id
|
|
94
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
95
|
+
*
|
|
96
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* await client.pods.webhooks.delete("pod_id", "webhook_id")
|
|
100
|
+
*/
|
|
101
|
+
delete(pod_id: AgentMail.pods.PodId, webhook_id: AgentMail.webhooks.WebhookId, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<void>;
|
|
102
|
+
private __delete;
|
|
103
|
+
}
|