agentmail 0.0.74 → 0.0.76

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/README.md CHANGED
@@ -204,7 +204,7 @@ On the other hand, contributions to the README are always very welcome!
204
204
  You can consume binary data from endpoints using the `BinaryResponse` type which lets you choose how to consume the data:
205
205
 
206
206
  ```typescript
207
- const response = await client.inboxes.messages.getAttachment(...);
207
+ const response = await client.domains.getZoneFile(...);
208
208
  const stream: ReadableStream<Uint8Array> = response.stream();
209
209
  // const arrayBuffer: ArrayBuffer = await response.arrayBuffer();
210
210
  // const blob: Blob = response.blob();
@@ -230,7 +230,7 @@ import { createWriteStream } from 'fs';
230
230
  import { Readable } from 'stream';
231
231
  import { pipeline } from 'stream/promises';
232
232
 
233
- const response = await client.inboxes.messages.getAttachment(...);
233
+ const response = await client.domains.getZoneFile(...);
234
234
 
235
235
  const stream = response.stream();
236
236
  const nodeStream = Readable.fromWeb(stream);
@@ -249,7 +249,7 @@ await pipeline(nodeStream, writeStream);
249
249
  ```ts
250
250
  import { writeFile } from 'fs/promises';
251
251
 
252
- const response = await client.inboxes.messages.getAttachment(...);
252
+ const response = await client.domains.getZoneFile(...);
253
253
 
254
254
  const arrayBuffer = await response.arrayBuffer();
255
255
  await writeFile('path/to/file', Buffer.from(arrayBuffer));
@@ -265,7 +265,7 @@ await writeFile('path/to/file', Buffer.from(arrayBuffer));
265
265
  ```ts
266
266
  import { writeFile } from 'fs/promises';
267
267
 
268
- const response = await client.inboxes.messages.getAttachment(...);
268
+ const response = await client.domains.getZoneFile(...);
269
269
 
270
270
  const blob = await response.blob();
271
271
  const arrayBuffer = await blob.arrayBuffer();
@@ -282,7 +282,7 @@ await writeFile('output.bin', Buffer.from(arrayBuffer));
282
282
  ```ts
283
283
  import { writeFile } from 'fs/promises';
284
284
 
285
- const response = await client.inboxes.messages.getAttachment(...);
285
+ const response = await client.domains.getZoneFile(...);
286
286
 
287
287
  const bytes = await response.bytes();
288
288
  await writeFile('path/to/file', bytes);
@@ -303,7 +303,7 @@ await writeFile('path/to/file', bytes);
303
303
  <summary>ReadableStream (most-efficient)</summary>
304
304
 
305
305
  ```ts
306
- const response = await client.inboxes.messages.getAttachment(...);
306
+ const response = await client.domains.getZoneFile(...);
307
307
 
308
308
  const stream = response.stream();
309
309
  await Bun.write('path/to/file', stream);
@@ -317,7 +317,7 @@ await Bun.write('path/to/file', stream);
317
317
  <summary>ArrayBuffer</summary>
318
318
 
319
319
  ```ts
320
- const response = await client.inboxes.messages.getAttachment(...);
320
+ const response = await client.domains.getZoneFile(...);
321
321
 
322
322
  const arrayBuffer = await response.arrayBuffer();
323
323
  await Bun.write('path/to/file', arrayBuffer);
@@ -331,7 +331,7 @@ await Bun.write('path/to/file', arrayBuffer);
331
331
  <summary>Blob</summary>
332
332
 
333
333
  ```ts
334
- const response = await client.inboxes.messages.getAttachment(...);
334
+ const response = await client.domains.getZoneFile(...);
335
335
 
336
336
  const blob = await response.blob();
337
337
  await Bun.write('path/to/file', blob);
@@ -345,7 +345,7 @@ await Bun.write('path/to/file', blob);
345
345
  <summary>Bytes (UIntArray8)</summary>
346
346
 
347
347
  ```ts
348
- const response = await client.inboxes.messages.getAttachment(...);
348
+ const response = await client.domains.getZoneFile(...);
349
349
 
350
350
  const bytes = await response.bytes();
351
351
  await Bun.write('path/to/file', bytes);
@@ -366,7 +366,7 @@ await Bun.write('path/to/file', bytes);
366
366
  <summary>ReadableStream (most-efficient)</summary>
367
367
 
