agentmail 0.0.78 → 0.1.0
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/apiKeys/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/apiKeys/client/Client.js +62 -52
- package/dist/cjs/api/resources/domains/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/domains/client/Client.js +62 -52
- package/dist/cjs/api/resources/drafts/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/drafts/client/Client.js +83 -70
- package/dist/cjs/api/resources/inboxes/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/inboxes/client/Client.js +62 -52
- package/dist/cjs/api/resources/inboxes/resources/drafts/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/inboxes/resources/drafts/client/Client.js +83 -70
- package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.js +83 -70
- package/dist/cjs/api/resources/inboxes/resources/threads/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/inboxes/resources/threads/client/Client.js +83 -70
- package/dist/cjs/api/resources/pods/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/pods/client/Client.js +62 -52
- package/dist/cjs/api/resources/pods/resources/domains/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/pods/resources/domains/client/Client.js +83 -70
- package/dist/cjs/api/resources/pods/resources/drafts/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/pods/resources/drafts/client/Client.js +83 -70
- package/dist/cjs/api/resources/pods/resources/inboxes/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/pods/resources/inboxes/client/Client.js +83 -70
- package/dist/cjs/api/resources/pods/resources/threads/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/pods/resources/threads/client/Client.js +83 -70
- package/dist/cjs/api/resources/threads/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/threads/client/Client.js +83 -70
- package/dist/cjs/api/resources/webhooks/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/webhooks/client/Client.js +62 -52
- 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/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.mjs +2 -2
- package/dist/esm/api/resources/apiKeys/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/apiKeys/client/Client.mjs +62 -52
- package/dist/esm/api/resources/domains/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/domains/client/Client.mjs +62 -52
- package/dist/esm/api/resources/drafts/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/drafts/client/Client.mjs +83 -70
- package/dist/esm/api/resources/inboxes/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/inboxes/client/Client.mjs +62 -52
- package/dist/esm/api/resources/inboxes/resources/drafts/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/inboxes/resources/drafts/client/Client.mjs +83 -70
- package/dist/esm/api/resources/inboxes/resources/messages/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/inboxes/resources/messages/client/Client.mjs +83 -70
- package/dist/esm/api/resources/inboxes/resources/threads/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/inboxes/resources/threads/client/Client.mjs +83 -70
- package/dist/esm/api/resources/pods/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/pods/client/Client.mjs +62 -52
- package/dist/esm/api/resources/pods/resources/domains/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/pods/resources/domains/client/Client.mjs +83 -70
- package/dist/esm/api/resources/pods/resources/drafts/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/pods/resources/drafts/client/Client.mjs +83 -70
- package/dist/esm/api/resources/pods/resources/inboxes/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/pods/resources/inboxes/client/Client.mjs +83 -70
- package/dist/esm/api/resources/pods/resources/threads/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/pods/resources/threads/client/Client.mjs +83 -70
- package/dist/esm/api/resources/threads/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/threads/client/Client.mjs +83 -70
- package/dist/esm/api/resources/webhooks/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/webhooks/client/Client.mjs +62 -52
- 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/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +154 -28
|
@@ -29,87 +29,100 @@ export class Drafts {
|
|
|
29
29
|
* @example
|
|
30
30
|
* await client.inboxes.drafts.list("inbox_id")
|
|
31
31
|
*/
|
|
32
|
-
list(
|
|
33
|
-
return core.HttpResponsePromise.fromPromise(this.__list(inboxId, request, requestOptions));
|
|
34
|
-
}
|
|
35
|
-
__list(inboxId_1) {
|
|
32
|
+
list(inboxId_1) {
|
|
36
33
|
return __awaiter(this, arguments, void 0, function* (inboxId, request = {}, requestOptions) {
|
|
37
|
-
|
|
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
|
-
headers:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
breadcrumbsPrefix: ["response"],
|
|
76
|
-
}),
|
|
77
|
-
rawResponse: _response.rawResponse,
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
if (_response.error.reason === "status-code") {
|
|
81
|
-
switch (_response.error.statusCode) {
|
|
82
|
-
case 404:
|
|
83
|
-
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
34
|
+
const list = core.HttpResponsePromise.interceptFunction((request) => __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
36
|
+
const { limit, pageToken, labels, before, after, ascending } = request;
|
|
37
|
+
const _queryParams = {};
|
|
38
|
+
if (limit != null) {
|
|
39
|
+
_queryParams.limit = limit.toString();
|
|
40
|
+
}
|
|
41
|
+
if (pageToken != null) {
|
|
42
|
+
_queryParams.page_token = pageToken;
|
|
43
|
+
}
|
|
44
|
+
if (labels != null) {
|
|
45
|
+
_queryParams.labels = toJson(serializers.Labels.jsonOrThrow(labels, {
|
|
46
|
+
unrecognizedObjectKeys: "strip",
|
|
47
|
+
omitUndefined: true,
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
if (before != null) {
|
|
51
|
+
_queryParams.before = before.toISOString();
|
|
52
|
+
}
|
|
53
|
+
if (after != null) {
|
|
54
|
+
_queryParams.after = after.toISOString();
|
|
55
|
+
}
|
|
56
|
+
if (ascending != null) {
|
|
57
|
+
_queryParams.ascending = ascending.toString();
|
|
58
|
+
}
|
|
59
|
+
const _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);
|
|
60
|
+
const _response = yield core.fetcher({
|
|
61
|
+
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(inboxId, { omitUndefined: true }))}/drafts`),
|
|
62
|
+
method: "GET",
|
|
63
|
+
headers: _headers,
|
|
64
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
65
|
+
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,
|
|
66
|
+
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,
|
|
67
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
68
|
+
});
|
|
69
|
+
if (_response.ok) {
|
|
70
|
+
return {
|
|
71
|
+
data: serializers.ListDraftsResponse.parseOrThrow(_response.body, {
|
|
84
72
|
unrecognizedObjectKeys: "passthrough",
|
|
85
73
|
allowUnrecognizedUnionMembers: true,
|
|
86
74
|
allowUnrecognizedEnumValues: true,
|
|
87
75
|
skipValidation: true,
|
|
88
76
|
breadcrumbsPrefix: ["response"],
|
|
89
|
-
}),
|
|
90
|
-
|
|
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, {
|
|
85
|
+
unrecognizedObjectKeys: "passthrough",
|
|
86
|
+
allowUnrecognizedUnionMembers: true,
|
|
87
|
+
allowUnrecognizedEnumValues: true,
|
|
88
|
+
skipValidation: true,
|
|
89
|
+
breadcrumbsPrefix: ["response"],
|
|
90
|
+
}), _response.rawResponse);
|
|
91
|
+
default:
|
|
92
|
+
throw new errors.AgentMailError({
|
|
93
|
+
statusCode: _response.error.statusCode,
|
|
94
|
+
body: _response.error.body,
|
|
95
|
+
rawResponse: _response.rawResponse,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
switch (_response.error.reason) {
|
|
100
|
+
case "non-json":
|
|
91
101
|
throw new errors.AgentMailError({
|
|
92
102
|
statusCode: _response.error.statusCode,
|
|
93
|
-
body: _response.error.
|
|
103
|
+
body: _response.error.rawBody,
|
|
104
|
+
rawResponse: _response.rawResponse,
|
|
105
|
+
});
|
|
106
|
+
case "timeout":
|
|
107
|
+
throw new errors.AgentMailTimeoutError("Timeout exceeded when calling GET /v0/inboxes/{inbox_id}/drafts.");
|
|
108
|
+
case "unknown":
|
|
109
|
+
throw new errors.AgentMailError({
|
|
110
|
+
message: _response.error.errorMessage,
|
|
94
111
|
rawResponse: _response.rawResponse,
|
|
95
112
|
});
|
|
96
113
|
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
message: _response.error.errorMessage,
|
|
110
|
-
rawResponse: _response.rawResponse,
|
|
111
|
-
});
|
|
112
|
-
}
|
|
114
|
+
}));
|
|
115
|
+
const dataWithRawResponse = yield list(request).withRawResponse();
|
|
116
|
+
return new core.Pageable({
|
|
117
|
+
response: dataWithRawResponse.data,
|
|
118
|
+
rawResponse: dataWithRawResponse.rawResponse,
|
|
119
|
+
hasNextPage: (response) => (response === null || response === void 0 ? void 0 : response.nextPageToken) != null &&
|
|
120
|
+
!(typeof (response === null || response === void 0 ? void 0 : response.nextPageToken) === "string" && (response === null || response === void 0 ? void 0 : response.nextPageToken) === ""),
|
|
121
|
+
getItems: (response) => { var _a; return (_a = response === null || response === void 0 ? void 0 : response.drafts) !== null && _a !== void 0 ? _a : []; },
|
|
122
|
+
loadPage: (response) => {
|
|
123
|
+
return list(core.setObjectProperty(request, "pageToken", response === null || response === void 0 ? void 0 : response.nextPageToken));
|
|
124
|
+
},
|
|
125
|
+
});
|
|
113
126
|
});
|
|
114
127
|
}
|
|
115
128
|
/**
|
|
@@ -20,8 +20,7 @@ export declare class Messages {
|
|
|
20
20
|
* @example
|
|
21
21
|
* await client.inboxes.messages.list("inbox_id")
|
|
22
22
|
*/
|
|
23
|
-
list(inboxId: AgentMail.inboxes.InboxId, request?: AgentMail.inboxes.ListMessagesRequest, requestOptions?: Messages.RequestOptions): core.
|
|
24
|
-
private __list;
|
|
23
|
+
list(inboxId: AgentMail.inboxes.InboxId, request?: AgentMail.inboxes.ListMessagesRequest, requestOptions?: Messages.RequestOptions): Promise<core.Page<AgentMail.MessageItem>>;
|
|
25
24
|
/**
|
|
26
25
|
* @param {AgentMail.inboxes.InboxId} inboxId
|
|
27
26
|
* @param {AgentMail.MessageId} messageId
|
|
@@ -29,87 +29,100 @@ export class Messages {
|
|
|
29
29
|
* @example
|
|
30
30
|
* await client.inboxes.messages.list("inbox_id")
|
|
31
31
|
*/
|
|
32
|
-
list(
|
|
33
|
-
return core.HttpResponsePromise.fromPromise(this.__list(inboxId, request, requestOptions));
|
|
34
|
-
}
|
|
35
|
-
__list(inboxId_1) {
|
|
32
|
+
list(inboxId_1) {
|
|
36
33
|
return __awaiter(this, arguments, void 0, function* (inboxId, request = {}, requestOptions) {
|
|
37
|
-
|
|
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
|
-
headers:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
breadcrumbsPrefix: ["response"],
|
|
76
|
-
}),
|
|
77
|
-
rawResponse: _response.rawResponse,
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
if (_response.error.reason === "status-code") {
|
|
81
|
-
switch (_response.error.statusCode) {
|
|
82
|
-
case 404:
|
|
83
|
-
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
34
|
+
const list = core.HttpResponsePromise.interceptFunction((request) => __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
36
|
+
const { limit, pageToken, labels, before, after, ascending } = request;
|
|
37
|
+
const _queryParams = {};
|
|
38
|
+
if (limit != null) {
|
|
39
|
+
_queryParams.limit = limit.toString();
|
|
40
|
+
}
|
|
41
|
+
if (pageToken != null) {
|
|
42
|
+
_queryParams.page_token = pageToken;
|
|
43
|
+
}
|
|
44
|
+
if (labels != null) {
|
|
45
|
+
_queryParams.labels = toJson(serializers.Labels.jsonOrThrow(labels, {
|
|
46
|
+
unrecognizedObjectKeys: "strip",
|
|
47
|
+
omitUndefined: true,
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
if (before != null) {
|
|
51
|
+
_queryParams.before = before.toISOString();
|
|
52
|
+
}
|
|
53
|
+
if (after != null) {
|
|
54
|
+
_queryParams.after = after.toISOString();
|
|
55
|
+
}
|
|
56
|
+
if (ascending != null) {
|
|
57
|
+
_queryParams.ascending = ascending.toString();
|
|
58
|
+
}
|
|
59
|
+
const _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);
|
|
60
|
+
const _response = yield core.fetcher({
|
|
61
|
+
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(inboxId, { omitUndefined: true }))}/messages`),
|
|
62
|
+
method: "GET",
|
|
63
|
+
headers: _headers,
|
|
64
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
65
|
+
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,
|
|
66
|
+
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,
|
|
67
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
68
|
+
});
|
|
69
|
+
if (_response.ok) {
|
|
70
|
+
return {
|
|
71
|
+
data: serializers.ListMessagesResponse.parseOrThrow(_response.body, {
|
|
84
72
|
unrecognizedObjectKeys: "passthrough",
|
|
85
73
|
allowUnrecognizedUnionMembers: true,
|
|
86
74
|
allowUnrecognizedEnumValues: true,
|
|
87
75
|
skipValidation: true,
|
|
88
76
|
breadcrumbsPrefix: ["response"],
|
|
89
|
-
}),
|
|
90
|
-
|
|
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, {
|
|
85
|
+
unrecognizedObjectKeys: "passthrough",
|
|
86
|
+
allowUnrecognizedUnionMembers: true,
|
|
87
|
+
allowUnrecognizedEnumValues: true,
|
|
88
|
+
skipValidation: true,
|
|
89
|
+
breadcrumbsPrefix: ["response"],
|
|
90
|
+
}), _response.rawResponse);
|
|
91
|
+
default:
|
|
92
|
+
throw new errors.AgentMailError({
|
|
93
|
+
statusCode: _response.error.statusCode,
|
|
94
|
+
body: _response.error.body,
|
|
95
|
+
rawResponse: _response.rawResponse,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
switch (_response.error.reason) {
|
|
100
|
+
case "non-json":
|
|
91
101
|
throw new errors.AgentMailError({
|
|
92
102
|
statusCode: _response.error.statusCode,
|
|
93
|
-
body: _response.error.
|
|
103
|
+
body: _response.error.rawBody,
|
|
104
|
+
rawResponse: _response.rawResponse,
|
|
105
|
+
});
|
|
106
|
+
case "timeout":
|
|
107
|
+
throw new errors.AgentMailTimeoutError("Timeout exceeded when calling GET /v0/inboxes/{inbox_id}/messages.");
|
|
108
|
+
case "unknown":
|
|
109
|
+
throw new errors.AgentMailError({
|
|
110
|
+
message: _response.error.errorMessage,
|
|
94
111
|
rawResponse: _response.rawResponse,
|
|
95
112
|
});
|
|
96
113
|
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
message: _response.error.errorMessage,
|
|
110
|
-
rawResponse: _response.rawResponse,
|
|
111
|
-
});
|
|
112
|
-
}
|
|
114
|
+
}));
|
|
115
|
+
const dataWithRawResponse = yield list(request).withRawResponse();
|
|
116
|
+
return new core.Pageable({
|
|
117
|
+
response: dataWithRawResponse.data,
|
|
118
|
+
rawResponse: dataWithRawResponse.rawResponse,
|
|
119
|
+
hasNextPage: (response) => (response === null || response === void 0 ? void 0 : response.nextPageToken) != null &&
|
|
120
|
+
!(typeof (response === null || response === void 0 ? void 0 : response.nextPageToken) === "string" && (response === null || response === void 0 ? void 0 : response.nextPageToken) === ""),
|
|
121
|
+
getItems: (response) => { var _a; return (_a = response === null || response === void 0 ? void 0 : response.messages) !== null && _a !== void 0 ? _a : []; },
|
|
122
|
+
loadPage: (response) => {
|
|
123
|
+
return list(core.setObjectProperty(request, "pageToken", response === null || response === void 0 ? void 0 : response.nextPageToken));
|
|
124
|
+
},
|
|
125
|
+
});
|
|
113
126
|
});
|
|
114
127
|
}
|
|
115
128
|
/**
|
|
@@ -20,8 +20,7 @@ export declare class Threads {
|
|
|
20
20
|
* @example
|
|
21
21
|
* await client.inboxes.threads.list("inbox_id")
|
|
22
22
|
*/
|
|
23
|
-
list(inboxId: AgentMail.inboxes.InboxId, request?: AgentMail.inboxes.ListThreadsRequest, requestOptions?: Threads.RequestOptions): core.
|
|
24
|
-
private __list;
|
|
23
|
+
list(inboxId: AgentMail.inboxes.InboxId, request?: AgentMail.inboxes.ListThreadsRequest, requestOptions?: Threads.RequestOptions): Promise<core.Page<AgentMail.ThreadItem>>;
|
|
25
24
|
/**
|
|
26
25
|
* @param {AgentMail.inboxes.InboxId} inboxId
|
|
27
26
|
* @param {AgentMail.ThreadId} threadId
|
|
@@ -29,87 +29,100 @@ export class Threads {
|
|
|
29
29
|
* @example
|
|
30
30
|
* await client.inboxes.threads.list("inbox_id")
|
|
31
31
|
*/
|
|
32
|
-
list(
|
|
33
|
-
return core.HttpResponsePromise.fromPromise(this.__list(inboxId, request, requestOptions));
|
|
34
|
-
}
|
|
35
|
-
__list(inboxId_1) {
|
|
32
|
+
list(inboxId_1) {
|
|
36
33
|
return __awaiter(this, arguments, void 0, function* (inboxId, request = {}, requestOptions) {
|
|
37
|
-
|
|
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
|
-
headers:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
breadcrumbsPrefix: ["response"],
|
|
76
|
-
}),
|
|
77
|
-
rawResponse: _response.rawResponse,
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
if (_response.error.reason === "status-code") {
|
|
81
|
-
switch (_response.error.statusCode) {
|
|
82
|
-
case 404:
|
|
83
|
-
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
34
|
+
const list = core.HttpResponsePromise.interceptFunction((request) => __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
36
|
+
const { limit, pageToken, labels, before, after, ascending } = request;
|
|
37
|
+
const _queryParams = {};
|
|
38
|
+
if (limit != null) {
|
|
39
|
+
_queryParams.limit = limit.toString();
|
|
40
|
+
}
|
|
41
|
+
if (pageToken != null) {
|
|
42
|
+
_queryParams.page_token = pageToken;
|
|
43
|
+
}
|
|
44
|
+
if (labels != null) {
|
|
45
|
+
_queryParams.labels = toJson(serializers.Labels.jsonOrThrow(labels, {
|
|
46
|
+
unrecognizedObjectKeys: "strip",
|
|
47
|
+
omitUndefined: true,
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
if (before != null) {
|
|
51
|
+
_queryParams.before = before.toISOString();
|
|
52
|
+
}
|
|
53
|
+
if (after != null) {
|
|
54
|
+
_queryParams.after = after.toISOString();
|
|
55
|
+
}
|
|
56
|
+
if (ascending != null) {
|
|
57
|
+
_queryParams.ascending = ascending.toString();
|
|
58
|
+
}
|
|
59
|
+
const _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);
|
|
60
|
+
const _response = yield core.fetcher({
|
|
61
|
+
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(inboxId, { omitUndefined: true }))}/threads`),
|
|
62
|
+
method: "GET",
|
|
63
|
+
headers: _headers,
|
|
64
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
65
|
+
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,
|
|
66
|
+
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,
|
|
67
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
68
|
+
});
|
|
69
|
+
if (_response.ok) {
|
|
70
|
+
return {
|
|
71
|
+
data: serializers.ListThreadsResponse.parseOrThrow(_response.body, {
|
|
84
72
|
unrecognizedObjectKeys: "passthrough",
|
|
85
73
|
allowUnrecognizedUnionMembers: true,
|
|
86
74
|
allowUnrecognizedEnumValues: true,
|
|
87
75
|
skipValidation: true,
|
|
88
76
|
breadcrumbsPrefix: ["response"],
|
|
89
|
-
}),
|
|
90
|
-
|
|
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, {
|
|
85
|
+
unrecognizedObjectKeys: "passthrough",
|
|
86
|
+
allowUnrecognizedUnionMembers: true,
|
|
87
|
+
allowUnrecognizedEnumValues: true,
|
|
88
|
+
skipValidation: true,
|
|
89
|
+
breadcrumbsPrefix: ["response"],
|
|
90
|
+
}), _response.rawResponse);
|
|
91
|
+
default:
|
|
92
|
+
throw new errors.AgentMailError({
|
|
93
|
+
statusCode: _response.error.statusCode,
|
|
94
|
+
body: _response.error.body,
|
|
95
|
+
rawResponse: _response.rawResponse,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
switch (_response.error.reason) {
|
|
100
|
+
case "non-json":
|
|
91
101
|
throw new errors.AgentMailError({
|
|
92
102
|
statusCode: _response.error.statusCode,
|
|
93
|
-
body: _response.error.
|
|
103
|
+
body: _response.error.rawBody,
|
|
104
|
+
rawResponse: _response.rawResponse,
|
|
105
|
+
});
|
|
106
|
+
case "timeout":
|
|
107
|
+
throw new errors.AgentMailTimeoutError("Timeout exceeded when calling GET /v0/inboxes/{inbox_id}/threads.");
|
|
108
|
+
case "unknown":
|
|
109
|
+
throw new errors.AgentMailError({
|
|
110
|
+
message: _response.error.errorMessage,
|
|
94
111
|
rawResponse: _response.rawResponse,
|
|
95
112
|
});
|
|
96
113
|
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
message: _response.error.errorMessage,
|
|
110
|
-
rawResponse: _response.rawResponse,
|
|
111
|
-
});
|
|
112
|
-
}
|
|
114
|
+
}));
|
|
115
|
+
const dataWithRawResponse = yield list(request).withRawResponse();
|
|
116
|
+
return new core.Pageable({
|
|
117
|
+
response: dataWithRawResponse.data,
|
|
118
|
+
rawResponse: dataWithRawResponse.rawResponse,
|
|
119
|
+
hasNextPage: (response) => (response === null || response === void 0 ? void 0 : response.nextPageToken) != null &&
|
|
120
|
+
!(typeof (response === null || response === void 0 ? void 0 : response.nextPageToken) === "string" && (response === null || response === void 0 ? void 0 : response.nextPageToken) === ""),
|
|
121
|
+
getItems: (response) => { var _a; return (_a = response === null || response === void 0 ? void 0 : response.threads) !== null && _a !== void 0 ? _a : []; },
|
|
122
|
+
loadPage: (response) => {
|
|
123
|
+
return list(core.setObjectProperty(request, "pageToken", response === null || response === void 0 ? void 0 : response.nextPageToken));
|
|
124
|
+
},
|
|
125
|
+
});
|
|
113
126
|
});
|
|
114
127
|
}
|
|
115
128
|
/**
|
|
@@ -29,8 +29,7 @@ export declare class Pods {
|
|
|
29
29
|
* @example
|
|
30
30
|
* await client.pods.list()
|
|
31
31
|
*/
|
|
32
|
-
list(request?: AgentMail.pods.ListPodsRequest, requestOptions?: Pods.RequestOptions): core.
|
|
33
|
-
private __list;
|
|
32
|
+
list(request?: AgentMail.pods.ListPodsRequest, requestOptions?: Pods.RequestOptions): Promise<core.Page<AgentMail.pods.Pod>>;
|
|
34
33
|
/**
|
|
35
34
|
* @param {AgentMail.pods.PodId} podId
|
|
36
35
|
* @param {Pods.RequestOptions} requestOptions - Request-specific configuration.
|