agentmail 0.0.58 → 0.0.66
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.d.ts +2 -2
- package/dist/cjs/Client.js +2 -2
- package/dist/cjs/api/resources/domains/client/Client.d.ts +7 -7
- package/dist/cjs/api/resources/domains/client/Client.js +69 -58
- package/dist/cjs/api/resources/drafts/client/Client.d.ts +3 -4
- package/dist/cjs/api/resources/drafts/client/Client.js +84 -71
- package/dist/cjs/api/resources/inboxes/client/Client.d.ts +14 -4
- package/dist/cjs/api/resources/inboxes/client/Client.js +127 -54
- package/dist/cjs/api/resources/inboxes/resources/drafts/client/Client.d.ts +3 -4
- package/dist/cjs/api/resources/inboxes/resources/drafts/client/Client.js +87 -74
- package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.d.ts +3 -4
- package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.js +89 -76
- package/dist/cjs/api/resources/inboxes/resources/metrics/client/Client.d.ts +2 -2
- package/dist/cjs/api/resources/inboxes/resources/metrics/client/Client.js +1 -1
- package/dist/cjs/api/resources/inboxes/resources/threads/client/Client.d.ts +15 -4
- package/dist/cjs/api/resources/inboxes/resources/threads/client/Client.js +138 -61
- package/dist/cjs/api/resources/messages/types/Message.d.ts +5 -8
- package/dist/cjs/api/resources/messages/types/MessageCreatedAt.d.ts +7 -0
- package/dist/cjs/api/resources/messages/types/MessageCreatedAt.js +5 -0
- package/dist/cjs/api/resources/messages/types/MessageInReplyTo.d.ts +7 -0
- package/dist/cjs/api/resources/messages/types/MessageInReplyTo.js +5 -0
- package/dist/cjs/api/resources/messages/types/MessageItem.d.ts +5 -0
- package/dist/cjs/api/resources/messages/types/MessageReferences.d.ts +7 -0
- package/dist/cjs/api/resources/messages/types/MessageReferences.js +5 -0
- package/dist/cjs/api/resources/messages/types/MessageReplyTo.d.ts +7 -0
- package/dist/cjs/api/resources/messages/types/MessageReplyTo.js +5 -0
- package/dist/cjs/api/resources/messages/types/MessageSize.d.ts +7 -0
- package/dist/cjs/api/resources/messages/types/MessageSize.js +5 -0
- package/dist/cjs/api/resources/messages/types/MessageUpdatedAt.d.ts +7 -0
- package/dist/cjs/api/resources/messages/types/MessageUpdatedAt.js +5 -0
- package/dist/cjs/api/resources/messages/types/index.d.ts +6 -0
- package/dist/cjs/api/resources/messages/types/index.js +6 -0
- package/dist/cjs/api/resources/metrics/client/Client.d.ts +2 -2
- package/dist/cjs/api/resources/metrics/client/Client.js +1 -1
- package/dist/cjs/api/resources/threads/client/Client.d.ts +14 -4
- package/dist/cjs/api/resources/threads/client/Client.js +136 -60
- package/dist/cjs/api/resources/threads/types/Thread.d.ts +6 -4
- package/dist/cjs/api/resources/threads/types/ThreadCreatedAt.d.ts +7 -0
- package/dist/cjs/api/resources/threads/types/ThreadCreatedAt.js +5 -0
- package/dist/cjs/api/resources/threads/types/ThreadItem.d.ts +6 -0
- package/dist/cjs/api/resources/threads/types/ThreadLastMessageId.d.ts +7 -0
- package/dist/cjs/api/resources/threads/types/ThreadLastMessageId.js +5 -0
- package/dist/cjs/api/resources/threads/types/ThreadReceivedTimestamp.d.ts +7 -0
- package/dist/cjs/api/resources/threads/types/ThreadReceivedTimestamp.js +5 -0
- package/dist/cjs/api/resources/threads/types/ThreadSentTimestamp.d.ts +7 -0
- package/dist/cjs/api/resources/threads/types/ThreadSentTimestamp.js +5 -0
- package/dist/cjs/api/resources/threads/types/ThreadSize.d.ts +7 -0
- package/dist/cjs/api/resources/threads/types/ThreadSize.js +5 -0
- package/dist/cjs/api/resources/threads/types/ThreadTimestamp.d.ts +1 -1
- package/dist/cjs/api/resources/threads/types/ThreadUpdatedAt.d.ts +7 -0
- package/dist/cjs/api/resources/threads/types/ThreadUpdatedAt.js +5 -0
- package/dist/cjs/api/resources/threads/types/index.d.ts +6 -0
- package/dist/cjs/api/resources/threads/types/index.js +6 -0
- package/dist/cjs/api/resources/webhooks/client/Client.d.ts +3 -4
- package/dist/cjs/api/resources/webhooks/client/Client.js +65 -55
- package/dist/cjs/api/resources/websockets/client/Client.d.ts +1 -1
- package/dist/cjs/api/resources/websockets/client/Client.js +2 -1
- package/dist/cjs/core/fetcher/Fetcher.d.ts +1 -1
- package/dist/cjs/core/fetcher/requestWithRetries.js +44 -8
- package/dist/cjs/core/headers.d.ts +2 -2
- package/dist/cjs/core/index.d.ts +2 -0
- package/dist/cjs/core/index.js +2 -0
- package/dist/cjs/core/pagination/Page.d.ts +32 -0
- package/dist/cjs/core/pagination/Page.js +100 -0
- package/dist/cjs/core/pagination/Pageable.d.ts +14 -0
- package/dist/cjs/core/pagination/Pageable.js +10 -0
- package/dist/cjs/core/pagination/index.d.ts +2 -0
- package/dist/cjs/core/pagination/index.js +7 -0
- package/dist/cjs/core/utils/index.d.ts +1 -0
- package/dist/cjs/core/utils/index.js +5 -0
- package/dist/cjs/core/utils/setObjectProperty.d.ts +11 -0
- package/dist/cjs/core/utils/setObjectProperty.js +42 -0
- package/dist/cjs/core/websocket/ws.d.ts +1 -1
- package/dist/cjs/serialization/resources/messages/types/Message.d.ts +10 -4
- package/dist/cjs/serialization/resources/messages/types/Message.js +10 -4
- package/dist/cjs/serialization/resources/messages/types/MessageCreatedAt.d.ts +10 -0
- package/dist/cjs/serialization/resources/messages/types/MessageCreatedAt.js +41 -0
- package/dist/cjs/serialization/resources/messages/types/MessageInReplyTo.d.ts +10 -0
- package/dist/cjs/serialization/resources/messages/types/MessageInReplyTo.js +41 -0
- package/dist/cjs/serialization/resources/messages/types/MessageItem.d.ts +10 -0
- package/dist/cjs/serialization/resources/messages/types/MessageItem.js +10 -0
- package/dist/cjs/serialization/resources/messages/types/MessageReferences.d.ts +10 -0
- package/dist/cjs/serialization/resources/messages/types/MessageReferences.js +41 -0
- package/dist/cjs/serialization/resources/messages/types/MessageReplyTo.d.ts +10 -0
- package/dist/cjs/serialization/resources/messages/types/MessageReplyTo.js +41 -0
- package/dist/cjs/serialization/resources/messages/types/MessageSize.d.ts +10 -0
- package/dist/cjs/serialization/resources/messages/types/MessageSize.js +41 -0
- package/dist/cjs/serialization/resources/messages/types/MessageUpdatedAt.d.ts +10 -0
- package/dist/cjs/serialization/resources/messages/types/MessageUpdatedAt.js +41 -0
- package/dist/cjs/serialization/resources/messages/types/index.d.ts +6 -0
- package/dist/cjs/serialization/resources/messages/types/index.js +6 -0
- package/dist/cjs/serialization/resources/threads/types/Thread.d.ts +12 -2
- package/dist/cjs/serialization/resources/threads/types/Thread.js +12 -2
- package/dist/cjs/serialization/resources/threads/types/ThreadCreatedAt.d.ts +10 -0
- package/dist/cjs/serialization/resources/threads/types/ThreadCreatedAt.js +41 -0
- package/dist/cjs/serialization/resources/threads/types/ThreadItem.d.ts +12 -0
- package/dist/cjs/serialization/resources/threads/types/ThreadItem.js +12 -0
- package/dist/cjs/serialization/resources/threads/types/ThreadLastMessageId.d.ts +10 -0
- package/dist/cjs/serialization/resources/threads/types/ThreadLastMessageId.js +41 -0
- package/dist/cjs/serialization/resources/threads/types/ThreadReceivedTimestamp.d.ts +10 -0
- package/dist/cjs/serialization/resources/threads/types/ThreadReceivedTimestamp.js +41 -0
- package/dist/cjs/serialization/resources/threads/types/ThreadSentTimestamp.d.ts +10 -0
- package/dist/cjs/serialization/resources/threads/types/ThreadSentTimestamp.js +41 -0
- package/dist/cjs/serialization/resources/threads/types/ThreadSize.d.ts +10 -0
- package/dist/cjs/serialization/resources/threads/types/ThreadSize.js +41 -0
- package/dist/cjs/serialization/resources/threads/types/ThreadUpdatedAt.d.ts +10 -0
- package/dist/cjs/serialization/resources/threads/types/ThreadUpdatedAt.js +41 -0
- package/dist/cjs/serialization/resources/threads/types/index.d.ts +6 -0
- package/dist/cjs/serialization/resources/threads/types/index.js +6 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.d.mts +2 -2
- package/dist/esm/Client.mjs +2 -2
- package/dist/esm/api/resources/domains/client/Client.d.mts +7 -7
- package/dist/esm/api/resources/domains/client/Client.mjs +69 -58
- package/dist/esm/api/resources/drafts/client/Client.d.mts +3 -4
- package/dist/esm/api/resources/drafts/client/Client.mjs +84 -71
- package/dist/esm/api/resources/inboxes/client/Client.d.mts +14 -4
- package/dist/esm/api/resources/inboxes/client/Client.mjs +127 -54
- package/dist/esm/api/resources/inboxes/resources/drafts/client/Client.d.mts +3 -4
- package/dist/esm/api/resources/inboxes/resources/drafts/client/Client.mjs +87 -74
- package/dist/esm/api/resources/inboxes/resources/messages/client/Client.d.mts +3 -4
- package/dist/esm/api/resources/inboxes/resources/messages/client/Client.mjs +89 -76
- package/dist/esm/api/resources/inboxes/resources/metrics/client/Client.d.mts +2 -2
- package/dist/esm/api/resources/inboxes/resources/metrics/client/Client.mjs +1 -1
- package/dist/esm/api/resources/inboxes/resources/threads/client/Client.d.mts +15 -4
- package/dist/esm/api/resources/inboxes/resources/threads/client/Client.mjs +138 -61
- package/dist/esm/api/resources/messages/types/Message.d.mts +5 -8
- package/dist/esm/api/resources/messages/types/MessageCreatedAt.d.mts +7 -0
- package/dist/esm/api/resources/messages/types/MessageCreatedAt.mjs +4 -0
- package/dist/esm/api/resources/messages/types/MessageInReplyTo.d.mts +7 -0
- package/dist/esm/api/resources/messages/types/MessageInReplyTo.mjs +4 -0
- package/dist/esm/api/resources/messages/types/MessageItem.d.mts +5 -0
- package/dist/esm/api/resources/messages/types/MessageReferences.d.mts +7 -0
- package/dist/esm/api/resources/messages/types/MessageReferences.mjs +4 -0
- package/dist/esm/api/resources/messages/types/MessageReplyTo.d.mts +7 -0
- package/dist/esm/api/resources/messages/types/MessageReplyTo.mjs +4 -0
- package/dist/esm/api/resources/messages/types/MessageSize.d.mts +7 -0
- package/dist/esm/api/resources/messages/types/MessageSize.mjs +4 -0
- package/dist/esm/api/resources/messages/types/MessageUpdatedAt.d.mts +7 -0
- package/dist/esm/api/resources/messages/types/MessageUpdatedAt.mjs +4 -0
- package/dist/esm/api/resources/messages/types/index.d.mts +6 -0
- package/dist/esm/api/resources/messages/types/index.mjs +6 -0
- package/dist/esm/api/resources/metrics/client/Client.d.mts +2 -2
- package/dist/esm/api/resources/metrics/client/Client.mjs +1 -1
- package/dist/esm/api/resources/threads/client/Client.d.mts +14 -4
- package/dist/esm/api/resources/threads/client/Client.mjs +136 -60
- package/dist/esm/api/resources/threads/types/Thread.d.mts +6 -4
- package/dist/esm/api/resources/threads/types/ThreadCreatedAt.d.mts +7 -0
- package/dist/esm/api/resources/threads/types/ThreadCreatedAt.mjs +4 -0
- package/dist/esm/api/resources/threads/types/ThreadItem.d.mts +6 -0
- package/dist/esm/api/resources/threads/types/ThreadLastMessageId.d.mts +7 -0
- package/dist/esm/api/resources/threads/types/ThreadLastMessageId.mjs +4 -0
- package/dist/esm/api/resources/threads/types/ThreadReceivedTimestamp.d.mts +7 -0
- package/dist/esm/api/resources/threads/types/ThreadReceivedTimestamp.mjs +4 -0
- package/dist/esm/api/resources/threads/types/ThreadSentTimestamp.d.mts +7 -0
- package/dist/esm/api/resources/threads/types/ThreadSentTimestamp.mjs +4 -0
- package/dist/esm/api/resources/threads/types/ThreadSize.d.mts +7 -0
- package/dist/esm/api/resources/threads/types/ThreadSize.mjs +4 -0
- package/dist/esm/api/resources/threads/types/ThreadTimestamp.d.mts +1 -1
- package/dist/esm/api/resources/threads/types/ThreadUpdatedAt.d.mts +7 -0
- package/dist/esm/api/resources/threads/types/ThreadUpdatedAt.mjs +4 -0
- package/dist/esm/api/resources/threads/types/index.d.mts +6 -0
- package/dist/esm/api/resources/threads/types/index.mjs +6 -0
- package/dist/esm/api/resources/webhooks/client/Client.d.mts +3 -4
- package/dist/esm/api/resources/webhooks/client/Client.mjs +65 -55
- package/dist/esm/api/resources/websockets/client/Client.d.mts +1 -1
- package/dist/esm/api/resources/websockets/client/Client.mjs +2 -1
- package/dist/esm/core/fetcher/Fetcher.d.mts +1 -1
- package/dist/esm/core/fetcher/requestWithRetries.mjs +44 -8
- package/dist/esm/core/headers.d.mts +2 -2
- package/dist/esm/core/index.d.mts +2 -0
- package/dist/esm/core/index.mjs +2 -0
- package/dist/esm/core/pagination/Page.d.mts +32 -0
- package/dist/esm/core/pagination/Page.mjs +96 -0
- package/dist/esm/core/pagination/Pageable.d.mts +14 -0
- package/dist/esm/core/pagination/Pageable.mjs +6 -0
- package/dist/esm/core/pagination/index.d.mts +2 -0
- package/dist/esm/core/pagination/index.mjs +2 -0
- package/dist/esm/core/utils/index.d.mts +1 -0
- package/dist/esm/core/utils/index.mjs +1 -0
- package/dist/esm/core/utils/setObjectProperty.d.mts +11 -0
- package/dist/esm/core/utils/setObjectProperty.mjs +39 -0
- package/dist/esm/core/websocket/ws.d.mts +1 -1
- package/dist/esm/serialization/resources/messages/types/Message.d.mts +10 -4
- package/dist/esm/serialization/resources/messages/types/Message.mjs +10 -4
- package/dist/esm/serialization/resources/messages/types/MessageCreatedAt.d.mts +10 -0
- package/dist/esm/serialization/resources/messages/types/MessageCreatedAt.mjs +5 -0
- package/dist/esm/serialization/resources/messages/types/MessageInReplyTo.d.mts +10 -0
- package/dist/esm/serialization/resources/messages/types/MessageInReplyTo.mjs +5 -0
- package/dist/esm/serialization/resources/messages/types/MessageItem.d.mts +10 -0
- package/dist/esm/serialization/resources/messages/types/MessageItem.mjs +10 -0
- package/dist/esm/serialization/resources/messages/types/MessageReferences.d.mts +10 -0
- package/dist/esm/serialization/resources/messages/types/MessageReferences.mjs +5 -0
- package/dist/esm/serialization/resources/messages/types/MessageReplyTo.d.mts +10 -0
- package/dist/esm/serialization/resources/messages/types/MessageReplyTo.mjs +5 -0
- package/dist/esm/serialization/resources/messages/types/MessageSize.d.mts +10 -0
- package/dist/esm/serialization/resources/messages/types/MessageSize.mjs +5 -0
- package/dist/esm/serialization/resources/messages/types/MessageUpdatedAt.d.mts +10 -0
- package/dist/esm/serialization/resources/messages/types/MessageUpdatedAt.mjs +5 -0
- package/dist/esm/serialization/resources/messages/types/index.d.mts +6 -0
- package/dist/esm/serialization/resources/messages/types/index.mjs +6 -0
- package/dist/esm/serialization/resources/threads/types/Thread.d.mts +12 -2
- package/dist/esm/serialization/resources/threads/types/Thread.mjs +12 -2
- package/dist/esm/serialization/resources/threads/types/ThreadCreatedAt.d.mts +10 -0
- package/dist/esm/serialization/resources/threads/types/ThreadCreatedAt.mjs +5 -0
- package/dist/esm/serialization/resources/threads/types/ThreadItem.d.mts +12 -0
- package/dist/esm/serialization/resources/threads/types/ThreadItem.mjs +12 -0
- package/dist/esm/serialization/resources/threads/types/ThreadLastMessageId.d.mts +10 -0
- package/dist/esm/serialization/resources/threads/types/ThreadLastMessageId.mjs +5 -0
- package/dist/esm/serialization/resources/threads/types/ThreadReceivedTimestamp.d.mts +10 -0
- package/dist/esm/serialization/resources/threads/types/ThreadReceivedTimestamp.mjs +5 -0
- package/dist/esm/serialization/resources/threads/types/ThreadSentTimestamp.d.mts +10 -0
- package/dist/esm/serialization/resources/threads/types/ThreadSentTimestamp.mjs +5 -0
- package/dist/esm/serialization/resources/threads/types/ThreadSize.d.mts +10 -0
- package/dist/esm/serialization/resources/threads/types/ThreadSize.mjs +5 -0
- package/dist/esm/serialization/resources/threads/types/ThreadUpdatedAt.d.mts +10 -0
- package/dist/esm/serialization/resources/threads/types/ThreadUpdatedAt.mjs +5 -0
- package/dist/esm/serialization/resources/threads/types/index.d.mts +6 -0
- package/dist/esm/serialization/resources/threads/types/index.mjs +6 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +404 -11
|
@@ -30,87 +30,100 @@ export class Drafts {
|
|
|
30
30
|
* @example
|
|
31
31
|
* await client.drafts.list()
|
|
32
32
|
*/
|
|
33
|
-
list(
|
|
34
|
-
return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
|
|
35
|
-
}
|
|
36
|
-
__list() {
|
|
33
|
+
list() {
|
|
37
34
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
headers:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
breadcrumbsPrefix: ["response"],
|
|
77
|
-
}),
|
|
78
|
-
rawResponse: _response.rawResponse,
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
if (_response.error.reason === "status-code") {
|
|
82
|
-
switch (_response.error.statusCode) {
|
|
83
|
-
case 404:
|
|
84
|
-
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
35
|
+
const list = core.HttpResponsePromise.interceptFunction((request) => __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
var _a, _b, _c;
|
|
37
|
+
const { limit, pageToken, labels, before, after, ascending } = request;
|
|
38
|
+
const _queryParams = {};
|
|
39
|
+
if (limit != null) {
|
|
40
|
+
_queryParams["limit"] = limit.toString();
|
|
41
|
+
}
|
|
42
|
+
if (pageToken != null) {
|
|
43
|
+
_queryParams["page_token"] = pageToken;
|
|
44
|
+
}
|
|
45
|
+
if (labels != null) {
|
|
46
|
+
_queryParams["labels"] = toJson(serializers.Labels.jsonOrThrow(labels, {
|
|
47
|
+
unrecognizedObjectKeys: "strip",
|
|
48
|
+
omitUndefined: true,
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
if (before != null) {
|
|
52
|
+
_queryParams["before"] = before.toISOString();
|
|
53
|
+
}
|
|
54
|
+
if (after != null) {
|
|
55
|
+
_queryParams["after"] = after.toISOString();
|
|
56
|
+
}
|
|
57
|
+
if (ascending != null) {
|
|
58
|
+
_queryParams["ascending"] = ascending.toString();
|
|
59
|
+
}
|
|
60
|
+
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);
|
|
61
|
+
const _response = yield core.fetcher({
|
|
62
|
+
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"),
|
|
63
|
+
method: "GET",
|
|
64
|
+
headers: _headers,
|
|
65
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
66
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
67
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
68
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
69
|
+
});
|
|
70
|
+
if (_response.ok) {
|
|
71
|
+
return {
|
|
72
|
+
data: serializers.ListDraftsResponse.parseOrThrow(_response.body, {
|
|
85
73
|
unrecognizedObjectKeys: "passthrough",
|
|
86
74
|
allowUnrecognizedUnionMembers: true,
|
|
87
75
|
allowUnrecognizedEnumValues: true,
|
|
88
76
|
skipValidation: true,
|
|
89
77
|
breadcrumbsPrefix: ["response"],
|
|
90
|
-
}),
|
|
91
|
-
|
|
78
|
+
}),
|
|
79
|
+
rawResponse: _response.rawResponse,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
if (_response.error.reason === "status-code") {
|
|
83
|
+
switch (_response.error.statusCode) {
|
|
84
|
+
case 404:
|
|
85
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
86
|
+
unrecognizedObjectKeys: "passthrough",
|
|
87
|
+
allowUnrecognizedUnionMembers: true,
|
|
88
|
+
allowUnrecognizedEnumValues: true,
|
|
89
|
+
skipValidation: true,
|
|
90
|
+
breadcrumbsPrefix: ["response"],
|
|
91
|
+
}), _response.rawResponse);
|
|
92
|
+
default:
|
|
93
|
+
throw new errors.AgentMailError({
|
|
94
|
+
statusCode: _response.error.statusCode,
|
|
95
|
+
body: _response.error.body,
|
|
96
|
+
rawResponse: _response.rawResponse,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
switch (_response.error.reason) {
|
|
101
|
+
case "non-json":
|
|
92
102
|
throw new errors.AgentMailError({
|
|
93
103
|
statusCode: _response.error.statusCode,
|
|
94
|
-
body: _response.error.
|
|
104
|
+
body: _response.error.rawBody,
|
|
105
|
+
rawResponse: _response.rawResponse,
|
|
106
|
+
});
|
|
107
|
+
case "timeout":
|
|
108
|
+
throw new errors.AgentMailTimeoutError("Timeout exceeded when calling GET /v0/drafts.");
|
|
109
|
+
case "unknown":
|
|
110
|
+
throw new errors.AgentMailError({
|
|
111
|
+
message: _response.error.errorMessage,
|
|
95
112
|
rawResponse: _response.rawResponse,
|
|
96
113
|
});
|
|
97
114
|
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
message: _response.error.errorMessage,
|
|
111
|
-
rawResponse: _response.rawResponse,
|
|
112
|
-
});
|
|
113
|
-
}
|
|
115
|
+
}));
|
|
116
|
+
const dataWithRawResponse = yield list(request).withRawResponse();
|
|
117
|
+
return new core.Pageable({
|
|
118
|
+
response: dataWithRawResponse.data,
|
|
119
|
+
rawResponse: dataWithRawResponse.rawResponse,
|
|
120
|
+
hasNextPage: (response) => (response === null || response === void 0 ? void 0 : response.nextPageToken) != null &&
|
|
121
|
+
!(typeof (response === null || response === void 0 ? void 0 : response.nextPageToken) === "string" && (response === null || response === void 0 ? void 0 : response.nextPageToken) === ""),
|
|
122
|
+
getItems: (response) => { var _a; return (_a = response === null || response === void 0 ? void 0 : response.drafts) !== null && _a !== void 0 ? _a : []; },
|
|
123
|
+
loadPage: (response) => {
|
|
124
|
+
return list(core.setObjectProperty(request, "pageToken", response === null || response === void 0 ? void 0 : response.nextPageToken));
|
|
125
|
+
},
|
|
126
|
+
});
|
|
114
127
|
});
|
|
115
128
|
}
|
|
116
129
|
/**
|
|
@@ -128,7 +141,7 @@ export class Drafts {
|
|
|
128
141
|
__get(draftId, requestOptions) {
|
|
129
142
|
return __awaiter(this, void 0, void 0, function* () {
|
|
130
143
|
var _a, _b, _c;
|
|
131
|
-
|
|
144
|
+
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);
|
|
132
145
|
const _response = yield core.fetcher({
|
|
133
146
|
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/${encodeURIComponent(serializers.DraftId.jsonOrThrow(draftId, { omitUndefined: true }))}`),
|
|
134
147
|
method: "GET",
|
|
@@ -15,7 +15,7 @@ export declare namespace Inboxes {
|
|
|
15
15
|
baseUrl?: core.Supplier<string>;
|
|
16
16
|
apiKey?: core.Supplier<core.BearerToken | undefined>;
|
|
17
17
|
/** Additional headers to include in requests. */
|
|
18
|
-
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
18
|
+
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
19
19
|
}
|
|
20
20
|
interface RequestOptions {
|
|
21
21
|
/** The maximum time to wait for a response in seconds. */
|
|
@@ -27,7 +27,7 @@ export declare namespace Inboxes {
|
|
|
27
27
|
/** Additional query string parameters to include in the request. */
|
|
28
28
|
queryParams?: Record<string, unknown>;
|
|
29
29
|
/** Additional headers to include in the request. */
|
|
30
|
-
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
30
|
+
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
export declare class Inboxes {
|
|
@@ -48,8 +48,7 @@ export declare class Inboxes {
|
|
|
48
48
|
* @example
|
|
49
49
|
* await client.inboxes.list()
|
|
50
50
|
*/
|
|
51
|
-
list(request?: AgentMail.inboxes.ListInboxesRequest, requestOptions?: Inboxes.RequestOptions): core.
|
|
52
|
-
private __list;
|
|
51
|
+
list(request?: AgentMail.inboxes.ListInboxesRequest, requestOptions?: Inboxes.RequestOptions): Promise<core.Page<AgentMail.inboxes.Inbox>>;
|
|
53
52
|
/**
|
|
54
53
|
* @param {AgentMail.inboxes.InboxId} inboxId
|
|
55
54
|
* @param {Inboxes.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -77,5 +76,16 @@ export declare class Inboxes {
|
|
|
77
76
|
*/
|
|
78
77
|
create(request: AgentMail.inboxes.CreateInboxRequest, requestOptions?: Inboxes.RequestOptions): core.HttpResponsePromise<AgentMail.inboxes.Inbox>;
|
|
79
78
|
private __create;
|
|
79
|
+
/**
|
|
80
|
+
* @param {AgentMail.inboxes.InboxId} inboxId
|
|
81
|
+
* @param {Inboxes.RequestOptions} requestOptions - Request-specific configuration.
|
|
82
|
+
*
|
|
83
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* await client.inboxes.delete("inbox_id")
|
|
87
|
+
*/
|
|
88
|
+
delete(inboxId: AgentMail.inboxes.InboxId, requestOptions?: Inboxes.RequestOptions): core.HttpResponsePromise<void>;
|
|
89
|
+
private __delete;
|
|
80
90
|
protected _getAuthorizationHeader(): Promise<string>;
|
|
81
91
|
}
|
|
@@ -47,64 +47,74 @@ export class Inboxes {
|
|
|
47
47
|
* @example
|
|
48
48
|
* await client.inboxes.list()
|
|
49
49
|
*/
|
|
50
|
-
list(
|
|
51
|
-
return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
|
|
52
|
-
}
|
|
53
|
-
__list() {
|
|
50
|
+
list() {
|
|
54
51
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
if (_response.ok) {
|
|
75
|
-
return {
|
|
76
|
-
data: serializers.inboxes.ListInboxesResponse.parseOrThrow(_response.body, {
|
|
77
|
-
unrecognizedObjectKeys: "passthrough",
|
|
78
|
-
allowUnrecognizedUnionMembers: true,
|
|
79
|
-
allowUnrecognizedEnumValues: true,
|
|
80
|
-
skipValidation: true,
|
|
81
|
-
breadcrumbsPrefix: ["response"],
|
|
82
|
-
}),
|
|
83
|
-
rawResponse: _response.rawResponse,
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
if (_response.error.reason === "status-code") {
|
|
87
|
-
throw new errors.AgentMailError({
|
|
88
|
-
statusCode: _response.error.statusCode,
|
|
89
|
-
body: _response.error.body,
|
|
90
|
-
rawResponse: _response.rawResponse,
|
|
52
|
+
const list = core.HttpResponsePromise.interceptFunction((request) => __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
var _a, _b, _c;
|
|
54
|
+
const { limit, pageToken } = request;
|
|
55
|
+
const _queryParams = {};
|
|
56
|
+
if (limit != null) {
|
|
57
|
+
_queryParams["limit"] = limit.toString();
|
|
58
|
+
}
|
|
59
|
+
if (pageToken != null) {
|
|
60
|
+
_queryParams["page_token"] = pageToken;
|
|
61
|
+
}
|
|
62
|
+
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);
|
|
63
|
+
const _response = yield core.fetcher({
|
|
64
|
+
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"),
|
|
65
|
+
method: "GET",
|
|
66
|
+
headers: _headers,
|
|
67
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
68
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
69
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
70
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
91
71
|
});
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
72
|
+
if (_response.ok) {
|
|
73
|
+
return {
|
|
74
|
+
data: serializers.inboxes.ListInboxesResponse.parseOrThrow(_response.body, {
|
|
75
|
+
unrecognizedObjectKeys: "passthrough",
|
|
76
|
+
allowUnrecognizedUnionMembers: true,
|
|
77
|
+
allowUnrecognizedEnumValues: true,
|
|
78
|
+
skipValidation: true,
|
|
79
|
+
breadcrumbsPrefix: ["response"],
|
|
80
|
+
}),
|
|
98
81
|
rawResponse: _response.rawResponse,
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
case "unknown":
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
if (_response.error.reason === "status-code") {
|
|
103
85
|
throw new errors.AgentMailError({
|
|
104
|
-
|
|
86
|
+
statusCode: _response.error.statusCode,
|
|
87
|
+
body: _response.error.body,
|
|
105
88
|
rawResponse: _response.rawResponse,
|
|
106
89
|
});
|
|
107
|
-
|
|
90
|
+
}
|
|
91
|
+
switch (_response.error.reason) {
|
|
92
|
+
case "non-json":
|
|
93
|
+
throw new errors.AgentMailError({
|
|
94
|
+
statusCode: _response.error.statusCode,
|
|
95
|
+
body: _response.error.rawBody,
|
|
96
|
+
rawResponse: _response.rawResponse,
|
|
97
|
+
});
|
|
98
|
+
case "timeout":
|
|
99
|
+
throw new errors.AgentMailTimeoutError("Timeout exceeded when calling GET /v0/inboxes.");
|
|
100
|
+
case "unknown":
|
|
101
|
+
throw new errors.AgentMailError({
|
|
102
|
+
message: _response.error.errorMessage,
|
|
103
|
+
rawResponse: _response.rawResponse,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}));
|
|
107
|
+
const dataWithRawResponse = yield list(request).withRawResponse();
|
|
108
|
+
return new core.Pageable({
|
|
109
|
+
response: dataWithRawResponse.data,
|
|
110
|
+
rawResponse: dataWithRawResponse.rawResponse,
|
|
111
|
+
hasNextPage: (response) => (response === null || response === void 0 ? void 0 : response.nextPageToken) != null &&
|
|
112
|
+
!(typeof (response === null || response === void 0 ? void 0 : response.nextPageToken) === "string" && (response === null || response === void 0 ? void 0 : response.nextPageToken) === ""),
|
|
113
|
+
getItems: (response) => { var _a; return (_a = response === null || response === void 0 ? void 0 : response.inboxes) !== null && _a !== void 0 ? _a : []; },
|
|
114
|
+
loadPage: (response) => {
|
|
115
|
+
return list(core.setObjectProperty(request, "pageToken", response === null || response === void 0 ? void 0 : response.nextPageToken));
|
|
116
|
+
},
|
|
117
|
+
});
|
|
108
118
|
});
|
|
109
119
|
}
|
|
110
120
|
/**
|
|
@@ -122,7 +132,7 @@ export class Inboxes {
|
|
|
122
132
|
__get(inboxId, requestOptions) {
|
|
123
133
|
return __awaiter(this, void 0, void 0, function* () {
|
|
124
134
|
var _a, _b, _c;
|
|
125
|
-
|
|
135
|
+
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);
|
|
126
136
|
const _response = yield core.fetcher({
|
|
127
137
|
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/${encodeURIComponent(serializers.inboxes.InboxId.jsonOrThrow(inboxId, { omitUndefined: true }))}`),
|
|
128
138
|
method: "GET",
|
|
@@ -199,7 +209,7 @@ export class Inboxes {
|
|
|
199
209
|
__create(request, requestOptions) {
|
|
200
210
|
return __awaiter(this, void 0, void 0, function* () {
|
|
201
211
|
var _a, _b, _c;
|
|
202
|
-
|
|
212
|
+
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);
|
|
203
213
|
const _response = yield core.fetcher({
|
|
204
214
|
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"),
|
|
205
215
|
method: "POST",
|
|
@@ -262,6 +272,69 @@ export class Inboxes {
|
|
|
262
272
|
}
|
|
263
273
|
});
|
|
264
274
|
}
|
|
275
|
+
/**
|
|
276
|
+
* @param {AgentMail.inboxes.InboxId} inboxId
|
|
277
|
+
* @param {Inboxes.RequestOptions} requestOptions - Request-specific configuration.
|
|
278
|
+
*
|
|
279
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
280
|
+
*
|
|
281
|
+
* @example
|
|
282
|
+
* await client.inboxes.delete("inbox_id")
|
|
283
|
+
*/
|
|
284
|
+
delete(inboxId, requestOptions) {
|
|
285
|
+
return core.HttpResponsePromise.fromPromise(this.__delete(inboxId, requestOptions));
|
|
286
|
+
}
|
|
287
|
+
__delete(inboxId, requestOptions) {
|
|
288
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
289
|
+
var _a, _b, _c;
|
|
290
|
+
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);
|
|
291
|
+
const _response = yield core.fetcher({
|
|
292
|
+
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/${encodeURIComponent(serializers.inboxes.InboxId.jsonOrThrow(inboxId, { omitUndefined: true }))}`),
|
|
293
|
+
method: "DELETE",
|
|
294
|
+
headers: _headers,
|
|
295
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
296
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
297
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
298
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
299
|
+
});
|
|
300
|
+
if (_response.ok) {
|
|
301
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
302
|
+
}
|
|
303
|
+
if (_response.error.reason === "status-code") {
|
|
304
|
+
switch (_response.error.statusCode) {
|
|
305
|
+
case 404:
|
|
306
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
307
|
+
unrecognizedObjectKeys: "passthrough",
|
|
308
|
+
allowUnrecognizedUnionMembers: true,
|
|
309
|
+
allowUnrecognizedEnumValues: true,
|
|
310
|
+
skipValidation: true,
|
|
311
|
+
breadcrumbsPrefix: ["response"],
|
|
312
|
+
}), _response.rawResponse);
|
|
313
|
+
default:
|
|
314
|
+
throw new errors.AgentMailError({
|
|
315
|
+
statusCode: _response.error.statusCode,
|
|
316
|
+
body: _response.error.body,
|
|
317
|
+
rawResponse: _response.rawResponse,
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
switch (_response.error.reason) {
|
|
322
|
+
case "non-json":
|
|
323
|
+
throw new errors.AgentMailError({
|
|
324
|
+
statusCode: _response.error.statusCode,
|
|
325
|
+
body: _response.error.rawBody,
|
|
326
|
+
rawResponse: _response.rawResponse,
|
|
327
|
+
});
|
|
328
|
+
case "timeout":
|
|
329
|
+
throw new errors.AgentMailTimeoutError("Timeout exceeded when calling DELETE /v0/inboxes/{inbox_id}.");
|
|
330
|
+
case "unknown":
|
|
331
|
+
throw new errors.AgentMailError({
|
|
332
|
+
message: _response.error.errorMessage,
|
|
333
|
+
rawResponse: _response.rawResponse,
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
}
|
|
265
338
|
_getAuthorizationHeader() {
|
|
266
339
|
return __awaiter(this, void 0, void 0, function* () {
|
|
267
340
|
var _a;
|
|
@@ -11,7 +11,7 @@ export declare namespace Drafts {
|
|
|
11
11
|
baseUrl?: core.Supplier<string>;
|
|
12
12
|
apiKey?: core.Supplier<core.BearerToken | undefined>;
|
|
13
13
|
/** Additional headers to include in requests. */
|
|
14
|
-
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
14
|
+
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
15
15
|
}
|
|
16
16
|
interface RequestOptions {
|
|
17
17
|
/** The maximum time to wait for a response in seconds. */
|
|
@@ -23,7 +23,7 @@ export declare namespace Drafts {
|
|
|
23
23
|
/** Additional query string parameters to include in the request. */
|
|
24
24
|
queryParams?: Record<string, unknown>;
|
|
25
25
|
/** Additional headers to include in the request. */
|
|
26
|
-
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
26
|
+
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
export declare class Drafts {
|
|
@@ -39,8 +39,7 @@ export declare class Drafts {
|
|
|
39
39
|
* @example
|
|
40
40
|
* await client.inboxes.drafts.list("inbox_id")
|
|
41
41
|
*/
|
|
42
|
-
list(inboxId: AgentMail.inboxes.InboxId, request?: AgentMail.inboxes.ListDraftsRequest, requestOptions?: Drafts.RequestOptions): core.
|
|
43
|
-
private __list;
|
|
42
|
+
list(inboxId: AgentMail.inboxes.InboxId, request?: AgentMail.inboxes.ListDraftsRequest, requestOptions?: Drafts.RequestOptions): Promise<core.Page<AgentMail.DraftItem>>;
|
|
44
43
|
/**
|
|
45
44
|
* @param {AgentMail.inboxes.InboxId} inboxId
|
|
46
45
|
* @param {AgentMail.DraftId} draftId
|