agentmail 0.2.10 → 0.2.12

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 (28) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/drafts/client/Client.d.ts +12 -0
  3. package/dist/cjs/api/resources/drafts/client/Client.js +62 -0
  4. package/dist/cjs/api/resources/inboxes/resources/drafts/client/Client.d.ts +13 -0
  5. package/dist/cjs/api/resources/inboxes/resources/drafts/client/Client.js +63 -0
  6. package/dist/cjs/api/resources/organizations/types/Organization.d.ts +10 -0
  7. package/dist/cjs/api/resources/pods/resources/drafts/client/Client.d.ts +13 -0
  8. package/dist/cjs/api/resources/pods/resources/drafts/client/Client.js +63 -0
  9. package/dist/cjs/serialization/resources/organizations/types/Organization.d.ts +5 -0
  10. package/dist/cjs/serialization/resources/organizations/types/Organization.js +5 -0
  11. package/dist/cjs/version.d.ts +1 -1
  12. package/dist/cjs/version.js +1 -1
  13. package/dist/esm/BaseClient.mjs +2 -2
  14. package/dist/esm/api/resources/drafts/client/Client.d.mts +12 -0
  15. package/dist/esm/api/resources/drafts/client/Client.mjs +62 -0
  16. package/dist/esm/api/resources/inboxes/resources/drafts/client/Client.d.mts +13 -0
  17. package/dist/esm/api/resources/inboxes/resources/drafts/client/Client.mjs +63 -0
  18. package/dist/esm/api/resources/organizations/types/Organization.d.mts +10 -0
  19. package/dist/esm/api/resources/pods/resources/drafts/client/Client.d.mts +13 -0
  20. package/dist/esm/api/resources/pods/resources/drafts/client/Client.mjs +63 -0
  21. package/dist/esm/serialization/resources/organizations/types/Organization.d.mts +5 -0
  22. package/dist/esm/serialization/resources/organizations/types/Organization.mjs +5 -0
  23. package/dist/esm/version.d.mts +1 -1
  24. package/dist/esm/version.mjs +1 -1
  25. package/dist/llms-full.txt +1954 -524
  26. package/dist/llms.txt +11 -1
  27. package/package.json +1 -1
  28. package/reference.md +187 -0
@@ -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.2.10",
47
- "User-Agent": "agentmail/0.2.10",
46
+ "X-Fern-SDK-Version": "0.2.12",
47
+ "User-Agent": "agentmail/0.2.12",
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);
@@ -32,4 +32,16 @@ export declare class DraftsClient {
32
32
  */
33
33
  get(draft_id: AgentMail.DraftId, requestOptions?: DraftsClient.RequestOptions): core.HttpResponsePromise<AgentMail.Draft>;
34
34
  private __get;
35
+ /**
36
+ * @param {AgentMail.DraftId} draft_id
37
+ * @param {AgentMail.AttachmentId} attachment_id
38
+ * @param {DraftsClient.RequestOptions} requestOptions - Request-specific configuration.
39
+ *
40
+ * @throws {@link AgentMail.NotFoundError}
41
+ *
42
+ * @example
43
+ * await client.drafts.getAttachment("draft_id", "attachment_id")
44
+ */
45
+ getAttachment(draft_id: AgentMail.DraftId, attachment_id: AgentMail.AttachmentId, requestOptions?: DraftsClient.RequestOptions): core.HttpResponsePromise<AgentMail.AttachmentResponse>;
46
+ private __getAttachment;
35
47
  }
@@ -197,5 +197,67 @@ class DraftsClient {
197
197
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v0/drafts/{draft_id}");
198
198
  });
199
199
  }
