agentmail 0.4.3 → 0.4.4
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/BaseClient.js +2 -2
- package/dist/cjs/api/resources/domains/client/Client.d.ts +12 -0
- package/dist/cjs/api/resources/domains/client/Client.js +69 -0
- package/dist/cjs/api/resources/domains/types/UpdateDomainRequest.d.ts +4 -0
- package/dist/cjs/api/resources/domains/types/UpdateDomainRequest.js +3 -0
- package/dist/cjs/api/resources/domains/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/domains/types/index.js +1 -0
- package/dist/cjs/api/resources/inboxes/resources/drafts/client/Client.d.ts +9 -9
- package/dist/cjs/api/resources/inboxes/resources/drafts/client/Client.js +50 -50
- package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.d.ts +22 -15
- package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.js +71 -56
- package/dist/cjs/api/resources/lists/client/Client.d.ts +15 -15
- package/dist/cjs/api/resources/lists/client/Client.js +67 -67
- package/dist/cjs/api/resources/messages/types/RawMessageResponse.d.ts +14 -0
- package/dist/cjs/api/resources/messages/types/RawMessageResponse.js +3 -0
- package/dist/cjs/api/resources/messages/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/messages/types/index.js +1 -0
- package/dist/cjs/api/resources/pods/client/Client.d.ts +4 -4
- package/dist/cjs/api/resources/pods/client/Client.js +8 -8
- package/dist/cjs/api/resources/pods/resources/apiKeys/client/Client.d.ts +11 -11
- package/dist/cjs/api/resources/pods/resources/apiKeys/client/Client.js +42 -42
- package/dist/cjs/api/resources/pods/resources/domains/client/Client.d.ts +33 -3
- package/dist/cjs/api/resources/pods/resources/domains/client/Client.js +178 -6
- package/dist/cjs/api/resources/pods/resources/inboxes/client/Client.d.ts +15 -0
- package/dist/cjs/api/resources/pods/resources/inboxes/client/Client.js +72 -0
- package/dist/cjs/api/resources/pods/resources/lists/client/Client.d.ts +16 -16
- package/dist/cjs/api/resources/pods/resources/lists/client/Client.js +67 -67
- package/dist/cjs/api/resources/pods/resources/threads/client/Client.d.ts +15 -0
- package/dist/cjs/api/resources/pods/resources/threads/client/Client.js +61 -0
- package/dist/cjs/api/resources/pods/resources/threads/client/requests/DeleteThreadRequest.d.ts +8 -0
- package/dist/cjs/api/resources/pods/resources/threads/client/requests/DeleteThreadRequest.js +3 -0
- package/dist/cjs/api/resources/pods/resources/threads/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/threads/client/Client.d.ts +14 -0
- package/dist/cjs/api/resources/threads/client/Client.js +60 -0
- package/dist/cjs/api/resources/threads/client/requests/DeleteThreadRequest.d.ts +8 -0
- package/dist/cjs/api/resources/threads/client/requests/DeleteThreadRequest.js +3 -0
- package/dist/cjs/api/resources/threads/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/webhooks/client/Client.d.ts +13 -13
- package/dist/cjs/api/resources/webhooks/client/Client.js +31 -31
- package/dist/cjs/serialization/resources/domains/types/UpdateDomainRequest.d.ts +10 -0
- package/dist/cjs/serialization/resources/domains/types/UpdateDomainRequest.js +42 -0
- package/dist/cjs/serialization/resources/domains/types/index.d.ts +1 -0
- package/dist/cjs/serialization/resources/domains/types/index.js +1 -0
- package/dist/cjs/serialization/resources/messages/types/RawMessageResponse.d.ts +14 -0
- package/dist/cjs/serialization/resources/messages/types/RawMessageResponse.js +46 -0
- package/dist/cjs/serialization/resources/messages/types/index.d.ts +1 -0
- package/dist/cjs/serialization/resources/messages/types/index.js +1 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/api/resources/domains/client/Client.d.mts +12 -0
- package/dist/esm/api/resources/domains/client/Client.mjs +69 -0
- package/dist/esm/api/resources/domains/types/UpdateDomainRequest.d.mts +4 -0
- package/dist/esm/api/resources/domains/types/UpdateDomainRequest.mjs +2 -0
- package/dist/esm/api/resources/domains/types/index.d.mts +1 -0
- package/dist/esm/api/resources/domains/types/index.mjs +1 -0
- package/dist/esm/api/resources/inboxes/resources/drafts/client/Client.d.mts +9 -9
- package/dist/esm/api/resources/inboxes/resources/drafts/client/Client.mjs +50 -50
- package/dist/esm/api/resources/inboxes/resources/messages/client/Client.d.mts +22 -15
- package/dist/esm/api/resources/inboxes/resources/messages/client/Client.mjs +71 -56
- package/dist/esm/api/resources/lists/client/Client.d.mts +15 -15
- package/dist/esm/api/resources/lists/client/Client.mjs +67 -67
- package/dist/esm/api/resources/messages/types/RawMessageResponse.d.mts +14 -0
- package/dist/esm/api/resources/messages/types/RawMessageResponse.mjs +2 -0
- package/dist/esm/api/resources/messages/types/index.d.mts +1 -0
- package/dist/esm/api/resources/messages/types/index.mjs +1 -0
- package/dist/esm/api/resources/pods/client/Client.d.mts +4 -4
- package/dist/esm/api/resources/pods/client/Client.mjs +8 -8
- package/dist/esm/api/resources/pods/resources/apiKeys/client/Client.d.mts +11 -11
- package/dist/esm/api/resources/pods/resources/apiKeys/client/Client.mjs +42 -42
- package/dist/esm/api/resources/pods/resources/domains/client/Client.d.mts +33 -3
- package/dist/esm/api/resources/pods/resources/domains/client/Client.mjs +178 -6
- package/dist/esm/api/resources/pods/resources/inboxes/client/Client.d.mts +15 -0
- package/dist/esm/api/resources/pods/resources/inboxes/client/Client.mjs +72 -0
- package/dist/esm/api/resources/pods/resources/lists/client/Client.d.mts +16 -16
- package/dist/esm/api/resources/pods/resources/lists/client/Client.mjs +67 -67
- package/dist/esm/api/resources/pods/resources/threads/client/Client.d.mts +15 -0
- package/dist/esm/api/resources/pods/resources/threads/client/Client.mjs +61 -0
- package/dist/esm/api/resources/pods/resources/threads/client/requests/DeleteThreadRequest.d.mts +8 -0
- package/dist/esm/api/resources/pods/resources/threads/client/requests/DeleteThreadRequest.mjs +2 -0
- package/dist/esm/api/resources/pods/resources/threads/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/threads/client/Client.d.mts +14 -0
- package/dist/esm/api/resources/threads/client/Client.mjs +60 -0
- package/dist/esm/api/resources/threads/client/requests/DeleteThreadRequest.d.mts +8 -0
- package/dist/esm/api/resources/threads/client/requests/DeleteThreadRequest.mjs +2 -0
- package/dist/esm/api/resources/threads/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/webhooks/client/Client.d.mts +13 -13
- package/dist/esm/api/resources/webhooks/client/Client.mjs +31 -31
- package/dist/esm/serialization/resources/domains/types/UpdateDomainRequest.d.mts +10 -0
- package/dist/esm/serialization/resources/domains/types/UpdateDomainRequest.mjs +6 -0
- package/dist/esm/serialization/resources/domains/types/index.d.mts +1 -0
- package/dist/esm/serialization/resources/domains/types/index.mjs +1 -0
- package/dist/esm/serialization/resources/messages/types/RawMessageResponse.d.mts +14 -0
- package/dist/esm/serialization/resources/messages/types/RawMessageResponse.mjs +10 -0
- package/dist/esm/serialization/resources/messages/types/index.d.mts +1 -0
- package/dist/esm/serialization/resources/messages/types/index.mjs +1 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/dist/llms-full.txt +16825 -11774
- package/dist/llms.txt +94 -25
- package/package.json +1 -1
- package/reference.md +570 -117
|
@@ -232,4 +232,65 @@ export class ThreadsClient {
|
|
|
232
232
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/pods/{pod_id}/threads/{thread_id}/attachments/{attachment_id}");
|
|
233
233
|
});
|
|
234
234
|
}
|
|
235
|
+
/**
|
|
236
|
+
* Moves the thread to trash by adding a trash label to all messages. If the thread is already in trash, it will be permanently deleted. Use `permanent=true` to force permanent deletion.
|
|
237
|
+
*
|
|
238
|
+
* @param {AgentMail.pods.PodId} pod_id
|
|
239
|
+
* @param {AgentMail.ThreadId} thread_id
|
|
240
|
+
* @param {AgentMail.pods.DeleteThreadRequest} request
|
|
241
|
+
* @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
242
|
+
*
|
|
243
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
244
|
+
*
|
|
245
|
+
* @example
|
|
246
|
+
* await client.pods.threads.delete("pod_id", "thread_id")
|
|
247
|
+
*/
|
|
248
|
+
delete(pod_id, thread_id, request = {}, requestOptions) {
|
|
249
|
+
return core.HttpResponsePromise.fromPromise(this.__delete(pod_id, thread_id, request, requestOptions));
|
|
250
|
+
}
|
|
251
|
+
__delete(pod_id_1, thread_id_1) {
|
|
252
|
+
return __awaiter(this, arguments, void 0, function* (pod_id, thread_id, request = {}, requestOptions) {
|
|
253
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
254
|
+
const { permanent } = request;
|
|
255
|
+
const _queryParams = {
|
|
256
|
+
permanent,
|
|
257
|
+
};
|
|
258
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
259
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
260
|
+
const _response = yield core.fetcher({
|
|
261
|
+
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.Prod)
|
|
262
|
+
.http, `/v0/pods/${core.url.encodePathParam(serializers.pods.PodId.jsonOrThrow(pod_id, { omitUndefined: true }))}/threads/${core.url.encodePathParam(serializers.ThreadId.jsonOrThrow(thread_id, { omitUndefined: true }))}`),
|
|
263
|
+
method: "DELETE",
|
|
264
|
+
headers: _headers,
|
|
265
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
266
|
+
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,
|
|
267
|
+
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,
|
|
268
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
269
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
270
|
+
logging: this._options.logging,
|
|
271
|
+
});
|
|
272
|
+
if (_response.ok) {
|
|
273
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
274
|
+
}
|
|
275
|
+
if (_response.error.reason === "status-code") {
|
|
276
|
+
switch (_response.error.statusCode) {
|
|
277
|
+
case 404:
|
|
278
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
279
|
+
unrecognizedObjectKeys: "passthrough",
|
|
280
|
+
allowUnrecognizedUnionMembers: true,
|
|
281
|
+
allowUnrecognizedEnumValues: true,
|
|
282
|
+
skipValidation: true,
|
|
283
|
+
breadcrumbsPrefix: ["response"],
|
|
284
|
+
}), _response.rawResponse);
|
|
285
|
+
default:
|
|
286
|
+
throw new errors.AgentMailError({
|
|
287
|
+
statusCode: _response.error.statusCode,
|
|
288
|
+
body: _response.error.body,
|
|
289
|
+
rawResponse: _response.rawResponse,
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v0/pods/{pod_id}/threads/{thread_id}");
|
|
294
|
+
});
|
|
295
|
+
}
|
|
235
296
|
}
|
|
@@ -44,4 +44,18 @@ export declare class ThreadsClient {
|
|
|
44
44
|
*/
|
|
45
45
|
getAttachment(thread_id: AgentMail.ThreadId, attachment_id: AgentMail.AttachmentId, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<AgentMail.AttachmentResponse>;
|
|
46
46
|
private __getAttachment;
|
|
47
|
+
/**
|
|
48
|
+
* Moves the thread to trash by adding a trash label to all messages. If the thread is already in trash, it will be permanently deleted. Use `permanent=true` to force permanent deletion.
|
|
49
|
+
*
|
|
50
|
+
* @param {AgentMail.ThreadId} thread_id
|
|
51
|
+
* @param {AgentMail.DeleteThreadRequest} request
|
|
52
|
+
* @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
53
|
+
*
|
|
54
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* await client.threads.delete("thread_id")
|
|
58
|
+
*/
|
|
59
|
+
delete(thread_id: AgentMail.ThreadId, request?: AgentMail.DeleteThreadRequest, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<void>;
|
|
60
|
+
private __delete;
|
|
47
61
|
}
|
|
@@ -229,4 +229,64 @@ export class ThreadsClient {
|
|
|
229
229
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/threads/{thread_id}/attachments/{attachment_id}");
|
|
230
230
|
});
|
|
231
231
|
}
|
|
232
|
+
/**
|
|
233
|
+
* Moves the thread to trash by adding a trash label to all messages. If the thread is already in trash, it will be permanently deleted. Use `permanent=true` to force permanent deletion.
|
|
234
|
+
*
|
|
235
|
+
* @param {AgentMail.ThreadId} thread_id
|
|
236
|
+
* @param {AgentMail.DeleteThreadRequest} request
|
|
237
|
+
* @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
238
|
+
*
|
|
239
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
240
|
+
*
|
|
241
|
+
* @example
|
|
242
|
+
* await client.threads.delete("thread_id")
|
|
243
|
+
*/
|
|
244
|
+
delete(thread_id, request = {}, requestOptions) {
|
|
245
|
+
return core.HttpResponsePromise.fromPromise(this.__delete(thread_id, request, requestOptions));
|
|
246
|
+
}
|
|
247
|
+
__delete(thread_id_1) {
|
|
248
|
+
return __awaiter(this, arguments, void 0, function* (thread_id, request = {}, requestOptions) {
|
|
249
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
250
|
+
const { permanent } = request;
|
|
251
|
+
const _queryParams = {
|
|
252
|
+
permanent,
|
|
253
|
+
};
|
|
254
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
255
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
256
|
+
const _response = yield core.fetcher({
|
|
257
|
+
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.Prod)
|
|
258
|
+
.http, `/v0/threads/${core.url.encodePathParam(serializers.ThreadId.jsonOrThrow(thread_id, { omitUndefined: true }))}`),
|
|
259
|
+
method: "DELETE",
|
|
260
|
+
headers: _headers,
|
|
261
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
262
|
+
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,
|
|
263
|
+
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,
|
|
264
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
265
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
266
|
+
logging: this._options.logging,
|
|
267
|
+
});
|
|
268
|
+
if (_response.ok) {
|
|
269
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
270
|
+
}
|
|
271
|
+
if (_response.error.reason === "status-code") {
|
|
272
|
+
switch (_response.error.statusCode) {
|
|
273
|
+
case 404:
|
|
274
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
275
|
+
unrecognizedObjectKeys: "passthrough",
|
|
276
|
+
allowUnrecognizedUnionMembers: true,
|
|
277
|
+
allowUnrecognizedEnumValues: true,
|
|
278
|
+
skipValidation: true,
|
|
279
|
+
breadcrumbsPrefix: ["response"],
|
|
280
|
+
}), _response.rawResponse);
|
|
281
|
+
default:
|
|
282
|
+
throw new errors.AgentMailError({
|
|
283
|
+
statusCode: _response.error.statusCode,
|
|
284
|
+
body: _response.error.body,
|
|
285
|
+
rawResponse: _response.rawResponse,
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v0/threads/{thread_id}");
|
|
290
|
+
});
|
|
291
|
+
}
|
|
232
292
|
}
|
|
@@ -30,19 +30,6 @@ export declare class WebhooksClient {
|
|
|
30
30
|
*/
|
|
31
31
|
get(webhook_id: AgentMail.webhooks.WebhookId, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentMail.webhooks.Webhook>;
|
|
32
32
|
private __get;
|
|
33
|
-
/**
|
|
34
|
-
* @param {AgentMail.webhooks.WebhookId} webhook_id
|
|
35
|
-
* @param {AgentMail.webhooks.UpdateWebhookRequest} request
|
|
36
|
-
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
37
|
-
*
|
|
38
|
-
* @throws {@link AgentMail.NotFoundError}
|
|
39
|
-
* @throws {@link AgentMail.ValidationError}
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* await client.webhooks.update("webhook_id", {})
|
|
43
|
-
*/
|
|
44
|
-
update(webhook_id: AgentMail.webhooks.WebhookId, request: AgentMail.webhooks.UpdateWebhookRequest, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentMail.webhooks.Webhook>;
|
|
45
|
-
private __update;
|
|
46
33
|
/**
|
|
47
34
|
* @param {AgentMail.webhooks.CreateWebhookRequest} request
|
|
48
35
|
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -57,6 +44,19 @@ export declare class WebhooksClient {
|
|
|
57
44
|
*/
|
|
58
45
|
create(request: AgentMail.webhooks.CreateWebhookRequest, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentMail.webhooks.Webhook>;
|
|
59
46
|
private __create;
|
|
47
|
+
/**
|
|
48
|
+
* @param {AgentMail.webhooks.WebhookId} webhook_id
|
|
49
|
+
* @param {AgentMail.webhooks.UpdateWebhookRequest} request
|
|
50
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
51
|
+
*
|
|
52
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
53
|
+
* @throws {@link AgentMail.ValidationError}
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* await client.webhooks.update("webhook_id", {})
|
|
57
|
+
*/
|
|
58
|
+
update(webhook_id: AgentMail.webhooks.WebhookId, request: AgentMail.webhooks.UpdateWebhookRequest, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentMail.webhooks.Webhook>;
|
|
59
|
+
private __update;
|
|
60
60
|
/**
|
|
61
61
|
* @param {AgentMail.webhooks.WebhookId} webhook_id
|
|
62
62
|
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -138,33 +138,34 @@ export class WebhooksClient {
|
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
140
|
/**
|
|
141
|
-
* @param {AgentMail.webhooks.
|
|
142
|
-
* @param {AgentMail.webhooks.UpdateWebhookRequest} request
|
|
141
|
+
* @param {AgentMail.webhooks.CreateWebhookRequest} request
|
|
143
142
|
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
144
143
|
*
|
|
145
|
-
* @throws {@link AgentMail.NotFoundError}
|
|
146
144
|
* @throws {@link AgentMail.ValidationError}
|
|
147
145
|
*
|
|
148
146
|
* @example
|
|
149
|
-
* await client.webhooks.
|
|
147
|
+
* await client.webhooks.create({
|
|
148
|
+
* url: "url",
|
|
149
|
+
* eventTypes: ["message.received", "message.received"]
|
|
150
|
+
* })
|
|
150
151
|
*/
|
|
151
|
-
|
|
152
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
152
|
+
create(request, requestOptions) {
|
|
153
|
+
return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
|
|
153
154
|
}
|
|
154
|
-
|
|
155
|
+
__create(request, requestOptions) {
|
|
155
156
|
return __awaiter(this, void 0, void 0, function* () {
|
|
156
157
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
157
158
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
158
159
|
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
159
160
|
const _response = yield core.fetcher({
|
|
160
161
|
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.Prod)
|
|
161
|
-
.http,
|
|
162
|
-
method: "
|
|
162
|
+
.http, "/v0/webhooks"),
|
|
163
|
+
method: "POST",
|
|
163
164
|
headers: _headers,
|
|
164
165
|
contentType: "application/json",
|
|
165
166
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
166
167
|
requestType: "json",
|
|
167
|
-
body: serializers.webhooks.
|
|
168
|
+
body: serializers.webhooks.CreateWebhookRequest.jsonOrThrow(request, {
|
|
168
169
|
unrecognizedObjectKeys: "strip",
|
|
169
170
|
omitUndefined: true,
|
|
170
171
|
}),
|
|
@@ -188,14 +189,6 @@ export class WebhooksClient {
|
|
|
188
189
|
}
|
|
189
190
|
if (_response.error.reason === "status-code") {
|
|
190
191
|
switch (_response.error.statusCode) {
|
|
191
|
-
case 404:
|
|
192
|
-
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
193
|
-
unrecognizedObjectKeys: "passthrough",
|
|
194
|
-
allowUnrecognizedUnionMembers: true,
|
|
195
|
-
allowUnrecognizedEnumValues: true,
|
|
196
|
-
skipValidation: true,
|
|
197
|
-
breadcrumbsPrefix: ["response"],
|
|
198
|
-
}), _response.rawResponse);
|
|
199
192
|
case 400:
|
|
200
193
|
throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
|
|
201
194
|
unrecognizedObjectKeys: "passthrough",
|
|
@@ -212,38 +205,37 @@ export class WebhooksClient {
|
|
|
212
205
|
});
|
|
213
206
|
}
|
|
214
207
|
}
|
|
215
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "
|
|
208
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v0/webhooks");
|
|
216
209
|
});
|
|
217
210
|
}
|
|
218
211
|
/**
|
|
219
|
-
* @param {AgentMail.webhooks.
|
|
212
|
+
* @param {AgentMail.webhooks.WebhookId} webhook_id
|
|
213
|
+
* @param {AgentMail.webhooks.UpdateWebhookRequest} request
|
|
220
214
|
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
221
215
|
*
|
|
216
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
222
217
|
* @throws {@link AgentMail.ValidationError}
|
|
223
218
|
*
|
|
224
219
|
* @example
|
|
225
|
-
* await client.webhooks.
|
|
226
|
-
* url: "url",
|
|
227
|
-
* eventTypes: ["message.received", "message.received"]
|
|
228
|
-
* })
|
|
220
|
+
* await client.webhooks.update("webhook_id", {})
|
|
229
221
|
*/
|
|
230
|
-
|
|
231
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
222
|
+
update(webhook_id, request, requestOptions) {
|
|
223
|
+
return core.HttpResponsePromise.fromPromise(this.__update(webhook_id, request, requestOptions));
|
|
232
224
|
}
|
|
233
|
-
|
|
225
|
+
__update(webhook_id, request, requestOptions) {
|
|
234
226
|
return __awaiter(this, void 0, void 0, function* () {
|
|
235
227
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
236
228
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
237
229
|
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
238
230
|
const _response = yield core.fetcher({
|
|
239
231
|
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.Prod)
|
|
240
|
-
.http,
|
|
241
|
-
method: "
|
|
232
|
+
.http, `/v0/webhooks/${core.url.encodePathParam(serializers.webhooks.WebhookId.jsonOrThrow(webhook_id, { omitUndefined: true }))}`),
|
|
233
|
+
method: "PATCH",
|
|
242
234
|
headers: _headers,
|
|
243
235
|
contentType: "application/json",
|
|
244
236
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
245
237
|
requestType: "json",
|
|
246
|
-
body: serializers.webhooks.
|
|
238
|
+
body: serializers.webhooks.UpdateWebhookRequest.jsonOrThrow(request, {
|
|
247
239
|
unrecognizedObjectKeys: "strip",
|
|
248
240
|
omitUndefined: true,
|
|
249
241
|
}),
|
|
@@ -267,6 +259,14 @@ export class WebhooksClient {
|
|
|
267
259
|
}
|
|
268
260
|
if (_response.error.reason === "status-code") {
|
|
269
261
|
switch (_response.error.statusCode) {
|
|
262
|
+
case 404:
|
|
263
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
264
|
+
unrecognizedObjectKeys: "passthrough",
|
|
265
|
+
allowUnrecognizedUnionMembers: true,
|
|
266
|
+
allowUnrecognizedEnumValues: true,
|
|
267
|
+
skipValidation: true,
|
|
268
|
+
breadcrumbsPrefix: ["response"],
|
|
269
|
+
}), _response.rawResponse);
|
|
270
270
|
case 400:
|
|
271
271
|
throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
|
|
272
272
|
unrecognizedObjectKeys: "passthrough",
|
|
@@ -283,7 +283,7 @@ export class WebhooksClient {
|
|
|
283
283
|
});
|
|
284
284
|
}
|
|
285
285
|
}
|
|
286
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "
|
|
286
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PATCH", "/v0/webhooks/{webhook_id}");
|
|
287
287
|
});
|
|
288
288
|
}
|
|
289
289
|
/**
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type * as AgentMail from "../../../../api/index.mjs";
|
|
2
|
+
import * as core from "../../../../core/index.mjs";
|
|
3
|
+
import type * as serializers from "../../../index.mjs";
|
|
4
|
+
import { FeedbackEnabled } from "./FeedbackEnabled.mjs";
|
|
5
|
+
export declare const UpdateDomainRequest: core.serialization.ObjectSchema<serializers.UpdateDomainRequest.Raw, AgentMail.UpdateDomainRequest>;
|
|
6
|
+
export declare namespace UpdateDomainRequest {
|
|
7
|
+
interface Raw {
|
|
8
|
+
feedback_enabled?: FeedbackEnabled.Raw | null;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
import * as core from "../../../../core/index.mjs";
|
|
3
|
+
import { FeedbackEnabled } from "./FeedbackEnabled.mjs";
|
|
4
|
+
export const UpdateDomainRequest = core.serialization.object({
|
|
5
|
+
feedbackEnabled: core.serialization.property("feedback_enabled", FeedbackEnabled.optional()),
|
|
6
|
+
});
|
|
@@ -8,5 +8,6 @@ export * from "./FeedbackEnabled.mjs";
|
|
|
8
8
|
export * from "./ListDomainsResponse.mjs";
|
|
9
9
|
export * from "./RecordStatus.mjs";
|
|
10
10
|
export * from "./RecordType.mjs";
|
|
11
|
+
export * from "./UpdateDomainRequest.mjs";
|
|
11
12
|
export * from "./VerificationRecord.mjs";
|
|
12
13
|
export * from "./VerificationStatus.mjs";
|
|
@@ -8,5 +8,6 @@ export * from "./FeedbackEnabled.mjs";
|
|
|
8
8
|
export * from "./ListDomainsResponse.mjs";
|
|
9
9
|
export * from "./RecordStatus.mjs";
|
|
10
10
|
export * from "./RecordType.mjs";
|
|
11
|
+
export * from "./UpdateDomainRequest.mjs";
|
|
11
12
|
export * from "./VerificationRecord.mjs";
|
|
12
13
|
export * from "./VerificationStatus.mjs";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type * as AgentMail from "../../../../api/index.mjs";
|
|
2
|
+
import * as core from "../../../../core/index.mjs";
|
|
3
|
+
import type * as serializers from "../../../index.mjs";
|
|
4
|
+
import { MessageId } from "./MessageId.mjs";
|
|
5
|
+
import { MessageSize } from "./MessageSize.mjs";
|
|
6
|
+
export declare const RawMessageResponse: core.serialization.ObjectSchema<serializers.RawMessageResponse.Raw, AgentMail.RawMessageResponse>;
|
|
7
|
+
export declare namespace RawMessageResponse {
|
|
8
|
+
interface Raw {
|
|
9
|
+
message_id: MessageId.Raw;
|
|
10
|
+
size: MessageSize.Raw;
|
|
11
|
+
download_url: string;
|
|
12
|
+
expires_at: string;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
import * as core from "../../../../core/index.mjs";
|
|
3
|
+
import { MessageId } from "./MessageId.mjs";
|
|
4
|
+
import { MessageSize } from "./MessageSize.mjs";
|
|
5
|
+
export const RawMessageResponse = core.serialization.object({
|
|
6
|
+
messageId: core.serialization.property("message_id", MessageId),
|
|
7
|
+
size: MessageSize,
|
|
8
|
+
downloadUrl: core.serialization.property("download_url", core.serialization.string()),
|
|
9
|
+
expiresAt: core.serialization.property("expires_at", core.serialization.date()),
|
|
10
|
+
});
|
|
@@ -21,6 +21,7 @@ export * from "./MessageText.mjs";
|
|
|
21
21
|
export * from "./MessageTimestamp.mjs";
|
|
22
22
|
export * from "./MessageTo.mjs";
|
|
23
23
|
export * from "./MessageUpdatedAt.mjs";
|
|
24
|
+
export * from "./RawMessageResponse.mjs";
|
|
24
25
|
export * from "./ReplyAll.mjs";
|
|
25
26
|
export * from "./ReplyAllMessageRequest.mjs";
|
|
26
27
|
export * from "./ReplyToMessageRequest.mjs";
|
|
@@ -21,6 +21,7 @@ export * from "./MessageText.mjs";
|
|
|
21
21
|
export * from "./MessageTimestamp.mjs";
|
|
22
22
|
export * from "./MessageTo.mjs";
|
|
23
23
|
export * from "./MessageUpdatedAt.mjs";
|
|
24
|
+
export * from "./RawMessageResponse.mjs";
|
|
24
25
|
export * from "./ReplyAll.mjs";
|
|
25
26
|
export * from "./ReplyAllMessageRequest.mjs";
|
|
26
27
|
export * from "./ReplyToMessageRequest.mjs";
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.4.
|
|
1
|
+
export declare const SDK_VERSION = "0.4.4";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.4.
|
|
1
|
+
export const SDK_VERSION = "0.4.4";
|