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
package/dist/cjs/Client.js
CHANGED
|
@@ -51,8 +51,8 @@ class AgentMailClient {
|
|
|
51
51
|
this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
|
|
52
52
|
"X-Fern-Language": "JavaScript",
|
|
53
53
|
"X-Fern-SDK-Name": "agentmail",
|
|
54
|
-
"X-Fern-SDK-Version": "0.1.
|
|
55
|
-
"User-Agent": "agentmail/0.1.
|
|
54
|
+
"X-Fern-SDK-Version": "0.1.3",
|
|
55
|
+
"User-Agent": "agentmail/0.1.3",
|
|
56
56
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
57
57
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
58
58
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -17,7 +17,8 @@ export declare class ApiKeys {
|
|
|
17
17
|
* @example
|
|
18
18
|
* await client.apiKeys.list()
|
|
19
19
|
*/
|
|
20
|
-
list(request?: AgentMail.ListApiKeysRequest, requestOptions?: ApiKeys.RequestOptions):
|
|
20
|
+
list(request?: AgentMail.ListApiKeysRequest, requestOptions?: ApiKeys.RequestOptions): core.HttpResponsePromise<AgentMail.ListApiKeysResponse>;
|
|
21
|
+
private __list;
|
|
21
22
|
/**
|
|
22
23
|
* @param {AgentMail.CreateApiKeyRequest} request
|
|
23
24
|
* @param {ApiKeys.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -61,74 +61,64 @@ class ApiKeys {
|
|
|
61
61
|
* @example
|
|
62
62
|
* await client.apiKeys.list()
|
|
63
63
|
*/
|
|
64
|
-
list() {
|
|
64
|
+
list(request = {}, requestOptions) {
|
|
65
|
+
return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
|
|
66
|
+
}
|
|
67
|
+
__list() {
|
|
65
68
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
69
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
70
|
+
const { limit, pageToken } = request;
|
|
71
|
+
const _queryParams = {};
|
|
72
|
+
if (limit != null) {
|
|
73
|
+
_queryParams.limit = limit.toString();
|
|
74
|
+
}
|
|
75
|
+
if (pageToken != null) {
|
|
76
|
+
_queryParams.page_token = pageToken;
|
|
77
|
+
}
|
|
78
|
+
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);
|
|
79
|
+
const _response = yield core.fetcher({
|
|
80
|
+
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/api-keys"),
|
|
81
|
+
method: "GET",
|
|
82
|
+
headers: _headers,
|
|
83
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
84
|
+
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,
|
|
85
|
+
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,
|
|
86
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
87
|
+
});
|
|
88
|
+
if (_response.ok) {
|
|
89
|
+
return {
|
|
90
|
+
data: serializers.ListApiKeysResponse.parseOrThrow(_response.body, {
|
|
91
|
+
unrecognizedObjectKeys: "passthrough",
|
|
92
|
+
allowUnrecognizedUnionMembers: true,
|
|
93
|
+
allowUnrecognizedEnumValues: true,
|
|
94
|
+
skipValidation: true,
|
|
95
|
+
breadcrumbsPrefix: ["response"],
|
|
96
|
+
}),
|
|
97
|
+
rawResponse: _response.rawResponse,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
if (_response.error.reason === "status-code") {
|
|
101
|
+
throw new errors.AgentMailError({
|
|
102
|
+
statusCode: _response.error.statusCode,
|
|
103
|
+
body: _response.error.body,
|
|
104
|
+
rawResponse: _response.rawResponse,
|
|
85
105
|
});
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
unrecognizedObjectKeys: "passthrough",
|
|
90
|
-
allowUnrecognizedUnionMembers: true,
|
|
91
|
-
allowUnrecognizedEnumValues: true,
|
|
92
|
-
skipValidation: true,
|
|
93
|
-
breadcrumbsPrefix: ["response"],
|
|
94
|
-
}),
|
|
95
|
-
rawResponse: _response.rawResponse,
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
if (_response.error.reason === "status-code") {
|
|
106
|
+
}
|
|
107
|
+
switch (_response.error.reason) {
|
|
108
|
+
case "non-json":
|
|
99
109
|
throw new errors.AgentMailError({
|
|
100
110
|
statusCode: _response.error.statusCode,
|
|
101
|
-
body: _response.error.
|
|
111
|
+
body: _response.error.rawBody,
|
|
102
112
|
rawResponse: _response.rawResponse,
|
|
103
113
|
});
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
case "timeout":
|
|
113
|
-
throw new errors.AgentMailTimeoutError("Timeout exceeded when calling GET /v0/api-keys.");
|
|
114
|
-
case "unknown":
|
|
115
|
-
throw new errors.AgentMailError({
|
|
116
|
-
message: _response.error.errorMessage,
|
|
117
|
-
rawResponse: _response.rawResponse,
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
}));
|
|
121
|
-
const dataWithRawResponse = yield list(request).withRawResponse();
|
|
122
|
-
return new core.Page({
|
|
123
|
-
response: dataWithRawResponse.data,
|
|
124
|
-
rawResponse: dataWithRawResponse.rawResponse,
|
|
125
|
-
hasNextPage: (response) => (response === null || response === void 0 ? void 0 : response.nextPageToken) != null &&
|
|
126
|
-
!(typeof (response === null || response === void 0 ? void 0 : response.nextPageToken) === "string" && (response === null || response === void 0 ? void 0 : response.nextPageToken) === ""),
|
|
127
|
-
getItems: (response) => { var _a; return (_a = response === null || response === void 0 ? void 0 : response.apiKeys) !== null && _a !== void 0 ? _a : []; },
|
|
128
|
-
loadPage: (response) => {
|
|
129
|
-
return list(core.setObjectProperty(request, "pageToken", response === null || response === void 0 ? void 0 : response.nextPageToken));
|
|
130
|
-
},
|
|
131
|
-
});
|
|
114
|
+
case "timeout":
|
|
115
|
+
throw new errors.AgentMailTimeoutError("Timeout exceeded when calling GET /v0/api-keys.");
|
|
116
|
+
case "unknown":
|
|
117
|
+
throw new errors.AgentMailError({
|
|
118
|
+
message: _response.error.errorMessage,
|
|
119
|
+
rawResponse: _response.rawResponse,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
132
122
|
});
|
|
133
123
|
}
|
|
134
124
|
/**
|
|
@@ -17,7 +17,8 @@ export declare class Domains {
|
|
|
17
17
|
* @example
|
|
18
18
|
* await client.domains.list()
|
|
19
19
|
*/
|
|
20
|
-
list(request?: AgentMail.ListDomainsRequest, requestOptions?: Domains.RequestOptions):
|
|
20
|
+
list(request?: AgentMail.ListDomainsRequest, requestOptions?: Domains.RequestOptions): core.HttpResponsePromise<AgentMail.ListDomainsResponse>;
|
|
21
|
+
private __list;
|
|
21
22
|
/**
|
|
22
23
|
* @param {AgentMail.DomainId} domainId
|
|
23
24
|
* @param {Domains.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -61,74 +61,64 @@ class Domains {
|
|
|
61
61
|
* @example
|
|
62
62
|
* await client.domains.list()
|
|
63
63
|
*/
|
|
64
|
-
list() {
|
|
64
|
+
list(request = {}, requestOptions) {
|
|
65
|
+
return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
|
|
66
|
+
}
|
|
67
|
+
__list() {
|
|
65
68
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
69
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
70
|
+
const { limit, pageToken } = request;
|
|
71
|
+
const _queryParams = {};
|
|
72
|
+
if (limit != null) {
|
|
73
|
+
_queryParams.limit = limit.toString();
|
|
74
|
+
}
|
|
75
|
+
if (pageToken != null) {
|
|
76
|
+
_queryParams.page_token = pageToken;
|
|
77
|
+
}
|
|
78
|
+
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);
|
|
79
|
+
const _response = yield core.fetcher({
|
|
80
|
+
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/domains"),
|
|
81
|
+
method: "GET",
|
|
82
|
+
headers: _headers,
|
|
83
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
84
|
+
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,
|
|
85
|
+
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,
|
|
86
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
87
|
+
});
|
|
88
|
+
if (_response.ok) {
|
|
89
|
+
return {
|
|
90
|
+
data: serializers.ListDomainsResponse.parseOrThrow(_response.body, {
|
|
91
|
+
unrecognizedObjectKeys: "passthrough",
|
|
92
|
+
allowUnrecognizedUnionMembers: true,
|
|
93
|
+
allowUnrecognizedEnumValues: true,
|
|
94
|
+
skipValidation: true,
|
|
95
|
+
breadcrumbsPrefix: ["response"],
|
|
96
|
+
}),
|
|
97
|
+
rawResponse: _response.rawResponse,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
if (_response.error.reason === "status-code") {
|
|
101
|
+
throw new errors.AgentMailError({
|
|
102
|
+
statusCode: _response.error.statusCode,
|
|
103
|
+
body: _response.error.body,
|
|
104
|
+
rawResponse: _response.rawResponse,
|
|
85
105
|
});
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
unrecognizedObjectKeys: "passthrough",
|
|
90
|
-
allowUnrecognizedUnionMembers: true,
|
|
91
|
-
allowUnrecognizedEnumValues: true,
|
|
92
|
-
skipValidation: true,
|
|
93
|
-
breadcrumbsPrefix: ["response"],
|
|
94
|
-
}),
|
|
95
|
-
rawResponse: _response.rawResponse,
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
if (_response.error.reason === "status-code") {
|
|
106
|
+
}
|
|
107
|
+
switch (_response.error.reason) {
|
|
108
|
+
case "non-json":
|
|
99
109
|
throw new errors.AgentMailError({
|
|
100
110
|
statusCode: _response.error.statusCode,
|
|
101
|
-
body: _response.error.
|
|
111
|
+
body: _response.error.rawBody,
|
|
102
112
|
rawResponse: _response.rawResponse,
|
|
103
113
|
});
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
case "timeout":
|
|
113
|
-
throw new errors.AgentMailTimeoutError("Timeout exceeded when calling GET /v0/domains.");
|
|
114
|
-
case "unknown":
|
|
115
|
-
throw new errors.AgentMailError({
|
|
116
|
-
message: _response.error.errorMessage,
|
|
117
|
-
rawResponse: _response.rawResponse,
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
}));
|
|
121
|
-
const dataWithRawResponse = yield list(request).withRawResponse();
|
|
122
|
-
return new core.Page({
|
|
123
|
-
response: dataWithRawResponse.data,
|
|
124
|
-
rawResponse: dataWithRawResponse.rawResponse,
|
|
125
|
-
hasNextPage: (response) => (response === null || response === void 0 ? void 0 : response.nextPageToken) != null &&
|
|
126
|
-
!(typeof (response === null || response === void 0 ? void 0 : response.nextPageToken) === "string" && (response === null || response === void 0 ? void 0 : response.nextPageToken) === ""),
|
|
127
|
-
getItems: (response) => { var _a; return (_a = response === null || response === void 0 ? void 0 : response.domains) !== null && _a !== void 0 ? _a : []; },
|
|
128
|
-
loadPage: (response) => {
|
|
129
|
-
return list(core.setObjectProperty(request, "pageToken", response === null || response === void 0 ? void 0 : response.nextPageToken));
|
|
130
|
-
},
|
|
131
|
-
});
|
|
114
|
+
case "timeout":
|
|
115
|
+
throw new errors.AgentMailTimeoutError("Timeout exceeded when calling GET /v0/domains.");
|
|
116
|
+
case "unknown":
|
|
117
|
+
throw new errors.AgentMailError({
|
|
118
|
+
message: _response.error.errorMessage,
|
|
119
|
+
rawResponse: _response.rawResponse,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
132
122
|
});
|
|
133
123
|
}
|
|
134
124
|
/**
|
|
@@ -19,7 +19,8 @@ export declare class Drafts {
|
|
|
19
19
|
* @example
|
|
20
20
|
* await client.drafts.list()
|
|
21
21
|
*/
|
|
22
|
-
list(request?: AgentMail.ListDraftsRequest, requestOptions?: Drafts.RequestOptions):
|
|
22
|
+
list(request?: AgentMail.ListDraftsRequest, requestOptions?: Drafts.RequestOptions): core.HttpResponsePromise<AgentMail.ListDraftsResponse>;
|
|
23
|
+
private __list;
|
|
23
24
|
/**
|
|
24
25
|
* @param {AgentMail.DraftId} draftId
|
|
25
26
|
* @param {Drafts.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -64,100 +64,87 @@ class Drafts {
|
|
|
64
64
|
* @example
|
|
65
65
|
* await client.drafts.list()
|
|
66
66
|
*/
|
|
67
|
-
list() {
|
|
67
|
+
list(request = {}, requestOptions) {
|
|
68
|
+
return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
|
|
69
|
+
}
|
|
70
|
+
__list() {
|
|
68
71
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
69
|
-
|
|
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
|
-
|
|
72
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
73
|
+
const { limit, pageToken, labels, before, after, ascending } = request;
|
|
74
|
+
const _queryParams = {};
|
|
75
|
+
if (limit != null) {
|
|
76
|
+
_queryParams.limit = limit.toString();
|
|
77
|
+
}
|
|
78
|
+
if (pageToken != null) {
|
|
79
|
+
_queryParams.page_token = pageToken;
|
|
80
|
+
}
|
|
81
|
+
if (labels != null) {
|
|
82
|
+
_queryParams.labels = (0, json_js_1.toJson)(serializers.Labels.jsonOrThrow(labels, { unrecognizedObjectKeys: "strip", omitUndefined: true }));
|
|
83
|
+
}
|
|
84
|
+
if (before != null) {
|
|
85
|
+
_queryParams.before = before.toISOString();
|
|
86
|
+
}
|
|
87
|
+
if (after != null) {
|
|
88
|
+
_queryParams.after = after.toISOString();
|
|
89
|
+
}
|
|
90
|
+
if (ascending != null) {
|
|
91
|
+
_queryParams.ascending = ascending.toString();
|
|
92
|
+
}
|
|
93
|
+
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);
|
|
94
|
+
const _response = yield core.fetcher({
|
|
95
|
+
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"),
|
|
96
|
+
method: "GET",
|
|
97
|
+
headers: _headers,
|
|
98
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
99
|
+
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,
|
|
100
|
+
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,
|
|
101
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
102
|
+
});
|
|
103
|
+
if (_response.ok) {
|
|
104
|
+
return {
|
|
105
|
+
data: serializers.ListDraftsResponse.parseOrThrow(_response.body, {
|
|
106
|
+
unrecognizedObjectKeys: "passthrough",
|
|
107
|
+
allowUnrecognizedUnionMembers: true,
|
|
108
|
+
allowUnrecognizedEnumValues: true,
|
|
109
|
+
skipValidation: true,
|
|
110
|
+
breadcrumbsPrefix: ["response"],
|
|
111
|
+
}),
|
|
112
|
+
rawResponse: _response.rawResponse,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
if (_response.error.reason === "status-code") {
|
|
116
|
+
switch (_response.error.statusCode) {
|
|
117
|
+
case 404:
|
|
118
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
107
119
|
unrecognizedObjectKeys: "passthrough",
|
|
108
120
|
allowUnrecognizedUnionMembers: true,
|
|
109
121
|
allowUnrecognizedEnumValues: true,
|
|
110
122
|
skipValidation: true,
|
|
111
123
|
breadcrumbsPrefix: ["response"],
|
|
112
|
-
}),
|
|
113
|
-
|
|
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, {
|
|
120
|
-
unrecognizedObjectKeys: "passthrough",
|
|
121
|
-
allowUnrecognizedUnionMembers: true,
|
|
122
|
-
allowUnrecognizedEnumValues: true,
|
|
123
|
-
skipValidation: true,
|
|
124
|
-
breadcrumbsPrefix: ["response"],
|
|
125
|
-
}), _response.rawResponse);
|
|
126
|
-
default:
|
|
127
|
-
throw new errors.AgentMailError({
|
|
128
|
-
statusCode: _response.error.statusCode,
|
|
129
|
-
body: _response.error.body,
|
|
130
|
-
rawResponse: _response.rawResponse,
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
switch (_response.error.reason) {
|
|
135
|
-
case "non-json":
|
|
124
|
+
}), _response.rawResponse);
|
|
125
|
+
default:
|
|
136
126
|
throw new errors.AgentMailError({
|
|
137
127
|
statusCode: _response.error.statusCode,
|
|
138
|
-
body: _response.error.
|
|
139
|
-
rawResponse: _response.rawResponse,
|
|
140
|
-
});
|
|
141
|
-
case "timeout":
|
|
142
|
-
throw new errors.AgentMailTimeoutError("Timeout exceeded when calling GET /v0/drafts.");
|
|
143
|
-
case "unknown":
|
|
144
|
-
throw new errors.AgentMailError({
|
|
145
|
-
message: _response.error.errorMessage,
|
|
128
|
+
body: _response.error.body,
|
|
146
129
|
rawResponse: _response.rawResponse,
|
|
147
130
|
});
|
|
148
131
|
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
132
|
+
}
|
|
133
|
+
switch (_response.error.reason) {
|
|
134
|
+
case "non-json":
|
|
135
|
+
throw new errors.AgentMailError({
|
|
136
|
+
statusCode: _response.error.statusCode,
|
|
137
|
+
body: _response.error.rawBody,
|
|
138
|
+
rawResponse: _response.rawResponse,
|
|
139
|
+
});
|
|
140
|
+
case "timeout":
|
|
141
|
+
throw new errors.AgentMailTimeoutError("Timeout exceeded when calling GET /v0/drafts.");
|
|
142
|
+
case "unknown":
|
|
143
|
+
throw new errors.AgentMailError({
|
|
144
|
+
message: _response.error.errorMessage,
|
|
145
|
+
rawResponse: _response.rawResponse,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
161
148
|
});
|
|
162
149
|
}
|
|
163
150
|
/**
|
|
@@ -29,7 +29,8 @@ export declare class Inboxes {
|
|
|
29
29
|
* @example
|
|
30
30
|
* await client.inboxes.list()
|
|
31
31
|
*/
|
|
32
|
-
list(request?: AgentMail.inboxes.ListInboxesRequest, requestOptions?: Inboxes.RequestOptions):
|
|
32
|
+
list(request?: AgentMail.inboxes.ListInboxesRequest, requestOptions?: Inboxes.RequestOptions): core.HttpResponsePromise<AgentMail.inboxes.ListInboxesResponse>;
|
|
33
|
+
private __list;
|
|
33
34
|
/**
|
|
34
35
|
* @param {AgentMail.inboxes.InboxId} inboxId
|
|
35
36
|
* @param {Inboxes.RequestOptions} requestOptions - Request-specific configuration.
|