368
368
  ```ts
369
- const response = await client.inboxes.messages.getAttachment(...);
369
+ const response = await client.domains.getZoneFile(...);
370
370
 
371
371
  const stream = response.stream();
372
372
  const file = await Deno.open('path/to/file', { write: true, create: true });
@@ -381,7 +381,7 @@ await stream.pipeTo(file.writable);
381
381
  <summary>ArrayBuffer</summary>
382
382
 
383
383
  ```ts
384
- const response = await client.inboxes.messages.getAttachment(...);
384
+ const response = await client.domains.getZoneFile(...);
385
385
 
386
386
  const arrayBuffer = await response.arrayBuffer();
387
387
  await Deno.writeFile('path/to/file', new Uint8Array(arrayBuffer));
@@ -395,7 +395,7 @@ await Deno.writeFile('path/to/file', new Uint8Array(arrayBuffer));
395
395
  <summary>Blob</summary>
396
396
 
397
397
  ```ts
398
- const response = await client.inboxes.messages.getAttachment(...);
398
+ const response = await client.domains.getZoneFile(...);
399
399
 
400
400
  const blob = await response.blob();
401
401
  const arrayBuffer = await blob.arrayBuffer();
@@ -410,7 +410,7 @@ await Deno.writeFile('path/to/file', new Uint8Array(arrayBuffer));
410
410
  <summary>Bytes (UIntArray8)</summary>
411
411
 
412
412
  ```ts
413
- const response = await client.inboxes.messages.getAttachment(...);
413
+ const response = await client.domains.getZoneFile(...);
414
414
 
415
415
  const bytes = await response.bytes();
416
416
  await Deno.writeFile('path/to/file', bytes);
@@ -431,7 +431,7 @@ await Deno.writeFile('path/to/file', bytes);
431
431
  <summary>Blob (most-efficient)</summary>
432
432
 
433
433
  ```ts
434
- const response = await client.inboxes.messages.getAttachment(...);
434
+ const response = await client.domains.getZoneFile(...);
435
435
 
436
436
  const blob = await response.blob();
437
437
  const url = URL.createObjectURL(blob);
@@ -452,7 +452,7 @@ URL.revokeObjectURL(url);
452
452
  <summary>ReadableStream</summary>
453
453
 
454
454
  ```ts
455
- const response = await client.inboxes.messages.getAttachment(...);
455
+ const response = await client.domains.getZoneFile(...);
456
456
 
457
457
  const stream = response.stream();
458
458
  const reader = stream.getReader();
@@ -483,7 +483,7 @@ URL.revokeObjectURL(url);
483
483
  <summary>ArrayBuffer</summary>
484
484
 
485
485
  ```ts
486
- const response = await client.inboxes.messages.getAttachment(...);
486
+ const response = await client.domains.getZoneFile(...);
487
487
 
488
488
  const arrayBuffer = await response.arrayBuffer();
489
489
  const blob = new Blob([arrayBuffer]);
@@ -505,7 +505,7 @@ URL.revokeObjectURL(url);
505
505
  <summary>Bytes (UIntArray8)</summary>
506
506
 
507
507
  ```ts
508
- const response = await client.inboxes.messages.getAttachment(...);
508
+ const response = await client.domains.getZoneFile(...);
509
509
 
510
510
  const bytes = await response.bytes();
511
511
  const blob = new Blob([bytes]);
@@ -536,7 +536,7 @@ URL.revokeObjectURL(url);
536
536
  <summary>ReadableStream</summary>
537
537
 
538
538
  ```ts
539
- const response = await client.inboxes.messages.getAttachment(...);
539
+ const response = await client.domains.getZoneFile(...);
540
540
 
541
541
  const stream = response.stream();
542
542
  const text = await new Response(stream).text();
@@ -550,7 +550,7 @@ const text = await new Response(stream).text();
550
550
  <summary>ArrayBuffer</summary>
551
551
 
552
552
  ```ts
553
- const response = await client.inboxes.messages.getAttachment(...);
553
+ const response = await client.domains.getZoneFile(...);
554
554
 
555
555
  const arrayBuffer = await response.arrayBuffer();
556
556
  const text = new TextDecoder().decode(arrayBuffer);
@@ -564,7 +564,7 @@ const text = new TextDecoder().decode(arrayBuffer);
564
564
  <summary>Blob</summary>
565
565
 
