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
|
@@ -83,74 +83,64 @@ class Inboxes {
|
|
|
83
83
|
* @example
|
|
84
84
|
* await client.inboxes.list()
|
|
85
85
|
*/
|
|
86
|
-
list() {
|
|
86
|
+
list(request = {}, requestOptions) {
|
|
87
|
+
return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
|
|
88
|
+
}
|
|
89
|
+
__list() {
|
|
87
90
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
91
|
+
var _a, _b, _c;
|
|
92
|
+
const { limit, pageToken } = request;
|
|
93
|
+
const _queryParams = {};
|
|
94
|
+
if (limit != null) {
|
|
95
|
+
_queryParams["limit"] = limit.toString();
|
|
96
|
+
}
|
|
97
|
+
if (pageToken != null) {
|
|
98
|
+
_queryParams["page_token"] = pageToken;
|
|
99
|
+
}
|
|
100
|
+
let _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);
|
|
101
|
+
const _response = yield core.fetcher({
|
|
102
|
+
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"),
|
|
103
|
+
method: "GET",
|
|
104
|
+
headers: _headers,
|
|
105
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
106
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
107
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
108
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
109
|
+
});
|
|
110
|
+
if (_response.ok) {
|
|
111
|
+
return {
|
|
112
|
+
data: serializers.inboxes.ListInboxesResponse.parseOrThrow(_response.body, {
|
|
113
|
+
unrecognizedObjectKeys: "passthrough",
|
|
114
|
+
allowUnrecognizedUnionMembers: true,
|
|
115
|
+
allowUnrecognizedEnumValues: true,
|
|
116
|
+
skipValidation: true,
|
|
117
|
+
breadcrumbsPrefix: ["response"],
|
|
118
|
+
}),
|
|
119
|
+
rawResponse: _response.rawResponse,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
if (_response.error.reason === "status-code") {
|
|
123
|
+
throw new errors.AgentMailError({
|
|
124
|
+
statusCode: _response.error.statusCode,
|
|
125
|
+
body: _response.error.body,
|
|
126
|
+
rawResponse: _response.rawResponse,
|
|
107
127
|
});
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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") {
|
|
128
|
+
}
|
|
129
|
+
switch (_response.error.reason) {
|
|
130
|
+
case "non-json":
|
|
121
131
|
throw new errors.AgentMailError({
|
|
122
132
|
statusCode: _response.error.statusCode,
|
|
123
|
-
body: _response.error.
|
|
133
|
+
body: _response.error.rawBody,
|
|
124
134
|
rawResponse: _response.rawResponse,
|
|
125
135
|
});
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
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
|
-
}
|
|
142
|
-
}));
|
|
143
|
-
const dataWithRawResponse = yield list(request).withRawResponse();
|
|
144
|
-
return new core.Pageable({
|
|
145
|
-
response: dataWithRawResponse.data,
|
|
146
|
-
rawResponse: dataWithRawResponse.rawResponse,
|
|
147
|
-
hasNextPage: (response) => (response === null || response === void 0 ? void 0 : response.nextPageToken) != null &&
|
|
148
|
-
!(typeof (response === null || response === void 0 ? void 0 : response.nextPageToken) === "string" && (response === null || response === void 0 ? void 0 : response.nextPageToken) === ""),
|
|
149
|
-
getItems: (response) => { var _a; return (_a = response === null || response === void 0 ? void 0 : response.inboxes) !== null && _a !== void 0 ? _a : []; },
|
|
150
|
-
loadPage: (response) => {
|
|
151
|
-
return list(core.setObjectProperty(request, "pageToken", response === null || response === void 0 ? void 0 : response.nextPageToken));
|
|
152
|
-
},
|
|
153
|
-
});
|
|
136
|
+
case "timeout":
|
|
137
|
+
throw new errors.AgentMailTimeoutError("Timeout exceeded when calling GET /v0/inboxes.");
|
|
138
|
+
case "unknown":
|
|
139
|
+
throw new errors.AgentMailError({
|
|
140
|
+
message: _response.error.errorMessage,
|
|
141
|
+
rawResponse: _response.rawResponse,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
154
144
|
});
|
|
155
145
|
}
|
|
156
146
|
/**
|
|
@@ -39,7 +39,8 @@ export declare class Drafts {
|
|
|
39
39
|
* @example
|
|
40
40
|
* await client.inboxes.drafts.list("inbox_id")
|
|
41
41
|
*/
|
|
42
|
-
list(inboxId: AgentMail.inboxes.InboxId, request?: AgentMail.inboxes.ListDraftsRequest, requestOptions?: Drafts.RequestOptions):
|
|
42
|
+
list(inboxId: AgentMail.inboxes.InboxId, request?: AgentMail.inboxes.ListDraftsRequest, requestOptions?: Drafts.RequestOptions): core.HttpResponsePromise<AgentMail.ListDraftsResponse>;
|
|
43
|
+
private __list;
|
|
43
44
|
/**
|
|
44
45
|
* @param {AgentMail.inboxes.InboxId} inboxId
|
|
45
46
|
* @param {AgentMail.DraftId} draftId
|
|
@@ -70,11 +71,34 @@ export declare class Drafts {
|
|
|
70
71
|
* text: undefined,
|
|
71
72
|
* html: undefined,
|
|
72
73
|
* inReplyTo: undefined,
|
|
73
|
-
* sendAt: undefined
|
|
74
|
+
* sendAt: undefined,
|
|
75
|
+
* clientId: undefined
|
|
74
76
|
* })
|
|
75
77
|
*/
|
|
76
78
|
create(inboxId: AgentMail.inboxes.InboxId, request: AgentMail.CreateDraftRequest, requestOptions?: Drafts.RequestOptions): core.HttpResponsePromise<AgentMail.Draft>;
|
|
77
79
|
private __create;
|
|
80
|
+
/**
|
|
81
|
+
* @param {AgentMail.inboxes.InboxId} inboxId
|
|
82
|
+
* @param {AgentMail.DraftId} draftId
|
|
83
|
+
* @param {AgentMail.UpdateDraftRequest} request
|
|
84
|
+
* @param {Drafts.RequestOptions} requestOptions - Request-specific configuration.
|
|
85
|
+
*
|
|
86
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* await client.inboxes.drafts.update("inbox_id", "draft_id", {
|
|
90
|
+
* replyTo: undefined,
|
|
91
|
+
* to: undefined,
|
|
92
|
+
* cc: undefined,
|
|
93
|
+
* bcc: undefined,
|
|
94
|
+
* subject: undefined,
|
|
95
|
+
* text: undefined,
|
|
96
|
+
* html: undefined,
|
|
97
|
+
* sendAt: undefined
|
|
98
|
+
* })
|
|
99
|
+
*/
|
|
100
|
+
update(inboxId: AgentMail.inboxes.InboxId, draftId: AgentMail.DraftId, request: AgentMail.UpdateDraftRequest, requestOptions?: Drafts.RequestOptions): core.HttpResponsePromise<AgentMail.Draft>;
|
|
101
|
+
private __update;
|
|
78
102
|
/**
|
|
79
103
|
* @param {AgentMail.inboxes.InboxId} inboxId
|
|
80
104
|
* @param {AgentMail.DraftId} draftId
|
|
@@ -67,100 +67,87 @@ class Drafts {
|
|
|
67
67
|
* @example
|
|
68
68
|
* await client.inboxes.drafts.list("inbox_id")
|
|
69
69
|
*/
|
|
70
|
-
list(
|
|
70
|
+
list(inboxId, request = {}, requestOptions) {
|
|
71
|
+
return core.HttpResponsePromise.fromPromise(this.__list(inboxId, request, requestOptions));
|
|
72
|
+
}
|
|
73
|
+
__list(inboxId_1) {
|
|
71
74
|
return __awaiter(this, arguments, void 0, function* (inboxId, request = {}, requestOptions) {
|
|
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
|
-
|
|
108
|
-
|
|
109
|
-
|
|
75
|
+
var _a, _b, _c;
|
|
76
|
+
const { limit, pageToken, labels, before, after, ascending } = request;
|
|
77
|
+
const _queryParams = {};
|
|
78
|
+
if (limit != null) {
|
|
79
|
+
_queryParams["limit"] = limit.toString();
|
|
80
|
+
}
|
|
81
|
+
if (pageToken != null) {
|
|
82
|
+
_queryParams["page_token"] = pageToken;
|
|
83
|
+
}
|
|
84
|
+
if (labels != null) {
|
|
85
|
+
_queryParams["labels"] = (0, json_js_1.toJson)(serializers.Labels.jsonOrThrow(labels, { unrecognizedObjectKeys: "strip", omitUndefined: true }));
|
|
86
|
+
}
|
|
87
|
+
if (before != null) {
|
|
88
|
+
_queryParams["before"] = before.toISOString();
|
|
89
|
+
}
|
|
90
|
+
if (after != null) {
|
|
91
|
+
_queryParams["after"] = after.toISOString();
|
|
92
|
+
}
|
|
93
|
+
if (ascending != null) {
|
|
94
|
+
_queryParams["ascending"] = ascending.toString();
|
|
95
|
+
}
|
|
96
|
+
let _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/inboxes/${encodeURIComponent(serializers.inboxes.InboxId.jsonOrThrow(inboxId, { omitUndefined: true }))}/drafts`),
|
|
99
|
+
method: "GET",
|
|
100
|
+
headers: _headers,
|
|
101
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
102
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
103
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
104
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
105
|
+
});
|
|
106
|
+
if (_response.ok) {
|
|
107
|
+
return {
|
|
108
|
+
data: serializers.ListDraftsResponse.parseOrThrow(_response.body, {
|
|
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") {
|
|
119
|
+
switch (_response.error.statusCode) {
|
|
120
|
+
case 404:
|
|
121
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
110
122
|
unrecognizedObjectKeys: "passthrough",
|
|
111
123
|
allowUnrecognizedUnionMembers: true,
|
|
112
124
|
allowUnrecognizedEnumValues: true,
|
|
113
125
|
skipValidation: true,
|
|
114
126
|
breadcrumbsPrefix: ["response"],
|
|
115
|
-
}),
|
|
116
|
-
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
if (_response.error.reason === "status-code") {
|
|
120
|
-
switch (_response.error.statusCode) {
|
|
121
|
-
case 404:
|
|
122
|
-
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
123
|
-
unrecognizedObjectKeys: "passthrough",
|
|
124
|
-
allowUnrecognizedUnionMembers: true,
|
|
125
|
-
allowUnrecognizedEnumValues: true,
|
|
126
|
-
skipValidation: true,
|
|
127
|
-
breadcrumbsPrefix: ["response"],
|
|
128
|
-
}), _response.rawResponse);
|
|
129
|
-
default:
|
|
130
|
-
throw new errors.AgentMailError({
|
|
131
|
-
statusCode: _response.error.statusCode,
|
|
132
|
-
body: _response.error.body,
|
|
133
|
-
rawResponse: _response.rawResponse,
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
switch (_response.error.reason) {
|
|
138
|
-
case "non-json":
|
|
127
|
+
}), _response.rawResponse);
|
|
128
|
+
default:
|
|
139
129
|
throw new errors.AgentMailError({
|
|
140
130
|
statusCode: _response.error.statusCode,
|
|
141
|
-
body: _response.error.
|
|
142
|
-
rawResponse: _response.rawResponse,
|
|
143
|
-
});
|
|
144
|
-
case "timeout":
|
|
145
|
-
throw new errors.AgentMailTimeoutError("Timeout exceeded when calling GET /v0/inboxes/{inbox_id}/drafts.");
|
|
146
|
-
case "unknown":
|
|
147
|
-
throw new errors.AgentMailError({
|
|
148
|
-
message: _response.error.errorMessage,
|
|
131
|
+
body: _response.error.body,
|
|
149
132
|
rawResponse: _response.rawResponse,
|
|
150
133
|
});
|
|
151
134
|
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
135
|
+
}
|
|
136
|
+
switch (_response.error.reason) {
|
|
137
|
+
case "non-json":
|
|
138
|
+
throw new errors.AgentMailError({
|
|
139
|
+
statusCode: _response.error.statusCode,
|
|
140
|
+
body: _response.error.rawBody,
|
|
141
|
+
rawResponse: _response.rawResponse,
|
|
142
|
+
});
|
|
143
|
+
case "timeout":
|
|
144
|
+
throw new errors.AgentMailTimeoutError("Timeout exceeded when calling GET /v0/inboxes/{inbox_id}/drafts.");
|
|
145
|
+
case "unknown":
|
|
146
|
+
throw new errors.AgentMailError({
|
|
147
|
+
message: _response.error.errorMessage,
|
|
148
|
+
rawResponse: _response.rawResponse,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
164
151
|
});
|
|
165
152
|
}
|
|
166
153
|
/**
|
|
@@ -254,7 +241,8 @@ class Drafts {
|
|
|
254
241
|
* text: undefined,
|
|
255
242
|
* html: undefined,
|
|
256
243
|
* inReplyTo: undefined,
|
|
257
|
-
* sendAt: undefined
|
|
244
|
+
* sendAt: undefined,
|
|
245
|
+
* clientId: undefined
|
|
258
246
|
* })
|
|
259
247
|
*/
|
|
260
248
|
create(inboxId, request, requestOptions) {
|
|
@@ -326,6 +314,95 @@ class Drafts {
|
|
|
326
314
|
}
|
|
327
315
|
});
|
|
328
316
|
}
|
|
317
|
+
/**
|
|
318
|
+
* @param {AgentMail.inboxes.InboxId} inboxId
|
|
319
|
+
* @param {AgentMail.DraftId} draftId
|
|
320
|
+
* @param {AgentMail.UpdateDraftRequest} request
|
|
321
|
+
* @param {Drafts.RequestOptions} requestOptions - Request-specific configuration.
|
|
322
|
+
*
|
|
323
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
324
|
+
*
|
|
325
|
+
* @example
|
|
326
|
+
* await client.inboxes.drafts.update("inbox_id", "draft_id", {
|
|
327
|
+
* replyTo: undefined,
|
|
328
|
+
* to: undefined,
|
|
329
|
+
* cc: undefined,
|
|
330
|
+
* bcc: undefined,
|
|
331
|
+
* subject: undefined,
|
|
332
|
+
* text: undefined,
|
|
333
|
+
* html: undefined,
|
|
334
|
+
* sendAt: undefined
|
|
335
|
+
* })
|
|
336
|
+
*/
|
|
337
|
+
update(inboxId, draftId, request, requestOptions) {
|
|
338
|
+
return core.HttpResponsePromise.fromPromise(this.__update(inboxId, draftId, request, requestOptions));
|
|
339
|
+
}
|
|
340
|
+
__update(inboxId, draftId, request, requestOptions) {
|
|
341
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
342
|
+
var _a, _b, _c;
|
|
343
|
+
let _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);
|
|
344
|
+
const _response = yield core.fetcher({
|
|
345
|
+
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/${encodeURIComponent(serializers.inboxes.InboxId.jsonOrThrow(inboxId, { omitUndefined: true }))}/drafts/${encodeURIComponent(serializers.DraftId.jsonOrThrow(draftId, { omitUndefined: true }))}`),
|
|
346
|
+
method: "PATCH",
|
|
347
|
+
headers: _headers,
|
|
348
|
+
contentType: "application/json",
|
|
349
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
350
|
+
requestType: "json",
|
|
351
|
+
body: serializers.UpdateDraftRequest.jsonOrThrow(request, {
|
|
352
|
+
unrecognizedObjectKeys: "strip",
|
|
353
|
+
omitUndefined: true,
|
|
354
|
+
}),
|
|
355
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
356
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
357
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
358
|
+
});
|
|
359
|
+
if (_response.ok) {
|
|
360
|
+
return {
|
|
361
|
+
data: serializers.Draft.parseOrThrow(_response.body, {
|
|
362
|
+
unrecognizedObjectKeys: "passthrough",
|
|
363
|
+
allowUnrecognizedUnionMembers: true,
|
|
364
|
+
allowUnrecognizedEnumValues: true,
|
|
365
|
+
skipValidation: true,
|
|
366
|
+
breadcrumbsPrefix: ["response"],
|
|
367
|
+
}),
|
|
368
|
+
rawResponse: _response.rawResponse,
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
if (_response.error.reason === "status-code") {
|
|
372
|
+
switch (_response.error.statusCode) {
|
|
373
|
+
case 404:
|
|
374
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
375
|
+
unrecognizedObjectKeys: "passthrough",
|
|
376
|
+
allowUnrecognizedUnionMembers: true,
|
|
377
|
+
allowUnrecognizedEnumValues: true,
|
|
378
|
+
skipValidation: true,
|
|
379
|
+
breadcrumbsPrefix: ["response"],
|
|
380
|
+
}), _response.rawResponse);
|
|
381
|
+
default:
|
|
382
|
+
throw new errors.AgentMailError({
|
|
383
|
+
statusCode: _response.error.statusCode,
|
|
384
|
+
body: _response.error.body,
|
|
385
|
+
rawResponse: _response.rawResponse,
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
switch (_response.error.reason) {
|
|
390
|
+
case "non-json":
|
|
391
|
+
throw new errors.AgentMailError({
|
|
392
|
+
statusCode: _response.error.statusCode,
|
|
393
|
+
body: _response.error.rawBody,
|
|
394
|
+
rawResponse: _response.rawResponse,
|
|
395
|
+
});
|
|
396
|
+
case "timeout":
|
|
397
|
+
throw new errors.AgentMailTimeoutError("Timeout exceeded when calling PATCH /v0/inboxes/{inbox_id}/drafts/{draft_id}.");
|
|
398
|
+
case "unknown":
|
|
399
|
+
throw new errors.AgentMailError({
|
|
400
|
+
message: _response.error.errorMessage,
|
|
401
|
+
rawResponse: _response.rawResponse,
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
});
|
|
405
|
+
}
|
|
329
406
|
/**
|
|
330
407
|
* @param {AgentMail.inboxes.InboxId} inboxId
|
|
331
408
|
* @param {AgentMail.DraftId} draftId
|
|
@@ -39,7 +39,8 @@ export declare class Messages {
|
|
|
39
39
|
* @example
|
|
40
40
|
* await client.inboxes.messages.list("inbox_id")
|
|
41
41
|
*/
|
|
42
|
-
list(inboxId: AgentMail.inboxes.InboxId, request?: AgentMail.inboxes.ListMessagesRequest, requestOptions?: Messages.RequestOptions):
|
|
42
|
+
list(inboxId: AgentMail.inboxes.InboxId, request?: AgentMail.inboxes.ListMessagesRequest, requestOptions?: Messages.RequestOptions): core.HttpResponsePromise<AgentMail.ListMessagesResponse>;
|
|
43
|
+
private __list;
|
|
43
44
|
/**
|
|
44
45
|
* @param {AgentMail.inboxes.InboxId} inboxId
|
|
45
46
|
* @param {AgentMail.MessageId} messageId
|