200
+ /**
201
+ * @param {AgentMail.DraftId} draft_id
202
+ * @param {AgentMail.AttachmentId} attachment_id
203
+ * @param {DraftsClient.RequestOptions} requestOptions - Request-specific configuration.
204
+ *
205
+ * @throws {@link AgentMail.NotFoundError}
206
+ *
207
+ * @example
208
+ * await client.drafts.getAttachment("draft_id", "attachment_id")
209
+ */
210
+ getAttachment(draft_id, attachment_id, requestOptions) {
211
+ return core.HttpResponsePromise.fromPromise(this.__getAttachment(draft_id, attachment_id, requestOptions));
212
+ }
213
+ __getAttachment(draft_id, attachment_id, requestOptions) {
214
+ return __awaiter(this, void 0, void 0, function* () {
215
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
216
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
217
+ 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);
218
+ const _response = yield core.fetcher({
219
+ 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.Production).http, `/v0/drafts/${core.url.encodePathParam(serializers.DraftId.jsonOrThrow(draft_id, { omitUndefined: true }))}/attachments/${core.url.encodePathParam(serializers.AttachmentId.jsonOrThrow(attachment_id, { omitUndefined: true }))}`),
220
+ method: "GET",
221
+ headers: _headers,
222
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
223
+ 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,
224
+ 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,
225
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
226
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
227
+ logging: this._options.logging,
228
+ });
229
+ if (_response.ok) {
230
+ return {
231
+ data: serializers.AttachmentResponse.parseOrThrow(_response.body, {
232
+ unrecognizedObjectKeys: "passthrough",
233
+ allowUnrecognizedUnionMembers: true,
234
+ allowUnrecognizedEnumValues: true,
235
+ skipValidation: true,
236
+ breadcrumbsPrefix: ["response"],
237
+ }),
238
+ rawResponse: _response.rawResponse,
239
+ };
240
+ }
241
+ if (_response.error.reason === "status-code") {
242
+ switch (_response.error.statusCode) {
243
+ case 404:
244
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
245
+ unrecognizedObjectKeys: "passthrough",
246
+ allowUnrecognizedUnionMembers: true,
247
+ allowUnrecognizedEnumValues: true,
248
+ skipValidation: true,
249
+ breadcrumbsPrefix: ["response"],
250
+ }), _response.rawResponse);
251
+ default:
252
+ throw new errors.AgentMailError({
253
+ statusCode: _response.error.statusCode,
254
+ body: _response.error.body,
255
+ rawResponse: _response.rawResponse,
256
+ });
257
+ }
258
+ }
259
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v0/drafts/{draft_id}/attachments/{attachment_id}");
260
+ });
261
+ }
200
262
  }
201
263
  exports.DraftsClient = DraftsClient;
