Skip to content

Commit 00760de

Browse files
Release 0.2.8
1 parent d0f67b5 commit 00760de

File tree

13 files changed

+299
-7
lines changed

13 files changed

+299
-7
lines changed

.fern/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
}
1414
}
1515
},
16-
"sdkVersion": "0.2.6"
16+
"sdkVersion": "0.2.8"
1717
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "agentmail",
3-
"version": "0.2.6",
3+
"version": "0.2.8",
44
"private": false,
55
"repository": {
66
"type": "git",

reference.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,63 @@ await client.webhooks.get("webhook_id");
547547
</dl>
548548

549549

550+
</dd>
551+
</dl>
552+
</details>
553+
554+
<details><summary><code>client.webhooks.<a href="/src/api/resources/webhooks/client/Client.ts">update</a>(webhook_id, { ...params }) -> AgentMail.Webhook</code></summary>
555+
<dl>
556+
<dd>
557+
558+
#### 🔌 Usage
559+
560+
<dl>
561+
<dd>
562+
563+
<dl>
564+
<dd>
565+
566+
```typescript
567+
await client.webhooks.update("webhook_id", {});
568+
569+
```
570+
</dd>
571+
</dl>
572+
</dd>
573+
</dl>
574+
575+
#### ⚙️ Parameters
576+
577+
<dl>
578+
<dd>
579+
580+
<dl>
581+
<dd>
582+
583+
**webhook_id:** `AgentMail.WebhookId`
584+
585+
</dd>
586+
</dl>
587+
588+
<dl>
589+
<dd>
590+
591+
**request:** `AgentMail.UpdateWebhookRequest`
592+
593+
</dd>
594+
</dl>
595+
596+
<dl>
597+
<dd>
598+
599+
**requestOptions:** `WebhooksClient.RequestOptions`
600+
601+
</dd>
602+
</dl>
603+
</dd>
604+
</dl>
605+
606+
550607
</dd>
551608
</dl>
552609
</details>

src/BaseClient.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ export function normalizeClientOptions<T extends BaseClientOptions = BaseClientO
5151
{
5252
"X-Fern-Language": "JavaScript",
5353
"X-Fern-SDK-Name": "agentmail",
54-
"X-Fern-SDK-Version": "0.2.6",
55-
"User-Agent": "agentmail/0.2.6",
54+
"X-Fern-SDK-Version": "0.2.8",
55+
"User-Agent": "agentmail/0.2.8",
5656
"X-Fern-Runtime": core.RUNTIME.type,
5757
"X-Fern-Runtime-Version": core.RUNTIME.version,
5858
},
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// This file was auto-generated by Fern from our API Definition.
22

33
/**
4-
* Inboxes for which to send events.
4+
* Inboxes for which to send events. Maximum 10 per webhook.
55
*/
66
export type InboxIds = string[];
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// This file was auto-generated by Fern from our API Definition.
22

33
/**
4-
* Pods for which to send events.
4+
* Pods for which to send events. Maximum 10 per webhook.
55
*/
66
export type PodIds = string[];

src/api/resources/webhooks/client/Client.ts

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,109 @@ export class WebhooksClient {
176176
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/webhooks/{webhook_id}");
177177
}
178178

179+
/**
180+
* @param {AgentMail.webhooks.WebhookId} webhook_id
181+
* @param {AgentMail.webhooks.UpdateWebhookRequest} request
182+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
183+
*
184+
* @throws {@link AgentMail.NotFoundError}
185+
* @throws {@link AgentMail.ValidationError}
186+
*
187+
* @example
188+
* await client.webhooks.update("webhook_id", {})
189+
*/
190+
public update(
191+
webhook_id: AgentMail.webhooks.WebhookId,
192+
request: AgentMail.webhooks.UpdateWebhookRequest,
193+
requestOptions?: WebhooksClient.RequestOptions,
194+
): core.HttpResponsePromise<AgentMail.webhooks.Webhook> {
195+
return core.HttpResponsePromise.fromPromise(this.__update(webhook_id, request, requestOptions));
196+
}
197+
198+
private async __update(
199+
webhook_id: AgentMail.webhooks.WebhookId,
200+
request: AgentMail.webhooks.UpdateWebhookRequest,
201+
requestOptions?: WebhooksClient.RequestOptions,
202+
): Promise<core.WithRawResponse<AgentMail.webhooks.Webhook>> {
203+
const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest();
204+
const _headers: core.Fetcher.Args["headers"] = mergeHeaders(
205+
_authRequest.headers,
206+
this._options?.headers,
207+
requestOptions?.headers,
208+
);
209+
const _response = await core.fetcher({
210+
url: core.url.join(
211+
(await core.Supplier.get(this._options.baseUrl)) ??
212+
(
213+
(await core.Supplier.get(this._options.environment)) ??
214+
environments.AgentMailEnvironment.Production
215+
).http,
216+
`/v0/webhooks/${core.url.encodePathParam(serializers.webhooks.WebhookId.jsonOrThrow(webhook_id, { omitUndefined: true }))}`,
217+
),
218+
method: "PATCH",
219+
headers: _headers,
220+
contentType: "application/json",
221+
queryParameters: requestOptions?.queryParams,
222+
requestType: "json",
223+
body: serializers.webhooks.UpdateWebhookRequest.jsonOrThrow(request, {
224+
unrecognizedObjectKeys: "strip",
225+
omitUndefined: true,
226+
}),
227+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
228+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
229+
abortSignal: requestOptions?.abortSignal,
230+
fetchFn: this._options?.fetch,
231+
logging: this._options.logging,
232+
});
233+
if (_response.ok) {
234+
return {
235+
data: serializers.webhooks.Webhook.parseOrThrow(_response.body, {
236+
unrecognizedObjectKeys: "passthrough",
237+
allowUnrecognizedUnionMembers: true,
238+
allowUnrecognizedEnumValues: true,
239+
skipValidation: true,
240+
breadcrumbsPrefix: ["response"],
241+
}),
242+
rawResponse: _response.rawResponse,
243+
};
244+
}
245+
246+
if (_response.error.reason === "status-code") {
247+
switch (_response.error.statusCode) {
248+
case 404:
249+
throw new AgentMail.NotFoundError(
250+
serializers.ErrorResponse.parseOrThrow(_response.error.body, {
251+
unrecognizedObjectKeys: "passthrough",
252+
allowUnrecognizedUnionMembers: true,
253+
allowUnrecognizedEnumValues: true,
254+
skipValidation: true,
255+
breadcrumbsPrefix: ["response"],
256+
}),
257+
_response.rawResponse,
258+
);
259+
case 400:
260+
throw new AgentMail.ValidationError(
261+
serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
262+
unrecognizedObjectKeys: "passthrough",
263+
allowUnrecognizedUnionMembers: true,
264+
allowUnrecognizedEnumValues: true,
265+
skipValidation: true,
266+
breadcrumbsPrefix: ["response"],
267+
}),
268+
_response.rawResponse,
269+
);
270+
default:
271+
throw new errors.AgentMailError({
272+
statusCode: _response.error.statusCode,
273+
body: _response.error.body,
274+
rawResponse: _response.rawResponse,
275+
});
276+
}
277+
}
278+
279+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PATCH", "/v0/webhooks/{webhook_id}");
280+
}
281+
179282
/**
180283
* @param {AgentMail.webhooks.CreateWebhookRequest} request
181284
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// This file was auto-generated by Fern from our API Definition.
2+
3+
import type * as AgentMail from "../../../index.js";
4+
5+
export interface UpdateWebhookRequest {
6+
/** Inbox IDs to subscribe to the webhook. */
7+
addInboxIds?: AgentMail.InboxIds;
8+
/** Inbox IDs to unsubscribe from the webhook. */
9+
removeInboxIds?: AgentMail.InboxIds;
10+
/** Pod IDs to subscribe to the webhook. */
11+
addPodIds?: AgentMail.PodIds;
12+
/** Pod IDs to unsubscribe from the webhook. */
13+
removePodIds?: AgentMail.PodIds;
14+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export * from "./ClientId.js";
22
export * from "./CreateWebhookRequest.js";
33
export * from "./ListWebhooksResponse.js";
4+
export * from "./UpdateWebhookRequest.js";
45
export * from "./Url.js";
56
export * from "./Webhook.js";
67
export * from "./WebhookId.js";
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// This file was auto-generated by Fern from our API Definition.
2+
3+
import type * as AgentMail from "../../../../api/index.js";
4+
import * as core from "../../../../core/index.js";
5+
import type * as serializers from "../../../index.js";
6+
import { InboxIds } from "../../events/types/InboxIds.js";
7+
import { PodIds } from "../../events/types/PodIds.js";
8+
9+
export const UpdateWebhookRequest: core.serialization.ObjectSchema<
10+
serializers.webhooks.UpdateWebhookRequest.Raw,
11+
AgentMail.webhooks.UpdateWebhookRequest
12+
> = core.serialization.object({
13+
addInboxIds: core.serialization.property("add_inbox_ids", InboxIds.optional()),
14+
removeInboxIds: core.serialization.property("remove_inbox_ids", InboxIds.optional()),
15+
addPodIds: core.serialization.property("add_pod_ids", PodIds.optional()),
16+
removePodIds: core.serialization.property("remove_pod_ids", PodIds.optional()),
17+
});
18+
19+
export declare namespace UpdateWebhookRequest {
20+
export interface Raw {
21+
add_inbox_ids?: InboxIds.Raw | null;
22+
remove_inbox_ids?: InboxIds.Raw | null;
23+
add_pod_ids?: PodIds.Raw | null;
24+
remove_pod_ids?: PodIds.Raw | null;
25+
}
26+
}

0 commit comments

Comments
 (0)