566
566
  ```ts
567
- const response = await client.inboxes.messages.getAttachment(...);
567
+ const response = await client.domains.getZoneFile(...);
568
568
 
569
569
  const blob = await response.blob();
570
570
  const text = await blob.text();
@@ -578,7 +578,7 @@ const text = await blob.text();
578
578
  <summary>Bytes (UIntArray8)</summary>
579
579
 
580
580
  ```ts
581
- const response = await client.inboxes.messages.getAttachment(...);
581
+ const response = await client.domains.getZoneFile(...);
582
582
 
583
583
  const bytes = await response.bytes();
584
584
  const text = new TextDecoder().decode(bytes);
@@ -53,8 +53,8 @@ class AgentMailClient {
53
53
  this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
54
54
  "X-Fern-Language": "JavaScript",
55
55
  "X-Fern-SDK-Name": "agentmail",
56
- "X-Fern-SDK-Version": "0.0.74",
57
- "User-Agent": "agentmail/0.0.74",
56
+ "X-Fern-SDK-Version": "0.0.76",
57
+ "User-Agent": "agentmail/0.0.76",
58
58
  "X-Fern-Runtime": core.RUNTIME.type,
59
59
  "X-Fern-Runtime-Version": core.RUNTIME.version,
60
60
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -49,6 +49,11 @@ export declare class Domains {
49
49
  */
50
50
  get(domainId: AgentMail.DomainId, requestOptions?: Domains.RequestOptions): core.HttpResponsePromise<AgentMail.Domain>;
51
51
  private __get;
52
+ /**
53
+ * @throws {@link AgentMail.NotFoundError}
54
+ */
55
+ getZoneFile(domainId: AgentMail.DomainId, requestOptions?: Domains.RequestOptions): core.HttpResponsePromise<core.BinaryResponse>;
56
+ private __getZoneFile;
52
57
  /**
53
58
  * @param {AgentMail.CreateDomainRequest} request
54
59
  * @param {Domains.RequestOptions} requestOptions - Request-specific configuration.
@@ -195,6 +195,64 @@ class Domains {
195
195
  }
196
196
  });
197
197
  }
198
+ /**
199
+ * @throws {@link AgentMail.NotFoundError}
200
+ */
201
+ getZoneFile(domainId, requestOptions) {
202
+ return core.HttpResponsePromise.fromPromise(this.__getZoneFile(domainId, requestOptions));
203
+ }
204
+ __getZoneFile(domainId, requestOptions) {
205
+ return __awaiter(this, void 0, void 0, function* () {
206
+ var _a, _b, _c;
207
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
208
+ const _response = yield core.fetcher({
209
+ 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/domains/${encodeURIComponent(serializers.DomainId.jsonOrThrow(domainId, { omitUndefined: true }))}/zone-file`),
210
+ method: "GET",
211
+ headers: _headers,
212
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
213
+ responseType: "binary-response",
214
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
215
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
216
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
217
+ });
218
+ if (_response.ok) {
219
+ return { data: _response.body, rawResponse: _response.rawResponse };
220
+ }
221
+ if (_response.error.reason === "status-code") {
222
+ switch (_response.error.statusCode) {
223
+ case 404:
224
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
225
+ unrecognizedObjectKeys: "passthrough",
226
+ allowUnrecognizedUnionMembers: true,
227
+ allowUnrecognizedEnumValues: true,
228
+ skipValidation: true,
229
+ breadcrumbsPrefix: ["response"],
230
+ }), _response.rawResponse);
231
+ default:
232
+ throw new errors.AgentMailError({
233
+ statusCode: _response.error.statusCode,
234
+ body: _response.error.body,
235
+ rawResponse: _response.rawResponse,
236
+ });
237
+ }
238
+ }
239
+ switch (_response.error.reason) {
240
+ case "non-json":
241
+ throw new errors.AgentMailError({
242
+ statusCode: _response.error.statusCode,
243
+ body: _response.error.rawBody,
244
+ rawResponse: _response.rawResponse,
245
+ });
246
+ case "timeout":
247
+ throw new errors.AgentMailTimeoutError("Timeout exceeded when calling GET /v0/domains/{domain_id}/zone-file.");
248
+ case "unknown":
249
+ throw new errors.AgentMailError({
250
+ message: _response.error.errorMessage,
251
+ rawResponse: _response.rawResponse,
252
+ });
253
+ }
254
+ });
255
+ }
198
256
  /**
199
257
  * @param {AgentMail.CreateDomainRequest} request
200
258
  * @param {Domains.RequestOptions} requestOptions - Request-specific configuration.
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.0.74";
1
+ export declare const SDK_VERSION = "0.0.76";
@@ -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.0.74";
4
+ exports.SDK_VERSION = "0.0.76";
@@ -17,8 +17,8 @@ export class AgentMailClient {
17
17
  this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
18
18
  "X-Fern-Language": "JavaScript",
19
19
  "X-Fern-SDK-Name": "agentmail",
20
- "X-Fern-SDK-Version": "0.0.74",
21
- "User-Agent": "agentmail/0.0.74",
20
+ "X-Fern-SDK-Version": "0.0.76",
21
+ "User-Agent": "agentmail/0.0.76",
22
22
  "X-Fern-Runtime": core.RUNTIME.type,
23
23
  "X-Fern-Runtime-Version": core.RUNTIME.version,
24
24
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -49,6 +49,11 @@ export declare class Domains {
49
49
  */
50
50
  get(domainId: AgentMail.DomainId, requestOptions?: Domains.RequestOptions): core.HttpResponsePromise<AgentMail.Domain>;
51
51
  private __get;
52
+ /**
53
+ * @throws {@link AgentMail.NotFoundError}
54
+ */
55
+ getZoneFile(domainId: AgentMail.DomainId, requestOptions?: Domains.RequestOptions): core.HttpResponsePromise<core.BinaryResponse>;
56
+ private __getZoneFile;
52
57
  /**
53
58
  * @param {AgentMail.CreateDomainRequest} request
54
59
  * @param {Domains.RequestOptions} requestOptions - Request-specific configuration.
@@ -159,6 +159,64 @@ export class Domains {
159
159
  }
160
160
  });
161
161
  }
162
+ /**
163
+ * @throws {@link AgentMail.NotFoundError}
164
+ */
165
+ getZoneFile(domainId, requestOptions) {
166
+ return core.HttpResponsePromise.fromPromise(this.__getZoneFile(domainId, requestOptions));
167
+ }
168
+ __getZoneFile(domainId, requestOptions) {
169
+ return __awaiter(this, void 0, void 0, function* () {
170
+ var _a, _b, _c;
171
+ let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
172
+ const _response = yield core.fetcher({
173
+ 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/domains/${encodeURIComponent(serializers.DomainId.jsonOrThrow(domainId, { omitUndefined: true }))}/zone-file`),
174
+ method: "GET",
175
+ headers: _headers,
176
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
177
+ responseType: "binary-response",
178
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
179
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
180
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
181
+ });
182
+ if (_response.ok) {
183
+ return { data: _response.body, rawResponse: _response.rawResponse };
184
+ }
185
+ if (_response.error.reason === "status-code") {
186
+ switch (_response.error.statusCode) {
187
+ case 404:
188
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
189
+ unrecognizedObjectKeys: "passthrough",
190
+ allowUnrecognizedUnionMembers: true,
191
+ allowUnrecognizedEnumValues: true,
192
+ skipValidation: true,
193
+ breadcrumbsPrefix: ["response"],
194
+ }), _response.rawResponse);
195
+ default:
196
+ throw new errors.AgentMailError({
197
+ statusCode: _response.error.statusCode,
198
+ body: _response.error.body,
199
+ rawResponse: _response.rawResponse,
200
+ });
201
+ }
202
+ }
203
+ switch (_response.error.reason) {
204
+ case "non-json":
205
+ throw new errors.AgentMailError({
206
+ statusCode: _response.error.statusCode,
207
+ body: _response.error.rawBody,
208
+ rawResponse: _response.rawResponse,
209
+ });
210
+ case "timeout":
211
+ throw new errors.AgentMailTimeoutError("Timeout exceeded when calling GET /v0/domains/{domain_id}/zone-file.");
212
+ case "unknown":
213
+ throw new errors.AgentMailError({
214
+ message: _response.error.errorMessage,
215
+ rawResponse: _response.rawResponse,
216
+ });
217
+ }
218
+ });
219
+ }
162
220
  /**
163
221
  * @param {AgentMail.CreateDomainRequest} request
164
222
  * @param {Domains.RequestOptions} requestOptions - Request-specific configuration.
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.0.74";
1
+ export declare const SDK_VERSION = "0.0.76";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.0.74";
1
+ export const SDK_VERSION = "0.0.76";