@@ -34,6 +34,19 @@ export declare class DraftsClient {
34
34
  */
35
35
  get(inbox_id: AgentMail.inboxes.InboxId, draft_id: AgentMail.DraftId, requestOptions?: DraftsClient.RequestOptions): core.HttpResponsePromise<AgentMail.Draft>;
36
36
  private __get;
37
+ /**
38
+ * @param {AgentMail.inboxes.InboxId} inbox_id
39
+ * @param {AgentMail.DraftId} draft_id
40
+ * @param {AgentMail.AttachmentId} attachment_id
41
+ * @param {DraftsClient.RequestOptions} requestOptions - Request-specific configuration.
42
+ *
43
+ * @throws {@link AgentMail.NotFoundError}
44
+ *
45
+ * @example
46
+ * await client.inboxes.drafts.getAttachment("inbox_id", "draft_id", "attachment_id")
47
+ */
48
+ getAttachment(inbox_id: AgentMail.inboxes.InboxId, draft_id: AgentMail.DraftId, attachment_id: AgentMail.AttachmentId, requestOptions?: DraftsClient.RequestOptions): core.HttpResponsePromise<AgentMail.AttachmentResponse>;
49
+ private __getAttachment;
37
50
  /**
38
51
  * @param {AgentMail.inboxes.InboxId} inbox_id
39
52
  * @param {AgentMail.CreateDraftRequest} request
@@ -199,6 +199,69 @@ class DraftsClient {
199
199
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v0/inboxes/{inbox_id}/drafts/{draft_id}");
200
200
  });
201
201
  }
202
+ /**
203
+ * @param {AgentMail.inboxes.InboxId} inbox_id
204
+ * @param {AgentMail.DraftId} draft_id
205
+ * @param {AgentMail.AttachmentId} attachment_id
206
+ * @param {DraftsClient.RequestOptions} requestOptions - Request-specific configuration.
207
+ *
208
+ * @throws {@link AgentMail.NotFoundError}
209
+ *
210
+ * @example
211
+ * await client.inboxes.drafts.getAttachment("inbox_id", "draft_id", "attachment_id")
212
+ */
213
+ getAttachment(inbox_id, draft_id, attachment_id, requestOptions) {
214
+ return core.HttpResponsePromise.fromPromise(this.__getAttachment(inbox_id, draft_id, attachment_id, requestOptions));
215
+ }
216
+ __getAttachment(inbox_id, draft_id, attachment_id, requestOptions) {
217
+ return __awaiter(this, void 0, void 0, function* () {
218
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
219
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
220
+ 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);
221
+ const _response = yield core.fetcher({
222
+ 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.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/drafts/${core.url.encodePathParam(serializers.DraftId.jsonOrThrow(draft_id, { omitUndefined: true }))}/attachments/${core.url.encodePathParam(serializers.AttachmentId.jsonOrThrow(attachment_id, { omitUndefined: true }))}`),
223
+ method: "GET",
224
+ headers: _headers,
225
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
226
+ 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,
227
+ 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,
228
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
229
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
230
+ logging: this._options.logging,
231
+ });
232
+ if (_response.ok) {
233
+ return {
234
+ data: serializers.AttachmentResponse.parseOrThrow(_response.body, {
235
+ unrecognizedObjectKeys: "passthrough",
236
+ allowUnrecognizedUnionMembers: true,
237
+ allowUnrecognizedEnumValues: true,
238
+ skipValidation: true,
239
+ breadcrumbsPrefix: ["response"],
240
+ }),
241
+ rawResponse: _response.rawResponse,
242
+ };
243
+ }
244
+ if (_response.error.reason === "status-code") {
245
+ switch (_response.error.statusCode) {
246
+ case 404:
247
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
248
+ unrecognizedObjectKeys: "passthrough",
249
+ allowUnrecognizedUnionMembers: true,
250
+ allowUnrecognizedEnumValues: true,
251
+ skipValidation: true,
252
+ breadcrumbsPrefix: ["response"],
253
+ }), _response.rawResponse);
254
+ default:
255
+ throw new errors.AgentMailError({
256
+ statusCode: _response.error.statusCode,
257
+ body: _response.error.body,
258
+ rawResponse: _response.rawResponse,
259
+ });
260
+ }
261
+ }
262
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v0/inboxes/{inbox_id}/drafts/{draft_id}/attachments/{attachment_id}");
263
+ });
264
+ }
202
265
  /**
203
266
  * @param {AgentMail.inboxes.InboxId} inbox_id
204
267
  * @param {AgentMail.CreateDraftRequest} request
@@ -12,6 +12,16 @@ export interface Organization {
12
12
  inboxLimit?: number;
13
13
  /** Maximum number of domains allowed. */
14
14
  domainLimit?: number;
15
+ /** Provider-agnostic billing customer ID. */
16
+ billingId?: string;
17
+ /** Billing provider type (e.g. "stripe"). */
18
+ billingType?: string;
19
+ /** Active billing subscription ID. */
20
+ billingSubscriptionId?: string;
21
+ /** Provider-agnostic authentication ID. */
22
+ authenticationId?: string;
23
+ /** Authentication provider type. */
24
+ authenticationType?: string;
15
25
  /** Time at which organization was last updated. */
16
26
  updatedAt: Date;
17
27
  /** Time at which organization was created. */
@@ -34,4 +34,17 @@ export declare class DraftsClient {
34
34
  */
35
35
  get(pod_id: AgentMail.pods.PodId, draft_id: AgentMail.DraftId, requestOptions?: DraftsClient.RequestOptions): core.HttpResponsePromise<AgentMail.Draft>;
36
36
  private __get;
37
+ /**
38
+ * @param {AgentMail.pods.PodId} pod_id
39
+ * @param {AgentMail.DraftId} draft_id
40
+ * @param {AgentMail.AttachmentId} attachment_id
41
+ * @param {DraftsClient.RequestOptions} requestOptions - Request-specific configuration.
42
+ *
43
+ * @throws {@link AgentMail.NotFoundError}
44
+ *
45
+ * @example
46
+ * await client.pods.drafts.getAttachment("pod_id", "draft_id", "attachment_id")
47
+ */
48
+ getAttachment(pod_id: AgentMail.pods.PodId, draft_id: AgentMail.DraftId, attachment_id: AgentMail.AttachmentId, requestOptions?: DraftsClient.RequestOptions): core.HttpResponsePromise<AgentMail.AttachmentResponse>;
49
+ private __getAttachment;
37
50
  }
@@ -199,5 +199,68 @@ class DraftsClient {
199
199
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v0/pods/{pod_id}/drafts/{draft_id}");
200
200
  });
201
201
  }
202
+ /**
203
+ * @param {AgentMail.pods.PodId} pod_id
204
+ * @param {AgentMail.DraftId} draft_id
205
+ * @param {AgentMail.AttachmentId} attachment_id
206
+ * @param {DraftsClient.RequestOptions} requestOptions - Request-specific configuration.
207
+ *
208
+ * @throws {@link AgentMail.NotFoundError}
209
+ *
210
+ * @example
211
+ * await client.pods.drafts.getAttachment("pod_id", "draft_id", "attachment_id")
212
+ */
213
+ getAttachment(pod_id, draft_id, attachment_id, requestOptions) {
214
+ return core.HttpResponsePromise.fromPromise(this.__getAttachment(pod_id, draft_id, attachment_id, requestOptions));
215
+ }
216
+ __getAttachment(pod_id, draft_id, attachment_id, requestOptions) {
217
+ return __awaiter(this, void 0, void 0, function* () {
218
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
219
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
220
+ 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);
221
+ const _response = yield core.fetcher({
222
+ 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.Production).http, `/v0/pods/${core.url.encodePathParam(serializers.pods.PodId.jsonOrThrow(pod_id, { omitUndefined: true }))}/drafts/${core.url.encodePathParam(serializers.DraftId.jsonOrThrow(draft_id, { omitUndefined: true }))}/attachments/${core.url.encodePathParam(serializers.AttachmentId.jsonOrThrow(attachment_id, { omitUndefined: true }))}`),
223
+ method: "GET",
224
+ headers: _headers,
225
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
226
+ 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,
227
+ 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,
228
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
229
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
230
+ logging: this._options.logging,
231
+ });
232
+ if (_response.ok) {
233
+ return {
234
+ data: serializers.AttachmentResponse.parseOrThrow(_response.body, {
235
+ unrecognizedObjectKeys: "passthrough",
236
+ allowUnrecognizedUnionMembers: true,
237
+ allowUnrecognizedEnumValues: true,
238
+ skipValidation: true,
239
+ breadcrumbsPrefix: ["response"],
240
+ }),
241
+ rawResponse: _response.rawResponse,
242
+ };
243
+ }
244
+ if (_response.error.reason === "status-code") {
245
+ switch (_response.error.statusCode) {
246
+ case 404:
247
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
248
+ unrecognizedObjectKeys: "passthrough",
249
+ allowUnrecognizedUnionMembers: true,
250
+ allowUnrecognizedEnumValues: true,
251
+ skipValidation: true,
252
+ breadcrumbsPrefix: ["response"],
253
+ }), _response.rawResponse);
254
+ default:
255
+ throw new errors.AgentMailError({
256
+ statusCode: _response.error.statusCode,
257
+ body: _response.error.body,
258
+ rawResponse: _response.rawResponse,
259
+ });
260
+ }
261
+ }
262
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v0/pods/{pod_id}/drafts/{draft_id}/attachments/{attachment_id}");
263
+ });
264
+ }
202
265
  }
203
266
  exports.DraftsClient = DraftsClient;
@@ -10,6 +10,11 @@ export declare namespace Organization {
10
10
  domain_count: number;
11
11
  inbox_limit?: number | null;
12
12
  domain_limit?: number | null;
13
+ billing_id?: string | null;
14
+ billing_type?: string | null;
15
+ billing_subscription_id?: string | null;
16
+ authentication_id?: string | null;
17
+ authentication_type?: string | null;
13
18
  updated_at: string;
14
19
  created_at: string;
15
20
  }
@@ -43,6 +43,11 @@ exports.Organization = core.serialization.object({
43
43
  domainCount: core.serialization.property("domain_count", core.serialization.number()),
44
44
  inboxLimit: core.serialization.property("inbox_limit", core.serialization.number().optional()),
45
45
  domainLimit: core.serialization.property("domain_limit", core.serialization.number().optional()),
46
+ billingId: core.serialization.property("billing_id", core.serialization.string().optional()),
47
+ billingType: core.serialization.property("billing_type", core.serialization.string().optional()),
48
+ billingSubscriptionId: core.serialization.property("billing_subscription_id", core.serialization.string().optional()),
49
+ authenticationId: core.serialization.property("authentication_id", core.serialization.string().optional()),
50
+ authenticationType: core.serialization.property("authentication_type", core.serialization.string().optional()),
46
51
  updatedAt: core.serialization.property("updated_at", core.serialization.date()),
47
52
  createdAt: core.serialization.property("created_at", core.serialization.date()),
48
53
  });
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.2.10";
1
+ export declare const SDK_VERSION = "0.2.12";
@@ -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.2.10";
4
+ exports.SDK_VERSION = "0.2.12";
@@ -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.2.10",
10
- "User-Agent": "agentmail/0.2.10",
9
+ "X-Fern-SDK-Version": "0.2.12",
10
+ "User-Agent": "agentmail/0.2.12",
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);
@@ -32,4 +32,16 @@ export declare class DraftsClient {
32
32
  */
33
33
  get(draft_id: AgentMail.DraftId, requestOptions?: DraftsClient.RequestOptions): core.HttpResponsePromise<AgentMail.Draft>;
34
34
  private __get;
35
+ /**
36
+ * @param {AgentMail.DraftId} draft_id
37
+ * @param {AgentMail.AttachmentId} attachment_id
38
+ * @param {DraftsClient.RequestOptions} requestOptions - Request-specific configuration.
39
+ *
40
+ * @throws {@link AgentMail.NotFoundError}
41
+ *
42
+ * @example
43
+ * await client.drafts.getAttachment("draft_id", "attachment_id")
44
+ */
45
+ getAttachment(draft_id: AgentMail.DraftId, attachment_id: AgentMail.AttachmentId, requestOptions?: DraftsClient.RequestOptions): core.HttpResponsePromise<AgentMail.AttachmentResponse>;
46
+ private __getAttachment;
35
47
  }
@@ -161,4 +161,66 @@ export class DraftsClient {
161
161
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/drafts/{draft_id}");
162
162
  });
163
163
  }
164
+ /**
165
+ * @param {AgentMail.DraftId} draft_id
166
+ * @param {AgentMail.AttachmentId} attachment_id
167
+ * @param {DraftsClient.RequestOptions} requestOptions - Request-specific configuration.
168
+ *
169
+ * @throws {@link AgentMail.NotFoundError}
170
+ *
171
+ * @example
172
+ * await client.drafts.getAttachment("draft_id", "attachment_id")
173
+ */
174
+ getAttachment(draft_id, attachment_id, requestOptions) {
175
+ return core.HttpResponsePromise.fromPromise(this.__getAttachment(draft_id, attachment_id, requestOptions));
176
+ }
177
+ __getAttachment(draft_id, attachment_id, requestOptions) {
178
+ return __awaiter(this, void 0, void 0, function* () {
179
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
180
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
181
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
182
+ const _response = yield core.fetcher({
183
+ 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.Production).http, `/v0/drafts/${core.url.encodePathParam(serializers.DraftId.jsonOrThrow(draft_id, { omitUndefined: true }))}/attachments/${core.url.encodePathParam(serializers.AttachmentId.jsonOrThrow(attachment_id, { omitUndefined: true }))}`),
184
+ method: "GET",
185
+ headers: _headers,
186
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
187
+ 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,
188
+ 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,
189
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
190
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
191
+ logging: this._options.logging,
192
+ });
193
+ if (_response.ok) {
194
+ return {
195
+ data: serializers.AttachmentResponse.parseOrThrow(_response.body, {
196
+ unrecognizedObjectKeys: "passthrough",
197
+ allowUnrecognizedUnionMembers: true,
198
+ allowUnrecognizedEnumValues: true,
199
+ skipValidation: true,
200
+ breadcrumbsPrefix: ["response"],
201
+ }),
202
+ rawResponse: _response.rawResponse,
203
+ };
204
+ }
205
+ if (_response.error.reason === "status-code") {
206
+ switch (_response.error.statusCode) {
207
+ case 404:
208
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
209
+ unrecognizedObjectKeys: "passthrough",
210
+ allowUnrecognizedUnionMembers: true,
211
+ allowUnrecognizedEnumValues: true,
212
+ skipValidation: true,
213
+ breadcrumbsPrefix: ["response"],
214
+ }), _response.rawResponse);
215
+ default:
216
+ throw new errors.AgentMailError({
217
+ statusCode: _response.error.statusCode,
218
+ body: _response.error.body,
219
+ rawResponse: _response.rawResponse,
220
+ });
221
+ }
222
+ }
223
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/drafts/{draft_id}/attachments/{attachment_id}");
224
+ });
225
+ }
164
226
  }
@@ -34,6 +34,19 @@ export declare class DraftsClient {
34
34
  */
35
35
  get(inbox_id: AgentMail.inboxes.InboxId, draft_id: AgentMail.DraftId, requestOptions?: DraftsClient.RequestOptions): core.HttpResponsePromise<AgentMail.Draft>;
36
36
  private __get;
37
+ /**
38
+ * @param {AgentMail.inboxes.InboxId} inbox_id
39
+ * @param {AgentMail.DraftId} draft_id
40
+ * @param {AgentMail.AttachmentId} attachment_id
41
+ * @param {DraftsClient.RequestOptions} requestOptions - Request-specific configuration.
42
+ *
43
+ * @throws {@link AgentMail.NotFoundError}
44
+ *
45
+ * @example
46
+ * await client.inboxes.drafts.getAttachment("inbox_id", "draft_id", "attachment_id")
47
+ */
48
+ getAttachment(inbox_id: AgentMail.inboxes.InboxId, draft_id: AgentMail.DraftId, attachment_id: AgentMail.AttachmentId, requestOptions?: DraftsClient.RequestOptions): core.HttpResponsePromise<AgentMail.AttachmentResponse>;
49
+ private __getAttachment;
37
50
  /**
38
51
  * @param {AgentMail.inboxes.InboxId} inbox_id
39
52
  * @param {AgentMail.CreateDraftRequest} request
@@ -163,6 +163,69 @@ export class DraftsClient {
163
163
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/inboxes/{inbox_id}/drafts/{draft_id}");
164
164
  });
165
165
  }
166
+ /**
167
+ * @param {AgentMail.inboxes.InboxId} inbox_id
168
+ * @param {AgentMail.DraftId} draft_id
169
+ * @param {AgentMail.AttachmentId} attachment_id
170
+ * @param {DraftsClient.RequestOptions} requestOptions - Request-specific configuration.
171
+ *
172
+ * @throws {@link AgentMail.NotFoundError}
173
+ *
174
+ * @example
175
+ * await client.inboxes.drafts.getAttachment("inbox_id", "draft_id", "attachment_id")
176
+ */
177
+ getAttachment(inbox_id, draft_id, attachment_id, requestOptions) {
178
+ return core.HttpResponsePromise.fromPromise(this.__getAttachment(inbox_id, draft_id, attachment_id, requestOptions));
179
+ }
180
+ __getAttachment(inbox_id, draft_id, attachment_id, requestOptions) {
181
+ return __awaiter(this, void 0, void 0, function* () {
182
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
183
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
184
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
185
+ const _response = yield core.fetcher({
186
+ 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.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/drafts/${core.url.encodePathParam(serializers.DraftId.jsonOrThrow(draft_id, { omitUndefined: true }))}/attachments/${core.url.encodePathParam(serializers.AttachmentId.jsonOrThrow(attachment_id, { omitUndefined: true }))}`),
187
+ method: "GET",
188
+ headers: _headers,
189
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
190
+ 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,
191
+ 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,
192
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
193
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
194
+ logging: this._options.logging,
195
+ });
196
+ if (_response.ok) {
197
+ return {
198
+ data: serializers.AttachmentResponse.parseOrThrow(_response.body, {
199
+ unrecognizedObjectKeys: "passthrough",
200
+ allowUnrecognizedUnionMembers: true,
201
+ allowUnrecognizedEnumValues: true,
202
+ skipValidation: true,
203
+ breadcrumbsPrefix: ["response"],
204
+ }),
205
+ rawResponse: _response.rawResponse,
206
+ };
207
+ }
208
+ if (_response.error.reason === "status-code") {
209
+ switch (_response.error.statusCode) {
210
+ case 404:
211
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
212
+ unrecognizedObjectKeys: "passthrough",
213
+ allowUnrecognizedUnionMembers: true,
214
+ allowUnrecognizedEnumValues: true,
215
+ skipValidation: true,
216
+ breadcrumbsPrefix: ["response"],
217
+ }), _response.rawResponse);
218
+ default:
219
+ throw new errors.AgentMailError({
220
+ statusCode: _response.error.statusCode,
221
+ body: _response.error.body,
222
+ rawResponse: _response.rawResponse,
223
+ });
224
+ }
225
+ }
226
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/inboxes/{inbox_id}/drafts/{draft_id}/attachments/{attachment_id}");
227
+ });
228
+ }
166
229
  /**
167
230
  * @param {AgentMail.inboxes.InboxId} inbox_id
168
231
  * @param {AgentMail.CreateDraftRequest} request
@@ -12,6 +12,16 @@ export interface Organization {
12
12
  inboxLimit?: number;
13
13
  /** Maximum number of domains allowed. */
