agentmail 0.0.73 → 0.0.75
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 +21 -21
- 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 +24 -7
- package/dist/cjs/api/resources/domains/client/Client.js +187 -76
- package/dist/cjs/api/resources/domains/types/Domain.d.ts +0 -1
- 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/drafts/types/CreateDraftRequest.d.ts +1 -0
- package/dist/cjs/api/resources/drafts/types/Draft.d.ts +1 -0
- package/dist/cjs/api/resources/drafts/types/DraftClientId.d.ts +7 -0
- package/dist/cjs/api/resources/drafts/types/DraftClientId.js +5 -0
- package/dist/cjs/api/resources/drafts/types/UpdateDraftRequest.d.ts +14 -0
- package/dist/cjs/api/resources/drafts/types/UpdateDraftRequest.js +5 -0
- package/dist/cjs/api/resources/drafts/types/index.d.ts +2 -0
- package/dist/cjs/api/resources/drafts/types/index.js +2 -0
- 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 +26 -2
- package/dist/cjs/api/resources/inboxes/resources/drafts/client/Client.js +161 -84
- 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/index.d.ts +0 -2
- package/dist/cjs/core/index.js +0 -2
- package/dist/cjs/serialization/resources/domains/types/Domain.d.ts +0 -2
- package/dist/cjs/serialization/resources/domains/types/Domain.js +0 -2
- package/dist/cjs/serialization/resources/drafts/types/CreateDraftRequest.d.ts +2 -0
- package/dist/cjs/serialization/resources/drafts/types/CreateDraftRequest.js +2 -0
- package/dist/cjs/serialization/resources/drafts/types/Draft.d.ts +2 -0
- package/dist/cjs/serialization/resources/drafts/types/Draft.js +2 -0
- package/dist/cjs/serialization/resources/drafts/types/DraftClientId.d.ts +10 -0
- package/dist/cjs/serialization/resources/drafts/types/DraftClientId.js +41 -0
- package/dist/cjs/serialization/resources/drafts/types/UpdateDraftRequest.d.ts +27 -0
- package/dist/cjs/serialization/resources/drafts/types/UpdateDraftRequest.js +58 -0
- package/dist/cjs/serialization/resources/drafts/types/index.d.ts +2 -0
- package/dist/cjs/serialization/resources/drafts/types/index.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 +2 -1
- package/dist/esm/api/resources/apiKeys/client/Client.mjs +52 -62
- package/dist/esm/api/resources/domains/client/Client.d.mts +24 -7
- package/dist/esm/api/resources/domains/client/Client.mjs +187 -76
- package/dist/esm/api/resources/domains/types/Domain.d.mts +0 -1
- 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/drafts/types/CreateDraftRequest.d.mts +1 -0
- package/dist/esm/api/resources/drafts/types/Draft.d.mts +1 -0
- package/dist/esm/api/resources/drafts/types/DraftClientId.d.mts +7 -0
- package/dist/esm/api/resources/drafts/types/DraftClientId.mjs +4 -0
- package/dist/esm/api/resources/drafts/types/UpdateDraftRequest.d.mts +14 -0
- package/dist/esm/api/resources/drafts/types/UpdateDraftRequest.mjs +4 -0
- package/dist/esm/api/resources/drafts/types/index.d.mts +2 -0
- package/dist/esm/api/resources/drafts/types/index.mjs +2 -0
- 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 +26 -2
- package/dist/esm/api/resources/inboxes/resources/drafts/client/Client.mjs +161 -84
- 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/index.d.mts +0 -2
- package/dist/esm/core/index.mjs +0 -2
- package/dist/esm/serialization/resources/domains/types/Domain.d.mts +0 -2
- package/dist/esm/serialization/resources/domains/types/Domain.mjs +0 -2
- package/dist/esm/serialization/resources/drafts/types/CreateDraftRequest.d.mts +2 -0
- package/dist/esm/serialization/resources/drafts/types/CreateDraftRequest.mjs +2 -0
- package/dist/esm/serialization/resources/drafts/types/Draft.d.mts +2 -0
- package/dist/esm/serialization/resources/drafts/types/Draft.mjs +2 -0
- package/dist/esm/serialization/resources/drafts/types/DraftClientId.d.mts +10 -0
- package/dist/esm/serialization/resources/drafts/types/DraftClientId.mjs +5 -0
- package/dist/esm/serialization/resources/drafts/types/UpdateDraftRequest.d.mts +27 -0
- package/dist/esm/serialization/resources/drafts/types/UpdateDraftRequest.mjs +22 -0
- package/dist/esm/serialization/resources/drafts/types/index.d.mts +2 -0
- package/dist/esm/serialization/resources/drafts/types/index.mjs +2 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/dist/llms-full.txt +6644 -669
- package/dist/llms.txt +27 -9
- package/package.json +1 -1
- package/reference.md +204 -160
- package/dist/cjs/core/pagination/Page.d.ts +0 -32
- package/dist/cjs/core/pagination/Page.js +0 -100
- package/dist/cjs/core/pagination/Pageable.d.ts +0 -14
- package/dist/cjs/core/pagination/Pageable.js +0 -10
- package/dist/cjs/core/pagination/index.d.ts +0 -2
- package/dist/cjs/core/pagination/index.js +0 -7
- 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 -32
- package/dist/esm/core/pagination/Page.mjs +0 -96
- package/dist/esm/core/pagination/Pageable.d.mts +0 -14
- package/dist/esm/core/pagination/Pageable.mjs +0 -6
- package/dist/esm/core/pagination/index.d.mts +0 -2
- package/dist/esm/core/pagination/index.mjs +0 -2
- 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
|
@@ -31,100 +31,87 @@ export class Threads {
|
|
|
31
31
|
* @example
|
|
32
32
|
* await client.pods.threads.list("pod_id")
|
|
33
33
|
*/
|
|
34
|
-
list(
|
|
34
|
+
list(podId, request = {}, requestOptions) {
|
|
35
|
+
return core.HttpResponsePromise.fromPromise(this.__list(podId, request, requestOptions));
|
|
36
|
+
}
|
|
37
|
+
__list(podId_1) {
|
|
35
38
|
return __awaiter(this, arguments, void 0, function* (podId, request = {}, requestOptions) {
|
|
36
|
-
|
|
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
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
39
|
+
var _a, _b, _c;
|
|
40
|
+
const { limit, pageToken, labels, before, after, ascending } = request;
|
|
41
|
+
const _queryParams = {};
|
|
42
|
+
if (limit != null) {
|
|
43
|
+
_queryParams["limit"] = limit.toString();
|
|
44
|
+
}
|
|
45
|
+
if (pageToken != null) {
|
|
46
|
+
_queryParams["page_token"] = pageToken;
|
|
47
|
+
}
|
|
48
|
+
if (labels != null) {
|
|
49
|
+
_queryParams["labels"] = toJson(serializers.Labels.jsonOrThrow(labels, { unrecognizedObjectKeys: "strip", omitUndefined: true }));
|
|
50
|
+
}
|
|
51
|
+
if (before != null) {
|
|
52
|
+
_queryParams["before"] = before.toISOString();
|
|
53
|
+
}
|
|
54
|
+
if (after != null) {
|
|
55
|
+
_queryParams["after"] = after.toISOString();
|
|
56
|
+
}
|
|
57
|
+
if (ascending != null) {
|
|
58
|
+
_queryParams["ascending"] = ascending.toString();
|
|
59
|
+
}
|
|
60
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
61
|
+
const _response = yield core.fetcher({
|
|
62
|
+
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Production).http, `/v0/pods/${encodeURIComponent(serializers.pods.PodId.jsonOrThrow(podId, { omitUndefined: true }))}/threads`),
|
|
63
|
+
method: "GET",
|
|
64
|
+
headers: _headers,
|
|
65
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
66
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
67
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
68
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
69
|
+
});
|
|
70
|
+
if (_response.ok) {
|
|
71
|
+
return {
|
|
72
|
+
data: serializers.ListThreadsResponse.parseOrThrow(_response.body, {
|
|
73
|
+
unrecognizedObjectKeys: "passthrough",
|
|
74
|
+
allowUnrecognizedUnionMembers: true,
|
|
75
|
+
allowUnrecognizedEnumValues: true,
|
|
76
|
+
skipValidation: true,
|
|
77
|
+
breadcrumbsPrefix: ["response"],
|
|
78
|
+
}),
|
|
79
|
+
rawResponse: _response.rawResponse,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
if (_response.error.reason === "status-code") {
|
|
83
|
+
switch (_response.error.statusCode) {
|
|
84
|
+
case 404:
|
|
85
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
74
86
|
unrecognizedObjectKeys: "passthrough",
|
|
75
87
|
allowUnrecognizedUnionMembers: true,
|
|
76
88
|
allowUnrecognizedEnumValues: true,
|
|
77
89
|
skipValidation: true,
|
|
78
90
|
breadcrumbsPrefix: ["response"],
|
|
79
|
-
}),
|
|
80
|
-
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
if (_response.error.reason === "status-code") {
|
|
84
|
-
switch (_response.error.statusCode) {
|
|
85
|
-
case 404:
|
|
86
|
-
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
87
|
-
unrecognizedObjectKeys: "passthrough",
|
|
88
|
-
allowUnrecognizedUnionMembers: true,
|
|
89
|
-
allowUnrecognizedEnumValues: true,
|
|
90
|
-
skipValidation: true,
|
|
91
|
-
breadcrumbsPrefix: ["response"],
|
|
92
|
-
}), _response.rawResponse);
|
|
93
|
-
default:
|
|
94
|
-
throw new errors.AgentMailError({
|
|
95
|
-
statusCode: _response.error.statusCode,
|
|
96
|
-
body: _response.error.body,
|
|
97
|
-
rawResponse: _response.rawResponse,
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
switch (_response.error.reason) {
|
|
102
|
-
case "non-json":
|
|
91
|
+
}), _response.rawResponse);
|
|
92
|
+
default:
|
|
103
93
|
throw new errors.AgentMailError({
|
|
104
94
|
statusCode: _response.error.statusCode,
|
|
105
|
-
body: _response.error.
|
|
106
|
-
rawResponse: _response.rawResponse,
|
|
107
|
-
});
|
|
108
|
-
case "timeout":
|
|
109
|
-
throw new errors.AgentMailTimeoutError("Timeout exceeded when calling GET /v0/pods/{pod_id}/threads.");
|
|
110
|
-
case "unknown":
|
|
111
|
-
throw new errors.AgentMailError({
|
|
112
|
-
message: _response.error.errorMessage,
|
|
95
|
+
body: _response.error.body,
|
|
113
96
|
rawResponse: _response.rawResponse,
|
|
114
97
|
});
|
|
115
98
|
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
99
|
+
}
|
|
100
|
+
switch (_response.error.reason) {
|
|
101
|
+
case "non-json":
|
|
102
|
+
throw new errors.AgentMailError({
|
|
103
|
+
statusCode: _response.error.statusCode,
|
|
104
|
+
body: _response.error.rawBody,
|
|
105
|
+
rawResponse: _response.rawResponse,
|
|
106
|
+
});
|
|
107
|
+
case "timeout":
|
|
108
|
+
throw new errors.AgentMailTimeoutError("Timeout exceeded when calling GET /v0/pods/{pod_id}/threads.");
|
|
109
|
+
case "unknown":
|
|
110
|
+
throw new errors.AgentMailError({
|
|
111
|
+
message: _response.error.errorMessage,
|
|
112
|
+
rawResponse: _response.rawResponse,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
128
115
|
});
|
|
129
116
|
}
|
|
130
117
|
/**
|
|
@@ -38,7 +38,8 @@ export declare class Threads {
|
|
|
38
38
|
* @example
|
|
39
39
|
* await client.threads.list()
|
|
40
40
|
*/
|
|
41
|
-
list(request?: AgentMail.ListThreadsRequest, requestOptions?: Threads.RequestOptions):
|
|
41
|
+
list(request?: AgentMail.ListThreadsRequest, requestOptions?: Threads.RequestOptions): core.HttpResponsePromise<AgentMail.ListThreadsResponse>;
|
|
42
|
+
private __list;
|
|
42
43
|
/**
|
|
43
44
|
* @param {AgentMail.ThreadId} threadId
|
|
44
45
|
* @param {Threads.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -30,100 +30,87 @@ export class Threads {
|
|
|
30
30
|
* @example
|
|
31
31
|
* await client.threads.list()
|
|
32
32
|
*/
|
|
33
|
-
list() {
|
|
33
|
+
list(request = {}, requestOptions) {
|
|
34
|
+
return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
|
|
35
|
+
}
|
|
36
|
+
__list() {
|
|
34
37
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
38
|
+
var _a, _b, _c;
|
|
39
|
+
const { limit, pageToken, labels, before, after, ascending } = request;
|
|
40
|
+
const _queryParams = {};
|
|
41
|
+
if (limit != null) {
|
|
42
|
+
_queryParams["limit"] = limit.toString();
|
|
43
|
+
}
|
|
44
|
+
if (pageToken != null) {
|
|
45
|
+
_queryParams["page_token"] = pageToken;
|
|
46
|
+
}
|
|
47
|
+
if (labels != null) {
|
|
48
|
+
_queryParams["labels"] = toJson(serializers.Labels.jsonOrThrow(labels, { unrecognizedObjectKeys: "strip", omitUndefined: true }));
|
|
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
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
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/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: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
66
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.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, {
|
|
72
|
+
unrecognizedObjectKeys: "passthrough",
|
|
73
|
+
allowUnrecognizedUnionMembers: true,
|
|
74
|
+
allowUnrecognizedEnumValues: true,
|
|
75
|
+
skipValidation: true,
|
|
76
|
+
breadcrumbsPrefix: ["response"],
|
|
77
|
+
}),
|
|
78
|
+
rawResponse: _response.rawResponse,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
if (_response.error.reason === "status-code") {
|
|
82
|
+
switch (_response.error.statusCode) {
|
|
83
|
+
case 404:
|
|
84
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
73
85
|
unrecognizedObjectKeys: "passthrough",
|
|
74
86
|
allowUnrecognizedUnionMembers: true,
|
|
75
87
|
allowUnrecognizedEnumValues: true,
|
|
76
88
|
skipValidation: true,
|
|
77
89
|
breadcrumbsPrefix: ["response"],
|
|
78
|
-
}),
|
|
79
|
-
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
if (_response.error.reason === "status-code") {
|
|
83
|
-
switch (_response.error.statusCode) {
|
|
84
|
-
case 404:
|
|
85
|
-
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
86
|
-
unrecognizedObjectKeys: "passthrough",
|
|
87
|
-
allowUnrecognizedUnionMembers: true,
|
|
88
|
-
allowUnrecognizedEnumValues: true,
|
|
89
|
-
skipValidation: true,
|
|
90
|
-
breadcrumbsPrefix: ["response"],
|
|
91
|
-
}), _response.rawResponse);
|
|
92
|
-
default:
|
|
93
|
-
throw new errors.AgentMailError({
|
|
94
|
-
statusCode: _response.error.statusCode,
|
|
95
|
-
body: _response.error.body,
|
|
96
|
-
rawResponse: _response.rawResponse,
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
switch (_response.error.reason) {
|
|
101
|
-
case "non-json":
|
|
90
|
+
}), _response.rawResponse);
|
|
91
|
+
default:
|
|
102
92
|
throw new errors.AgentMailError({
|
|
103
93
|
statusCode: _response.error.statusCode,
|
|
104
|
-
body: _response.error.
|
|
105
|
-
rawResponse: _response.rawResponse,
|
|
106
|
-
});
|
|
107
|
-
case "timeout":
|
|
108
|
-
throw new errors.AgentMailTimeoutError("Timeout exceeded when calling GET /v0/threads.");
|
|
109
|
-
case "unknown":
|
|
110
|
-
throw new errors.AgentMailError({
|
|
111
|
-
message: _response.error.errorMessage,
|
|
94
|
+
body: _response.error.body,
|
|
112
95
|
rawResponse: _response.rawResponse,
|
|
113
96
|
});
|
|
114
97
|
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
98
|
+
}
|
|
99
|
+
switch (_response.error.reason) {
|
|
100
|
+
case "non-json":
|
|
101
|
+
throw new errors.AgentMailError({
|
|
102
|
+
statusCode: _response.error.statusCode,
|
|
103
|
+
body: _response.error.rawBody,
|
|
104
|
+
rawResponse: _response.rawResponse,
|
|
105
|
+
});
|
|
106
|
+
case "timeout":
|
|
107
|
+
throw new errors.AgentMailTimeoutError("Timeout exceeded when calling GET /v0/threads.");
|
|
108
|
+
case "unknown":
|
|
109
|
+
throw new errors.AgentMailError({
|
|
110
|
+
message: _response.error.errorMessage,
|
|
111
|
+
rawResponse: _response.rawResponse,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
127
114
|
});
|
|
128
115
|
}
|
|
129
116
|
/**
|
|
@@ -36,7 +36,8 @@ export declare class Webhooks {
|
|
|
36
36
|
* @example
|
|
37
37
|
* await client.webhooks.list()
|
|
38
38
|
*/
|
|
39
|
-
list(request?: AgentMail.webhooks.ListWebhooksRequest, requestOptions?: Webhooks.RequestOptions):
|
|
39
|
+
list(request?: AgentMail.webhooks.ListWebhooksRequest, requestOptions?: Webhooks.RequestOptions): core.HttpResponsePromise<AgentMail.webhooks.ListWebhooksResponse>;
|
|
40
|
+
private __list;
|
|
40
41
|
/**
|
|
41
42
|
* @param {AgentMail.webhooks.WebhookId} webhookId
|
|
42
43
|
* @param {Webhooks.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -27,74 +27,64 @@ export class Webhooks {
|
|
|
27
27
|
* @example
|
|
28
28
|
* await client.webhooks.list()
|
|
29
29
|
*/
|
|
30
|
-
list() {
|
|
30
|
+
list(request = {}, requestOptions) {
|
|
31
|
+
return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
|
|
32
|
+
}
|
|
33
|
+
__list() {
|
|
31
34
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
35
|
+
var _a, _b, _c;
|
|
36
|
+
const { limit, pageToken } = 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
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
45
|
+
const _response = yield core.fetcher({
|
|
46
|
+
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/webhooks"),
|
|
47
|
+
method: "GET",
|
|
48
|
+
headers: _headers,
|
|
49
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
50
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
51
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
52
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
53
|
+
});
|
|
54
|
+
if (_response.ok) {
|
|
55
|
+
return {
|
|
56
|
+
data: serializers.webhooks.ListWebhooksResponse.parseOrThrow(_response.body, {
|
|
57
|
+
unrecognizedObjectKeys: "passthrough",
|
|
58
|
+
allowUnrecognizedUnionMembers: true,
|
|
59
|
+
allowUnrecognizedEnumValues: true,
|
|
60
|
+
skipValidation: true,
|
|
61
|
+
breadcrumbsPrefix: ["response"],
|
|
62
|
+
}),
|
|
63
|
+
rawResponse: _response.rawResponse,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
if (_response.error.reason === "status-code") {
|
|
67
|
+
throw new errors.AgentMailError({
|
|
68
|
+
statusCode: _response.error.statusCode,
|
|
69
|
+
body: _response.error.body,
|
|
70
|
+
rawResponse: _response.rawResponse,
|
|
51
71
|
});
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
unrecognizedObjectKeys: "passthrough",
|
|
56
|
-
allowUnrecognizedUnionMembers: true,
|
|
57
|
-
allowUnrecognizedEnumValues: true,
|
|
58
|
-
skipValidation: true,
|
|
59
|
-
breadcrumbsPrefix: ["response"],
|
|
60
|
-
}),
|
|
61
|
-
rawResponse: _response.rawResponse,
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
if (_response.error.reason === "status-code") {
|
|
72
|
+
}
|
|
73
|
+
switch (_response.error.reason) {
|
|
74
|
+
case "non-json":
|
|
65
75
|
throw new errors.AgentMailError({
|
|
66
76
|
statusCode: _response.error.statusCode,
|
|
67
|
-
body: _response.error.
|
|
77
|
+
body: _response.error.rawBody,
|
|
68
78
|
rawResponse: _response.rawResponse,
|
|
69
79
|
});
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
case "timeout":
|
|
79
|
-
throw new errors.AgentMailTimeoutError("Timeout exceeded when calling GET /v0/webhooks.");
|
|
80
|
-
case "unknown":
|
|
81
|
-
throw new errors.AgentMailError({
|
|
82
|
-
message: _response.error.errorMessage,
|
|
83
|
-
rawResponse: _response.rawResponse,
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
}));
|
|
87
|
-
const dataWithRawResponse = yield list(request).withRawResponse();
|
|
88
|
-
return new core.Pageable({
|
|
89
|
-
response: dataWithRawResponse.data,
|
|
90
|
-
rawResponse: dataWithRawResponse.rawResponse,
|
|
91
|
-
hasNextPage: (response) => (response === null || response === void 0 ? void 0 : response.nextPageToken) != null &&
|
|
92
|
-
!(typeof (response === null || response === void 0 ? void 0 : response.nextPageToken) === "string" && (response === null || response === void 0 ? void 0 : response.nextPageToken) === ""),
|
|
93
|
-
getItems: (response) => { var _a; return (_a = response === null || response === void 0 ? void 0 : response.webhooks) !== null && _a !== void 0 ? _a : []; },
|
|
94
|
-
loadPage: (response) => {
|
|
95
|
-
return list(core.setObjectProperty(request, "pageToken", response === null || response === void 0 ? void 0 : response.nextPageToken));
|
|
96
|
-
},
|
|
97
|
-
});
|
|
80
|
+
case "timeout":
|
|
81
|
+
throw new errors.AgentMailTimeoutError("Timeout exceeded when calling GET /v0/webhooks.");
|
|
82
|
+
case "unknown":
|
|
83
|
+
throw new errors.AgentMailError({
|
|
84
|
+
message: _response.error.errorMessage,
|
|
85
|
+
rawResponse: _response.rawResponse,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
98
88
|
});
|
|
99
89
|
}
|
|
100
90
|
/**
|
package/dist/esm/core/index.mjs
CHANGED
|
@@ -5,7 +5,6 @@ import * as serializers from "../../../index.mjs";
|
|
|
5
5
|
import * as AgentMail from "../../../../api/index.mjs";
|
|
6
6
|
import * as core from "../../../../core/index.mjs";
|
|
7
7
|
import { DomainId } from "./DomainId.mjs";
|
|
8
|
-
import { DomainName } from "./DomainName.mjs";
|
|
9
8
|
import { VerificationStatus } from "./VerificationStatus.mjs";
|
|
10
9
|
import { FeedbackEnabled } from "./FeedbackEnabled.mjs";
|
|
11
10
|
import { VerificationRecord } from "./VerificationRecord.mjs";
|
|
@@ -14,7 +13,6 @@ export declare const Domain: core.serialization.ObjectSchema<serializers.Domain.
|
|
|
14
13
|
export declare namespace Domain {
|
|
15
14
|
interface Raw {
|
|
16
15
|
domain_id: DomainId.Raw;
|
|
17
|
-
domain: DomainName.Raw;
|
|
18
16
|
status: VerificationStatus.Raw;
|
|
19
17
|
feedback_enabled: FeedbackEnabled.Raw;
|
|
20
18
|
records: VerificationRecord.Raw[];
|
|
@@ -3,14 +3,12 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as core from "../../../../core/index.mjs";
|
|
5
5
|
import { DomainId } from "./DomainId.mjs";
|
|
6
|
-
import { DomainName } from "./DomainName.mjs";
|
|
7
6
|
import { VerificationStatus } from "./VerificationStatus.mjs";
|
|
8
7
|
import { FeedbackEnabled } from "./FeedbackEnabled.mjs";
|
|
9
8
|
import { VerificationRecord } from "./VerificationRecord.mjs";
|
|
10
9
|
import { ClientId } from "./ClientId.mjs";
|
|
11
10
|
export const Domain = core.serialization.object({
|
|
12
11
|
domainId: core.serialization.property("domain_id", DomainId),
|
|
13
|
-
domain: DomainName,
|
|
14
12
|
status: VerificationStatus,
|
|
15
13
|
feedbackEnabled: core.serialization.property("feedback_enabled", FeedbackEnabled),
|
|
16
14
|
records: core.serialization.list(VerificationRecord),
|
|
@@ -14,6 +14,7 @@ import { DraftText } from "./DraftText.mjs";
|
|
|
14
14
|
import { DraftHtml } from "./DraftHtml.mjs";
|
|
15
15
|
import { DraftInReplyTo } from "./DraftInReplyTo.mjs";
|
|
16
16
|
import { DraftSendAt } from "./DraftSendAt.mjs";
|
|
17
|
+
import { DraftClientId } from "./DraftClientId.mjs";
|
|
17
18
|
export declare const CreateDraftRequest: core.serialization.ObjectSchema<serializers.CreateDraftRequest.Raw, AgentMail.CreateDraftRequest>;
|
|
18
19
|
export declare namespace CreateDraftRequest {
|
|
19
20
|
interface Raw {
|
|
@@ -27,5 +28,6 @@ export declare namespace CreateDraftRequest {
|
|
|
27
28
|
html?: DraftHtml.Raw | null;
|
|
28
29
|
in_reply_to?: DraftInReplyTo.Raw | null;
|
|
29
30
|
send_at?: DraftSendAt.Raw | null;
|
|
31
|
+
client_id?: DraftClientId.Raw | null;
|
|
30
32
|
}
|
|
31
33
|
}
|
|
@@ -12,6 +12,7 @@ import { DraftText } from "./DraftText.mjs";
|
|
|
12
12
|
import { DraftHtml } from "./DraftHtml.mjs";
|
|
13
13
|
import { DraftInReplyTo } from "./DraftInReplyTo.mjs";
|
|
14
14
|
import { DraftSendAt } from "./DraftSendAt.mjs";
|
|
15
|
+
import { DraftClientId } from "./DraftClientId.mjs";
|
|
15
16
|
export const CreateDraftRequest = core.serialization.object({
|
|
16
17
|
labels: DraftLabels.optional(),
|
|
17
18
|
replyTo: core.serialization.property("reply_to", DraftReplyTo.optional()),
|
|
@@ -23,4 +24,5 @@ export const CreateDraftRequest = core.serialization.object({
|
|
|
23
24
|
html: DraftHtml.optional(),
|
|
24
25
|
inReplyTo: core.serialization.property("in_reply_to", DraftInReplyTo.optional()),
|
|
25
26
|
sendAt: core.serialization.property("send_at", DraftSendAt.optional()),
|
|
27
|
+
clientId: core.serialization.property("client_id", DraftClientId.optional()),
|
|
26
28
|
});
|
|
@@ -7,6 +7,7 @@ import * as core from "../../../../core/index.mjs";
|
|
|
7
7
|
import { InboxId } from "../../inboxes/types/InboxId.mjs";
|
|
8
8
|
import { ThreadId } from "../../threads/types/ThreadId.mjs";
|
|
9
9
|
import { DraftId } from "./DraftId.mjs";
|
|
10
|
+
import { DraftClientId } from "./DraftClientId.mjs";
|
|
10
11
|
import { DraftLabels } from "./DraftLabels.mjs";
|
|
11
12
|
import { DraftReplyTo } from "./DraftReplyTo.mjs";
|
|
12
13
|
import { DraftTo } from "./DraftTo.mjs";
|
|
@@ -27,6 +28,7 @@ export declare namespace Draft {
|
|
|
27
28
|
inbox_id: InboxId.Raw;
|
|
28
29
|
thread_id: ThreadId.Raw;
|
|
29
30
|
draft_id: DraftId.Raw;
|
|
31
|
+
client_id?: DraftClientId.Raw | null;
|
|
30
32
|
labels: DraftLabels.Raw;
|
|
31
33
|
reply_to?: DraftReplyTo.Raw | null;
|
|
32
34
|
to?: DraftTo.Raw | null;
|
|
@@ -5,6 +5,7 @@ import * as core from "../../../../core/index.mjs";
|
|
|
5
5
|
import { InboxId } from "../../inboxes/types/InboxId.mjs";
|
|
6
6
|
import { ThreadId } from "../../threads/types/ThreadId.mjs";
|
|
7
7
|
import { DraftId } from "./DraftId.mjs";
|
|
8
|
+
import { DraftClientId } from "./DraftClientId.mjs";
|
|
8
9
|
import { DraftLabels } from "./DraftLabels.mjs";
|
|
9
10
|
import { DraftReplyTo } from "./DraftReplyTo.mjs";
|
|
10
11
|
import { DraftTo } from "./DraftTo.mjs";
|
|
@@ -23,6 +24,7 @@ export const Draft = core.serialization.object({
|
|
|
23
24
|
inboxId: core.serialization.property("inbox_id", InboxId),
|
|
24
25
|
threadId: core.serialization.property("thread_id", ThreadId),
|
|
25
26
|
draftId: core.serialization.property("draft_id", DraftId),
|
|
27
|
+
clientId: core.serialization.property("client_id", DraftClientId.optional()),
|
|
26
28
|
labels: DraftLabels,
|
|
27
29
|
replyTo: core.serialization.property("reply_to", DraftReplyTo.optional()),
|
|
28
30
|
to: DraftTo.optional(),
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as serializers from "../../../index.mjs";
|
|
5
|
+
import * as AgentMail from "../../../../api/index.mjs";
|
|
6
|
+
import * as core from "../../../../core/index.mjs";
|
|
7
|
+
export declare const DraftClientId: core.serialization.Schema<serializers.DraftClientId.Raw, AgentMail.DraftClientId>;
|
|
8
|
+
export declare namespace DraftClientId {
|
|
9
|
+
type Raw = string;
|
|
10
|
+
}
|