agentmail 0.2.5 → 0.2.8
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/attachments/types/SendAttachment.d.ts +4 -1
- package/dist/cjs/api/resources/attachments/types/index.d.ts +0 -1
- package/dist/cjs/api/resources/attachments/types/index.js +0 -1
- package/dist/cjs/api/resources/events/types/InboxIds.d.ts +1 -1
- package/dist/cjs/api/resources/events/types/PodIds.d.ts +1 -1
- package/dist/cjs/api/resources/webhooks/client/Client.d.ts +13 -0
- package/dist/cjs/api/resources/webhooks/client/Client.js +77 -0
- package/dist/cjs/api/resources/webhooks/types/UpdateWebhookRequest.d.ts +11 -0
- package/dist/cjs/api/resources/webhooks/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/webhooks/types/index.js +1 -0
- package/dist/cjs/serialization/resources/attachments/types/SendAttachment.d.ts +2 -2
- package/dist/cjs/serialization/resources/attachments/types/SendAttachment.js +2 -2
- package/dist/cjs/serialization/resources/attachments/types/index.d.ts +0 -1
- package/dist/cjs/serialization/resources/attachments/types/index.js +0 -1
- package/dist/cjs/serialization/resources/webhooks/types/UpdateWebhookRequest.d.ts +14 -0
- package/dist/cjs/serialization/resources/{attachments/types/AttachmentContent.js → webhooks/types/UpdateWebhookRequest.js} +9 -2
- package/dist/cjs/serialization/resources/webhooks/types/index.d.ts +1 -0
- package/dist/cjs/serialization/resources/webhooks/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/attachments/types/SendAttachment.d.mts +4 -1
- package/dist/esm/api/resources/attachments/types/index.d.mts +0 -1
- package/dist/esm/api/resources/attachments/types/index.mjs +0 -1
- package/dist/esm/api/resources/events/types/InboxIds.d.mts +1 -1
- package/dist/esm/api/resources/events/types/PodIds.d.mts +1 -1
- package/dist/esm/api/resources/webhooks/client/Client.d.mts +13 -0
- package/dist/esm/api/resources/webhooks/client/Client.mjs +77 -0
- package/dist/esm/api/resources/webhooks/types/UpdateWebhookRequest.d.mts +11 -0
- package/dist/esm/api/resources/webhooks/types/index.d.mts +1 -0
- package/dist/esm/api/resources/webhooks/types/index.mjs +1 -0
- package/dist/esm/serialization/resources/attachments/types/SendAttachment.d.mts +2 -2
- package/dist/esm/serialization/resources/attachments/types/SendAttachment.mjs +2 -2
- package/dist/esm/serialization/resources/attachments/types/index.d.mts +0 -1
- package/dist/esm/serialization/resources/attachments/types/index.mjs +0 -1
- package/dist/esm/serialization/resources/webhooks/types/UpdateWebhookRequest.d.mts +14 -0
- package/dist/esm/serialization/resources/webhooks/types/UpdateWebhookRequest.mjs +10 -0
- package/dist/esm/serialization/resources/webhooks/types/index.d.mts +1 -0
- package/dist/esm/serialization/resources/webhooks/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 +872 -280
- package/dist/llms.txt +2 -0
- package/package.json +1 -1
- package/reference.md +57 -0
- package/dist/cjs/api/resources/attachments/types/AttachmentContent.d.ts +0 -4
- package/dist/cjs/serialization/resources/attachments/types/AttachmentContent.d.ts +0 -7
- package/dist/esm/api/resources/attachments/types/AttachmentContent.d.mts +0 -4
- package/dist/esm/serialization/resources/attachments/types/AttachmentContent.d.mts +0 -7
- package/dist/esm/serialization/resources/attachments/types/AttachmentContent.mjs +0 -3
- /package/dist/cjs/api/resources/{attachments/types/AttachmentContent.js → webhooks/types/UpdateWebhookRequest.js} +0 -0
- /package/dist/esm/api/resources/{attachments/types/AttachmentContent.mjs → webhooks/types/UpdateWebhookRequest.mjs} +0 -0
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
|
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
44
|
"X-Fern-Language": "JavaScript",
|
|
45
45
|
"X-Fern-SDK-Name": "agentmail",
|
|
46
|
-
"X-Fern-SDK-Version": "0.2.
|
|
47
|
-
"User-Agent": "agentmail/0.2.
|
|
46
|
+
"X-Fern-SDK-Version": "0.2.8",
|
|
47
|
+
"User-Agent": "agentmail/0.2.8",
|
|
48
48
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
49
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
50
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -4,5 +4,8 @@ export interface SendAttachment {
|
|
|
4
4
|
contentType?: AgentMail.AttachmentContentType;
|
|
5
5
|
contentDisposition?: AgentMail.AttachmentContentDisposition;
|
|
6
6
|
contentId?: AgentMail.AttachmentContentId;
|
|
7
|
-
content
|
|
7
|
+
/** Base64 encoded content of attachment. */
|
|
8
|
+
content?: string;
|
|
9
|
+
/** URL to the attachment. */
|
|
10
|
+
url?: string;
|
|
8
11
|
}
|
|
@@ -15,7 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./Attachment.js"), exports);
|
|
18
|
-
__exportStar(require("./AttachmentContent.js"), exports);
|
|
19
18
|
__exportStar(require("./AttachmentContentDisposition.js"), exports);
|
|
20
19
|
__exportStar(require("./AttachmentContentId.js"), exports);
|
|
21
20
|
__exportStar(require("./AttachmentContentType.js"), exports);
|
|
@@ -30,6 +30,19 @@ 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;
|
|
33
46
|
/**
|
|
34
47
|
* @param {AgentMail.webhooks.CreateWebhookRequest} request
|
|
35
48
|
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -170,6 +170,83 @@ class WebhooksClient {
|
|
|
170
170
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v0/webhooks/{webhook_id}");
|
|
171
171
|
});
|
|
172
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* @param {AgentMail.webhooks.WebhookId} webhook_id
|
|
175
|
+
* @param {AgentMail.webhooks.UpdateWebhookRequest} request
|
|
176
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
177
|
+
*
|
|
178
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
179
|
+
* @throws {@link AgentMail.ValidationError}
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* await client.webhooks.update("webhook_id", {})
|
|
183
|
+
*/
|
|
184
|
+
update(webhook_id, request, requestOptions) {
|
|
185
|
+
return core.HttpResponsePromise.fromPromise(this.__update(webhook_id, request, requestOptions));
|
|
186
|
+
}
|
|
187
|
+
__update(webhook_id, request, requestOptions) {
|
|
188
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
189
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
190
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
191
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
192
|
+
const _response = yield core.fetcher({
|
|
193
|
+
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/${core.url.encodePathParam(serializers.webhooks.WebhookId.jsonOrThrow(webhook_id, { omitUndefined: true }))}`),
|
|
194
|
+
method: "PATCH",
|
|
195
|
+
headers: _headers,
|
|
196
|
+
contentType: "application/json",
|
|
197
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
198
|
+
requestType: "json",
|
|
199
|
+
body: serializers.webhooks.UpdateWebhookRequest.jsonOrThrow(request, {
|
|
200
|
+
unrecognizedObjectKeys: "strip",
|
|
201
|
+
omitUndefined: true,
|
|
202
|
+
}),
|
|
203
|
+
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,
|
|
204
|
+
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,
|
|
205
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
206
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
207
|
+
logging: this._options.logging,
|
|
208
|
+
});
|
|
209
|
+
if (_response.ok) {
|
|
210
|
+
return {
|
|
211
|
+
data: serializers.webhooks.Webhook.parseOrThrow(_response.body, {
|
|
212
|
+
unrecognizedObjectKeys: "passthrough",
|
|
213
|
+
allowUnrecognizedUnionMembers: true,
|
|
214
|
+
allowUnrecognizedEnumValues: true,
|
|
215
|
+
skipValidation: true,
|
|
216
|
+
breadcrumbsPrefix: ["response"],
|
|
217
|
+
}),
|
|
218
|
+
rawResponse: _response.rawResponse,
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
if (_response.error.reason === "status-code") {
|
|
222
|
+
switch (_response.error.statusCode) {
|
|
223
|
+
case 404:
|
|
224
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
225
|
+
unrecognizedObjectKeys: "passthrough",
|
|
226
|
+
allowUnrecognizedUnionMembers: true,
|
|
227
|
+
allowUnrecognizedEnumValues: true,
|
|
228
|
+
skipValidation: true,
|
|
229
|
+
breadcrumbsPrefix: ["response"],
|
|
230
|
+
}), _response.rawResponse);
|
|
231
|
+
case 400:
|
|
232
|
+
throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
|
|
233
|
+
unrecognizedObjectKeys: "passthrough",
|
|
234
|
+
allowUnrecognizedUnionMembers: true,
|
|
235
|
+
allowUnrecognizedEnumValues: true,
|
|
236
|
+
skipValidation: true,
|
|
237
|
+
breadcrumbsPrefix: ["response"],
|
|
238
|
+
}), _response.rawResponse);
|
|
239
|
+
default:
|
|
240
|
+
throw new errors.AgentMailError({
|
|
241
|
+
statusCode: _response.error.statusCode,
|
|
242
|
+
body: _response.error.body,
|
|
243
|
+
rawResponse: _response.rawResponse,
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PATCH", "/v0/webhooks/{webhook_id}");
|
|
248
|
+
});
|
|
249
|
+
}
|
|
173
250
|
/**
|
|
174
251
|
* @param {AgentMail.webhooks.CreateWebhookRequest} request
|
|
175
252
|
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type * as AgentMail from "../../../index.js";
|
|
2
|
+
export interface UpdateWebhookRequest {
|
|
3
|
+
/** Inbox IDs to subscribe to the webhook. */
|
|
4
|
+
addInboxIds?: AgentMail.InboxIds;
|
|
5
|
+
/** Inbox IDs to unsubscribe from the webhook. */
|
|
6
|
+
removeInboxIds?: AgentMail.InboxIds;
|
|
7
|
+
/** Pod IDs to subscribe to the webhook. */
|
|
8
|
+
addPodIds?: AgentMail.PodIds;
|
|
9
|
+
/** Pod IDs to unsubscribe from the webhook. */
|
|
10
|
+
removePodIds?: AgentMail.PodIds;
|
|
11
|
+
}
|
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./ClientId.js"), exports);
|
|
18
18
|
__exportStar(require("./CreateWebhookRequest.js"), exports);
|
|
19
19
|
__exportStar(require("./ListWebhooksResponse.js"), exports);
|
|
20
|
+
__exportStar(require("./UpdateWebhookRequest.js"), exports);
|
|
20
21
|
__exportStar(require("./Url.js"), exports);
|
|
21
22
|
__exportStar(require("./Webhook.js"), exports);
|
|
22
23
|
__exportStar(require("./WebhookId.js"), exports);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type * as AgentMail from "../../../../api/index.js";
|
|
2
2
|
import * as core from "../../../../core/index.js";
|
|
3
3
|
import type * as serializers from "../../../index.js";
|
|
4
|
-
import { AttachmentContent } from "./AttachmentContent.js";
|
|
5
4
|
import { AttachmentContentDisposition } from "./AttachmentContentDisposition.js";
|
|
6
5
|
import { AttachmentContentId } from "./AttachmentContentId.js";
|
|
7
6
|
import { AttachmentContentType } from "./AttachmentContentType.js";
|
|
@@ -13,6 +12,7 @@ export declare namespace SendAttachment {
|
|
|
13
12
|
content_type?: AttachmentContentType.Raw | null;
|
|
14
13
|
content_disposition?: AttachmentContentDisposition.Raw | null;
|
|
15
14
|
content_id?: AttachmentContentId.Raw | null;
|
|
16
|
-
content
|
|
15
|
+
content?: string | null;
|
|
16
|
+
url?: string | null;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -36,7 +36,6 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
37
|
exports.SendAttachment = void 0;
|
|
38
38
|
const core = __importStar(require("../../../../core/index.js"));
|
|
39
|
-
const AttachmentContent_js_1 = require("./AttachmentContent.js");
|
|
40
39
|
const AttachmentContentDisposition_js_1 = require("./AttachmentContentDisposition.js");
|
|
41
40
|
const AttachmentContentId_js_1 = require("./AttachmentContentId.js");
|
|
42
41
|
const AttachmentContentType_js_1 = require("./AttachmentContentType.js");
|
|
@@ -46,5 +45,6 @@ exports.SendAttachment = core.serialization.object({
|
|
|
46
45
|
contentType: core.serialization.property("content_type", AttachmentContentType_js_1.AttachmentContentType.optional()),
|
|
47
46
|
contentDisposition: core.serialization.property("content_disposition", AttachmentContentDisposition_js_1.AttachmentContentDisposition.optional()),
|
|
48
47
|
contentId: core.serialization.property("content_id", AttachmentContentId_js_1.AttachmentContentId.optional()),
|
|
49
|
-
content:
|
|
48
|
+
content: core.serialization.string().optional(),
|
|
49
|
+
url: core.serialization.string().optional(),
|
|
50
50
|
});
|
|
@@ -15,7 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./Attachment.js"), exports);
|
|
18
|
-
__exportStar(require("./AttachmentContent.js"), exports);
|
|
19
18
|
__exportStar(require("./AttachmentContentDisposition.js"), exports);
|
|
20
19
|
__exportStar(require("./AttachmentContentId.js"), exports);
|
|
21
20
|
__exportStar(require("./AttachmentContentType.js"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type * as AgentMail from "../../../../api/index.js";
|
|
2
|
+
import * as core from "../../../../core/index.js";
|
|
3
|
+
import type * as serializers from "../../../index.js";
|
|
4
|
+
import { InboxIds } from "../../events/types/InboxIds.js";
|
|
5
|
+
import { PodIds } from "../../events/types/PodIds.js";
|
|
6
|
+
export declare const UpdateWebhookRequest: core.serialization.ObjectSchema<serializers.webhooks.UpdateWebhookRequest.Raw, AgentMail.webhooks.UpdateWebhookRequest>;
|
|
7
|
+
export declare namespace UpdateWebhookRequest {
|
|
8
|
+
interface Raw {
|
|
9
|
+
add_inbox_ids?: InboxIds.Raw | null;
|
|
10
|
+
remove_inbox_ids?: InboxIds.Raw | null;
|
|
11
|
+
add_pod_ids?: PodIds.Raw | null;
|
|
12
|
+
remove_pod_ids?: PodIds.Raw | null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -34,6 +34,13 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
};
|
|
35
35
|
})();
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
exports.
|
|
37
|
+
exports.UpdateWebhookRequest = void 0;
|
|
38
38
|
const core = __importStar(require("../../../../core/index.js"));
|
|
39
|
-
|
|
39
|
+
const InboxIds_js_1 = require("../../events/types/InboxIds.js");
|
|
40
|
+
const PodIds_js_1 = require("../../events/types/PodIds.js");
|
|
41
|
+
exports.UpdateWebhookRequest = core.serialization.object({
|
|
42
|
+
addInboxIds: core.serialization.property("add_inbox_ids", InboxIds_js_1.InboxIds.optional()),
|
|
43
|
+
removeInboxIds: core.serialization.property("remove_inbox_ids", InboxIds_js_1.InboxIds.optional()),
|
|
44
|
+
addPodIds: core.serialization.property("add_pod_ids", PodIds_js_1.PodIds.optional()),
|
|
45
|
+
removePodIds: core.serialization.property("remove_pod_ids", PodIds_js_1.PodIds.optional()),
|
|
46
|
+
});
|
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./ClientId.js"), exports);
|
|
18
18
|
__exportStar(require("./CreateWebhookRequest.js"), exports);
|
|
19
19
|
__exportStar(require("./ListWebhooksResponse.js"), exports);
|
|
20
|
+
__exportStar(require("./UpdateWebhookRequest.js"), exports);
|
|
20
21
|
__exportStar(require("./Url.js"), exports);
|
|
21
22
|
__exportStar(require("./Webhook.js"), exports);
|
|
22
23
|
__exportStar(require("./WebhookId.js"), exports);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.2.
|
|
1
|
+
export declare const SDK_VERSION = "0.2.8";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/BaseClient.mjs
CHANGED
|
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
|
|
|
6
6
|
const headers = mergeHeaders({
|
|
7
7
|
"X-Fern-Language": "JavaScript",
|
|
8
8
|
"X-Fern-SDK-Name": "agentmail",
|
|
9
|
-
"X-Fern-SDK-Version": "0.2.
|
|
10
|
-
"User-Agent": "agentmail/0.2.
|
|
9
|
+
"X-Fern-SDK-Version": "0.2.8",
|
|
10
|
+
"User-Agent": "agentmail/0.2.8",
|
|
11
11
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
12
12
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
13
13
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -4,5 +4,8 @@ export interface SendAttachment {
|
|
|
4
4
|
contentType?: AgentMail.AttachmentContentType;
|
|
5
5
|
contentDisposition?: AgentMail.AttachmentContentDisposition;
|
|
6
6
|
contentId?: AgentMail.AttachmentContentId;
|
|
7
|
-
content
|
|
7
|
+
/** Base64 encoded content of attachment. */
|
|
8
|
+
content?: string;
|
|
9
|
+
/** URL to the attachment. */
|
|
10
|
+
url?: string;
|
|
8
11
|
}
|
|
@@ -30,6 +30,19 @@ 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;
|
|
33
46
|
/**
|
|
34
47
|
* @param {AgentMail.webhooks.CreateWebhookRequest} request
|
|
35
48
|
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -134,6 +134,83 @@ export class WebhooksClient {
|
|
|
134
134
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/webhooks/{webhook_id}");
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* @param {AgentMail.webhooks.WebhookId} webhook_id
|
|
139
|
+
* @param {AgentMail.webhooks.UpdateWebhookRequest} request
|
|
140
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
141
|
+
*
|
|
142
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
143
|
+
* @throws {@link AgentMail.ValidationError}
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* await client.webhooks.update("webhook_id", {})
|
|
147
|
+
*/
|
|
148
|
+
update(webhook_id, request, requestOptions) {
|
|
149
|
+
return core.HttpResponsePromise.fromPromise(this.__update(webhook_id, request, requestOptions));
|
|
150
|
+
}
|
|
151
|
+
__update(webhook_id, request, requestOptions) {
|
|
152
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
153
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
154
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
155
|
+
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);
|
|
156
|
+
const _response = yield core.fetcher({
|
|
157
|
+
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/${core.url.encodePathParam(serializers.webhooks.WebhookId.jsonOrThrow(webhook_id, { omitUndefined: true }))}`),
|
|
158
|
+
method: "PATCH",
|
|
159
|
+
headers: _headers,
|
|
160
|
+
contentType: "application/json",
|
|
161
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
162
|
+
requestType: "json",
|
|
163
|
+
body: serializers.webhooks.UpdateWebhookRequest.jsonOrThrow(request, {
|
|
164
|
+
unrecognizedObjectKeys: "strip",
|
|
165
|
+
omitUndefined: true,
|
|
166
|
+
}),
|
|
167
|
+
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,
|
|
168
|
+
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,
|
|
169
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
170
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
171
|
+
logging: this._options.logging,
|
|
172
|
+
});
|
|
173
|
+
if (_response.ok) {
|
|
174
|
+
return {
|
|
175
|
+
data: serializers.webhooks.Webhook.parseOrThrow(_response.body, {
|
|
176
|
+
unrecognizedObjectKeys: "passthrough",
|
|
177
|
+
allowUnrecognizedUnionMembers: true,
|
|
178
|
+
allowUnrecognizedEnumValues: true,
|
|
179
|
+
skipValidation: true,
|
|
180
|
+
breadcrumbsPrefix: ["response"],
|
|
181
|
+
}),
|
|
182
|
+
rawResponse: _response.rawResponse,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
if (_response.error.reason === "status-code") {
|
|
186
|
+
switch (_response.error.statusCode) {
|
|
187
|
+
case 404:
|
|
188
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
189
|
+
unrecognizedObjectKeys: "passthrough",
|
|
190
|
+
allowUnrecognizedUnionMembers: true,
|
|
191
|
+
allowUnrecognizedEnumValues: true,
|
|
192
|
+
skipValidation: true,
|
|
193
|
+
breadcrumbsPrefix: ["response"],
|
|
194
|
+
}), _response.rawResponse);
|
|
195
|
+
case 400:
|
|
196
|
+
throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
|
|
197
|
+
unrecognizedObjectKeys: "passthrough",
|
|
198
|
+
allowUnrecognizedUnionMembers: true,
|
|
199
|
+
allowUnrecognizedEnumValues: true,
|
|
200
|
+
skipValidation: true,
|
|
201
|
+
breadcrumbsPrefix: ["response"],
|
|
202
|
+
}), _response.rawResponse);
|
|
203
|
+
default:
|
|
204
|
+
throw new errors.AgentMailError({
|
|
205
|
+
statusCode: _response.error.statusCode,
|
|
206
|
+
body: _response.error.body,
|
|
207
|
+
rawResponse: _response.rawResponse,
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PATCH", "/v0/webhooks/{webhook_id}");
|
|
212
|
+
});
|
|
213
|
+
}
|
|
137
214
|
/**
|
|
138
215
|
* @param {AgentMail.webhooks.CreateWebhookRequest} request
|
|
139
216
|
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type * as AgentMail from "../../../index.mjs";
|
|
2
|
+
export interface UpdateWebhookRequest {
|
|
3
|
+
/** Inbox IDs to subscribe to the webhook. */
|
|
4
|
+
addInboxIds?: AgentMail.InboxIds;
|
|
5
|
+
/** Inbox IDs to unsubscribe from the webhook. */
|
|
6
|
+
removeInboxIds?: AgentMail.InboxIds;
|
|
7
|
+
/** Pod IDs to subscribe to the webhook. */
|
|
8
|
+
addPodIds?: AgentMail.PodIds;
|
|
9
|
+
/** Pod IDs to unsubscribe from the webhook. */
|
|
10
|
+
removePodIds?: AgentMail.PodIds;
|
|
11
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type * as AgentMail from "../../../../api/index.mjs";
|
|
2
2
|
import * as core from "../../../../core/index.mjs";
|
|
3
3
|
import type * as serializers from "../../../index.mjs";
|
|
4
|
-
import { AttachmentContent } from "./AttachmentContent.mjs";
|
|
5
4
|
import { AttachmentContentDisposition } from "./AttachmentContentDisposition.mjs";
|
|
6
5
|
import { AttachmentContentId } from "./AttachmentContentId.mjs";
|
|
7
6
|
import { AttachmentContentType } from "./AttachmentContentType.mjs";
|
|
@@ -13,6 +12,7 @@ export declare namespace SendAttachment {
|
|
|
13
12
|
content_type?: AttachmentContentType.Raw | null;
|
|
14
13
|
content_disposition?: AttachmentContentDisposition.Raw | null;
|
|
15
14
|
content_id?: AttachmentContentId.Raw | null;
|
|
16
|
-
content
|
|
15
|
+
content?: string | null;
|
|
16
|
+
url?: string | null;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
import * as core from "../../../../core/index.mjs";
|
|
3
|
-
import { AttachmentContent } from "./AttachmentContent.mjs";
|
|
4
3
|
import { AttachmentContentDisposition } from "./AttachmentContentDisposition.mjs";
|
|
5
4
|
import { AttachmentContentId } from "./AttachmentContentId.mjs";
|
|
6
5
|
import { AttachmentContentType } from "./AttachmentContentType.mjs";
|
|
@@ -10,5 +9,6 @@ export const SendAttachment = core.serialization.object({
|
|
|
10
9
|
contentType: core.serialization.property("content_type", AttachmentContentType.optional()),
|
|
11
10
|
contentDisposition: core.serialization.property("content_disposition", AttachmentContentDisposition.optional()),
|
|
12
11
|
contentId: core.serialization.property("content_id", AttachmentContentId.optional()),
|
|
13
|
-
content:
|
|
12
|
+
content: core.serialization.string().optional(),
|
|
13
|
+
url: core.serialization.string().optional(),
|
|
14
14
|
});
|
|
@@ -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 { InboxIds } from "../../events/types/InboxIds.mjs";
|
|
5
|
+
import { PodIds } from "../../events/types/PodIds.mjs";
|
|
6
|
+
export declare const UpdateWebhookRequest: core.serialization.ObjectSchema<serializers.webhooks.UpdateWebhookRequest.Raw, AgentMail.webhooks.UpdateWebhookRequest>;
|
|
7
|
+
export declare namespace UpdateWebhookRequest {
|
|
8
|
+
interface Raw {
|
|
9
|
+
add_inbox_ids?: InboxIds.Raw | null;
|
|
10
|
+
remove_inbox_ids?: InboxIds.Raw | null;
|
|
11
|
+
add_pod_ids?: PodIds.Raw | null;
|
|
12
|
+
remove_pod_ids?: PodIds.Raw | null;
|
|
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 { InboxIds } from "../../events/types/InboxIds.mjs";
|
|
4
|
+
import { PodIds } from "../../events/types/PodIds.mjs";
|
|
5
|
+
export const UpdateWebhookRequest = core.serialization.object({
|
|
6
|
+
addInboxIds: core.serialization.property("add_inbox_ids", InboxIds.optional()),
|
|
7
|
+
removeInboxIds: core.serialization.property("remove_inbox_ids", InboxIds.optional()),
|
|
8
|
+
addPodIds: core.serialization.property("add_pod_ids", PodIds.optional()),
|
|
9
|
+
removePodIds: core.serialization.property("remove_pod_ids", PodIds.optional()),
|
|
10
|
+
});
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.2.
|
|
1
|
+
export declare const SDK_VERSION = "0.2.8";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.2.
|
|
1
|
+
export const SDK_VERSION = "0.2.8";
|