Skip to content

Commit 087335b

Browse files
committed
javascript: Add operational webhook endpoint API
1 parent 72c060e commit 087335b

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

javascript/src/index.ts

+71
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ import {
6969
AppUsageStatsOut,
7070
AggregateEventTypesOut,
7171
EndpointOauthConfigIn,
72+
WebhookEndpointApi,
73+
OperationalWebhookEndpointIn,
74+
OperationalWebhookEndpointOut,
75+
OperationalWebhookEndpointSecretIn,
76+
OperationalWebhookEndpointSecretOut,
77+
OperationalWebhookEndpointUpdate,
78+
ListResponseOperationalWebhookEndpointOut,
7279
} from "./openapi/index";
7380
export * from "./openapi/models/all";
7481
export * from "./openapi/apis/exception";
@@ -112,6 +119,7 @@ export class Svix {
112119
public readonly messageAttempt: MessageAttempt;
113120
public readonly backgroundTask: BackgroundTask;
114121
public readonly statistics: Statistics;
122+
public readonly operationalWebhookEndpoint: OperationalWebhookEndpoint;
115123

116124
public constructor(token: string, options: SvixOptions = {}) {
117125
const regionalUrl = REGIONS.find((x) => x.region === token.split(".")[1])?.url;
@@ -142,6 +150,7 @@ export class Svix {
142150
this.messageAttempt = new MessageAttempt(config);
143151
this.backgroundTask = new BackgroundTask(config);
144152
this.statistics = new Statistics(config);
153+
this.operationalWebhookEndpoint = new OperationalWebhookEndpoint(config);
145154
}
146155
}
147156
export interface PostOptions {
@@ -194,6 +203,10 @@ export interface EndpointListOptions extends ListOptions {
194203
order?: Ordering;
195204
}
196205

206+
export interface OperationalWebhookEndpointListOptions extends ListOptions {
207+
order?: Ordering;
208+
}
209+
197210
export interface EndpointStatsOptions {
198211
since?: Date;
199212
until?: Date;
@@ -972,3 +985,61 @@ class Statistics {
972985
});
973986
}
974987
}
988+
989+
class OperationalWebhookEndpoint {
990+
private readonly api: WebhookEndpointApi;
991+
992+
public constructor(config: Configuration) {
993+
this.api = new WebhookEndpointApi(config);
994+
}
995+
996+
public list(
997+
options?: OperationalWebhookEndpointListOptions,
998+
): Promise<ListResponseOperationalWebhookEndpointOut> {
999+
return this.api.listOperationalWebhookEndpoints({ ...options });
1000+
}
1001+
1002+
public create(
1003+
endpointIn: OperationalWebhookEndpointIn,
1004+
options?: PostOptions,
1005+
): Promise<OperationalWebhookEndpointOut> {
1006+
return this.api.createOperationalWebhookEndpoint({
1007+
operationalWebhookEndpointIn: endpointIn,
1008+
...options,
1009+
});
1010+
}
1011+
1012+
public get(endpointId: string): Promise<OperationalWebhookEndpointOut> {
1013+
return this.api.getOperationalWebhookEndpoint({ endpointId });
1014+
}
1015+
1016+
public update(
1017+
endpointId: string,
1018+
endpointUpdate: OperationalWebhookEndpointUpdate,
1019+
): Promise<OperationalWebhookEndpointOut> {
1020+
return this.api.updateOperationalWebhookEndpoint({
1021+
endpointId,
1022+
operationalWebhookEndpointUpdate: endpointUpdate,
1023+
});
1024+
}
1025+
1026+
public delete(endpointId: string): Promise<void> {
1027+
return this.api.deleteOperationalWebhookEndpoint({ endpointId });
1028+
}
1029+
1030+
public getSecret(endpointId: string): Promise<OperationalWebhookEndpointSecretOut> {
1031+
return this.api.getOperationalWebhookEndpointSecret({ endpointId });
1032+
}
1033+
1034+
public rotateSecret(
1035+
endpointId: string,
1036+
endpointSecretIn: OperationalWebhookEndpointSecretIn,
1037+
options?: PostOptions,
1038+
): Promise<void> {
1039+
return this.api.rotateOperationalWebhookEndpointSecret({
1040+
endpointId,
1041+
operationalWebhookEndpointSecretIn: endpointSecretIn,
1042+
...options,
1043+
});
1044+
}
1045+
}

0 commit comments

Comments
 (0)