agentmail 0.0.48 → 0.0.50
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/Client.js +2 -2
- package/dist/cjs/api/resources/inboxes/resources/drafts/client/Client.d.ts +12 -0
- package/dist/cjs/api/resources/inboxes/resources/drafts/client/Client.js +56 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.mjs +2 -2
- package/dist/esm/api/resources/inboxes/resources/drafts/client/Client.d.mts +12 -0
- package/dist/esm/api/resources/inboxes/resources/drafts/client/Client.mjs +56 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +56 -0
package/dist/cjs/Client.js
CHANGED
|
@@ -51,8 +51,8 @@ class AgentMailClient {
|
|
|
51
51
|
this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
|
|
52
52
|
"X-Fern-Language": "JavaScript",
|
|
53
53
|
"X-Fern-SDK-Name": "agentmail",
|
|
54
|
-
"X-Fern-SDK-Version": "0.0.
|
|
55
|
-
"User-Agent": "agentmail/0.0.
|
|
54
|
+
"X-Fern-SDK-Version": "0.0.50",
|
|
55
|
+
"User-Agent": "agentmail/0.0.50",
|
|
56
56
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
57
57
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
58
58
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -91,5 +91,17 @@ export declare class Drafts {
|
|
|
91
91
|
*/
|
|
92
92
|
send(inboxId: AgentMail.inboxes.InboxId, draftId: AgentMail.DraftId, request: AgentMail.UpdateMessageRequest, requestOptions?: Drafts.RequestOptions): core.HttpResponsePromise<AgentMail.SendMessageResponse>;
|
|
93
93
|
private __send;
|
|
94
|
+
/**
|
|
95
|
+
* @param {AgentMail.inboxes.InboxId} inboxId
|
|
96
|
+
* @param {AgentMail.DraftId} draftId
|
|
97
|
+
* @param {Drafts.RequestOptions} requestOptions - Request-specific configuration.
|
|
98
|
+
*
|
|
99
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* await client.inboxes.drafts.delete("inbox_id", "draft_id")
|
|
103
|
+
*/
|
|
104
|
+
delete(inboxId: AgentMail.inboxes.InboxId, draftId: AgentMail.DraftId, requestOptions?: Drafts.RequestOptions): core.HttpResponsePromise<void>;
|
|
105
|
+
private __delete;
|
|
94
106
|
protected _getAuthorizationHeader(): Promise<string>;
|
|
95
107
|
}
|
|
@@ -321,6 +321,62 @@ class Drafts {
|
|
|
321
321
|
}
|
|
322
322
|
});
|
|
323
323
|
}
|
|
324
|
+
/**
|
|
325
|
+
* @param {AgentMail.inboxes.InboxId} inboxId
|
|
326
|
+
* @param {AgentMail.DraftId} draftId
|
|
327
|
+
* @param {Drafts.RequestOptions} requestOptions - Request-specific configuration.
|
|
328
|
+
*
|
|
329
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
330
|
+
*
|
|
331
|
+
* @example
|
|
332
|
+
* await client.inboxes.drafts.delete("inbox_id", "draft_id")
|
|
333
|
+
*/
|
|
334
|
+
delete(inboxId, draftId, requestOptions) {
|
|
335
|
+
return core.HttpResponsePromise.fromPromise(this.__delete(inboxId, draftId, requestOptions));
|
|
336
|
+
}
|
|
337
|
+
__delete(inboxId, draftId, requestOptions) {
|
|
338
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
339
|
+
var _a, _b, _c;
|
|
340
|
+
const _response = yield core.fetcher({
|
|
341
|
+
url: core.url.join((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : ((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Production).http, `/v0/inboxes/${encodeURIComponent(inboxId)}/drafts/${encodeURIComponent(draftId)}`),
|
|
342
|
+
method: "DELETE",
|
|
343
|
+
headers: (0, headers_js_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
344
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
345
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
346
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
347
|
+
});
|
|
348
|
+
if (_response.ok) {
|
|
349
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
350
|
+
}
|
|
351
|
+
if (_response.error.reason === "status-code") {
|
|
352
|
+
switch (_response.error.statusCode) {
|
|
353
|
+
case 404:
|
|
354
|
+
throw new AgentMail.NotFoundError(_response.error.body, _response.rawResponse);
|
|
355
|
+
default:
|
|
356
|
+
throw new errors.AgentMailError({
|
|
357
|
+
statusCode: _response.error.statusCode,
|
|
358
|
+
body: _response.error.body,
|
|
359
|
+
rawResponse: _response.rawResponse,
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
switch (_response.error.reason) {
|
|
364
|
+
case "non-json":
|
|
365
|
+
throw new errors.AgentMailError({
|
|
366
|
+
statusCode: _response.error.statusCode,
|
|
367
|
+
body: _response.error.rawBody,
|
|
368
|
+
rawResponse: _response.rawResponse,
|
|
369
|
+
});
|
|
370
|
+
case "timeout":
|
|
371
|
+
throw new errors.AgentMailTimeoutError("Timeout exceeded when calling DELETE /v0/inboxes/{inbox_id}/drafts/{draft_id}.");
|
|
372
|
+
case "unknown":
|
|
373
|
+
throw new errors.AgentMailError({
|
|
374
|
+
message: _response.error.errorMessage,
|
|
375
|
+
rawResponse: _response.rawResponse,
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
});
|
|
379
|
+
}
|
|
324
380
|
_getAuthorizationHeader() {
|
|
325
381
|
return __awaiter(this, void 0, void 0, function* () {
|
|
326
382
|
var _a;
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.0.
|
|
1
|
+
export declare const SDK_VERSION = "0.0.50";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/Client.mjs
CHANGED
|
@@ -15,8 +15,8 @@ export class AgentMailClient {
|
|
|
15
15
|
this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
|
|
16
16
|
"X-Fern-Language": "JavaScript",
|
|
17
17
|
"X-Fern-SDK-Name": "agentmail",
|
|
18
|
-
"X-Fern-SDK-Version": "0.0.
|
|
19
|
-
"User-Agent": "agentmail/0.0.
|
|
18
|
+
"X-Fern-SDK-Version": "0.0.50",
|
|
19
|
+
"User-Agent": "agentmail/0.0.50",
|
|
20
20
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
21
21
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
22
22
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -91,5 +91,17 @@ export declare class Drafts {
|
|
|
91
91
|
*/
|
|
92
92
|
send(inboxId: AgentMail.inboxes.InboxId, draftId: AgentMail.DraftId, request: AgentMail.UpdateMessageRequest, requestOptions?: Drafts.RequestOptions): core.HttpResponsePromise<AgentMail.SendMessageResponse>;
|
|
93
93
|
private __send;
|
|
94
|
+
/**
|
|
95
|
+
* @param {AgentMail.inboxes.InboxId} inboxId
|
|
96
|
+
* @param {AgentMail.DraftId} draftId
|
|
97
|
+
* @param {Drafts.RequestOptions} requestOptions - Request-specific configuration.
|
|
98
|
+
*
|
|
99
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* await client.inboxes.drafts.delete("inbox_id", "draft_id")
|
|
103
|
+
*/
|
|
104
|
+
delete(inboxId: AgentMail.inboxes.InboxId, draftId: AgentMail.DraftId, requestOptions?: Drafts.RequestOptions): core.HttpResponsePromise<void>;
|
|
105
|
+
private __delete;
|
|
94
106
|
protected _getAuthorizationHeader(): Promise<string>;
|
|
95
107
|
}
|
|
@@ -285,6 +285,62 @@ export class Drafts {
|
|
|
285
285
|
}
|
|
286
286
|
});
|
|
287
287
|
}
|
|
288
|
+
/**
|
|
289
|
+
* @param {AgentMail.inboxes.InboxId} inboxId
|
|
290
|
+
* @param {AgentMail.DraftId} draftId
|
|
291
|
+
* @param {Drafts.RequestOptions} requestOptions - Request-specific configuration.
|
|
292
|
+
*
|
|
293
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
294
|
+
*
|
|
295
|
+
* @example
|
|
296
|
+
* await client.inboxes.drafts.delete("inbox_id", "draft_id")
|
|
297
|
+
*/
|
|
298
|
+
delete(inboxId, draftId, requestOptions) {
|
|
299
|
+
return core.HttpResponsePromise.fromPromise(this.__delete(inboxId, draftId, requestOptions));
|
|
300
|
+
}
|
|
301
|
+
__delete(inboxId, draftId, requestOptions) {
|
|
302
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
303
|
+
var _a, _b, _c;
|
|
304
|
+
const _response = yield core.fetcher({
|
|
305
|
+
url: core.url.join((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : ((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Production).http, `/v0/inboxes/${encodeURIComponent(inboxId)}/drafts/${encodeURIComponent(draftId)}`),
|
|
306
|
+
method: "DELETE",
|
|
307
|
+
headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
308
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
309
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
310
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
311
|
+
});
|
|
312
|
+
if (_response.ok) {
|
|
313
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
314
|
+
}
|
|
315
|
+
if (_response.error.reason === "status-code") {
|
|
316
|
+
switch (_response.error.statusCode) {
|
|
317
|
+
case 404:
|
|
318
|
+
throw new AgentMail.NotFoundError(_response.error.body, _response.rawResponse);
|
|
319
|
+
default:
|
|
320
|
+
throw new errors.AgentMailError({
|
|
321
|
+
statusCode: _response.error.statusCode,
|
|
322
|
+
body: _response.error.body,
|
|
323
|
+
rawResponse: _response.rawResponse,
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
switch (_response.error.reason) {
|
|
328
|
+
case "non-json":
|
|
329
|
+
throw new errors.AgentMailError({
|
|
330
|
+
statusCode: _response.error.statusCode,
|
|
331
|
+
body: _response.error.rawBody,
|
|
332
|
+
rawResponse: _response.rawResponse,
|
|
333
|
+
});
|
|
334
|
+
case "timeout":
|
|
335
|
+
throw new errors.AgentMailTimeoutError("Timeout exceeded when calling DELETE /v0/inboxes/{inbox_id}/drafts/{draft_id}.");
|
|
336
|
+
case "unknown":
|
|
337
|
+
throw new errors.AgentMailError({
|
|
338
|
+
message: _response.error.errorMessage,
|
|
339
|
+
rawResponse: _response.rawResponse,
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
}
|
|
288
344
|
_getAuthorizationHeader() {
|
|
289
345
|
return __awaiter(this, void 0, void 0, function* () {
|
|
290
346
|
var _a;
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.0.
|
|
1
|
+
export declare const SDK_VERSION = "0.0.50";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.0.
|
|
1
|
+
export const SDK_VERSION = "0.0.50";
|
package/package.json
CHANGED
package/reference.md
CHANGED
|
@@ -891,6 +891,62 @@ await client.inboxes.drafts.send("inbox_id", "draft_id", {
|
|
|
891
891
|
</dl>
|
|
892
892
|
</details>
|
|
893
893
|
|
|
894
|
+
<details><summary><code>client.inboxes.drafts.<a href="/src/api/resources/inboxes/resources/drafts/client/Client.ts">delete</a>(inboxId, draftId) -> void</code></summary>
|
|
895
|
+
<dl>
|
|
896
|
+
<dd>
|
|
897
|
+
|
|
898
|
+
#### 🔌 Usage
|
|
899
|
+
|
|
900
|
+
<dl>
|
|
901
|
+
<dd>
|
|
902
|
+
|
|
903
|
+
<dl>
|
|
904
|
+
<dd>
|
|
905
|
+
|
|
906
|
+
```typescript
|
|
907
|
+
await client.inboxes.drafts.delete("inbox_id", "draft_id");
|
|
908
|
+
```
|
|
909
|
+
|
|
910
|
+
</dd>
|
|
911
|
+
</dl>
|
|
912
|
+
</dd>
|
|
913
|
+
</dl>
|
|
914
|
+
|
|
915
|
+
#### ⚙️ Parameters
|
|
916
|
+
|
|
917
|
+
<dl>
|
|
918
|
+
<dd>
|
|
919
|
+
|
|
920
|
+
<dl>
|
|
921
|
+
<dd>
|
|
922
|
+
|
|
923
|
+
**inboxId:** `AgentMail.InboxId`
|
|
924
|
+
|
|
925
|
+
</dd>
|
|
926
|
+
</dl>
|
|
927
|
+
|
|
928
|
+
<dl>
|
|
929
|
+
<dd>
|
|
930
|
+
|
|
931
|
+
**draftId:** `AgentMail.DraftId`
|
|
932
|
+
|
|
933
|
+
</dd>
|
|
934
|
+
</dl>
|
|
935
|
+
|
|
936
|
+
<dl>
|
|
937
|
+
<dd>
|
|
938
|
+
|
|
939
|
+
**requestOptions:** `Drafts.RequestOptions`
|
|
940
|
+
|
|
941
|
+
</dd>
|
|
942
|
+
</dl>
|
|
943
|
+
</dd>
|
|
944
|
+
</dl>
|
|
945
|
+
|
|
946
|
+
</dd>
|
|
947
|
+
</dl>
|
|
948
|
+
</details>
|
|
949
|
+
|
|
894
950
|
## Inboxes Messages
|
|
895
951
|
|
|
896
952
|
<details><summary><code>client.inboxes.messages.<a href="/src/api/resources/inboxes/resources/messages/client/Client.ts">list</a>(inboxId, { ...params }) -> AgentMail.ListMessagesResponse</code></summary>
|