agentmail 0.1.18 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +20 -0
  2. package/dist/cjs/BaseClient.js +2 -2
  3. package/dist/cjs/api/resources/attachments/types/Attachment.d.ts +1 -1
  4. package/dist/cjs/api/resources/attachments/types/AttachmentResponse.d.ts +13 -0
  5. package/dist/cjs/api/resources/attachments/types/AttachmentResponse.js +3 -0
  6. package/dist/cjs/api/resources/attachments/types/index.d.ts +1 -0
  7. package/dist/cjs/api/resources/attachments/types/index.js +1 -0
  8. package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.d.ts +9 -1
  9. package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.js +18 -2
  10. package/dist/cjs/api/resources/inboxes/resources/threads/client/Client.d.ts +9 -1
  11. package/dist/cjs/api/resources/inboxes/resources/threads/client/Client.js +18 -2
  12. package/dist/cjs/api/resources/pods/resources/threads/client/Client.d.ts +9 -1
  13. package/dist/cjs/api/resources/pods/resources/threads/client/Client.js +18 -2
  14. package/dist/cjs/api/resources/threads/client/Client.d.ts +8 -1
  15. package/dist/cjs/api/resources/threads/client/Client.js +17 -2
  16. package/dist/cjs/serialization/resources/attachments/types/Attachment.d.ts +1 -1
  17. package/dist/cjs/serialization/resources/attachments/types/Attachment.js +1 -1
  18. package/dist/cjs/serialization/resources/attachments/types/AttachmentResponse.d.ts +22 -0
  19. package/dist/cjs/serialization/resources/attachments/types/AttachmentResponse.js +54 -0
  20. package/dist/cjs/serialization/resources/attachments/types/index.d.ts +1 -0
  21. package/dist/cjs/serialization/resources/attachments/types/index.js +1 -0
  22. package/dist/cjs/version.d.ts +1 -1
  23. package/dist/cjs/version.js +1 -1
  24. package/dist/esm/BaseClient.mjs +2 -2
  25. package/dist/esm/api/resources/attachments/types/Attachment.d.mts +1 -1
  26. package/dist/esm/api/resources/attachments/types/AttachmentResponse.d.mts +13 -0
  27. package/dist/esm/api/resources/attachments/types/AttachmentResponse.mjs +2 -0
  28. package/dist/esm/api/resources/attachments/types/index.d.mts +1 -0
  29. package/dist/esm/api/resources/attachments/types/index.mjs +1 -0
  30. package/dist/esm/api/resources/inboxes/resources/messages/client/Client.d.mts +9 -1
  31. package/dist/esm/api/resources/inboxes/resources/messages/client/Client.mjs +18 -2
  32. package/dist/esm/api/resources/inboxes/resources/threads/client/Client.d.mts +9 -1
  33. package/dist/esm/api/resources/inboxes/resources/threads/client/Client.mjs +18 -2
  34. package/dist/esm/api/resources/pods/resources/threads/client/Client.d.mts +9 -1
  35. package/dist/esm/api/resources/pods/resources/threads/client/Client.mjs +18 -2
  36. package/dist/esm/api/resources/threads/client/Client.d.mts +8 -1
  37. package/dist/esm/api/resources/threads/client/Client.mjs +17 -2
  38. package/dist/esm/serialization/resources/attachments/types/Attachment.d.mts +1 -1
  39. package/dist/esm/serialization/resources/attachments/types/Attachment.mjs +1 -1
  40. package/dist/esm/serialization/resources/attachments/types/AttachmentResponse.d.mts +22 -0
  41. package/dist/esm/serialization/resources/attachments/types/AttachmentResponse.mjs +18 -0
  42. package/dist/esm/serialization/resources/attachments/types/index.d.mts +1 -0
  43. package/dist/esm/serialization/resources/attachments/types/index.mjs +1 -0
  44. package/dist/esm/version.d.mts +1 -1
  45. package/dist/esm/version.mjs +1 -1
  46. package/dist/llms-full.txt +2250 -310
  47. package/dist/llms.txt +3 -0
  48. package/package.json +1 -1
  49. package/reference.md +4 -4
