agentmail 0.0.78 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -2
- 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/events/types/Bounce.d.ts +1 -0
- package/dist/cjs/api/resources/events/types/Complaint.d.ts +1 -0
- package/dist/cjs/api/resources/events/types/Delivery.d.ts +1 -0
- package/dist/cjs/api/resources/events/types/Reject.d.ts +1 -0
- package/dist/cjs/api/resources/events/types/Send.d.ts +1 -0
- 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/exports.d.ts +2 -0
- package/dist/cjs/core/exports.js +18 -0
- 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 +33 -0
- package/dist/cjs/core/pagination/Page.js +101 -0
- package/dist/cjs/core/pagination/exports.d.ts +1 -0
- package/dist/cjs/core/pagination/exports.js +2 -0
- package/dist/cjs/core/pagination/index.d.ts +1 -0
- package/dist/cjs/core/pagination/index.js +5 -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/exports.d.ts +8 -0
- package/dist/cjs/core/websocket/exports.js +2 -0
- package/dist/cjs/exports.d.ts +1 -0
- package/dist/cjs/exports.js +17 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +4 -0
- package/dist/cjs/serialization/resources/events/types/Bounce.d.ts +2 -0
- package/dist/cjs/serialization/resources/events/types/Bounce.js +2 -0
- package/dist/cjs/serialization/resources/events/types/Complaint.d.ts +2 -0
- package/dist/cjs/serialization/resources/events/types/Complaint.js +2 -0
- package/dist/cjs/serialization/resources/events/types/Delivery.d.ts +2 -0
- package/dist/cjs/serialization/resources/events/types/Delivery.js +2 -0
- package/dist/cjs/serialization/resources/events/types/Reject.d.ts +2 -0
- package/dist/cjs/serialization/resources/events/types/Reject.js +2 -0
- package/dist/cjs/serialization/resources/events/types/Send.d.ts +2 -0
- package/dist/cjs/serialization/resources/events/types/Send.js +2 -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/events/types/Bounce.d.mts +1 -0
- package/dist/esm/api/resources/events/types/Complaint.d.mts +1 -0
- package/dist/esm/api/resources/events/types/Delivery.d.mts +1 -0
- package/dist/esm/api/resources/events/types/Reject.d.mts +1 -0
- package/dist/esm/api/resources/events/types/Send.d.mts +1 -0
- 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/exports.d.mts +2 -0
- package/dist/esm/core/exports.mjs +2 -0
- 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 +33 -0
- package/dist/esm/core/pagination/Page.mjs +97 -0
- package/dist/esm/core/pagination/exports.d.mts +1 -0
- package/dist/esm/core/pagination/exports.mjs +1 -0
- package/dist/esm/core/pagination/index.d.mts +1 -0
- package/dist/esm/core/pagination/index.mjs +1 -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/exports.d.mts +8 -0
- package/dist/esm/core/websocket/exports.mjs +1 -0
- package/dist/esm/exports.d.mts +1 -0
- package/dist/esm/exports.mjs +1 -0
- package/dist/esm/index.d.mts +1 -0
- package/dist/esm/index.mjs +1 -0
- package/dist/esm/serialization/resources/events/types/Bounce.d.mts +2 -0
- package/dist/esm/serialization/resources/events/types/Bounce.mjs +2 -0
- package/dist/esm/serialization/resources/events/types/Complaint.d.mts +2 -0
- package/dist/esm/serialization/resources/events/types/Complaint.mjs +2 -0
- package/dist/esm/serialization/resources/events/types/Delivery.d.mts +2 -0
- package/dist/esm/serialization/resources/events/types/Delivery.mjs +2 -0
- package/dist/esm/serialization/resources/events/types/Reject.d.mts +2 -0
- package/dist/esm/serialization/resources/events/types/Reject.mjs +2 -0
- package/dist/esm/serialization/resources/events/types/Send.d.mts +2 -0
- package/dist/esm/serialization/resources/events/types/Send.mjs +2 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +196 -28
|
@@ -65,87 +65,100 @@ class Threads {
|
|
|
65
65
|
* @example
|
|
66
66
|
* await client.inboxes.threads.list("inbox_id")
|
|
67
67
|
*/
|
|
68
|
-
list(
|
|
69
|
-
return core.HttpResponsePromise.fromPromise(this.__list(inboxId, request, requestOptions));
|
|
70
|
-
}
|
|
71
|
-
__list(inboxId_1) {
|
|
68
|
+
list(inboxId_1) {
|
|
72
69
|
return __awaiter(this, arguments, void 0, function* (inboxId, request = {}, requestOptions) {
|
|
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
|
-
headers:
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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, {
|
|
70
|
+
const list = core.HttpResponsePromise.interceptFunction((request) => __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
72
|
+
const { limit, pageToken, labels, before, after, ascending } = request;
|
|
73
|
+
const _queryParams = {};
|
|
74
|
+
if (limit != null) {
|
|
75
|
+
_queryParams.limit = limit.toString();
|
|
76
|
+
}
|
|
77
|
+
if (pageToken != null) {
|
|
78
|
+
_queryParams.page_token = pageToken;
|
|
79
|
+
}
|
|
80
|
+
if (labels != null) {
|
|
81
|
+
_queryParams.labels = (0, json_js_1.toJson)(serializers.Labels.jsonOrThrow(labels, {
|
|
82
|
+
unrecognizedObjectKeys: "strip",
|
|
83
|
+
omitUndefined: true,
|
|
84
|
+
}));
|
|
85
|
+
}
|
|
86
|
+
if (before != null) {
|
|
87
|
+
_queryParams.before = before.toISOString();
|
|
88
|
+
}
|
|
89
|
+
if (after != null) {
|
|
90
|
+
_queryParams.after = after.toISOString();
|
|
91
|
+
}
|
|
92
|
+
if (ascending != null) {
|
|
93
|
+
_queryParams.ascending = ascending.toString();
|
|
94
|
+
}
|
|
95
|
+
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);
|
|
96
|
+
const _response = yield core.fetcher({
|
|
97
|
+
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`),
|
|
98
|
+
method: "GET",
|
|
99
|
+
headers: _headers,
|
|
100
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
101
|
+
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,
|
|
102
|
+
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,
|
|
103
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
104
|
+
});
|
|
105
|
+
if (_response.ok) {
|
|
106
|
+
return {
|
|
107
|
+
data: serializers.ListThreadsResponse.parseOrThrow(_response.body, {
|
|
120
108
|
unrecognizedObjectKeys: "passthrough",
|
|
121
109
|
allowUnrecognizedUnionMembers: true,
|
|
122
110
|
allowUnrecognizedEnumValues: true,
|
|
123
111
|
skipValidation: true,
|
|
124
112
|
breadcrumbsPrefix: ["response"],
|
|
125
|
-
}),
|
|
126
|
-
|
|
113
|
+
}),
|
|
114
|
+
rawResponse: _response.rawResponse,
|
|
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":
|
|
127
137
|
throw new errors.AgentMailError({
|
|
128
138
|
statusCode: _response.error.statusCode,
|
|
129
|
-
body: _response.error.
|
|
139
|
+
body: _response.error.rawBody,
|
|
140
|
+
rawResponse: _response.rawResponse,
|
|
141
|
+
});
|
|
142
|
+
case "timeout":
|
|
143
|
+
throw new errors.AgentMailTimeoutError("Timeout exceeded when calling GET /v0/inboxes/{inbox_id}/threads.");
|
|
144
|
+
case "unknown":
|
|
145
|
+
throw new errors.AgentMailError({
|
|
146
|
+
message: _response.error.errorMessage,
|
|
130
147
|
rawResponse: _response.rawResponse,
|
|
131
148
|
});
|
|
132
149
|
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
message: _response.error.errorMessage,
|
|
146
|
-
rawResponse: _response.rawResponse,
|
|
147
|
-
});
|
|
148
|
-
}
|
|
150
|
+
}));
|
|
151
|
+
const dataWithRawResponse = yield list(request).withRawResponse();
|
|
152
|
+
return new core.Page({
|
|
153
|
+
response: dataWithRawResponse.data,
|
|
154
|
+
rawResponse: dataWithRawResponse.rawResponse,
|
|
155
|
+
hasNextPage: (response) => (response === null || response === void 0 ? void 0 : response.nextPageToken) != null &&
|
|
156
|
+
!(typeof (response === null || response === void 0 ? void 0 : response.nextPageToken) === "string" && (response === null || response === void 0 ? void 0 : response.nextPageToken) === ""),
|
|
157
|
+
getItems: (response) => { var _a; return (_a = response === null || response === void 0 ? void 0 : response.threads) !== null && _a !== void 0 ? _a : []; },
|
|
158
|
+
loadPage: (response) => {
|
|
159
|
+
return list(core.setObjectProperty(request, "pageToken", response === null || response === void 0 ? void 0 : response.nextPageToken));
|
|
160
|
+
},
|
|
161
|
+
});
|
|
149
162
|
});
|
|
150
163
|
}
|
|
151
164
|
/**
|
|
@@ -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, AgentMail.pods.ListPodsResponse>>;
|
|
34
33
|
/**
|
|
35
34
|
* @param {AgentMail.pods.PodId} podId
|
|
36
35
|
* @param {Pods.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -81,64 +81,74 @@ class Pods {
|
|
|
81
81
|
* @example
|
|
82
82
|
* await client.pods.list()
|
|
83
83
|
*/
|
|
84
|
-
list(
|
|
85
|
-
return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
|
|
86
|
-
}
|
|
87
|
-
__list() {
|
|
84
|
+
list() {
|
|
88
85
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
if (_response.ok) {
|
|
109
|
-
return {
|
|
110
|
-
data: serializers.pods.ListPodsResponse.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,
|
|
86
|
+
const list = core.HttpResponsePromise.interceptFunction((request) => __awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
88
|
+
const { limit, pageToken } = request;
|
|
89
|
+
const _queryParams = {};
|
|
90
|
+
if (limit != null) {
|
|
91
|
+
_queryParams.limit = limit.toString();
|
|
92
|
+
}
|
|
93
|
+
if (pageToken != null) {
|
|
94
|
+
_queryParams.page_token = pageToken;
|
|
95
|
+
}
|
|
96
|
+
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);
|
|
97
|
+
const _response = yield core.fetcher({
|
|
98
|
+
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/pods"),
|
|
99
|
+
method: "GET",
|
|
100
|
+
headers: _headers,
|
|
101
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
102
|
+
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,
|
|
103
|
+
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,
|
|
104
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
125
105
|
});
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
106
|
+
if (_response.ok) {
|
|
107
|
+
return {
|
|
108
|
+
data: serializers.pods.ListPodsResponse.parseOrThrow(_response.body, {
|
|
109
|
+
unrecognizedObjectKeys: "passthrough",
|
|
110
|
+
allowUnrecognizedUnionMembers: true,
|
|
111
|
+
allowUnrecognizedEnumValues: true,
|
|
112
|
+
skipValidation: true,
|
|
113
|
+
breadcrumbsPrefix: ["response"],
|
|
114
|
+
}),
|
|
132
115
|
rawResponse: _response.rawResponse,
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
case "unknown":
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
if (_response.error.reason === "status-code") {
|
|
137
119
|
throw new errors.AgentMailError({
|
|
138
|
-
|
|
120
|
+
statusCode: _response.error.statusCode,
|
|
121
|
+
body: _response.error.body,
|
|
139
122
|
rawResponse: _response.rawResponse,
|
|
140
123
|
});
|
|
141
|
-
|
|
124
|
+
}
|
|
125
|
+
switch (_response.error.reason) {
|
|
126
|
+
case "non-json":
|
|
127
|
+
throw new errors.AgentMailError({
|
|
128
|
+
statusCode: _response.error.statusCode,
|
|
129
|
+
body: _response.error.rawBody,
|
|
130
|
+
rawResponse: _response.rawResponse,
|
|
131
|
+
});
|
|
132
|
+
case "timeout":
|
|
133
|
+
throw new errors.AgentMailTimeoutError("Timeout exceeded when calling GET /v0/pods.");
|
|
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.pods) !== 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
|
+
});
|
|
142
152
|
});
|
|
143
153
|
}
|
|
144
154
|
/**
|
|
@@ -20,8 +20,7 @@ export declare class Domains {
|
|
|
20
20
|
* @example
|
|
21
21
|
* await client.pods.domains.list("pod_id")
|
|
22
22
|
*/
|
|
23
|
-
list(podId: AgentMail.pods.PodId, request?: AgentMail.pods.ListDomainsRequest, requestOptions?: Domains.RequestOptions): core.
|
|
24
|
-
private __list;
|
|
23
|
+
list(podId: AgentMail.pods.PodId, request?: AgentMail.pods.ListDomainsRequest, requestOptions?: Domains.RequestOptions): Promise<core.Page<AgentMail.DomainSummary, AgentMail.ListDomainsResponse>>;
|
|
25
24
|
/**
|
|
26
25
|
* @param {AgentMail.pods.PodId} podId
|
|
27
26
|
* @param {AgentMail.CreateDomainRequest} request
|
|
@@ -65,87 +65,100 @@ class Domains {
|
|
|
65
65
|
* @example
|
|
66
66
|
* await client.pods.domains.list("pod_id")
|
|
67
67
|
*/
|
|
68
|
-
list(
|
|
69
|
-
return core.HttpResponsePromise.fromPromise(this.__list(podId, request, requestOptions));
|
|
70
|
-
}
|
|
71
|
-
__list(podId_1) {
|
|
68
|
+
list(podId_1) {
|
|
72
69
|
return __awaiter(this, arguments, void 0, function* (podId, request = {}, requestOptions) {
|
|
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
|
-
headers:
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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, {
|
|
70
|
+
const list = core.HttpResponsePromise.interceptFunction((request) => __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
72
|
+
const { limit, pageToken, labels, before, after, ascending } = request;
|
|
73
|
+
const _queryParams = {};
|
|
74
|
+
if (limit != null) {
|
|
75
|
+
_queryParams.limit = limit.toString();
|
|
76
|
+
}
|
|
77
|
+
if (pageToken != null) {
|
|
78
|
+
_queryParams.page_token = pageToken;
|
|
79
|
+
}
|
|
80
|
+
if (labels != null) {
|
|
81
|
+
_queryParams.labels = (0, json_js_1.toJson)(serializers.Labels.jsonOrThrow(labels, {
|
|
82
|
+
unrecognizedObjectKeys: "strip",
|
|
83
|
+
omitUndefined: true,
|
|
84
|
+
}));
|
|
85
|
+
}
|
|
86
|
+
if (before != null) {
|
|
87
|
+
_queryParams.before = before.toISOString();
|
|
88
|
+
}
|
|
89
|
+
if (after != null) {
|
|
90
|
+
_queryParams.after = after.toISOString();
|
|
91
|
+
}
|
|
92
|
+
if (ascending != null) {
|
|
93
|
+
_queryParams.ascending = ascending.toString();
|
|
94
|
+
}
|
|
95
|
+
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);
|
|
96
|
+
const _response = yield core.fetcher({
|
|
97
|
+
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/pods/${core.url.encodePathParam(serializers.pods.PodId.jsonOrThrow(podId, { omitUndefined: true }))}/domains`),
|
|
98
|
+
method: "GET",
|
|
99
|
+
headers: _headers,
|
|
100
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
101
|
+
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,
|
|
102
|
+
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,
|
|
103
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
104
|
+
});
|
|
105
|
+
if (_response.ok) {
|
|
106
|
+
return {
|
|
107
|
+
data: serializers.ListDomainsResponse.parseOrThrow(_response.body, {
|
|
120
108
|
unrecognizedObjectKeys: "passthrough",
|
|
121
109
|
allowUnrecognizedUnionMembers: true,
|
|
122
110
|
allowUnrecognizedEnumValues: true,
|
|
123
111
|
skipValidation: true,
|
|
124
112
|
breadcrumbsPrefix: ["response"],
|
|
125
|
-
}),
|
|
126
|
-
|
|
113
|
+
}),
|
|
114
|
+
rawResponse: _response.rawResponse,
|
|
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":
|
|
127
137
|
throw new errors.AgentMailError({
|
|
128
138
|
statusCode: _response.error.statusCode,
|
|
129
|
-
body: _response.error.
|
|
139
|
+
body: _response.error.rawBody,
|
|
140
|
+
rawResponse: _response.rawResponse,
|
|
141
|
+
});
|
|
142
|
+
case "timeout":
|
|
143
|
+
throw new errors.AgentMailTimeoutError("Timeout exceeded when calling GET /v0/pods/{pod_id}/domains.");
|
|
144
|
+
case "unknown":
|
|
145
|
+
throw new errors.AgentMailError({
|
|
146
|
+
message: _response.error.errorMessage,
|
|
130
147
|
rawResponse: _response.rawResponse,
|
|
131
148
|
});
|
|
132
149
|
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
message: _response.error.errorMessage,
|
|
146
|
-
rawResponse: _response.rawResponse,
|
|
147
|
-
});
|
|
148
|
-
}
|
|
150
|
+
}));
|
|
151
|
+
const dataWithRawResponse = yield list(request).withRawResponse();
|
|
152
|
+
return new core.Page({
|
|
153
|
+
response: dataWithRawResponse.data,
|
|
154
|
+
rawResponse: dataWithRawResponse.rawResponse,
|
|
155
|
+
hasNextPage: (response) => (response === null || response === void 0 ? void 0 : response.nextPageToken) != null &&
|
|
156
|
+
!(typeof (response === null || response === void 0 ? void 0 : response.nextPageToken) === "string" && (response === null || response === void 0 ? void 0 : response.nextPageToken) === ""),
|
|
157
|
+
getItems: (response) => { var _a; return (_a = response === null || response === void 0 ? void 0 : response.domains) !== null && _a !== void 0 ? _a : []; },
|
|
158
|
+
loadPage: (response) => {
|
|
159
|
+
return list(core.setObjectProperty(request, "pageToken", response === null || response === void 0 ? void 0 : response.nextPageToken));
|
|
160
|
+
},
|
|
161
|
+
});
|
|
149
162
|
});
|
|
150
163
|
}
|
|
151
164
|
/**
|
|
@@ -20,8 +20,7 @@ export declare class Drafts {
|
|
|
20
20
|
* @example
|
|
21
21
|
* await client.pods.drafts.list("pod_id")
|
|
22
22
|
*/
|
|
23
|
-
list(podId: AgentMail.pods.PodId, request?: AgentMail.pods.ListDraftsRequest, requestOptions?: Drafts.RequestOptions): core.
|
|
24
|
-
private __list;
|
|
23
|
+
list(podId: AgentMail.pods.PodId, request?: AgentMail.pods.ListDraftsRequest, requestOptions?: Drafts.RequestOptions): Promise<core.Page<AgentMail.DraftItem, AgentMail.ListDraftsResponse>>;
|
|
25
24
|
/**
|
|
26
25
|
* @param {AgentMail.pods.PodId} podId
|
|
27
26
|
* @param {AgentMail.DraftId} draftId
|