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
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
import { normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.mjs";
|
|
12
|
-
import { mergeHeaders } from "../../../../../../core/headers.mjs";
|
|
12
|
+
import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.mjs";
|
|
13
13
|
import * as core from "../../../../../../core/index.mjs";
|
|
14
14
|
import { toJson } from "../../../../../../core/json.mjs";
|
|
15
15
|
import * as environments from "../../../../../../environments.mjs";
|
|
@@ -732,10 +732,11 @@ export class MessagesClient {
|
|
|
732
732
|
*
|
|
733
733
|
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
734
734
|
* @param {AgentMail.SendMessageRequest} request
|
|
735
|
-
* @param {MessagesClient.
|
|
735
|
+
* @param {MessagesClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
|
|
736
736
|
*
|
|
737
737
|
* @throws {@link AgentMail.ValidationError}
|
|
738
738
|
* @throws {@link AgentMail.NotFoundError}
|
|
739
|
+
* @throws {@link AgentMail.ConflictError}
|
|
739
740
|
* @throws {@link AgentMail.MessageRejectedError}
|
|
740
741
|
*
|
|
741
742
|
* @example
|
|
@@ -748,7 +749,7 @@ export class MessagesClient {
|
|
|
748
749
|
return __awaiter(this, void 0, void 0, function* () {
|
|
749
750
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
750
751
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
751
|
-
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);
|
|
752
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ "Idempotency-Key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
752
753
|
const _response = yield core.fetcher({
|
|
753
754
|
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)
|
|
754
755
|
.http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/send`),
|
|
@@ -797,6 +798,14 @@ export class MessagesClient {
|
|
|
797
798
|
skipValidation: true,
|
|
798
799
|
breadcrumbsPrefix: ["response"],
|
|
799
800
|
}), _response.rawResponse);
|
|
801
|
+
case 409:
|
|
802
|
+
throw new AgentMail.ConflictError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
803
|
+
unrecognizedObjectKeys: "passthrough",
|
|
804
|
+
allowUnrecognizedUnionMembers: true,
|
|
805
|
+
allowUnrecognizedEnumValues: true,
|
|
806
|
+
skipValidation: true,
|
|
807
|
+
breadcrumbsPrefix: ["response"],
|
|
808
|
+
}), _response.rawResponse);
|
|
800
809
|
case 403:
|
|
801
810
|
throw new AgentMail.MessageRejectedError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
802
811
|
unrecognizedObjectKeys: "passthrough",
|
|
@@ -825,10 +834,11 @@ export class MessagesClient {
|
|
|
825
834
|
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
826
835
|
* @param {AgentMail.MessageId} message_id
|
|
827
836
|
* @param {AgentMail.ReplyToMessageRequest} request
|
|
828
|
-
* @param {MessagesClient.
|
|
837
|
+
* @param {MessagesClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
|
|
829
838
|
*
|
|
830
839
|
* @throws {@link AgentMail.ValidationError}
|
|
831
840
|
* @throws {@link AgentMail.NotFoundError}
|
|
841
|
+
* @throws {@link AgentMail.ConflictError}
|
|
832
842
|
* @throws {@link AgentMail.MessageRejectedError}
|
|
833
843
|
*
|
|
834
844
|
* @example
|
|
@@ -841,7 +851,7 @@ export class MessagesClient {
|
|
|
841
851
|
return __awaiter(this, void 0, void 0, function* () {
|
|
842
852
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
843
853
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
844
|
-
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);
|
|
854
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ "Idempotency-Key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
845
855
|
const _response = yield core.fetcher({
|
|
846
856
|
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)
|
|
847
857
|
.http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(message_id, { omitUndefined: true }))}/reply`),
|
|
@@ -890,6 +900,14 @@ export class MessagesClient {
|
|
|
890
900
|
skipValidation: true,
|
|
891
901
|
breadcrumbsPrefix: ["response"],
|
|
892
902
|
}), _response.rawResponse);
|
|
903
|
+
case 409:
|
|
904
|
+
throw new AgentMail.ConflictError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
905
|
+
unrecognizedObjectKeys: "passthrough",
|
|
906
|
+
allowUnrecognizedUnionMembers: true,
|
|
907
|
+
allowUnrecognizedEnumValues: true,
|
|
908
|
+
skipValidation: true,
|
|
909
|
+
breadcrumbsPrefix: ["response"],
|
|
910
|
+
}), _response.rawResponse);
|
|
893
911
|
case 403:
|
|
894
912
|
throw new AgentMail.MessageRejectedError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
895
913
|
unrecognizedObjectKeys: "passthrough",
|
|
@@ -918,10 +936,11 @@ export class MessagesClient {
|
|
|
918
936
|
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
919
937
|
* @param {AgentMail.MessageId} message_id
|
|
920
938
|
* @param {AgentMail.ReplyAllMessageRequest} request
|
|
921
|
-
* @param {MessagesClient.
|
|
939
|
+
* @param {MessagesClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
|
|
922
940
|
*
|
|
923
941
|
* @throws {@link AgentMail.ValidationError}
|
|
924
942
|
* @throws {@link AgentMail.NotFoundError}
|
|
943
|
+
* @throws {@link AgentMail.ConflictError}
|
|
925
944
|
* @throws {@link AgentMail.MessageRejectedError}
|
|
926
945
|
*
|
|
927
946
|
* @example
|
|
@@ -934,7 +953,7 @@ export class MessagesClient {
|
|
|
934
953
|
return __awaiter(this, void 0, void 0, function* () {
|
|
935
954
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
936
955
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
937
|
-
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);
|
|
956
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ "Idempotency-Key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
938
957
|
const _response = yield core.fetcher({
|
|
939
958
|
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)
|
|
940
959
|
.http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(message_id, { omitUndefined: true }))}/reply-all`),
|
|
@@ -983,6 +1002,14 @@ export class MessagesClient {
|
|
|
983
1002
|
skipValidation: true,
|
|
984
1003
|
breadcrumbsPrefix: ["response"],
|
|
985
1004
|
}), _response.rawResponse);
|
|
1005
|
+
case 409:
|
|
1006
|
+
throw new AgentMail.ConflictError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
1007
|
+
unrecognizedObjectKeys: "passthrough",
|
|
1008
|
+
allowUnrecognizedUnionMembers: true,
|
|
1009
|
+
allowUnrecognizedEnumValues: true,
|
|
1010
|
+
skipValidation: true,
|
|
1011
|
+
breadcrumbsPrefix: ["response"],
|
|
1012
|
+
}), _response.rawResponse);
|
|
986
1013
|
case 403:
|
|
987
1014
|
throw new AgentMail.MessageRejectedError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
988
1015
|
unrecognizedObjectKeys: "passthrough",
|
|
@@ -1011,10 +1038,11 @@ export class MessagesClient {
|
|
|
1011
1038
|
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
1012
1039
|
* @param {AgentMail.MessageId} message_id
|
|
1013
1040
|
* @param {AgentMail.SendMessageRequest} request
|
|
1014
|
-
* @param {MessagesClient.
|
|
1041
|
+
* @param {MessagesClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
|
|
1015
1042
|
*
|
|
1016
1043
|
* @throws {@link AgentMail.ValidationError}
|
|
1017
1044
|
* @throws {@link AgentMail.NotFoundError}
|
|
1045
|
+
* @throws {@link AgentMail.ConflictError}
|
|
1018
1046
|
* @throws {@link AgentMail.MessageRejectedError}
|
|
1019
1047
|
*
|
|
1020
1048
|
* @example
|
|
@@ -1027,7 +1055,7 @@ export class MessagesClient {
|
|
|
1027
1055
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1028
1056
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1029
1057
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
1030
|
-
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);
|
|
1058
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ "Idempotency-Key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
1031
1059
|
const _response = yield core.fetcher({
|
|
1032
1060
|
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)
|
|
1033
1061
|
.http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(message_id, { omitUndefined: true }))}/forward`),
|
|
@@ -1076,6 +1104,14 @@ export class MessagesClient {
|
|
|
1076
1104
|
skipValidation: true,
|
|
1077
1105
|
breadcrumbsPrefix: ["response"],
|
|
1078
1106
|
}), _response.rawResponse);
|
|
1107
|
+
case 409:
|
|
1108
|
+
throw new AgentMail.ConflictError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
1109
|
+
unrecognizedObjectKeys: "passthrough",
|
|
1110
|
+
allowUnrecognizedUnionMembers: true,
|
|
1111
|
+
allowUnrecognizedEnumValues: true,
|
|
1112
|
+
skipValidation: true,
|
|
1113
|
+
breadcrumbsPrefix: ["response"],
|
|
1114
|
+
}), _response.rawResponse);
|
|
1079
1115
|
case 403:
|
|
1080
1116
|
throw new AgentMail.MessageRejectedError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
1081
1117
|
unrecognizedObjectKeys: "passthrough",
|
|
@@ -1095,4 +1131,268 @@ export class MessagesClient {
|
|
|
1095
1131
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/messages/{message_id}/forward");
|
|
1096
1132
|
});
|
|
1097
1133
|
}
|
|
1134
|
+
/**
|
|
1135
|
+
* Create a draft that replies to a message instead of sending it. The
|
|
1136
|
+
* recipients, subject, and threading are derived from the source message.
|
|
1137
|
+
* Send it later with `Send Draft`.
|
|
1138
|
+
*
|
|
1139
|
+
* **CLI:**
|
|
1140
|
+
* ```bash
|
|
1141
|
+
* agentmail inboxes:messages draft-reply --inbox-id <inbox_id> --message-id <message_id> --text "Reply text"
|
|
1142
|
+
* ```
|
|
1143
|
+
*
|
|
1144
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
1145
|
+
* @param {AgentMail.MessageId} message_id
|
|
1146
|
+
* @param {AgentMail.CreateDraftReplyRequest} request
|
|
1147
|
+
* @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
1148
|
+
*
|
|
1149
|
+
* @throws {@link AgentMail.ValidationError}
|
|
1150
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
1151
|
+
*
|
|
1152
|
+
* @example
|
|
1153
|
+
* await client.inboxes.messages.draftReply("inbox_id", "message_id", {})
|
|
1154
|
+
*/
|
|
1155
|
+
draftReply(inbox_id, message_id, request, requestOptions) {
|
|
1156
|
+
return core.HttpResponsePromise.fromPromise(this.__draftReply(inbox_id, message_id, request, requestOptions));
|
|
1157
|
+
}
|
|
1158
|
+
__draftReply(inbox_id, message_id, request, requestOptions) {
|
|
1159
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1160
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1161
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
1162
|
+
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);
|
|
1163
|
+
const _response = yield core.fetcher({
|
|
1164
|
+
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)
|
|
1165
|
+
.http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(message_id, { omitUndefined: true }))}/draft-reply`),
|
|
1166
|
+
method: "POST",
|
|
1167
|
+
headers: _headers,
|
|
1168
|
+
contentType: "application/json",
|
|
1169
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
1170
|
+
requestType: "json",
|
|
1171
|
+
body: serializers.CreateDraftReplyRequest.jsonOrThrow(request, {
|
|
1172
|
+
unrecognizedObjectKeys: "strip",
|
|
1173
|
+
omitUndefined: true,
|
|
1174
|
+
}),
|
|
1175
|
+
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,
|
|
1176
|
+
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,
|
|
1177
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
1178
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
1179
|
+
logging: this._options.logging,
|
|
1180
|
+
});
|
|
1181
|
+
if (_response.ok) {
|
|
1182
|
+
return {
|
|
1183
|
+
data: serializers.Draft.parseOrThrow(_response.body, {
|
|
1184
|
+
unrecognizedObjectKeys: "passthrough",
|
|
1185
|
+
allowUnrecognizedUnionMembers: true,
|
|
1186
|
+
allowUnrecognizedEnumValues: true,
|
|
1187
|
+
skipValidation: true,
|
|
1188
|
+
breadcrumbsPrefix: ["response"],
|
|
1189
|
+
}),
|
|
1190
|
+
rawResponse: _response.rawResponse,
|
|
1191
|
+
};
|
|
1192
|
+
}
|
|
1193
|
+
if (_response.error.reason === "status-code") {
|
|
1194
|
+
switch (_response.error.statusCode) {
|
|
1195
|
+
case 400:
|
|
1196
|
+
throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
|
|
1197
|
+
unrecognizedObjectKeys: "passthrough",
|
|
1198
|
+
allowUnrecognizedUnionMembers: true,
|
|
1199
|
+
allowUnrecognizedEnumValues: true,
|
|
1200
|
+
skipValidation: true,
|
|
1201
|
+
breadcrumbsPrefix: ["response"],
|
|
1202
|
+
}), _response.rawResponse);
|
|
1203
|
+
case 404:
|
|
1204
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
1205
|
+
unrecognizedObjectKeys: "passthrough",
|
|
1206
|
+
allowUnrecognizedUnionMembers: true,
|
|
1207
|
+
allowUnrecognizedEnumValues: true,
|
|
1208
|
+
skipValidation: true,
|
|
1209
|
+
breadcrumbsPrefix: ["response"],
|
|
1210
|
+
}), _response.rawResponse);
|
|
1211
|
+
default:
|
|
1212
|
+
throw new errors.AgentMailError({
|
|
1213
|
+
statusCode: _response.error.statusCode,
|
|
1214
|
+
body: _response.error.body,
|
|
1215
|
+
rawResponse: _response.rawResponse,
|
|
1216
|
+
});
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/messages/{message_id}/draft-reply");
|
|
1220
|
+
});
|
|
1221
|
+
}
|
|
1222
|
+
/**
|
|
1223
|
+
* Create a draft that replies to every recipient of a message instead of
|
|
1224
|
+
* sending it. Recipients, subject, and threading are derived from the
|
|
1225
|
+
* source message. Send it later with `Send Draft`.
|
|
1226
|
+
*
|
|
1227
|
+
* **CLI:**
|
|
1228
|
+
* ```bash
|
|
1229
|
+
* agentmail inboxes:messages draft-reply-all --inbox-id <inbox_id> --message-id <message_id> --text "Reply text"
|
|
1230
|
+
* ```
|
|
1231
|
+
*
|
|
1232
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
1233
|
+
* @param {AgentMail.MessageId} message_id
|
|
1234
|
+
* @param {AgentMail.CreateDraftReplyAllRequest} request
|
|
1235
|
+
* @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
1236
|
+
*
|
|
1237
|
+
* @throws {@link AgentMail.ValidationError}
|
|
1238
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
1239
|
+
*
|
|
1240
|
+
* @example
|
|
1241
|
+
* await client.inboxes.messages.draftReplyAll("inbox_id", "message_id", {})
|
|
1242
|
+
*/
|
|
1243
|
+
draftReplyAll(inbox_id, message_id, request, requestOptions) {
|
|
1244
|
+
return core.HttpResponsePromise.fromPromise(this.__draftReplyAll(inbox_id, message_id, request, requestOptions));
|
|
1245
|
+
}
|
|
1246
|
+
__draftReplyAll(inbox_id, message_id, request, requestOptions) {
|
|
1247
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1248
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1249
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
1250
|
+
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);
|
|
1251
|
+
const _response = yield core.fetcher({
|
|
1252
|
+
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)
|
|
1253
|
+
.http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(message_id, { omitUndefined: true }))}/draft-reply-all`),
|
|
1254
|
+
method: "POST",
|
|
1255
|
+
headers: _headers,
|
|
1256
|
+
contentType: "application/json",
|
|
1257
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
1258
|
+
requestType: "json",
|
|
1259
|
+
body: serializers.CreateDraftReplyAllRequest.jsonOrThrow(request, {
|
|
1260
|
+
unrecognizedObjectKeys: "strip",
|
|
1261
|
+
omitUndefined: true,
|
|
1262
|
+
}),
|
|
1263
|
+
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,
|
|
1264
|
+
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,
|
|
1265
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
1266
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
1267
|
+
logging: this._options.logging,
|
|
1268
|
+
});
|
|
1269
|
+
if (_response.ok) {
|
|
1270
|
+
return {
|
|
1271
|
+
data: serializers.Draft.parseOrThrow(_response.body, {
|
|
1272
|
+
unrecognizedObjectKeys: "passthrough",
|
|
1273
|
+
allowUnrecognizedUnionMembers: true,
|
|
1274
|
+
allowUnrecognizedEnumValues: true,
|
|
1275
|
+
skipValidation: true,
|
|
1276
|
+
breadcrumbsPrefix: ["response"],
|
|
1277
|
+
}),
|
|
1278
|
+
rawResponse: _response.rawResponse,
|
|
1279
|
+
};
|
|
1280
|
+
}
|
|
1281
|
+
if (_response.error.reason === "status-code") {
|
|
1282
|
+
switch (_response.error.statusCode) {
|
|
1283
|
+
case 400:
|
|
1284
|
+
throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
|
|
1285
|
+
unrecognizedObjectKeys: "passthrough",
|
|
1286
|
+
allowUnrecognizedUnionMembers: true,
|
|
1287
|
+
allowUnrecognizedEnumValues: true,
|
|
1288
|
+
skipValidation: true,
|
|
1289
|
+
breadcrumbsPrefix: ["response"],
|
|
1290
|
+
}), _response.rawResponse);
|
|
1291
|
+
case 404:
|
|
1292
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
1293
|
+
unrecognizedObjectKeys: "passthrough",
|
|
1294
|
+
allowUnrecognizedUnionMembers: true,
|
|
1295
|
+
allowUnrecognizedEnumValues: true,
|
|
1296
|
+
skipValidation: true,
|
|
1297
|
+
breadcrumbsPrefix: ["response"],
|
|
1298
|
+
}), _response.rawResponse);
|
|
1299
|
+
default:
|
|
1300
|
+
throw new errors.AgentMailError({
|
|
1301
|
+
statusCode: _response.error.statusCode,
|
|
1302
|
+
body: _response.error.body,
|
|
1303
|
+
rawResponse: _response.rawResponse,
|
|
1304
|
+
});
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/messages/{message_id}/draft-reply-all");
|
|
1308
|
+
});
|
|
1309
|
+
}
|
|
1310
|
+
/**
|
|
1311
|
+
* Create a draft that forwards a message instead of sending it. The subject
|
|
1312
|
+
* and threading are derived from the source message, whose body and
|
|
1313
|
+
* attachments are merged in at send time. Send it later with `Send Draft`.
|
|
1314
|
+
*
|
|
1315
|
+
* **CLI:**
|
|
1316
|
+
* ```bash
|
|
1317
|
+
* agentmail inboxes:messages draft-forward --inbox-id <inbox_id> --message-id <message_id> --to recipient@example.com
|
|
1318
|
+
* ```
|
|
1319
|
+
*
|
|
1320
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
1321
|
+
* @param {AgentMail.MessageId} message_id
|
|
1322
|
+
* @param {AgentMail.CreateDraftForwardRequest} request
|
|
1323
|
+
* @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
1324
|
+
*
|
|
1325
|
+
* @throws {@link AgentMail.ValidationError}
|
|
1326
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
1327
|
+
*
|
|
1328
|
+
* @example
|
|
1329
|
+
* await client.inboxes.messages.draftForward("inbox_id", "message_id", {})
|
|
1330
|
+
*/
|
|
1331
|
+
draftForward(inbox_id, message_id, request, requestOptions) {
|
|
1332
|
+
return core.HttpResponsePromise.fromPromise(this.__draftForward(inbox_id, message_id, request, requestOptions));
|
|
1333
|
+
}
|
|
1334
|
+
__draftForward(inbox_id, message_id, request, requestOptions) {
|
|
1335
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1336
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1337
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
1338
|
+
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);
|
|
1339
|
+
const _response = yield core.fetcher({
|
|
1340
|
+
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)
|
|
1341
|
+
.http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(message_id, { omitUndefined: true }))}/draft-forward`),
|
|
1342
|
+
method: "POST",
|
|
1343
|
+
headers: _headers,
|
|
1344
|
+
contentType: "application/json",
|
|
1345
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
1346
|
+
requestType: "json",
|
|
1347
|
+
body: serializers.CreateDraftForwardRequest.jsonOrThrow(request, {
|
|
1348
|
+
unrecognizedObjectKeys: "strip",
|
|
1349
|
+
omitUndefined: true,
|
|
1350
|
+
}),
|
|
1351
|
+
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,
|
|
1352
|
+
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,
|
|
1353
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
1354
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
1355
|
+
logging: this._options.logging,
|
|
1356
|
+
});
|
|
1357
|
+
if (_response.ok) {
|
|
1358
|
+
return {
|
|
1359
|
+
data: serializers.Draft.parseOrThrow(_response.body, {
|
|
1360
|
+
unrecognizedObjectKeys: "passthrough",
|
|
1361
|
+
allowUnrecognizedUnionMembers: true,
|
|
1362
|
+
allowUnrecognizedEnumValues: true,
|
|
1363
|
+
skipValidation: true,
|
|
1364
|
+
breadcrumbsPrefix: ["response"],
|
|
1365
|
+
}),
|
|
1366
|
+
rawResponse: _response.rawResponse,
|
|
1367
|
+
};
|
|
1368
|
+
}
|
|
1369
|
+
if (_response.error.reason === "status-code") {
|
|
1370
|
+
switch (_response.error.statusCode) {
|
|
1371
|
+
case 400:
|
|
1372
|
+
throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
|
|
1373
|
+
unrecognizedObjectKeys: "passthrough",
|
|
1374
|
+
allowUnrecognizedUnionMembers: true,
|
|
1375
|
+
allowUnrecognizedEnumValues: true,
|
|
1376
|
+
skipValidation: true,
|
|
1377
|
+
breadcrumbsPrefix: ["response"],
|
|
1378
|
+
}), _response.rawResponse);
|
|
1379
|
+
case 404:
|
|
1380
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
1381
|
+
unrecognizedObjectKeys: "passthrough",
|
|
1382
|
+
allowUnrecognizedUnionMembers: true,
|
|
1383
|
+
allowUnrecognizedEnumValues: true,
|
|
1384
|
+
skipValidation: true,
|
|
1385
|
+
breadcrumbsPrefix: ["response"],
|
|
1386
|
+
}), _response.rawResponse);
|
|
1387
|
+
default:
|
|
1388
|
+
throw new errors.AgentMailError({
|
|
1389
|
+
statusCode: _response.error.statusCode,
|
|
1390
|
+
body: _response.error.body,
|
|
1391
|
+
rawResponse: _response.rawResponse,
|
|
1392
|
+
});
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/messages/{message_id}/draft-forward");
|
|
1396
|
+
});
|
|
1397
|
+
}
|
|
1098
1398
|
}
|
|
@@ -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 inboxes:webhooks list --inbox-id <inbox_id>
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
20
|
+
* @param {AgentMail.inboxes.InboxListWebhooksRequest} request
|
|
21
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* await client.inboxes.webhooks.list("inbox_id")
|
|
25
|
+
*/
|
|
26
|
+
list(inbox_id: AgentMail.inboxes.InboxId, request?: AgentMail.inboxes.InboxListWebhooksRequest, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentMail.webhooks.ListWebhooksResponse>;
|
|
27
|
+
private __list;
|
|
28
|
+
/**
|
|
29
|
+
* **CLI:**
|
|
30
|
+
* ```bash
|
|
31
|
+
* agentmail inboxes:webhooks get --inbox-id <inbox_id> --webhook-id <webhook_id>
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @param {AgentMail.inboxes.InboxId} inbox_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.inboxes.webhooks.get("inbox_id", "webhook_id")
|
|
42
|
+
*/
|
|
43
|
+
get(inbox_id: AgentMail.inboxes.InboxId, webhook_id: AgentMail.webhooks.WebhookId, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentMail.webhooks.Webhook>;
|
|
44
|
+
private __get;
|
|
45
|
+
/**
|
|
46
|
+
* Create a webhook scoped to this inbox.
|
|
47
|
+
*
|
|
48
|
+
* **CLI:**
|
|
49
|
+
* ```bash
|
|
50
|
+
* agentmail inboxes:webhooks create --inbox-id <inbox_id> --url https://example.com/webhook --event-type message.received
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
54
|
+
* @param {AgentMail.webhooks.CreateInboxWebhookRequest} request
|
|
55
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
56
|
+
*
|
|
57
|
+
* @throws {@link AgentMail.ValidationError}
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* await client.inboxes.webhooks.create("inbox_id", {
|
|
61
|
+
* url: "url",
|
|
62
|
+
* eventTypes: ["message.received", "message.received"]
|
|
63
|
+
* })
|
|
64
|
+
*/
|
|
65
|
+
create(inbox_id: AgentMail.inboxes.InboxId, request: AgentMail.webhooks.CreateInboxWebhookRequest, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentMail.webhooks.Webhook>;
|
|
66
|
+
private __create;
|
|
67
|
+
/**
|
|
68
|
+
* **CLI:**
|
|
69
|
+
* ```bash
|
|
70
|
+
* agentmail inboxes:webhooks update --inbox-id <inbox_id> --webhook-id <webhook_id> --event-type message.received
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
74
|
+
* @param {AgentMail.webhooks.WebhookId} webhook_id
|
|
75
|
+
* @param {AgentMail.webhooks.UpdateInboxWebhookRequest} 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.inboxes.webhooks.update("inbox_id", "webhook_id", {})
|
|
83
|
+
*/
|
|
84
|
+
update(inbox_id: AgentMail.inboxes.InboxId, webhook_id: AgentMail.webhooks.WebhookId, request: AgentMail.webhooks.UpdateInboxWebhookRequest, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentMail.webhooks.Webhook>;
|
|
85
|
+
private __update;
|
|
86
|
+
/**
|
|
87
|
+
* **CLI:**
|
|
88
|
+
* ```bash
|
|
89
|
+
* agentmail inboxes:webhooks delete --inbox-id <inbox_id> --webhook-id <webhook_id>
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* @param {AgentMail.inboxes.InboxId} inbox_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.inboxes.webhooks.delete("inbox_id", "webhook_id")
|
|
100
|
+
*/
|
|
101
|
+
delete(inbox_id: AgentMail.inboxes.InboxId, webhook_id: AgentMail.webhooks.WebhookId, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<void>;
|
|
102
|
+
private __delete;
|
|
103
|
+
}
|