package/README.md CHANGED
@@ -5,6 +5,26 @@
5
5
 
6
6
  The Agentmail TypeScript library provides convenient access to the Agentmail APIs from TypeScript.
7
7
 
8
+ ## Table of Contents
9
+
10
+ - [Installation](#installation)
11
+ - [Reference](#reference)
12
+ - [Usage](#usage)
13
+ - [Request and Response Types](#request-and-response-types)
14
+ - [Exception Handling](#exception-handling)
15
+ - [Pagination](#pagination)
16
+ - [Advanced](#advanced)
17
+ - [Additional Headers](#additional-headers)
18
+ - [Additional Query String Parameters](#additional-query-string-parameters)
19
+ - [Retries](#retries)
20
+ - [Timeouts](#timeouts)
21
+ - [Aborting Requests](#aborting-requests)
22
+ - [Access Raw Response Data](#access-raw-response-data)
23
+ - [Logging](#logging)
24
+ - [Runtime Compatibility](#runtime-compatibility)
25
+ - [Contributing](#contributing)
26
+ - [Binary Response](#binary-response)
27
+
8
28
  ## Installation
9
29
 
10
30
  ```sh
@@ -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.1.18",
47
- "User-Agent": "agentmail/0.1.18",
46
+ "X-Fern-SDK-Version": "0.2.1",
47
+ "User-Agent": "agentmail/0.2.1",
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);
@@ -4,6 +4,6 @@ export interface Attachment {
4
4
  filename?: AgentMail.AttachmentFilename;
5
5
  size: AgentMail.AttachmentSize;
6
6
  contentType?: AgentMail.AttachmentContentType;
7
- contentDisposition: AgentMail.AttachmentContentDisposition;
7
+ contentDisposition?: AgentMail.AttachmentContentDisposition;
8
8
  contentId?: AgentMail.AttachmentContentId;
9
9
  }
@@ -0,0 +1,13 @@
1
+ import type * as AgentMail from "../../../index.js";
2
+ export interface AttachmentResponse {
3
+ attachmentId: AgentMail.AttachmentId;
4
+ filename?: AgentMail.AttachmentFilename;
5
+ size: AgentMail.AttachmentSize;
6
+ contentType?: AgentMail.AttachmentContentType;
7
+ contentDisposition?: AgentMail.AttachmentContentDisposition;
8
+ contentId?: AgentMail.AttachmentContentId;
9
+ /** URL to download the attachment. */
10
+ downloadUrl: string;
11
+ /** Time at which the download URL expires. */
12
+ expiresAt: Date;
13
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -5,5 +5,6 @@ export * from "./AttachmentContentId.js";
5
5
  export * from "./AttachmentContentType.js";
6
6
  export * from "./AttachmentFilename.js";
7
7
  export * from "./AttachmentId.js";
8
+ export * from "./AttachmentResponse.js";
8
9
  export * from "./AttachmentSize.js";
9
10
  export * from "./SendAttachment.js";
@@ -21,5 +21,6 @@ __exportStar(require("./AttachmentContentId.js"), exports);
21
21
  __exportStar(require("./AttachmentContentType.js"), exports);
22
22
  __exportStar(require("./AttachmentFilename.js"), exports);
23
23
  __exportStar(require("./AttachmentId.js"), exports);
24
+ __exportStar(require("./AttachmentResponse.js"), exports);
24
25
  __exportStar(require("./AttachmentSize.js"), exports);
25
26
  __exportStar(require("./SendAttachment.js"), exports);
@@ -36,9 +36,17 @@ export declare class MessagesClient {
36
36
  get(inbox_id: AgentMail.inboxes.InboxId, message_id: AgentMail.MessageId, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<AgentMail.Message>;
37
37
  private __get;
38
38
  /**
39
+ * @param {AgentMail.inboxes.InboxId} inbox_id
40
+ * @param {AgentMail.MessageId} message_id
41
+ * @param {AgentMail.AttachmentId} attachment_id
42
+ * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
43
+ *
39
44
  * @throws {@link AgentMail.NotFoundError}
45
+ *
46
+ * @example
47
+ * await client.inboxes.messages.getAttachment("inbox_id", "message_id", "attachment_id")
40
48
  */
41
- getAttachment(inbox_id: AgentMail.inboxes.InboxId, message_id: AgentMail.MessageId, attachment_id: AgentMail.AttachmentId, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<core.BinaryResponse>;
49
+ getAttachment(inbox_id: AgentMail.inboxes.InboxId, message_id: AgentMail.MessageId, attachment_id: AgentMail.AttachmentId, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<AgentMail.AttachmentResponse>;
42
50
  private __getAttachment;
43
51
  /**
44
52
  * @throws {@link AgentMail.NotFoundError}
@@ -232,7 +232,15 @@ class MessagesClient {
232
232
  });
233
233
  }
234
234
  /**
235
+ * @param {AgentMail.inboxes.InboxId} inbox_id
236
+ * @param {AgentMail.MessageId} message_id
237
+ * @param {AgentMail.AttachmentId} attachment_id
238
+ * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
239
+ *
235
240
  * @throws {@link AgentMail.NotFoundError}
241
+ *
242
+ * @example
243
+ * await client.inboxes.messages.getAttachment("inbox_id", "message_id", "attachment_id")
236
244
  */
237
245
  getAttachment(inbox_id, message_id, attachment_id, requestOptions) {
238
246
  return core.HttpResponsePromise.fromPromise(this.__getAttachment(inbox_id, message_id, attachment_id, requestOptions));
@@ -247,7 +255,6 @@ class MessagesClient {
247
255
  method: "GET",
248
256
  headers: _headers,
249
257
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
250
- responseType: "binary-response",
251
258
  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,
252
259
  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,
253
260
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -255,7 +262,16 @@ class MessagesClient {
255
262
  logging: this._options.logging,
256
263
  });
257
264
  if (_response.ok) {
258
- return { data: _response.body, rawResponse: _response.rawResponse };
265
+ return {
266
+ data: serializers.AttachmentResponse.parseOrThrow(_response.body, {
267
+ unrecognizedObjectKeys: "passthrough",
268
+ allowUnrecognizedUnionMembers: true,
269
+ allowUnrecognizedEnumValues: true,
270
+ skipValidation: true,
271
+ breadcrumbsPrefix: ["response"],
272
+ }),
273
+ rawResponse: _response.rawResponse,
274
+ };
259
275
  }
260
276
  if (_response.error.reason === "status-code") {
261
277
  switch (_response.error.statusCode) {
@@ -36,9 +36,17 @@ export declare class ThreadsClient {
36
36
  get(inbox_id: AgentMail.inboxes.InboxId, thread_id: AgentMail.ThreadId, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<AgentMail.Thread>;
37
37
  private __get;
38
38
  /**
39
+ * @param {AgentMail.inboxes.InboxId} inbox_id
40
+ * @param {AgentMail.ThreadId} thread_id
41
+ * @param {AgentMail.AttachmentId} attachment_id
42
+ * @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
43
+ *
39
44
  * @throws {@link AgentMail.NotFoundError}
45
+ *
46
+ * @example
47
+ * await client.inboxes.threads.getAttachment("inbox_id", "thread_id", "attachment_id")
40
48
  */
41
- getAttachment(inbox_id: AgentMail.inboxes.InboxId, thread_id: AgentMail.ThreadId, attachment_id: AgentMail.AttachmentId, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<core.BinaryResponse>;
49
+ getAttachment(inbox_id: AgentMail.inboxes.InboxId, thread_id: AgentMail.ThreadId, attachment_id: AgentMail.AttachmentId, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<AgentMail.AttachmentResponse>;
42
50
  private __getAttachment;
43
51
  /**
44
52
  * @param {AgentMail.inboxes.InboxId} inbox_id
@@ -232,7 +232,15 @@ class ThreadsClient {
232
232
  });
233
233
  }
234
234
  /**
235
+ * @param {AgentMail.inboxes.InboxId} inbox_id
236
+ * @param {AgentMail.ThreadId} thread_id
237
+ * @param {AgentMail.AttachmentId} attachment_id
238
+ * @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
239
+ *
235
240
  * @throws {@link AgentMail.NotFoundError}
241
+ *
242
+ * @example
243
+ * await client.inboxes.threads.getAttachment("inbox_id", "thread_id", "attachment_id")
236
244
  */
237
245
  getAttachment(inbox_id, thread_id, attachment_id, requestOptions) {
238
246
  return core.HttpResponsePromise.fromPromise(this.__getAttachment(inbox_id, thread_id, attachment_id, requestOptions));
@@ -247,7 +255,6 @@ class ThreadsClient {
247
255
  method: "GET",
248
256
  headers: _headers,
249
257
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
250
- responseType: "binary-response",
251
258
  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,
252
259
  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,
253
260
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -255,7 +262,16 @@ class ThreadsClient {
255
262
  logging: this._options.logging,
256
263
  });
257
264
  if (_response.ok) {
258
- return { data: _response.body, rawResponse: _response.rawResponse };
265
+ return {
266
+ data: serializers.AttachmentResponse.parseOrThrow(_response.body, {
267
+ unrecognizedObjectKeys: "passthrough",
268
+ allowUnrecognizedUnionMembers: true,
269
+ allowUnrecognizedEnumValues: true,
270
+ skipValidation: true,
271
+ breadcrumbsPrefix: ["response"],
272
+ }),
273
+ rawResponse: _response.rawResponse,
274
+ };
259
275
  }
260
276
  if (_response.error.reason === "status-code") {
261
277
  switch (_response.error.statusCode) {
@@ -36,8 +36,16 @@ export declare class ThreadsClient {
36
36
  get(pod_id: AgentMail.pods.PodId, thread_id: AgentMail.ThreadId, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<AgentMail.Thread>;
37
37
  private __get;
38
38
  /**
39
+ * @param {AgentMail.pods.PodId} pod_id
40
+ * @param {AgentMail.ThreadId} thread_id
41
+ * @param {AgentMail.AttachmentId} attachment_id
42
+ * @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
43
+ *
39
44
  * @throws {@link AgentMail.NotFoundError}
45
+ *
46
+ * @example
47
+ * await client.pods.threads.getAttachment("pod_id", "thread_id", "attachment_id")
40
48
  */
41
- getAttachment(pod_id: AgentMail.pods.PodId, thread_id: AgentMail.ThreadId, attachment_id: AgentMail.AttachmentId, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<core.BinaryResponse>;
49
+ getAttachment(pod_id: AgentMail.pods.PodId, thread_id: AgentMail.ThreadId, attachment_id: AgentMail.AttachmentId, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<AgentMail.AttachmentResponse>;
42
50
  private __getAttachment;
43
51
  }
@@ -232,7 +232,15 @@ class ThreadsClient {
232
232
  });
233
233
  }
234
234
  /**
235
+ * @param {AgentMail.pods.PodId} pod_id
236
+ * @param {AgentMail.ThreadId} thread_id
237
+ * @param {AgentMail.AttachmentId} attachment_id
238
+ * @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
239
+ *
235
240
  * @throws {@link AgentMail.NotFoundError}
241
+ *
242
+ * @example
243
+ * await client.pods.threads.getAttachment("pod_id", "thread_id", "attachment_id")
236
244
  */
237
245
  getAttachment(pod_id, thread_id, attachment_id, requestOptions) {
238
246
  return core.HttpResponsePromise.fromPromise(this.__getAttachment(pod_id, thread_id, attachment_id, requestOptions));
@@ -247,7 +255,6 @@ class ThreadsClient {
247
255
  method: "GET",
248
256
  headers: _headers,
249
257
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
250
- responseType: "binary-response",
251
258
  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,
252
259
  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,
253
260
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -255,7 +262,16 @@ class ThreadsClient {
255
262
  logging: this._options.logging,
256
263
  });
257
264
  if (_response.ok) {
258
- return { data: _response.body, rawResponse: _response.rawResponse };
265
+ return {
266
+ data: serializers.AttachmentResponse.parseOrThrow(_response.body, {
267
+ unrecognizedObjectKeys: "passthrough",
268
+ allowUnrecognizedUnionMembers: true,
269
+ allowUnrecognizedEnumValues: true,
270
+ skipValidation: true,
271
+ breadcrumbsPrefix: ["response"],
272
+ }),
273
+ rawResponse: _response.rawResponse,
274
+ };
259
275
  }
260
276
  if (_response.error.reason === "status-code") {
261
277
  switch (_response.error.statusCode) {
@@ -34,8 +34,15 @@ export declare class ThreadsClient {
34
34
  get(thread_id: AgentMail.ThreadId, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<AgentMail.Thread>;
35
35
  private __get;
36
36
  /**
37
+ * @param {AgentMail.ThreadId} thread_id
38
+ * @param {AgentMail.AttachmentId} attachment_id
39
+ * @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
40
+ *
37
41
  * @throws {@link AgentMail.NotFoundError}
42
+ *
43
+ * @example
44
+ * await client.threads.getAttachment("thread_id", "attachment_id")
38
45
  */
39
- getAttachment(thread_id: AgentMail.ThreadId, attachment_id: AgentMail.AttachmentId, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<core.BinaryResponse>;
46
+ getAttachment(thread_id: AgentMail.ThreadId, attachment_id: AgentMail.AttachmentId, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<AgentMail.AttachmentResponse>;
40
47
  private __getAttachment;
41
48
  }
@@ -230,7 +230,14 @@ class ThreadsClient {
230
230
  });
231
231
  }
232
232
  /**
233
+ * @param {AgentMail.ThreadId} thread_id
234
+ * @param {AgentMail.AttachmentId} attachment_id
235
+ * @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
236
+ *
233
237
  * @throws {@link AgentMail.NotFoundError}
238
+ *
239
+ * @example
240
+ * await client.threads.getAttachment("thread_id", "attachment_id")
234
241
  */
235
242
  getAttachment(thread_id, attachment_id, requestOptions) {
236
243
  return core.HttpResponsePromise.fromPromise(this.__getAttachment(thread_id, attachment_id, requestOptions));
@@ -245,7 +252,6 @@ class ThreadsClient {
245
252
  method: "GET",
246
253
  headers: _headers,
247
254
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
248
- responseType: "binary-response",
249
255
  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,
250
256
  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,
251
257
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -253,7 +259,16 @@ class ThreadsClient {
253
259
  logging: this._options.logging,
254
260
  });
255
261
  if (_response.ok) {
256
- return { data: _response.body, rawResponse: _response.rawResponse };
262
+ return {
263
+ data: serializers.AttachmentResponse.parseOrThrow(_response.body, {
264
+ unrecognizedObjectKeys: "passthrough",
265
+ allowUnrecognizedUnionMembers: true,
266
+ allowUnrecognizedEnumValues: true,
267
+ skipValidation: true,
268
+ breadcrumbsPrefix: ["response"],
269
+ }),
270
+ rawResponse: _response.rawResponse,
271
+ };
257
272
  }
258
273
  if (_response.error.reason === "status-code") {
259
274
  switch (_response.error.statusCode) {
@@ -14,7 +14,7 @@ export declare namespace Attachment {
14
14
  filename?: AttachmentFilename.Raw | null;
15
15
  size: AttachmentSize.Raw;
16
16
  content_type?: AttachmentContentType.Raw | null;
17
- content_disposition: AttachmentContentDisposition.Raw;
17
+ content_disposition?: AttachmentContentDisposition.Raw | null;
18
18
  content_id?: AttachmentContentId.Raw | null;
19
19
  }
20
20
  }
@@ -47,6 +47,6 @@ exports.Attachment = core.serialization.object({
47
47
  filename: AttachmentFilename_js_1.AttachmentFilename.optional(),
48
48
  size: AttachmentSize_js_1.AttachmentSize,
49
49
  contentType: core.serialization.property("content_type", AttachmentContentType_js_1.AttachmentContentType.optional()),
50
- contentDisposition: core.serialization.property("content_disposition", AttachmentContentDisposition_js_1.AttachmentContentDisposition),
50
+ contentDisposition: core.serialization.property("content_disposition", AttachmentContentDisposition_js_1.AttachmentContentDisposition.optional()),
51
51
  contentId: core.serialization.property("content_id", AttachmentContentId_js_1.AttachmentContentId.optional()),
52
52
  });
@@ -0,0 +1,22 @@
1
+ import type * as AgentMail from "../../../../api/index.js";
2
+ import * as core from "../../../../core/index.js";
3
+ import type * as serializers from "../../../index.js";
4
+ import { AttachmentContentDisposition } from "./AttachmentContentDisposition.js";
5
+ import { AttachmentContentId } from "./AttachmentContentId.js";
6
+ import { AttachmentContentType } from "./AttachmentContentType.js";
7
+ import { AttachmentFilename } from "./AttachmentFilename.js";
8
+ import { AttachmentId } from "./AttachmentId.js";
9
+ import { AttachmentSize } from "./AttachmentSize.js";
10
+ export declare const AttachmentResponse: core.serialization.ObjectSchema<serializers.AttachmentResponse.Raw, AgentMail.AttachmentResponse>;
11
+ export declare namespace AttachmentResponse {
12
+ interface Raw {
13
+ attachment_id: AttachmentId.Raw;
14
+ filename?: AttachmentFilename.Raw | null;
15
+ size: AttachmentSize.Raw;
16
+ content_type?: AttachmentContentType.Raw | null;
17
+ content_disposition?: AttachmentContentDisposition.Raw | null;
18
+ content_id?: AttachmentContentId.Raw | null;
19
+ download_url: string;
20
+ expires_at: string;
21
+ }
22
+ }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.AttachmentResponse = void 0;
38
+ const core = __importStar(require("../../../../core/index.js"));
39
+ const AttachmentContentDisposition_js_1 = require("./AttachmentContentDisposition.js");
40
+ const AttachmentContentId_js_1 = require("./AttachmentContentId.js");
41
+ const AttachmentContentType_js_1 = require("./AttachmentContentType.js");
42
+ const AttachmentFilename_js_1 = require("./AttachmentFilename.js");
43
+ const AttachmentId_js_1 = require("./AttachmentId.js");
44
+ const AttachmentSize_js_1 = require("./AttachmentSize.js");
45
+ exports.AttachmentResponse = core.serialization.object({
46
+ attachmentId: core.serialization.property("attachment_id", AttachmentId_js_1.AttachmentId),
47
+ filename: AttachmentFilename_js_1.AttachmentFilename.optional(),
48
+ size: AttachmentSize_js_1.AttachmentSize,
49
+ contentType: core.serialization.property("content_type", AttachmentContentType_js_1.AttachmentContentType.optional()),
50
+ contentDisposition: core.serialization.property("content_disposition", AttachmentContentDisposition_js_1.AttachmentContentDisposition.optional()),
51
+ contentId: core.serialization.property("content_id", AttachmentContentId_js_1.AttachmentContentId.optional()),
52
+ downloadUrl: core.serialization.property("download_url", core.serialization.string()),
53
+ expiresAt: core.serialization.property("expires_at", core.serialization.date()),
54
+ });
@@ -5,5 +5,6 @@ export * from "./AttachmentContentId.js";
5
5
  export * from "./AttachmentContentType.js";
6
6
  export * from "./AttachmentFilename.js";
7
7
  export * from "./AttachmentId.js";
8
+ export * from "./AttachmentResponse.js";
8
9
  export * from "./AttachmentSize.js";
9
10
  export * from "./SendAttachment.js";
@@ -21,5 +21,6 @@ __exportStar(require("./AttachmentContentId.js"), exports);
21
21
  __exportStar(require("./AttachmentContentType.js"), exports);
22
22
  __exportStar(require("./AttachmentFilename.js"), exports);
23
23
  __exportStar(require("./AttachmentId.js"), exports);
24
+ __exportStar(require("./AttachmentResponse.js"), exports);
24
25
  __exportStar(require("./AttachmentSize.js"), exports);
25
26
  __exportStar(require("./SendAttachment.js"), exports);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.1.18";
1
+ export declare const SDK_VERSION = "0.2.1";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "0.1.18";
4
+ exports.SDK_VERSION = "0.2.1";
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
6
6
  const headers = mergeHeaders({
7
7
  "X-Fern-Language": "JavaScript",
8
8
  "X-Fern-SDK-Name": "agentmail",
9
- "X-Fern-SDK-Version": "0.1.18",
10
- "User-Agent": "agentmail/0.1.18",
9
+ "X-Fern-SDK-Version": "0.2.1",
10
+ "User-Agent": "agentmail/0.2.1",
11
11
  "X-Fern-Runtime": core.RUNTIME.type,
12
12
  "X-Fern-Runtime-Version": core.RUNTIME.version,
13
13
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -4,6 +4,6 @@ export interface Attachment {
4
4
  filename?: AgentMail.AttachmentFilename;
5
5
  size: AgentMail.AttachmentSize;
6
6
  contentType?: AgentMail.AttachmentContentType;
7
- contentDisposition: AgentMail.AttachmentContentDisposition;
7
+ contentDisposition?: AgentMail.AttachmentContentDisposition;
8
8
  contentId?: AgentMail.AttachmentContentId;
9
9
  }
@@ -0,0 +1,13 @@
1
+ import type * as AgentMail from "../../../index.mjs";
2
+ export interface AttachmentResponse {
3
+ attachmentId: AgentMail.AttachmentId;
4
+ filename?: AgentMail.AttachmentFilename;
5
+ size: AgentMail.AttachmentSize;
6
+ contentType?: AgentMail.AttachmentContentType;
7
+ contentDisposition?: AgentMail.AttachmentContentDisposition;
8
+ contentId?: AgentMail.AttachmentContentId;
9
+ /** URL to download the attachment. */
10
+ downloadUrl: string;
11
+ /** Time at which the download URL expires. */
12
+ expiresAt: Date;
13
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -5,5 +5,6 @@ export * from "./AttachmentContentId.mjs";
5
5
  export * from "./AttachmentContentType.mjs";
6
6
  export * from "./AttachmentFilename.mjs";
7
7
  export * from "./AttachmentId.mjs";
8
+ export * from "./AttachmentResponse.mjs";
8
9
  export * from "./AttachmentSize.mjs";
9
10
  export * from "./SendAttachment.mjs";
@@ -5,5 +5,6 @@ export * from "./AttachmentContentId.mjs";
5
5
  export * from "./AttachmentContentType.mjs";
6
6
  export * from "./AttachmentFilename.mjs";
7
7
  export * from "./AttachmentId.mjs";
8
+ export * from "./AttachmentResponse.mjs";
8
9
  export * from "./AttachmentSize.mjs";
9
10
  export * from "./SendAttachment.mjs";
@@ -36,9 +36,17 @@ export declare class MessagesClient {
36
36
  get(inbox_id: AgentMail.inboxes.InboxId, message_id: AgentMail.MessageId, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<AgentMail.Message>;
37
37
  private __get;
38
38
  /**
39
+ * @param {AgentMail.inboxes.InboxId} inbox_id
40
+ * @param {AgentMail.MessageId} message_id
41
+ * @param {AgentMail.AttachmentId} attachment_id
42
+ * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
43
+ *
39
44
  * @throws {@link AgentMail.NotFoundError}
45
+ *
46
+ * @example
47
+ * await client.inboxes.messages.getAttachment("inbox_id", "message_id", "attachment_id")
40
48
  */
41
- getAttachment(inbox_id: AgentMail.inboxes.InboxId, message_id: AgentMail.MessageId, attachment_id: AgentMail.AttachmentId, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<core.BinaryResponse>;
49
+ getAttachment(inbox_id: AgentMail.inboxes.InboxId, message_id: AgentMail.MessageId, attachment_id: AgentMail.AttachmentId, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<AgentMail.AttachmentResponse>;
42
50
  private __getAttachment;
43
51
  /**
44
52
  * @throws {@link AgentMail.NotFoundError}
@@ -196,7 +196,15 @@ export class MessagesClient {
196
196
  });
197
197
  }
198
198
  /**
199
+ * @param {AgentMail.inboxes.InboxId} inbox_id
200
+ * @param {AgentMail.MessageId} message_id
201
+ * @param {AgentMail.AttachmentId} attachment_id
202
+ * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
203
+ *
199
204
  * @throws {@link AgentMail.NotFoundError}
205
+ *
206
+ * @example
207
+ * await client.inboxes.messages.getAttachment("inbox_id", "message_id", "attachment_id")
200
208
  */
201
209
  getAttachment(inbox_id, message_id, attachment_id, requestOptions) {
202
210
  return core.HttpResponsePromise.fromPromise(this.__getAttachment(inbox_id, message_id, attachment_id, requestOptions));
@@ -211,7 +219,6 @@ export class MessagesClient {
211
219
  method: "GET",
212
220
  headers: _headers,
213
221
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
214
- responseType: "binary-response",
215
222
  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,
216
223
  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,
217
224
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -219,7 +226,16 @@ export class MessagesClient {
219
226
  logging: this._options.logging,
220
227
  });
221
228
  if (_response.ok) {
222
- return { data: _response.body, rawResponse: _response.rawResponse };
229
+ return {
230
+ data: serializers.AttachmentResponse.parseOrThrow(_response.body, {
231
+ unrecognizedObjectKeys: "passthrough",
232
+ allowUnrecognizedUnionMembers: true,
233
+ allowUnrecognizedEnumValues: true,
234
+ skipValidation: true,
235
+ breadcrumbsPrefix: ["response"],
236
+ }),
237
+ rawResponse: _response.rawResponse,
238
+ };
223
239
  }
224
240
  if (_response.error.reason === "status-code") {
225
241
  switch (_response.error.statusCode) {
@@ -36,9 +36,17 @@ export declare class ThreadsClient {
36
36
  get(inbox_id: AgentMail.inboxes.InboxId, thread_id: AgentMail.ThreadId, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<AgentMail.Thread>;
37
37
  private __get;
38
38
  /**
39
+ * @param {AgentMail.inboxes.InboxId} inbox_id
40
+ * @param {AgentMail.ThreadId} thread_id
41
+ * @param {AgentMail.AttachmentId} attachment_id
42
+ * @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
43
+ *
39
44
  * @throws {@link AgentMail.NotFoundError}
45
+ *
46
+ * @example
47
+ * await client.inboxes.threads.getAttachment("inbox_id", "thread_id", "attachment_id")
40
48
  */
41
- getAttachment(inbox_id: AgentMail.inboxes.InboxId, thread_id: AgentMail.ThreadId, attachment_id: AgentMail.AttachmentId, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<core.BinaryResponse>;
49
+ getAttachment(inbox_id: AgentMail.inboxes.InboxId, thread_id: AgentMail.ThreadId, attachment_id: AgentMail.AttachmentId, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<AgentMail.AttachmentResponse>;
42
50
  private __getAttachment;
43
51
  /**
44
52
  * @param {AgentMail.inboxes.InboxId} inbox_id