14
14
  domainLimit?: number;
15
+ /** Provider-agnostic billing customer ID. */
16
+ billingId?: string;
17
+ /** Billing provider type (e.g. "stripe"). */
18
+ billingType?: string;
19
+ /** Active billing subscription ID. */
20
+ billingSubscriptionId?: string;
21
+ /** Provider-agnostic authentication ID. */
22
+ authenticationId?: string;
23
+ /** Authentication provider type. */
24
+ authenticationType?: string;
15
25
  /** Time at which organization was last updated. */
16
26
  updatedAt: Date;
17
27
  /** Time at which organization was created. */
@@ -34,4 +34,17 @@ export declare class DraftsClient {
34
34
  */
35
35
  get(pod_id: AgentMail.pods.PodId, draft_id: AgentMail.DraftId, requestOptions?: DraftsClient.RequestOptions): core.HttpResponsePromise<AgentMail.Draft>;
36
36
  private __get;
37
+ /**
38
+ * @param {AgentMail.pods.PodId} pod_id
39
+ * @param {AgentMail.DraftId} draft_id
40
+ * @param {AgentMail.AttachmentId} attachment_id
41
+ * @param {DraftsClient.RequestOptions} requestOptions - Request-specific configuration.
42
+ *
43
+ * @throws {@link AgentMail.NotFoundError}
44
+ *
45
+ * @example
46
+ * await client.pods.drafts.getAttachment("pod_id", "draft_id", "attachment_id")
47
+ */
48
+ getAttachment(pod_id: AgentMail.pods.PodId, draft_id: AgentMail.DraftId, attachment_id: AgentMail.AttachmentId, requestOptions?: DraftsClient.RequestOptions): core.HttpResponsePromise<AgentMail.AttachmentResponse>;
49
+ private __getAttachment;
37
50
  }
