agentmail 0.5.14 → 0.5.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/api/resources/drafts/types/CreateDraftRequest.d.ts +17 -0
- package/dist/cjs/api/resources/drafts/types/UpdateDraftRequest.d.ts +22 -8
- package/dist/cjs/api/resources/drafts/types/index.d.ts +0 -3
- package/dist/cjs/api/resources/drafts/types/index.js +0 -3
- package/dist/cjs/api/resources/inboxes/resources/drafts/client/Client.d.ts +13 -0
- package/dist/cjs/api/resources/inboxes/resources/drafts/client/Client.js +37 -0
- package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.d.ts +0 -69
- package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.js +0 -264
- package/dist/cjs/api/resources/inboxes/resources/threads/client/Client.d.ts +2 -3
- package/dist/cjs/api/resources/inboxes/resources/threads/client/Client.js +6 -11
- package/dist/cjs/api/resources/inboxes/resources/threads/client/requests/index.d.ts +0 -1
- package/dist/cjs/api/resources/pods/resources/threads/client/Client.d.ts +2 -3
- package/dist/cjs/api/resources/pods/resources/threads/client/Client.js +6 -11
- package/dist/cjs/api/resources/pods/resources/threads/client/requests/index.d.ts +0 -1
- package/dist/cjs/api/resources/threads/client/Client.d.ts +2 -3
- package/dist/cjs/api/resources/threads/client/Client.js +6 -11
- package/dist/cjs/api/resources/threads/client/requests/index.d.ts +0 -1
- package/dist/cjs/api/types/ErrorCode.d.ts +4 -0
- package/dist/cjs/api/types/ErrorDocs.d.ts +4 -0
- package/dist/cjs/api/types/ErrorFix.d.ts +4 -0
- package/dist/cjs/api/types/ErrorResponse.d.ts +3 -0
- package/dist/cjs/api/types/ValidationErrorResponse.d.ts +5 -1
- package/dist/cjs/api/types/index.d.ts +3 -0
- package/dist/cjs/api/types/index.js +3 -0
- package/dist/cjs/serialization/resources/drafts/types/CreateDraftRequest.d.ts +4 -0
- package/dist/cjs/serialization/resources/drafts/types/CreateDraftRequest.js +4 -0
- package/dist/cjs/serialization/resources/drafts/types/UpdateDraftRequest.d.ts +15 -8
- package/dist/cjs/serialization/resources/drafts/types/UpdateDraftRequest.js +15 -8
- package/dist/cjs/serialization/resources/drafts/types/index.d.ts +0 -3
- package/dist/cjs/serialization/resources/drafts/types/index.js +0 -3
- package/dist/cjs/serialization/types/ErrorCode.d.ts +7 -0
- package/dist/cjs/serialization/{resources/drafts/types/CreateDraftReplyAllRequest.js → types/ErrorCode.js} +3 -20
- package/dist/cjs/serialization/types/ErrorDocs.d.ts +7 -0
- package/dist/cjs/serialization/{resources/drafts/types/CreateDraftForwardRequest.js → types/ErrorDocs.js} +3 -26
- package/dist/cjs/serialization/types/ErrorFix.d.ts +7 -0
- package/dist/cjs/serialization/types/ErrorFix.js +39 -0
- package/dist/cjs/serialization/types/ErrorResponse.d.ts +6 -0
- package/dist/cjs/serialization/types/ErrorResponse.js +6 -0
- package/dist/cjs/serialization/types/ValidationErrorResponse.d.ts +8 -0
- package/dist/cjs/serialization/types/ValidationErrorResponse.js +8 -0
- package/dist/cjs/serialization/types/index.d.ts +3 -0
- package/dist/cjs/serialization/types/index.js +3 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/api/resources/drafts/types/CreateDraftRequest.d.mts +17 -0
- package/dist/esm/api/resources/drafts/types/UpdateDraftRequest.d.mts +22 -8
- package/dist/esm/api/resources/drafts/types/index.d.mts +0 -3
- package/dist/esm/api/resources/drafts/types/index.mjs +0 -3
- package/dist/esm/api/resources/inboxes/resources/drafts/client/Client.d.mts +13 -0
- package/dist/esm/api/resources/inboxes/resources/drafts/client/Client.mjs +37 -0
- package/dist/esm/api/resources/inboxes/resources/messages/client/Client.d.mts +0 -69
- package/dist/esm/api/resources/inboxes/resources/messages/client/Client.mjs +0 -264
- package/dist/esm/api/resources/inboxes/resources/threads/client/Client.d.mts +2 -3
- package/dist/esm/api/resources/inboxes/resources/threads/client/Client.mjs +6 -11
- package/dist/esm/api/resources/inboxes/resources/threads/client/requests/index.d.mts +0 -1
- package/dist/esm/api/resources/pods/resources/threads/client/Client.d.mts +2 -3
- package/dist/esm/api/resources/pods/resources/threads/client/Client.mjs +6 -11
- package/dist/esm/api/resources/pods/resources/threads/client/requests/index.d.mts +0 -1
- package/dist/esm/api/resources/threads/client/Client.d.mts +2 -3
- package/dist/esm/api/resources/threads/client/Client.mjs +6 -11
- package/dist/esm/api/resources/threads/client/requests/index.d.mts +0 -1
- package/dist/esm/api/types/ErrorCode.d.mts +4 -0
- package/dist/esm/api/types/ErrorDocs.d.mts +4 -0
- package/dist/esm/api/types/ErrorFix.d.mts +4 -0
- package/dist/esm/api/types/ErrorResponse.d.mts +3 -0
- package/dist/esm/api/types/ValidationErrorResponse.d.mts +5 -1
- package/dist/esm/api/types/index.d.mts +3 -0
- package/dist/esm/api/types/index.mjs +3 -0
- package/dist/esm/serialization/resources/drafts/types/CreateDraftRequest.d.mts +4 -0
- package/dist/esm/serialization/resources/drafts/types/CreateDraftRequest.mjs +4 -0
- package/dist/esm/serialization/resources/drafts/types/UpdateDraftRequest.d.mts +15 -8
- package/dist/esm/serialization/resources/drafts/types/UpdateDraftRequest.mjs +15 -8
- package/dist/esm/serialization/resources/drafts/types/index.d.mts +0 -3
- package/dist/esm/serialization/resources/drafts/types/index.mjs +0 -3
- package/dist/esm/serialization/types/ErrorCode.d.mts +7 -0
- package/dist/esm/serialization/types/ErrorCode.mjs +3 -0
- package/dist/esm/serialization/types/ErrorDocs.d.mts +7 -0
- package/dist/esm/serialization/types/ErrorDocs.mjs +3 -0
- package/dist/esm/serialization/types/ErrorFix.d.mts +7 -0
- package/dist/esm/serialization/types/ErrorFix.mjs +3 -0
- package/dist/esm/serialization/types/ErrorResponse.d.mts +6 -0
- package/dist/esm/serialization/types/ErrorResponse.mjs +6 -0
- package/dist/esm/serialization/types/ValidationErrorResponse.d.mts +8 -0
- package/dist/esm/serialization/types/ValidationErrorResponse.mjs +8 -0
- package/dist/esm/serialization/types/index.d.mts +3 -0
- package/dist/esm/serialization/types/index.mjs +3 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/dist/llms.txt +2 -4
- package/package.json +1 -1
- package/reference.md +16 -288
- package/dist/cjs/api/resources/drafts/types/CreateDraftForwardRequest.d.ts +0 -21
- package/dist/cjs/api/resources/drafts/types/CreateDraftReplyAllRequest.d.ts +0 -17
- package/dist/cjs/api/resources/drafts/types/CreateDraftReplyRequest.d.ts +0 -22
- package/dist/cjs/api/resources/inboxes/resources/threads/client/requests/DeleteThreadRequest.d.ts +0 -8
- package/dist/cjs/api/resources/inboxes/resources/threads/client/requests/DeleteThreadRequest.js +0 -3
- package/dist/cjs/api/resources/pods/resources/threads/client/requests/DeleteThreadRequest.d.ts +0 -8
- package/dist/cjs/api/resources/pods/resources/threads/client/requests/DeleteThreadRequest.js +0 -3
- package/dist/cjs/api/resources/threads/client/requests/DeleteThreadRequest.d.ts +0 -8
- package/dist/cjs/api/resources/threads/client/requests/DeleteThreadRequest.js +0 -3
- package/dist/cjs/serialization/resources/drafts/types/CreateDraftForwardRequest.d.ts +0 -30
- package/dist/cjs/serialization/resources/drafts/types/CreateDraftReplyAllRequest.d.ts +0 -24
- package/dist/cjs/serialization/resources/drafts/types/CreateDraftReplyRequest.d.ts +0 -32
- package/dist/cjs/serialization/resources/drafts/types/CreateDraftReplyRequest.js +0 -64
- package/dist/esm/api/resources/drafts/types/CreateDraftForwardRequest.d.mts +0 -21
- package/dist/esm/api/resources/drafts/types/CreateDraftReplyAllRequest.d.mts +0 -17
- package/dist/esm/api/resources/drafts/types/CreateDraftReplyRequest.d.mts +0 -22
- package/dist/esm/api/resources/inboxes/resources/threads/client/requests/DeleteThreadRequest.d.mts +0 -8
- package/dist/esm/api/resources/inboxes/resources/threads/client/requests/DeleteThreadRequest.mjs +0 -2
- package/dist/esm/api/resources/pods/resources/threads/client/requests/DeleteThreadRequest.d.mts +0 -8
- package/dist/esm/api/resources/pods/resources/threads/client/requests/DeleteThreadRequest.mjs +0 -2
- package/dist/esm/api/resources/threads/client/requests/DeleteThreadRequest.d.mts +0 -8
- package/dist/esm/api/resources/threads/client/requests/DeleteThreadRequest.mjs +0 -2
- package/dist/esm/serialization/resources/drafts/types/CreateDraftForwardRequest.d.mts +0 -30
- package/dist/esm/serialization/resources/drafts/types/CreateDraftForwardRequest.mjs +0 -26
- package/dist/esm/serialization/resources/drafts/types/CreateDraftReplyAllRequest.d.mts +0 -24
- package/dist/esm/serialization/resources/drafts/types/CreateDraftReplyAllRequest.mjs +0 -20
- package/dist/esm/serialization/resources/drafts/types/CreateDraftReplyRequest.d.mts +0 -32
- package/dist/esm/serialization/resources/drafts/types/CreateDraftReplyRequest.mjs +0 -28
- /package/dist/cjs/api/{resources/drafts/types/CreateDraftForwardRequest.js → types/ErrorCode.js} +0 -0
- /package/dist/cjs/api/{resources/drafts/types/CreateDraftReplyAllRequest.js → types/ErrorDocs.js} +0 -0
- /package/dist/cjs/api/{resources/drafts/types/CreateDraftReplyRequest.js → types/ErrorFix.js} +0 -0
- /package/dist/esm/api/{resources/drafts/types/CreateDraftForwardRequest.mjs → types/ErrorCode.mjs} +0 -0
- /package/dist/esm/api/{resources/drafts/types/CreateDraftReplyAllRequest.mjs → types/ErrorDocs.mjs} +0 -0
- /package/dist/esm/api/{resources/drafts/types/CreateDraftReplyRequest.mjs → types/ErrorFix.mjs} +0 -0
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
|
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
44
|
"X-Fern-Language": "JavaScript",
|
|
45
45
|
"X-Fern-SDK-Name": "agentmail",
|
|
46
|
-
"X-Fern-SDK-Version": "0.5.
|
|
47
|
-
"User-Agent": "agentmail/0.5.
|
|
46
|
+
"X-Fern-SDK-Version": "0.5.16",
|
|
47
|
+
"User-Agent": "agentmail/0.5.16",
|
|
48
48
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
49
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
50
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
import type * as AgentMail from "../../../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Body for creating a draft. Supports plain, reply, reply-all, and forward
|
|
4
|
+
* drafts:
|
|
5
|
+
*
|
|
6
|
+
* - **Plain draft:** supply `to`, `subject`, `text`, etc.
|
|
7
|
+
* - **Reply:** set `in_reply_to` to a message ID. Recipients, subject, and
|
|
8
|
+
* threading are derived from that message. Set `reply_all` to address the
|
|
9
|
+
* whole thread (you then cannot also pass `to`, `cc`, or `bcc`).
|
|
10
|
+
* - **Forward:** set `forward_of` to a message ID. The subject and threading
|
|
11
|
+
* are derived from the source message, whose body and attachments are
|
|
12
|
+
* merged in at send time.
|
|
13
|
+
*
|
|
14
|
+
* `in_reply_to` and `forward_of` are mutually exclusive, and reading the
|
|
15
|
+
* referenced message requires `message_read` permission.
|
|
16
|
+
*/
|
|
2
17
|
export interface CreateDraftRequest {
|
|
3
18
|
labels?: AgentMail.DraftLabels;
|
|
4
19
|
replyTo?: AgentMail.DraftReplyTo;
|
|
@@ -11,6 +26,8 @@ export interface CreateDraftRequest {
|
|
|
11
26
|
/** Attachments to include in draft. */
|
|
12
27
|
attachments?: AgentMail.SendAttachment[];
|
|
13
28
|
inReplyTo?: AgentMail.DraftInReplyTo;
|
|
29
|
+
forwardOf?: AgentMail.DraftForwardOf;
|
|
30
|
+
replyAll?: AgentMail.DraftReplyAll;
|
|
14
31
|
sendAt?: AgentMail.DraftSendAt;
|
|
15
32
|
clientId?: AgentMail.DraftClientId;
|
|
16
33
|
}
|
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
import type * as AgentMail from "../../../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Edit fields on an existing draft. A draft's kind (plain, reply, or forward)
|
|
4
|
+
* is fixed at creation and cannot be changed here. Omitting a field leaves it
|
|
5
|
+
* unchanged; passing `null` (or `[]` for a recipient field) clears it. Pass
|
|
6
|
+
* `send_at` to schedule or reschedule the draft, or `null` to un-schedule it.
|
|
7
|
+
*/
|
|
2
8
|
export interface UpdateDraftRequest {
|
|
3
|
-
replyTo?: AgentMail.DraftReplyTo;
|
|
4
|
-
to?: AgentMail.DraftTo;
|
|
5
|
-
cc?: AgentMail.DraftCc;
|
|
6
|
-
bcc?: AgentMail.DraftBcc;
|
|
7
|
-
subject?: AgentMail.DraftSubject;
|
|
8
|
-
text?: AgentMail.DraftText;
|
|
9
|
-
html?: AgentMail.DraftHtml;
|
|
10
|
-
|
|
9
|
+
replyTo?: AgentMail.DraftReplyTo | null;
|
|
10
|
+
to?: AgentMail.DraftTo | null;
|
|
11
|
+
cc?: AgentMail.DraftCc | null;
|
|
12
|
+
bcc?: AgentMail.DraftBcc | null;
|
|
13
|
+
subject?: AgentMail.DraftSubject | null;
|
|
14
|
+
text?: AgentMail.DraftText | null;
|
|
15
|
+
html?: AgentMail.DraftHtml | null;
|
|
16
|
+
/** Attachments to add to the draft. */
|
|
17
|
+
addAttachments?: AgentMail.SendAttachment[];
|
|
18
|
+
/** IDs of attachments to remove from the draft. */
|
|
19
|
+
removeAttachments?: AgentMail.AttachmentId[];
|
|
20
|
+
/** Label or labels to add to the draft. */
|
|
21
|
+
addLabels?: AgentMail.DraftLabels;
|
|
22
|
+
/** Label or labels to remove from the draft. */
|
|
23
|
+
removeLabels?: AgentMail.DraftLabels;
|
|
24
|
+
sendAt?: AgentMail.DraftSendAt | null;
|
|
11
25
|
}
|
|
@@ -14,9 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./CreateDraftForwardRequest.js"), exports);
|
|
18
|
-
__exportStar(require("./CreateDraftReplyAllRequest.js"), exports);
|
|
19
|
-
__exportStar(require("./CreateDraftReplyRequest.js"), exports);
|
|
20
17
|
__exportStar(require("./CreateDraftRequest.js"), exports);
|
|
21
18
|
__exportStar(require("./Draft.js"), exports);
|
|
22
19
|
__exportStar(require("./DraftAttachments.js"), exports);
|
|
@@ -65,6 +65,12 @@ export declare class DraftsClient {
|
|
|
65
65
|
getAttachment(inbox_id: AgentMail.inboxes.InboxId, draft_id: AgentMail.DraftId, attachment_id: AgentMail.AttachmentId, requestOptions?: DraftsClient.RequestOptions): core.HttpResponsePromise<AgentMail.AttachmentResponse>;
|
|
66
66
|
private __getAttachment;
|
|
67
67
|
/**
|
|
68
|
+
* Create a draft. Supply `in_reply_to` to create a reply draft (with
|
|
69
|
+
* `reply_all` to address the whole thread), whose recipients, subject, and
|
|
70
|
+
* threading are derived from the referenced message, or `forward_of` to
|
|
71
|
+
* create a forward draft, which derives the subject, threading, and
|
|
72
|
+
* forwarded content from the source but keeps recipients caller-supplied.
|
|
73
|
+
*
|
|
68
74
|
* **CLI:**
|
|
69
75
|
* ```bash
|
|
70
76
|
* agentmail inboxes:drafts create --inbox-id <inbox_id> --to recipient@example.com --subject "Draft subject" --text "Draft body"
|
|
@@ -74,6 +80,7 @@ export declare class DraftsClient {
|
|
|
74
80
|
* @param {AgentMail.CreateDraftRequest} request
|
|
75
81
|
* @param {DraftsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
76
82
|
*
|
|
83
|
+
* @throws {@link AgentMail.ValidationError}
|
|
77
84
|
* @throws {@link AgentMail.NotFoundError}
|
|
78
85
|
*
|
|
79
86
|
* @example
|
|
@@ -82,6 +89,10 @@ export declare class DraftsClient {
|
|
|
82
89
|
create(inbox_id: AgentMail.inboxes.InboxId, request: AgentMail.CreateDraftRequest, requestOptions?: DraftsClient.RequestOptions): core.HttpResponsePromise<AgentMail.Draft>;
|
|
83
90
|
private __create;
|
|
84
91
|
/**
|
|
92
|
+
* Edit fields on an existing draft. Passing `null` clears a field (or `[]`
|
|
93
|
+
* for a recipient field); `send_at: null` un-schedules a scheduled draft.
|
|
94
|
+
* A draft that is already being sent cannot be edited.
|
|
95
|
+
*
|
|
85
96
|
* **CLI:**
|
|
86
97
|
* ```bash
|
|
87
98
|
* agentmail inboxes:drafts update --inbox-id <inbox_id> --draft-id <draft_id> --subject "Updated subject"
|
|
@@ -92,7 +103,9 @@ export declare class DraftsClient {
|
|
|
92
103
|
* @param {AgentMail.UpdateDraftRequest} request
|
|
93
104
|
* @param {DraftsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
94
105
|
*
|
|
106
|
+
* @throws {@link AgentMail.ValidationError}
|
|
95
107
|
* @throws {@link AgentMail.NotFoundError}
|
|
108
|
+
* @throws {@link AgentMail.ConflictError}
|
|
96
109
|
*
|
|
97
110
|
* @example
|
|
98
111
|
* await client.inboxes.drafts.update("inbox_id", "draft_id", {})
|
|
@@ -281,6 +281,12 @@ class DraftsClient {
|
|
|
281
281
|
});
|
|
282
282
|
}
|
|
283
283
|
/**
|
|
284
|
+
* Create a draft. Supply `in_reply_to` to create a reply draft (with
|
|
285
|
+
* `reply_all` to address the whole thread), whose recipients, subject, and
|
|
286
|
+
* threading are derived from the referenced message, or `forward_of` to
|
|
287
|
+
* create a forward draft, which derives the subject, threading, and
|
|
288
|
+
* forwarded content from the source but keeps recipients caller-supplied.
|
|
289
|
+
*
|
|
284
290
|
* **CLI:**
|
|
285
291
|
* ```bash
|
|
286
292
|
* agentmail inboxes:drafts create --inbox-id <inbox_id> --to recipient@example.com --subject "Draft subject" --text "Draft body"
|
|
@@ -290,6 +296,7 @@ class DraftsClient {
|
|
|
290
296
|
* @param {AgentMail.CreateDraftRequest} request
|
|
291
297
|
* @param {DraftsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
292
298
|
*
|
|
299
|
+
* @throws {@link AgentMail.ValidationError}
|
|
293
300
|
* @throws {@link AgentMail.NotFoundError}
|
|
294
301
|
*
|
|
295
302
|
* @example
|
|
@@ -335,6 +342,14 @@ class DraftsClient {
|
|
|
335
342
|
}
|
|
336
343
|
if (_response.error.reason === "status-code") {
|
|
337
344
|
switch (_response.error.statusCode) {
|
|
345
|
+
case 400:
|
|
346
|
+
throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
|
|
347
|
+
unrecognizedObjectKeys: "passthrough",
|
|
348
|
+
allowUnrecognizedUnionMembers: true,
|
|
349
|
+
allowUnrecognizedEnumValues: true,
|
|
350
|
+
skipValidation: true,
|
|
351
|
+
breadcrumbsPrefix: ["response"],
|
|
352
|
+
}), _response.rawResponse);
|
|
338
353
|
case 404:
|
|
339
354
|
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
340
355
|
unrecognizedObjectKeys: "passthrough",
|
|
@@ -355,6 +370,10 @@ class DraftsClient {
|
|
|
355
370
|
});
|
|
356
371
|
}
|
|
357
372
|
/**
|
|
373
|
+
* Edit fields on an existing draft. Passing `null` clears a field (or `[]`
|
|
374
|
+
* for a recipient field); `send_at: null` un-schedules a scheduled draft.
|
|
375
|
+
* A draft that is already being sent cannot be edited.
|
|
376
|
+
*
|
|
358
377
|
* **CLI:**
|
|
359
378
|
* ```bash
|
|
360
379
|
* agentmail inboxes:drafts update --inbox-id <inbox_id> --draft-id <draft_id> --subject "Updated subject"
|
|
@@ -365,7 +384,9 @@ class DraftsClient {
|
|
|
365
384
|
* @param {AgentMail.UpdateDraftRequest} request
|
|
366
385
|
* @param {DraftsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
367
386
|
*
|
|
387
|
+
* @throws {@link AgentMail.ValidationError}
|
|
368
388
|
* @throws {@link AgentMail.NotFoundError}
|
|
389
|
+
* @throws {@link AgentMail.ConflictError}
|
|
369
390
|
*
|
|
370
391
|
* @example
|
|
371
392
|
* await client.inboxes.drafts.update("inbox_id", "draft_id", {})
|
|
@@ -410,6 +431,14 @@ class DraftsClient {
|
|
|
410
431
|
}
|
|
411
432
|
if (_response.error.reason === "status-code") {
|
|
412
433
|
switch (_response.error.statusCode) {
|
|
434
|
+
case 400:
|
|
435
|
+
throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
|
|
436
|
+
unrecognizedObjectKeys: "passthrough",
|
|
437
|
+
allowUnrecognizedUnionMembers: true,
|
|
438
|
+
allowUnrecognizedEnumValues: true,
|
|
439
|
+
skipValidation: true,
|
|
440
|
+
breadcrumbsPrefix: ["response"],
|
|
441
|
+
}), _response.rawResponse);
|
|
413
442
|
case 404:
|
|
414
443
|
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
415
444
|
unrecognizedObjectKeys: "passthrough",
|
|
@@ -418,6 +447,14 @@ class DraftsClient {
|
|
|
418
447
|
skipValidation: true,
|
|
419
448
|
breadcrumbsPrefix: ["response"],
|
|
420
449
|
}), _response.rawResponse);
|
|
450
|
+
case 409:
|
|
451
|
+
throw new AgentMail.ConflictError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
452
|
+
unrecognizedObjectKeys: "passthrough",
|
|
453
|
+
allowUnrecognizedUnionMembers: true,
|
|
454
|
+
allowUnrecognizedEnumValues: true,
|
|
455
|
+
skipValidation: true,
|
|
456
|
+
breadcrumbsPrefix: ["response"],
|
|
457
|
+
}), _response.rawResponse);
|
|
421
458
|
default:
|
|
422
459
|
throw new errors.AgentMailError({
|
|
423
460
|
statusCode: _response.error.statusCode,
|
|
@@ -277,73 +277,4 @@ export declare class MessagesClient {
|
|
|
277
277
|
*/
|
|
278
278
|
forward(inbox_id: AgentMail.inboxes.InboxId, message_id: AgentMail.MessageId, request: AgentMail.SendMessageRequest, requestOptions?: MessagesClient.IdempotentRequestOptions): core.HttpResponsePromise<AgentMail.SendMessageResponse>;
|
|
279
279
|
private __forward;
|
|
280
|
-
/**
|
|
281
|
-
* Create a draft that replies to a message instead of sending it. The
|
|
282
|
-
* recipients, subject, and threading are derived from the source message.
|
|
283
|
-
* Send it later with `Send Draft`.
|
|
284
|
-
*
|
|
285
|
-
* **CLI:**
|
|
286
|
-
* ```bash
|
|
287
|
-
* agentmail inboxes:messages draft-reply --inbox-id <inbox_id> --message-id <message_id> --text "Reply text"
|
|
288
|
-
* ```
|
|
289
|
-
*
|
|
290
|
-
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
291
|
-
* @param {AgentMail.MessageId} message_id
|
|
292
|
-
* @param {AgentMail.CreateDraftReplyRequest} request
|
|
293
|
-
* @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
294
|
-
*
|
|
295
|
-
* @throws {@link AgentMail.ValidationError}
|
|
296
|
-
* @throws {@link AgentMail.NotFoundError}
|
|
297
|
-
*
|
|
298
|
-
* @example
|
|
299
|
-
* await client.inboxes.messages.draftReply("inbox_id", "message_id", {})
|
|
300
|
-
*/
|
|
301
|
-
draftReply(inbox_id: AgentMail.inboxes.InboxId, message_id: AgentMail.MessageId, request: AgentMail.CreateDraftReplyRequest, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<AgentMail.Draft>;
|
|
302
|
-
private __draftReply;
|
|
303
|
-
/**
|
|
304
|
-
* Create a draft that replies to every recipient of a message instead of
|
|
305
|
-
* sending it. Recipients, subject, and threading are derived from the
|
|
306
|
-
* source message. Send it later with `Send Draft`.
|
|
307
|
-
*
|
|
308
|
-
* **CLI:**
|
|
309
|
-
* ```bash
|
|
310
|
-
* agentmail inboxes:messages draft-reply-all --inbox-id <inbox_id> --message-id <message_id> --text "Reply text"
|
|
311
|
-
* ```
|
|
312
|
-
*
|
|
313
|
-
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
314
|
-
* @param {AgentMail.MessageId} message_id
|
|
315
|
-
* @param {AgentMail.CreateDraftReplyAllRequest} request
|
|
316
|
-
* @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
317
|
-
*
|
|
318
|
-
* @throws {@link AgentMail.ValidationError}
|
|
319
|
-
* @throws {@link AgentMail.NotFoundError}
|
|
320
|
-
*
|
|
321
|
-
* @example
|
|
322
|
-
* await client.inboxes.messages.draftReplyAll("inbox_id", "message_id", {})
|
|
323
|
-
*/
|
|
324
|
-
draftReplyAll(inbox_id: AgentMail.inboxes.InboxId, message_id: AgentMail.MessageId, request: AgentMail.CreateDraftReplyAllRequest, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<AgentMail.Draft>;
|
|
325
|
-
private __draftReplyAll;
|
|
326
|
-
/**
|
|
327
|
-
* Create a draft that forwards a message instead of sending it. The subject
|
|
328
|
-
* and threading are derived from the source message, whose body and
|
|
329
|
-
* attachments are merged in at send time. Send it later with `Send Draft`.
|
|
330
|
-
*
|
|
331
|
-
* **CLI:**
|
|
332
|
-
* ```bash
|
|
333
|
-
* agentmail inboxes:messages draft-forward --inbox-id <inbox_id> --message-id <message_id> --to recipient@example.com
|
|
334
|
-
* ```
|
|
335
|
-
*
|
|
336
|
-
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
337
|
-
* @param {AgentMail.MessageId} message_id
|
|
338
|
-
* @param {AgentMail.CreateDraftForwardRequest} request
|
|
339
|
-
* @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
340
|
-
*
|
|
341
|
-
* @throws {@link AgentMail.ValidationError}
|
|
342
|
-
* @throws {@link AgentMail.NotFoundError}
|
|
343
|
-
*
|
|
344
|
-
* @example
|
|
345
|
-
* await client.inboxes.messages.draftForward("inbox_id", "message_id", {})
|
|
346
|
-
*/
|
|
347
|
-
draftForward(inbox_id: AgentMail.inboxes.InboxId, message_id: AgentMail.MessageId, request: AgentMail.CreateDraftForwardRequest, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<AgentMail.Draft>;
|
|
348
|
-
private __draftForward;
|
|
349
280
|
}
|
|
@@ -1167,269 +1167,5 @@ class MessagesClient {
|
|
|
1167
1167
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/messages/{message_id}/forward");
|
|
1168
1168
|
});
|
|
1169
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
|
-
}
|
|
1434
1170
|
}
|
|
1435
1171
|
exports.MessagesClient = MessagesClient;
|
|
@@ -105,7 +105,7 @@ export declare class ThreadsClient {
|
|
|
105
105
|
update(inbox_id: AgentMail.inboxes.InboxId, thread_id: AgentMail.ThreadId, request: AgentMail.UpdateThreadRequest, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<AgentMail.UpdateThreadResponse>;
|
|
106
106
|
private __update;
|
|
107
107
|
/**
|
|
108
|
-
*
|
|
108
|
+
* Permanently deletes a thread and all of its messages.
|
|
109
109
|
*
|
|
110
110
|
* **CLI:**
|
|
111
111
|
* ```bash
|
|
@@ -114,7 +114,6 @@ export declare class ThreadsClient {
|
|
|
114
114
|
*
|
|
115
115
|
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
116
116
|
* @param {AgentMail.ThreadId} thread_id
|
|
117
|
-
* @param {AgentMail.inboxes.DeleteThreadRequest} request
|
|
118
117
|
* @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
119
118
|
*
|
|
120
119
|
* @throws {@link AgentMail.NotFoundError}
|
|
@@ -122,6 +121,6 @@ export declare class ThreadsClient {
|
|
|
122
121
|
* @example
|
|
123
122
|
* await client.inboxes.threads.delete("inbox_id", "thread_id")
|
|
124
123
|
*/
|
|
125
|
-
delete(inbox_id: AgentMail.inboxes.InboxId, thread_id: AgentMail.ThreadId,
|
|
124
|
+
delete(inbox_id: AgentMail.inboxes.InboxId, thread_id: AgentMail.ThreadId, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<void>;
|
|
126
125
|
private __delete;
|
|
127
126
|
}
|
|
@@ -474,7 +474,7 @@ class ThreadsClient {
|
|
|
474
474
|
});
|
|
475
475
|
}
|
|
476
476
|
/**
|
|
477
|
-
*
|
|
477
|
+
* Permanently deletes a thread and all of its messages.
|
|
478
478
|
*
|
|
479
479
|
* **CLI:**
|
|
480
480
|
* ```bash
|
|
@@ -483,7 +483,6 @@ class ThreadsClient {
|
|
|
483
483
|
*
|
|
484
484
|
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
485
485
|
* @param {AgentMail.ThreadId} thread_id
|
|
486
|
-
* @param {AgentMail.inboxes.DeleteThreadRequest} request
|
|
487
486
|
* @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
488
487
|
*
|
|
489
488
|
* @throws {@link AgentMail.NotFoundError}
|
|
@@ -491,16 +490,12 @@ class ThreadsClient {
|
|
|
491
490
|
* @example
|
|
492
491
|
* await client.inboxes.threads.delete("inbox_id", "thread_id")
|
|
493
492
|
*/
|
|
494
|
-
delete(inbox_id, thread_id,
|
|
495
|
-
return core.HttpResponsePromise.fromPromise(this.__delete(inbox_id, thread_id,
|
|
493
|
+
delete(inbox_id, thread_id, requestOptions) {
|
|
494
|
+
return core.HttpResponsePromise.fromPromise(this.__delete(inbox_id, thread_id, requestOptions));
|
|
496
495
|
}
|
|
497
|
-
__delete(
|
|
498
|
-
return __awaiter(this,
|
|
496
|
+
__delete(inbox_id, thread_id, requestOptions) {
|
|
497
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
499
498
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
500
|
-
const { permanent } = request;
|
|
501
|
-
const _queryParams = {
|
|
502
|
-
permanent,
|
|
503
|
-
};
|
|
504
499
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
505
500
|
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);
|
|
506
501
|
const _response = yield core.fetcher({
|
|
@@ -508,7 +503,7 @@ class ThreadsClient {
|
|
|
508
503
|
.http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/threads/${core.url.encodePathParam(serializers.ThreadId.jsonOrThrow(thread_id, { omitUndefined: true }))}`),
|
|
509
504
|
method: "DELETE",
|
|
510
505
|
headers: _headers,
|
|
511
|
-
queryParameters:
|
|
506
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
512
507
|
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,
|
|
513
508
|
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,
|
|
514
509
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|