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
|
@@ -768,10 +768,11 @@ class MessagesClient {
|
|
|
768
768
|
*
|
|
769
769
|
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
770
770
|
* @param {AgentMail.SendMessageRequest} request
|
|
771
|
-
* @param {MessagesClient.
|
|
771
|
+
* @param {MessagesClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
|
|
772
772
|
*
|
|
773
773
|
* @throws {@link AgentMail.ValidationError}
|
|
774
774
|
* @throws {@link AgentMail.NotFoundError}
|
|
775
|
+
* @throws {@link AgentMail.ConflictError}
|
|
775
776
|
* @throws {@link AgentMail.MessageRejectedError}
|
|
776
777
|
*
|
|
777
778
|
* @example
|
|
@@ -784,7 +785,7 @@ class MessagesClient {
|
|
|
784
785
|
return __awaiter(this, void 0, void 0, function* () {
|
|
785
786
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
786
787
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
787
|
-
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
788
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "Idempotency-Key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
788
789
|
const _response = yield core.fetcher({
|
|
789
790
|
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)
|
|
790
791
|
.http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/send`),
|
|
@@ -833,6 +834,14 @@ class MessagesClient {
|
|
|
833
834
|
skipValidation: true,
|
|
834
835
|
breadcrumbsPrefix: ["response"],
|
|
835
836
|
}), _response.rawResponse);
|
|
837
|
+
case 409:
|
|
838
|
+
throw new AgentMail.ConflictError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
839
|
+
unrecognizedObjectKeys: "passthrough",
|
|
840
|
+
allowUnrecognizedUnionMembers: true,
|
|
841
|
+
allowUnrecognizedEnumValues: true,
|
|
842
|
+
skipValidation: true,
|
|
843
|
+
breadcrumbsPrefix: ["response"],
|
|
844
|
+
}), _response.rawResponse);
|
|
836
845
|
case 403:
|
|
837
846
|
throw new AgentMail.MessageRejectedError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
838
847
|
unrecognizedObjectKeys: "passthrough",
|
|
@@ -861,10 +870,11 @@ class MessagesClient {
|
|
|
861
870
|
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
862
871
|
* @param {AgentMail.MessageId} message_id
|
|
863
872
|
* @param {AgentMail.ReplyToMessageRequest} request
|
|
864
|
-
* @param {MessagesClient.
|
|
873
|
+
* @param {MessagesClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
|
|
865
874
|
*
|
|
866
875
|
* @throws {@link AgentMail.ValidationError}
|
|
867
876
|
* @throws {@link AgentMail.NotFoundError}
|
|
877
|
+
* @throws {@link AgentMail.ConflictError}
|
|
868
878
|
* @throws {@link AgentMail.MessageRejectedError}
|
|
869
879
|
*
|
|
870
880
|
* @example
|
|
@@ -877,7 +887,7 @@ class MessagesClient {
|
|
|
877
887
|
return __awaiter(this, void 0, void 0, function* () {
|
|
878
888
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
879
889
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
880
|
-
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
890
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "Idempotency-Key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
881
891
|
const _response = yield core.fetcher({
|
|
882
892
|
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)
|
|
883
893
|
.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`),
|
|
@@ -926,6 +936,14 @@ class MessagesClient {
|
|
|
926
936
|
skipValidation: true,
|
|
927
937
|
breadcrumbsPrefix: ["response"],
|
|
928
938
|
}), _response.rawResponse);
|
|
939
|
+
case 409:
|
|
940
|
+
throw new AgentMail.ConflictError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
941
|
+
unrecognizedObjectKeys: "passthrough",
|
|
942
|
+
allowUnrecognizedUnionMembers: true,
|
|
943
|
+
allowUnrecognizedEnumValues: true,
|
|
944
|
+
skipValidation: true,
|
|
945
|
+
breadcrumbsPrefix: ["response"],
|
|
946
|
+
}), _response.rawResponse);
|
|
929
947
|
case 403:
|
|
930
948
|
throw new AgentMail.MessageRejectedError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
931
949
|
unrecognizedObjectKeys: "passthrough",
|
|
@@ -954,10 +972,11 @@ class MessagesClient {
|
|
|
954
972
|
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
955
973
|
* @param {AgentMail.MessageId} message_id
|
|
956
974
|
* @param {AgentMail.ReplyAllMessageRequest} request
|
|
957
|
-
* @param {MessagesClient.
|
|
975
|
+
* @param {MessagesClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
|
|
958
976
|
*
|
|
959
977
|
* @throws {@link AgentMail.ValidationError}
|
|
960
978
|
* @throws {@link AgentMail.NotFoundError}
|
|
979
|
+
* @throws {@link AgentMail.ConflictError}
|
|
961
980
|
* @throws {@link AgentMail.MessageRejectedError}
|
|
962
981
|
*
|
|
963
982
|
* @example
|
|
@@ -970,7 +989,7 @@ class MessagesClient {
|
|
|
970
989
|
return __awaiter(this, void 0, void 0, function* () {
|
|
971
990
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
972
991
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
973
|
-
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
992
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "Idempotency-Key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
974
993
|
const _response = yield core.fetcher({
|
|
975
994
|
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)
|
|
976
995
|
.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`),
|
|
@@ -1019,6 +1038,14 @@ class MessagesClient {
|
|
|
1019
1038
|
skipValidation: true,
|
|
1020
1039
|
breadcrumbsPrefix: ["response"],
|
|
1021
1040
|
}), _response.rawResponse);
|
|
1041
|
+
case 409:
|
|
1042
|
+
throw new AgentMail.ConflictError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
1043
|
+
unrecognizedObjectKeys: "passthrough",
|
|
1044
|
+
allowUnrecognizedUnionMembers: true,
|
|
1045
|
+
allowUnrecognizedEnumValues: true,
|
|
1046
|
+
skipValidation: true,
|
|
1047
|
+
breadcrumbsPrefix: ["response"],
|
|
1048
|
+
}), _response.rawResponse);
|
|
1022
1049
|
case 403:
|
|
1023
1050
|
throw new AgentMail.MessageRejectedError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
1024
1051
|
unrecognizedObjectKeys: "passthrough",
|
|
@@ -1047,10 +1074,11 @@ class MessagesClient {
|
|
|
1047
1074
|
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
1048
1075
|
* @param {AgentMail.MessageId} message_id
|
|
1049
1076
|
* @param {AgentMail.SendMessageRequest} request
|
|
1050
|
-
* @param {MessagesClient.
|
|
1077
|
+
* @param {MessagesClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
|
|
1051
1078
|
*
|
|
1052
1079
|
* @throws {@link AgentMail.ValidationError}
|
|
1053
1080
|
* @throws {@link AgentMail.NotFoundError}
|
|
1081
|
+
* @throws {@link AgentMail.ConflictError}
|
|
1054
1082
|
* @throws {@link AgentMail.MessageRejectedError}
|
|
1055
1083
|
*
|
|
1056
1084
|
* @example
|
|
@@ -1063,7 +1091,7 @@ class MessagesClient {
|
|
|
1063
1091
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1064
1092
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1065
1093
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
1066
|
-
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
1094
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "Idempotency-Key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
1067
1095
|
const _response = yield core.fetcher({
|
|
1068
1096
|
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)
|
|
1069
1097
|
.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`),
|
|
@@ -1112,6 +1140,14 @@ class MessagesClient {
|
|
|
1112
1140
|
skipValidation: true,
|
|
1113
1141
|
breadcrumbsPrefix: ["response"],
|
|
1114
1142
|
}), _response.rawResponse);
|
|
1143
|
+
case 409:
|
|
1144
|
+
throw new AgentMail.ConflictError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
1145
|
+
unrecognizedObjectKeys: "passthrough",
|
|
1146
|
+
allowUnrecognizedUnionMembers: true,
|
|
1147
|
+
allowUnrecognizedEnumValues: true,
|
|
1148
|
+
skipValidation: true,
|
|
1149
|
+
breadcrumbsPrefix: ["response"],
|
|
1150
|
+
}), _response.rawResponse);
|
|
1115
1151
|
case 403:
|
|
1116
1152
|
throw new AgentMail.MessageRejectedError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
1117
1153
|
unrecognizedObjectKeys: "passthrough",
|
|
@@ -1131,5 +1167,269 @@ class MessagesClient {
|
|
|
1131
1167
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/messages/{message_id}/forward");
|
|
1132
1168
|
});
|
|
1133
1169
|
}
|
|
1170
|
+
/**
|
|
1171
|
+
* Create a draft that replies to a message instead of sending it. The
|
|
1172
|
+
* recipients, subject, and threading are derived from the source message.
|
|
1173
|
+
* Send it later with `Send Draft`.
|
|
1174
|
+
*
|
|
1175
|
+
* **CLI:**
|
|
1176
|
+
* ```bash
|
|
1177
|
+
* agentmail inboxes:messages draft-reply --inbox-id <inbox_id> --message-id <message_id> --text "Reply text"
|
|
1178
|
+
* ```
|
|
1179
|
+
*
|
|
1180
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
1181
|
+
* @param {AgentMail.MessageId} message_id
|
|
1182
|
+
* @param {AgentMail.CreateDraftReplyRequest} request
|
|
1183
|
+
* @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
1184
|
+
*
|
|
1185
|
+
* @throws {@link AgentMail.ValidationError}
|
|
1186
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
1187
|
+
*
|
|
1188
|
+
* @example
|
|
1189
|
+
* await client.inboxes.messages.draftReply("inbox_id", "message_id", {})
|
|
1190
|
+
*/
|
|
1191
|
+
draftReply(inbox_id, message_id, request, requestOptions) {
|
|
1192
|
+
return core.HttpResponsePromise.fromPromise(this.__draftReply(inbox_id, message_id, request, requestOptions));
|
|
1193
|
+
}
|
|
1194
|
+
__draftReply(inbox_id, message_id, request, requestOptions) {
|
|
1195
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1196
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1197
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
1198
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
1199
|
+
const _response = yield core.fetcher({
|
|
1200
|
+
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)
|
|
1201
|
+
.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`),
|
|
1202
|
+
method: "POST",
|
|
1203
|
+
headers: _headers,
|
|
1204
|
+
contentType: "application/json",
|
|
1205
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
1206
|
+
requestType: "json",
|
|
1207
|
+
body: serializers.CreateDraftReplyRequest.jsonOrThrow(request, {
|
|
1208
|
+
unrecognizedObjectKeys: "strip",
|
|
1209
|
+
omitUndefined: true,
|
|
1210
|
+
}),
|
|
1211
|
+
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,
|
|
1212
|
+
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,
|
|
1213
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
1214
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
1215
|
+
logging: this._options.logging,
|
|
1216
|
+
});
|
|
1217
|
+
if (_response.ok) {
|
|
1218
|
+
return {
|
|
1219
|
+
data: serializers.Draft.parseOrThrow(_response.body, {
|
|
1220
|
+
unrecognizedObjectKeys: "passthrough",
|
|
1221
|
+
allowUnrecognizedUnionMembers: true,
|
|
1222
|
+
allowUnrecognizedEnumValues: true,
|
|
1223
|
+
skipValidation: true,
|
|
1224
|
+
breadcrumbsPrefix: ["response"],
|
|
1225
|
+
}),
|
|
1226
|
+
rawResponse: _response.rawResponse,
|
|
1227
|
+
};
|
|
1228
|
+
}
|
|
1229
|
+
if (_response.error.reason === "status-code") {
|
|
1230
|
+
switch (_response.error.statusCode) {
|
|
1231
|
+
case 400:
|
|
1232
|
+
throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
|
|
1233
|
+
unrecognizedObjectKeys: "passthrough",
|
|
1234
|
+
allowUnrecognizedUnionMembers: true,
|
|
1235
|
+
allowUnrecognizedEnumValues: true,
|
|
1236
|
+
skipValidation: true,
|
|
1237
|
+
breadcrumbsPrefix: ["response"],
|
|
1238
|
+
}), _response.rawResponse);
|
|
1239
|
+
case 404:
|
|
1240
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
1241
|
+
unrecognizedObjectKeys: "passthrough",
|
|
1242
|
+
allowUnrecognizedUnionMembers: true,
|
|
1243
|
+
allowUnrecognizedEnumValues: true,
|
|
1244
|
+
skipValidation: true,
|
|
1245
|
+
breadcrumbsPrefix: ["response"],
|
|
1246
|
+
}), _response.rawResponse);
|
|
1247
|
+
default:
|
|
1248
|
+
throw new errors.AgentMailError({
|
|
1249
|
+
statusCode: _response.error.statusCode,
|
|
1250
|
+
body: _response.error.body,
|
|
1251
|
+
rawResponse: _response.rawResponse,
|
|
1252
|
+
});
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/messages/{message_id}/draft-reply");
|
|
1256
|
+
});
|
|
1257
|
+
}
|
|
1258
|
+
/**
|
|
1259
|
+
* Create a draft that replies to every recipient of a message instead of
|
|
1260
|
+
* sending it. Recipients, subject, and threading are derived from the
|
|
1261
|
+
* source message. Send it later with `Send Draft`.
|
|
1262
|
+
*
|
|
1263
|
+
* **CLI:**
|
|
1264
|
+
* ```bash
|
|
1265
|
+
* agentmail inboxes:messages draft-reply-all --inbox-id <inbox_id> --message-id <message_id> --text "Reply text"
|
|
1266
|
+
* ```
|
|
1267
|
+
*
|
|
1268
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
1269
|
+
* @param {AgentMail.MessageId} message_id
|
|
1270
|
+
* @param {AgentMail.CreateDraftReplyAllRequest} request
|
|
1271
|
+
* @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
1272
|
+
*
|
|
1273
|
+
* @throws {@link AgentMail.ValidationError}
|
|
1274
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
1275
|
+
*
|
|
1276
|
+
* @example
|
|
1277
|
+
* await client.inboxes.messages.draftReplyAll("inbox_id", "message_id", {})
|
|
1278
|
+
*/
|
|
1279
|
+
draftReplyAll(inbox_id, message_id, request, requestOptions) {
|
|
1280
|
+
return core.HttpResponsePromise.fromPromise(this.__draftReplyAll(inbox_id, message_id, request, requestOptions));
|
|
1281
|
+
}
|
|
1282
|
+
__draftReplyAll(inbox_id, message_id, request, requestOptions) {
|
|
1283
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1284
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1285
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
1286
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
1287
|
+
const _response = yield core.fetcher({
|
|
1288
|
+
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)
|
|
1289
|
+
.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`),
|
|
1290
|
+
method: "POST",
|
|
1291
|
+
headers: _headers,
|
|
1292
|
+
contentType: "application/json",
|
|
1293
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
1294
|
+
requestType: "json",
|
|
1295
|
+
body: serializers.CreateDraftReplyAllRequest.jsonOrThrow(request, {
|
|
1296
|
+
unrecognizedObjectKeys: "strip",
|
|
1297
|
+
omitUndefined: true,
|
|
1298
|
+
}),
|
|
1299
|
+
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,
|
|
1300
|
+
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,
|
|
1301
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
1302
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
1303
|
+
logging: this._options.logging,
|
|
1304
|
+
});
|
|
1305
|
+
if (_response.ok) {
|
|
1306
|
+
return {
|
|
1307
|
+
data: serializers.Draft.parseOrThrow(_response.body, {
|
|
1308
|
+
unrecognizedObjectKeys: "passthrough",
|
|
1309
|
+
allowUnrecognizedUnionMembers: true,
|
|
1310
|
+
allowUnrecognizedEnumValues: true,
|
|
1311
|
+
skipValidation: true,
|
|
1312
|
+
breadcrumbsPrefix: ["response"],
|
|
1313
|
+
}),
|
|
1314
|
+
rawResponse: _response.rawResponse,
|
|
1315
|
+
};
|
|
1316
|
+
}
|
|
1317
|
+
if (_response.error.reason === "status-code") {
|
|
1318
|
+
switch (_response.error.statusCode) {
|
|
1319
|
+
case 400:
|
|
1320
|
+
throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
|
|
1321
|
+
unrecognizedObjectKeys: "passthrough",
|
|
1322
|
+
allowUnrecognizedUnionMembers: true,
|
|
1323
|
+
allowUnrecognizedEnumValues: true,
|
|
1324
|
+
skipValidation: true,
|
|
1325
|
+
breadcrumbsPrefix: ["response"],
|
|
1326
|
+
}), _response.rawResponse);
|
|
1327
|
+
case 404:
|
|
1328
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
1329
|
+
unrecognizedObjectKeys: "passthrough",
|
|
1330
|
+
allowUnrecognizedUnionMembers: true,
|
|
1331
|
+
allowUnrecognizedEnumValues: true,
|
|
1332
|
+
skipValidation: true,
|
|
1333
|
+
breadcrumbsPrefix: ["response"],
|
|
1334
|
+
}), _response.rawResponse);
|
|
1335
|
+
default:
|
|
1336
|
+
throw new errors.AgentMailError({
|
|
1337
|
+
statusCode: _response.error.statusCode,
|
|
1338
|
+
body: _response.error.body,
|
|
1339
|
+
rawResponse: _response.rawResponse,
|
|
1340
|
+
});
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/messages/{message_id}/draft-reply-all");
|
|
1344
|
+
});
|
|
1345
|
+
}
|
|
1346
|
+
/**
|
|
1347
|
+
* Create a draft that forwards a message instead of sending it. The subject
|
|
1348
|
+
* and threading are derived from the source message, whose body and
|
|
1349
|
+
* attachments are merged in at send time. Send it later with `Send Draft`.
|
|
1350
|
+
*
|
|
1351
|
+
* **CLI:**
|
|
1352
|
+
* ```bash
|
|
1353
|
+
* agentmail inboxes:messages draft-forward --inbox-id <inbox_id> --message-id <message_id> --to recipient@example.com
|
|
1354
|
+
* ```
|
|
1355
|
+
*
|
|
1356
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
1357
|
+
* @param {AgentMail.MessageId} message_id
|
|
1358
|
+
* @param {AgentMail.CreateDraftForwardRequest} request
|
|
1359
|
+
* @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
1360
|
+
*
|
|
1361
|
+
* @throws {@link AgentMail.ValidationError}
|
|
1362
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
1363
|
+
*
|
|
1364
|
+
* @example
|
|
1365
|
+
* await client.inboxes.messages.draftForward("inbox_id", "message_id", {})
|
|
1366
|
+
*/
|
|
1367
|
+
draftForward(inbox_id, message_id, request, requestOptions) {
|
|
1368
|
+
return core.HttpResponsePromise.fromPromise(this.__draftForward(inbox_id, message_id, request, requestOptions));
|
|
1369
|
+
}
|
|
1370
|
+
__draftForward(inbox_id, message_id, request, requestOptions) {
|
|
1371
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1372
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1373
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
1374
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
1375
|
+
const _response = yield core.fetcher({
|
|
1376
|
+
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)
|
|
1377
|
+
.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`),
|
|
1378
|
+
method: "POST",
|
|
1379
|
+
headers: _headers,
|
|
1380
|
+
contentType: "application/json",
|
|
1381
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
1382
|
+
requestType: "json",
|
|
1383
|
+
body: serializers.CreateDraftForwardRequest.jsonOrThrow(request, {
|
|
1384
|
+
unrecognizedObjectKeys: "strip",
|
|
1385
|
+
omitUndefined: true,
|
|
1386
|
+
}),
|
|
1387
|
+
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,
|
|
1388
|
+
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,
|
|
1389
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
1390
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
1391
|
+
logging: this._options.logging,
|
|
1392
|
+
});
|
|
1393
|
+
if (_response.ok) {
|
|
1394
|
+
return {
|
|
1395
|
+
data: serializers.Draft.parseOrThrow(_response.body, {
|
|
1396
|
+
unrecognizedObjectKeys: "passthrough",
|
|
1397
|
+
allowUnrecognizedUnionMembers: true,
|
|
1398
|
+
allowUnrecognizedEnumValues: true,
|
|
1399
|
+
skipValidation: true,
|
|
1400
|
+
breadcrumbsPrefix: ["response"],
|
|
1401
|
+
}),
|
|
1402
|
+
rawResponse: _response.rawResponse,
|
|
1403
|
+
};
|
|
1404
|
+
}
|
|
1405
|
+
if (_response.error.reason === "status-code") {
|
|
1406
|
+
switch (_response.error.statusCode) {
|
|
1407
|
+
case 400:
|
|
1408
|
+
throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
|
|
1409
|
+
unrecognizedObjectKeys: "passthrough",
|
|
1410
|
+
allowUnrecognizedUnionMembers: true,
|
|
1411
|
+
allowUnrecognizedEnumValues: true,
|
|
1412
|
+
skipValidation: true,
|
|
1413
|
+
breadcrumbsPrefix: ["response"],
|
|
1414
|
+
}), _response.rawResponse);
|
|
1415
|
+
case 404:
|
|
1416
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
1417
|
+
unrecognizedObjectKeys: "passthrough",
|
|
1418
|
+
allowUnrecognizedUnionMembers: true,
|
|
1419
|
+
allowUnrecognizedEnumValues: true,
|
|
1420
|
+
skipValidation: true,
|
|
1421
|
+
breadcrumbsPrefix: ["response"],
|
|
1422
|
+
}), _response.rawResponse);
|
|
1423
|
+
default:
|
|
1424
|
+
throw new errors.AgentMailError({
|
|
1425
|
+
statusCode: _response.error.statusCode,
|
|
1426
|
+
body: _response.error.body,
|
|
1427
|
+
rawResponse: _response.rawResponse,
|
|
1428
|
+
});
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/messages/{message_id}/draft-forward");
|
|
1432
|
+
});
|
|
1433
|
+
}
|
|
1134
1434
|
}
|
|
1135
1435
|
exports.MessagesClient = MessagesClient;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../BaseClient.js";
|
|
2
|
+
import { type NormalizedClientOptionsWithAuth } from "../../../../../../BaseClient.js";
|
|
3
|
+
import * as core from "../../../../../../core/index.js";
|
|
4
|
+
import * as AgentMail from "../../../../../index.js";
|
|
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
|
+
}
|