@@ -163,4 +163,67 @@ export class DraftsClient {
163
163
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/pods/{pod_id}/drafts/{draft_id}");
164
164
  });
165
165
  }
166
+ /**
167
+ * @param {AgentMail.pods.PodId} pod_id
168
+ * @param {AgentMail.DraftId} draft_id
169
+ * @param {AgentMail.AttachmentId} attachment_id
170
+ * @param {DraftsClient.RequestOptions} requestOptions - Request-specific configuration.
171
+ *
172
+ * @throws {@link AgentMail.NotFoundError}
173
+ *
174
+ * @example
175
+ * await client.pods.drafts.getAttachment("pod_id", "draft_id", "attachment_id")
176
+ */
177
+ getAttachment(pod_id, draft_id, attachment_id, requestOptions) {
178
+ return core.HttpResponsePromise.fromPromise(this.__getAttachment(pod_id, draft_id, attachment_id, requestOptions));
179
+ }
180
+ __getAttachment(pod_id, draft_id, attachment_id, requestOptions) {
181
+ return __awaiter(this, void 0, void 0, function* () {
182
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
183
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
184
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
185
+ const _response = yield core.fetcher({
186
+ 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.Production).http, `/v0/pods/${core.url.encodePathParam(serializers.pods.PodId.jsonOrThrow(pod_id, { omitUndefined: true }))}/drafts/${core.url.encodePathParam(serializers.DraftId.jsonOrThrow(draft_id, { omitUndefined: true }))}/attachments/${core.url.encodePathParam(serializers.AttachmentId.jsonOrThrow(attachment_id, { omitUndefined: true }))}`),
187
+ method: "GET",
188
+ headers: _headers,
189
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
190
+ 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,
191
+ 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,
192
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
193
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
194
+ logging: this._options.logging,
195
+ });
196
+ if (_response.ok) {
197
+ return {
198
+ data: serializers.AttachmentResponse.parseOrThrow(_response.body, {
199
+ unrecognizedObjectKeys: "passthrough",
200
+ allowUnrecognizedUnionMembers: true,
201
+ allowUnrecognizedEnumValues: true,
202
+ skipValidation: true,
203
+ breadcrumbsPrefix: ["response"],
204
+ }),
205
+ rawResponse: _response.rawResponse,
206
+ };
207
+ }
208
+ if (_response.error.reason === "status-code") {
209
+ switch (_response.error.statusCode) {
210
+ case 404:
211
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
212
+ unrecognizedObjectKeys: "passthrough",
213
+ allowUnrecognizedUnionMembers: true,
214
+ allowUnrecognizedEnumValues: true,
215
+ skipValidation: true,
216
+ breadcrumbsPrefix: ["response"],
217
+ }), _response.rawResponse);
218
+ default:
219
+ throw new errors.AgentMailError({
220
+ statusCode: _response.error.statusCode,
221
+ body: _response.error.body,
222
+ rawResponse: _response.rawResponse,
223
+ });
224
+ }
225
+ }
226
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/pods/{pod_id}/drafts/{draft_id}/attachments/{attachment_id}");
227
+ });
228
+ }
166
229
  }