agentmail 0.1.1 → 0.1.3
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 +2 -1
- package/dist/cjs/api/resources/apiKeys/client/Client.js +52 -62
- package/dist/cjs/api/resources/domains/client/Client.d.ts +2 -1
- package/dist/cjs/api/resources/domains/client/Client.js +52 -62
- package/dist/cjs/api/resources/drafts/client/Client.d.ts +2 -1
- package/dist/cjs/api/resources/drafts/client/Client.js +70 -83
- package/dist/cjs/api/resources/inboxes/client/Client.d.ts +2 -1
- package/dist/cjs/api/resources/inboxes/client/Client.js +52 -62
- package/dist/cjs/api/resources/inboxes/resources/drafts/client/Client.d.ts +2 -1
- package/dist/cjs/api/resources/inboxes/resources/drafts/client/Client.js +70 -83
- package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.d.ts +2 -1
- package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.js +70 -83
- package/dist/cjs/api/resources/inboxes/resources/threads/client/Client.d.ts +2 -1
- package/dist/cjs/api/resources/inboxes/resources/threads/client/Client.js +70 -83
- package/dist/cjs/api/resources/pods/client/Client.d.ts +2 -1
- package/dist/cjs/api/resources/pods/client/Client.js +52 -62
- package/dist/cjs/api/resources/pods/resources/domains/client/Client.d.ts +2 -1
- package/dist/cjs/api/resources/pods/resources/domains/client/Client.js +70 -83
- package/dist/cjs/api/resources/pods/resources/drafts/client/Client.d.ts +2 -1
- package/dist/cjs/api/resources/pods/resources/drafts/client/Client.js +70 -83
- package/dist/cjs/api/resources/pods/resources/inboxes/client/Client.d.ts +2 -1
- package/dist/cjs/api/resources/pods/resources/inboxes/client/Client.js +70 -83
- package/dist/cjs/api/resources/pods/resources/threads/client/Client.d.ts +2 -1
- package/dist/cjs/api/resources/pods/resources/threads/client/Client.js +70 -83
- package/dist/cjs/api/resources/threads/client/Client.d.ts +2 -1
- package/dist/cjs/api/resources/threads/client/Client.js +70 -83
- package/dist/cjs/api/resources/webhooks/client/Client.d.ts +2 -1
- package/dist/cjs/api/resources/webhooks/client/Client.js +52 -62
- package/dist/cjs/core/exports.d.ts +0 -1
- package/dist/cjs/core/exports.js +0 -1
- package/dist/cjs/core/index.d.ts +0 -2
- package/dist/cjs/core/index.js +0 -2
- 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 +2 -1
- package/dist/esm/api/resources/apiKeys/client/Client.mjs +52 -62
- package/dist/esm/api/resources/domains/client/Client.d.mts +2 -1
- package/dist/esm/api/resources/domains/client/Client.mjs +52 -62
- package/dist/esm/api/resources/drafts/client/Client.d.mts +2 -1
- package/dist/esm/api/resources/drafts/client/Client.mjs +70 -83
- package/dist/esm/api/resources/inboxes/client/Client.d.mts +2 -1
- package/dist/esm/api/resources/inboxes/client/Client.mjs +52 -62
- package/dist/esm/api/resources/inboxes/resources/drafts/client/Client.d.mts +2 -1
- package/dist/esm/api/resources/inboxes/resources/drafts/client/Client.mjs +70 -83
- package/dist/esm/api/resources/inboxes/resources/messages/client/Client.d.mts +2 -1
- package/dist/esm/api/resources/inboxes/resources/messages/client/Client.mjs +70 -83
- package/dist/esm/api/resources/inboxes/resources/threads/client/Client.d.mts +2 -1
- package/dist/esm/api/resources/inboxes/resources/threads/client/Client.mjs +70 -83
- package/dist/esm/api/resources/pods/client/Client.d.mts +2 -1
- package/dist/esm/api/resources/pods/client/Client.mjs +52 -62
- package/dist/esm/api/resources/pods/resources/domains/client/Client.d.mts +2 -1
- package/dist/esm/api/resources/pods/resources/domains/client/Client.mjs +70 -83
- package/dist/esm/api/resources/pods/resources/drafts/client/Client.d.mts +2 -1
- package/dist/esm/api/resources/pods/resources/drafts/client/Client.mjs +70 -83
- package/dist/esm/api/resources/pods/resources/inboxes/client/Client.d.mts +2 -1
- package/dist/esm/api/resources/pods/resources/inboxes/client/Client.mjs +70 -83
- package/dist/esm/api/resources/pods/resources/threads/client/Client.d.mts +2 -1
- package/dist/esm/api/resources/pods/resources/threads/client/Client.mjs +70 -83
- package/dist/esm/api/resources/threads/client/Client.d.mts +2 -1
- package/dist/esm/api/resources/threads/client/Client.mjs +70 -83
- package/dist/esm/api/resources/webhooks/client/Client.d.mts +2 -1
- package/dist/esm/api/resources/webhooks/client/Client.mjs +52 -62
- package/dist/esm/core/exports.d.mts +0 -1
- package/dist/esm/core/exports.mjs +0 -1
- package/dist/esm/core/index.d.mts +0 -2
- package/dist/esm/core/index.mjs +0 -2
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/dist/llms-full.txt +21118 -0
- package/dist/llms.txt +101 -0
- package/package.json +2 -2
- package/reference.md +28 -196
- package/dist/cjs/core/pagination/Page.d.ts +0 -33
- package/dist/cjs/core/pagination/Page.js +0 -101
- package/dist/cjs/core/pagination/exports.d.ts +0 -1
- package/dist/cjs/core/pagination/exports.js +0 -2
- package/dist/cjs/core/pagination/index.d.ts +0 -1
- package/dist/cjs/core/pagination/index.js +0 -5
- package/dist/cjs/core/utils/index.d.ts +0 -1
- package/dist/cjs/core/utils/index.js +0 -5
- package/dist/cjs/core/utils/setObjectProperty.d.ts +0 -11
- package/dist/cjs/core/utils/setObjectProperty.js +0 -42
- package/dist/esm/core/pagination/Page.d.mts +0 -33
- package/dist/esm/core/pagination/Page.mjs +0 -97
- package/dist/esm/core/pagination/exports.d.mts +0 -1
- package/dist/esm/core/pagination/exports.mjs +0 -1
- package/dist/esm/core/pagination/index.d.mts +0 -1
- package/dist/esm/core/pagination/index.mjs +0 -1
- package/dist/esm/core/utils/index.d.mts +0 -1
- package/dist/esm/core/utils/index.mjs +0 -1
- package/dist/esm/core/utils/setObjectProperty.d.mts +0 -11
- package/dist/esm/core/utils/setObjectProperty.mjs +0 -39
|
@@ -81,74 +81,64 @@ class Inboxes {
|
|
|
81
81
|
* @example
|
|
82
82
|
* await client.inboxes.list()
|
|
83
83
|
*/
|
|
84
|
-
list() {
|
|
84
|
+
list(request = {}, requestOptions) {
|
|
85
|
+
return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
|
|
86
|
+
}
|
|
87
|
+
__list() {
|
|
85
88
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
89
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
90
|
+
const { limit, pageToken } = request;
|
|
91
|
+
const _queryParams = {};
|
|
92
|
+
if (limit != null) {
|
|
93
|
+
_queryParams.limit = limit.toString();
|
|
94
|
+
}
|
|
95
|
+
if (pageToken != null) {
|
|
96
|
+
_queryParams.page_token = pageToken;
|
|
97
|
+
}
|
|
98
|
+
const _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);
|
|
99
|
+
const _response = yield core.fetcher({
|
|
100
|
+
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"),
|
|
101
|
+
method: "GET",
|
|
102
|
+
headers: _headers,
|
|
103
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
104
|
+
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,
|
|
105
|
+
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,
|
|
106
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
107
|
+
});
|
|
108
|
+
if (_response.ok) {
|
|
109
|
+
return {
|
|
110
|
+
data: serializers.inboxes.ListInboxesResponse.parseOrThrow(_response.body, {
|
|
111
|
+
unrecognizedObjectKeys: "passthrough",
|
|
112
|
+
allowUnrecognizedUnionMembers: true,
|
|
113
|
+
allowUnrecognizedEnumValues: true,
|
|
114
|
+
skipValidation: true,
|
|
115
|
+
breadcrumbsPrefix: ["response"],
|
|
116
|
+
}),
|
|
117
|
+
rawResponse: _response.rawResponse,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
if (_response.error.reason === "status-code") {
|
|
121
|
+
throw new errors.AgentMailError({
|
|
122
|
+
statusCode: _response.error.statusCode,
|
|
123
|
+
body: _response.error.body,
|
|
124
|
+
rawResponse: _response.rawResponse,
|
|
105
125
|
});
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
unrecognizedObjectKeys: "passthrough",
|
|
110
|
-
allowUnrecognizedUnionMembers: true,
|
|
111
|
-
allowUnrecognizedEnumValues: true,
|
|
112
|
-
skipValidation: true,
|
|
113
|
-
breadcrumbsPrefix: ["response"],
|
|
114
|
-
}),
|
|
115
|
-
rawResponse: _response.rawResponse,
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
if (_response.error.reason === "status-code") {
|
|
126
|
+
}
|
|
127
|
+
switch (_response.error.reason) {
|
|
128
|
+
case "non-json":
|
|
119
129
|
throw new errors.AgentMailError({
|
|
120
130
|
statusCode: _response.error.statusCode,
|
|
121
|
-
body: _response.error.
|
|
131
|
+
body: _response.error.rawBody,
|
|
122
132
|
rawResponse: _response.rawResponse,
|
|
123
133
|
});
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
case "timeout":
|
|
133
|
-
throw new errors.AgentMailTimeoutError("Timeout exceeded when calling GET /v0/inboxes.");
|
|
134
|
-
case "unknown":
|
|
135
|
-
throw new errors.AgentMailError({
|
|
136
|
-
message: _response.error.errorMessage,
|
|
137
|
-
rawResponse: _response.rawResponse,
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
}));
|
|
141
|
-
const dataWithRawResponse = yield list(request).withRawResponse();
|
|
142
|
-
return new core.Page({
|
|
143
|
-
response: dataWithRawResponse.data,
|
|
144
|
-
rawResponse: dataWithRawResponse.rawResponse,
|
|
145
|
-
hasNextPage: (response) => (response === null || response === void 0 ? void 0 : response.nextPageToken) != null &&
|
|
146
|
-
!(typeof (response === null || response === void 0 ? void 0 : response.nextPageToken) === "string" && (response === null || response === void 0 ? void 0 : response.nextPageToken) === ""),
|
|
147
|
-
getItems: (response) => { var _a; return (_a = response === null || response === void 0 ? void 0 : response.inboxes) !== null && _a !== void 0 ? _a : []; },
|
|
148
|
-
loadPage: (response) => {
|
|
149
|
-
return list(core.setObjectProperty(request, "pageToken", response === null || response === void 0 ? void 0 : response.nextPageToken));
|
|
150
|
-
},
|
|
151
|
-
});
|
|
134
|
+
case "timeout":
|
|
135
|
+
throw new errors.AgentMailTimeoutError("Timeout exceeded when calling GET /v0/inboxes.");
|
|
136
|
+
case "unknown":
|
|
137
|
+
throw new errors.AgentMailError({
|
|
138
|
+
message: _response.error.errorMessage,
|
|
139
|
+
rawResponse: _response.rawResponse,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
152
142
|
});
|
|
153
143
|
}
|
|
154
144
|
/**
|
|
@@ -20,7 +20,8 @@ export declare class Drafts {
|
|
|
20
20
|
* @example
|
|
21
21
|
* await client.inboxes.drafts.list("inbox_id")
|
|
22
22
|
*/
|
|
23
|
-
list(inboxId: AgentMail.inboxes.InboxId, request?: AgentMail.inboxes.ListDraftsRequest, requestOptions?: Drafts.RequestOptions):
|
|
23
|
+
list(inboxId: AgentMail.inboxes.InboxId, request?: AgentMail.inboxes.ListDraftsRequest, requestOptions?: Drafts.RequestOptions): core.HttpResponsePromise<AgentMail.ListDraftsResponse>;
|
|
24
|
+
private __list;
|
|
24
25
|
/**
|
|
25
26
|
* @param {AgentMail.inboxes.InboxId} inboxId
|
|
26
27
|
* @param {AgentMail.DraftId} draftId
|
|
@@ -65,100 +65,87 @@ class Drafts {
|
|
|
65
65
|
* @example
|
|
66
66
|
* await client.inboxes.drafts.list("inbox_id")
|
|
67
67
|
*/
|
|
68
|
-
list(
|
|
68
|
+
list(inboxId, request = {}, requestOptions) {
|
|
69
|
+
return core.HttpResponsePromise.fromPromise(this.__list(inboxId, request, requestOptions));
|
|
70
|
+
}
|
|
71
|
+
__list(inboxId_1) {
|
|
69
72
|
return __awaiter(this, arguments, void 0, function* (inboxId, request = {}, requestOptions) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
73
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
74
|
+
const { limit, pageToken, labels, before, after, ascending } = request;
|
|
75
|
+
const _queryParams = {};
|
|
76
|
+
if (limit != null) {
|
|
77
|
+
_queryParams.limit = limit.toString();
|
|
78
|
+
}
|
|
79
|
+
if (pageToken != null) {
|
|
80
|
+
_queryParams.page_token = pageToken;
|
|
81
|
+
}
|
|
82
|
+
if (labels != null) {
|
|
83
|
+
_queryParams.labels = (0, json_js_1.toJson)(serializers.Labels.jsonOrThrow(labels, { unrecognizedObjectKeys: "strip", omitUndefined: true }));
|
|
84
|
+
}
|
|
85
|
+
if (before != null) {
|
|
86
|
+
_queryParams.before = before.toISOString();
|
|
87
|
+
}
|
|
88
|
+
if (after != null) {
|
|
89
|
+
_queryParams.after = after.toISOString();
|
|
90
|
+
}
|
|
91
|
+
if (ascending != null) {
|
|
92
|
+
_queryParams.ascending = ascending.toString();
|
|
93
|
+
}
|
|
94
|
+
const _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);
|
|
95
|
+
const _response = yield core.fetcher({
|
|
96
|
+
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`),
|
|
97
|
+
method: "GET",
|
|
98
|
+
headers: _headers,
|
|
99
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
100
|
+
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,
|
|
101
|
+
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,
|
|
102
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
103
|
+
});
|
|
104
|
+
if (_response.ok) {
|
|
105
|
+
return {
|
|
106
|
+
data: serializers.ListDraftsResponse.parseOrThrow(_response.body, {
|
|
107
|
+
unrecognizedObjectKeys: "passthrough",
|
|
108
|
+
allowUnrecognizedUnionMembers: true,
|
|
109
|
+
allowUnrecognizedEnumValues: true,
|
|
110
|
+
skipValidation: true,
|
|
111
|
+
breadcrumbsPrefix: ["response"],
|
|
112
|
+
}),
|
|
113
|
+
rawResponse: _response.rawResponse,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
if (_response.error.reason === "status-code") {
|
|
117
|
+
switch (_response.error.statusCode) {
|
|
118
|
+
case 404:
|
|
119
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
108
120
|
unrecognizedObjectKeys: "passthrough",
|
|
109
121
|
allowUnrecognizedUnionMembers: true,
|
|
110
122
|
allowUnrecognizedEnumValues: true,
|
|
111
123
|
skipValidation: true,
|
|
112
124
|
breadcrumbsPrefix: ["response"],
|
|
113
|
-
}),
|
|
114
|
-
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
if (_response.error.reason === "status-code") {
|
|
118
|
-
switch (_response.error.statusCode) {
|
|
119
|
-
case 404:
|
|
120
|
-
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
121
|
-
unrecognizedObjectKeys: "passthrough",
|
|
122
|
-
allowUnrecognizedUnionMembers: true,
|
|
123
|
-
allowUnrecognizedEnumValues: true,
|
|
124
|
-
skipValidation: true,
|
|
125
|
-
breadcrumbsPrefix: ["response"],
|
|
126
|
-
}), _response.rawResponse);
|
|
127
|
-
default:
|
|
128
|
-
throw new errors.AgentMailError({
|
|
129
|
-
statusCode: _response.error.statusCode,
|
|
130
|
-
body: _response.error.body,
|
|
131
|
-
rawResponse: _response.rawResponse,
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
switch (_response.error.reason) {
|
|
136
|
-
case "non-json":
|
|
125
|
+
}), _response.rawResponse);
|
|
126
|
+
default:
|
|
137
127
|
throw new errors.AgentMailError({
|
|
138
128
|
statusCode: _response.error.statusCode,
|
|
139
|
-
body: _response.error.
|
|
140
|
-
rawResponse: _response.rawResponse,
|
|
141
|
-
});
|
|
142
|
-
case "timeout":
|
|
143
|
-
throw new errors.AgentMailTimeoutError("Timeout exceeded when calling GET /v0/inboxes/{inbox_id}/drafts.");
|
|
144
|
-
case "unknown":
|
|
145
|
-
throw new errors.AgentMailError({
|
|
146
|
-
message: _response.error.errorMessage,
|
|
129
|
+
body: _response.error.body,
|
|
147
130
|
rawResponse: _response.rawResponse,
|
|
148
131
|
});
|
|
149
132
|
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
133
|
+
}
|
|
134
|
+
switch (_response.error.reason) {
|
|
135
|
+
case "non-json":
|
|
136
|
+
throw new errors.AgentMailError({
|
|
137
|
+
statusCode: _response.error.statusCode,
|
|
138
|
+
body: _response.error.rawBody,
|
|
139
|
+
rawResponse: _response.rawResponse,
|
|
140
|
+
});
|
|
141
|
+
case "timeout":
|
|
142
|
+
throw new errors.AgentMailTimeoutError("Timeout exceeded when calling GET /v0/inboxes/{inbox_id}/drafts.");
|
|
143
|
+
case "unknown":
|
|
144
|
+
throw new errors.AgentMailError({
|
|
145
|
+
message: _response.error.errorMessage,
|
|
146
|
+
rawResponse: _response.rawResponse,
|
|
147
|
+
});
|
|
148
|
+
}
|
|
162
149
|
});
|
|
163
150
|
}
|
|
164
151
|
/**
|
|
@@ -20,7 +20,8 @@ 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):
|
|
23
|
+
list(inboxId: AgentMail.inboxes.InboxId, request?: AgentMail.inboxes.ListMessagesRequest, requestOptions?: Messages.RequestOptions): core.HttpResponsePromise<AgentMail.ListMessagesResponse>;
|
|
24
|
+
private __list;
|
|
24
25
|
/**
|
|
25
26
|
* @param {AgentMail.inboxes.InboxId} inboxId
|
|
26
27
|
* @param {AgentMail.MessageId} messageId
|
|
@@ -65,100 +65,87 @@ class Messages {
|
|
|
65
65
|
* @example
|
|
66
66
|
* await client.inboxes.messages.list("inbox_id")
|
|
67
67
|
*/
|
|
68
|
-
list(
|
|
68
|
+
list(inboxId, request = {}, requestOptions) {
|
|
69
|
+
return core.HttpResponsePromise.fromPromise(this.__list(inboxId, request, requestOptions));
|
|
70
|
+
}
|
|
71
|
+
__list(inboxId_1) {
|
|
69
72
|
return __awaiter(this, arguments, void 0, function* (inboxId, request = {}, requestOptions) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
73
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
74
|
+
const { limit, pageToken, labels, before, after, ascending } = request;
|
|
75
|
+
const _queryParams = {};
|
|
76
|
+
if (limit != null) {
|
|
77
|
+
_queryParams.limit = limit.toString();
|
|
78
|
+
}
|
|
79
|
+
if (pageToken != null) {
|
|
80
|
+
_queryParams.page_token = pageToken;
|
|
81
|
+
}
|
|
82
|
+
if (labels != null) {
|
|
83
|
+
_queryParams.labels = (0, json_js_1.toJson)(serializers.Labels.jsonOrThrow(labels, { unrecognizedObjectKeys: "strip", omitUndefined: true }));
|
|
84
|
+
}
|
|
85
|
+
if (before != null) {
|
|
86
|
+
_queryParams.before = before.toISOString();
|
|
87
|
+
}
|
|
88
|
+
if (after != null) {
|
|
89
|
+
_queryParams.after = after.toISOString();
|
|
90
|
+
}
|
|
91
|
+
if (ascending != null) {
|
|
92
|
+
_queryParams.ascending = ascending.toString();
|
|
93
|
+
}
|
|
94
|
+
const _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);
|
|
95
|
+
const _response = yield core.fetcher({
|
|
96
|
+
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`),
|
|
97
|
+
method: "GET",
|
|
98
|
+
headers: _headers,
|
|
99
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
100
|
+
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,
|
|
101
|
+
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,
|
|
102
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
103
|
+
});
|
|
104
|
+
if (_response.ok) {
|
|
105
|
+
return {
|
|
106
|
+
data: serializers.ListMessagesResponse.parseOrThrow(_response.body, {
|
|
107
|
+
unrecognizedObjectKeys: "passthrough",
|
|
108
|
+
allowUnrecognizedUnionMembers: true,
|
|
109
|
+
allowUnrecognizedEnumValues: true,
|
|
110
|
+
skipValidation: true,
|
|
111
|
+
breadcrumbsPrefix: ["response"],
|
|
112
|
+
}),
|
|
113
|
+
rawResponse: _response.rawResponse,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
if (_response.error.reason === "status-code") {
|
|
117
|
+
switch (_response.error.statusCode) {
|
|
118
|
+
case 404:
|
|
119
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
108
120
|
unrecognizedObjectKeys: "passthrough",
|
|
109
121
|
allowUnrecognizedUnionMembers: true,
|
|
110
122
|
allowUnrecognizedEnumValues: true,
|
|
111
123
|
skipValidation: true,
|
|
112
124
|
breadcrumbsPrefix: ["response"],
|
|
113
|
-
}),
|
|
114
|
-
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
if (_response.error.reason === "status-code") {
|
|
118
|
-
switch (_response.error.statusCode) {
|
|
119
|
-
case 404:
|
|
120
|
-
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
121
|
-
unrecognizedObjectKeys: "passthrough",
|
|
122
|
-
allowUnrecognizedUnionMembers: true,
|
|
123
|
-
allowUnrecognizedEnumValues: true,
|
|
124
|
-
skipValidation: true,
|
|
125
|
-
breadcrumbsPrefix: ["response"],
|
|
126
|
-
}), _response.rawResponse);
|
|
127
|
-
default:
|
|
128
|
-
throw new errors.AgentMailError({
|
|
129
|
-
statusCode: _response.error.statusCode,
|
|
130
|
-
body: _response.error.body,
|
|
131
|
-
rawResponse: _response.rawResponse,
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
switch (_response.error.reason) {
|
|
136
|
-
case "non-json":
|
|
125
|
+
}), _response.rawResponse);
|
|
126
|
+
default:
|
|
137
127
|
throw new errors.AgentMailError({
|
|
138
128
|
statusCode: _response.error.statusCode,
|
|
139
|
-
body: _response.error.
|
|
140
|
-
rawResponse: _response.rawResponse,
|
|
141
|
-
});
|
|
142
|
-
case "timeout":
|
|
143
|
-
throw new errors.AgentMailTimeoutError("Timeout exceeded when calling GET /v0/inboxes/{inbox_id}/messages.");
|
|
144
|
-
case "unknown":
|
|
145
|
-
throw new errors.AgentMailError({
|
|
146
|
-
message: _response.error.errorMessage,
|
|
129
|
+
body: _response.error.body,
|
|
147
130
|
rawResponse: _response.rawResponse,
|
|
148
131
|
});
|
|
149
132
|
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
133
|
+
}
|
|
134
|
+
switch (_response.error.reason) {
|
|
135
|
+
case "non-json":
|
|
136
|
+
throw new errors.AgentMailError({
|
|
137
|
+
statusCode: _response.error.statusCode,
|
|
138
|
+
body: _response.error.rawBody,
|
|
139
|
+
rawResponse: _response.rawResponse,
|
|
140
|
+
});
|
|
141
|
+
case "timeout":
|
|
142
|
+
throw new errors.AgentMailTimeoutError("Timeout exceeded when calling GET /v0/inboxes/{inbox_id}/messages.");
|
|
143
|
+
case "unknown":
|
|
144
|
+
throw new errors.AgentMailError({
|
|
145
|
+
message: _response.error.errorMessage,
|
|
146
|
+
rawResponse: _response.rawResponse,
|
|
147
|
+
});
|
|
148
|
+
}
|
|
162
149
|
});
|
|
163
150
|
}
|
|
164
151
|
/**
|
|
@@ -20,7 +20,8 @@ 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):
|
|
23
|
+
list(inboxId: AgentMail.inboxes.InboxId, request?: AgentMail.inboxes.ListThreadsRequest, requestOptions?: Threads.RequestOptions): core.HttpResponsePromise<AgentMail.ListThreadsResponse>;
|
|
24
|
+
private __list;
|
|
24
25
|
/**
|
|
25
26
|
* @param {AgentMail.inboxes.InboxId} inboxId
|
|
26
27
|
* @param {AgentMail.ThreadId} threadId
|