Skip to content

Commit 0238111

Browse files
committed
java: Add operational webhook endpoint API
1 parent 55de090 commit 0238111

File tree

3 files changed

+107
-0
lines changed

3 files changed

+107
-0
lines changed
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
package com.svix;
2+
3+
import com.svix.exceptions.ApiException;
4+
import com.svix.internal.api.WebhookEndpointApi;
5+
import com.svix.models.OperationalWebhookEndpointIn;
6+
import com.svix.models.OperationalWebhookEndpointOut;
7+
import com.svix.models.OperationalWebhookEndpointUpdate;
8+
import com.svix.models.OperationalWebhookEndpointSecretOut;
9+
import com.svix.models.OperationalWebhookEndpointSecretIn;
10+
import com.svix.models.ListResponseOperationalWebhookEndpointOut;
11+
12+
public final class OperationalWebhookEndpoint {
13+
private final WebhookEndpointApi api;
14+
15+
public OperationalWebhookEndpoint() {
16+
api = new WebhookEndpointApi();
17+
}
18+
19+
public ListResponseOperationalWebhookEndpointOut list(final OperationalWebhookEndpointListOptions options) throws ApiException {
20+
try {
21+
return api.listOperationalWebhookEndpoints(options.getLimit(), options.getIterator(), options.getOrder());
22+
} catch (com.svix.internal.ApiException e) {
23+
throw Utils.wrapInternalApiException(e);
24+
}
25+
}
26+
27+
public OperationalWebhookEndpointOut create(final OperationalWebhookEndpointIn endpointIn) throws ApiException {
28+
return this.create(endpointIn, new PostOptions());
29+
}
30+
31+
public OperationalWebhookEndpointOut create(final OperationalWebhookEndpointIn endpointIn, final PostOptions options)
32+
throws ApiException {
33+
try {
34+
return api.createOperationalWebhookEndpoint(endpointIn, options.getIdempotencyKey());
35+
} catch (com.svix.internal.ApiException e) {
36+
throw Utils.wrapInternalApiException(e);
37+
}
38+
}
39+
40+
public OperationalWebhookEndpointOut get(final String endpointId) throws ApiException {
41+
try {
42+
return api.getOperationalWebhookEndpoint(endpointId);
43+
} catch (com.svix.internal.ApiException e) {
44+
throw Utils.wrapInternalApiException(e);
45+
}
46+
}
47+
48+
public OperationalWebhookEndpointOut update(final String endpointId, final OperationalWebhookEndpointUpdate endpointUpdate)
49+
throws ApiException {
50+
try {
51+
return api.updateOperationalWebhookEndpoint(endpointId, endpointUpdate);
52+
} catch (com.svix.internal.ApiException e) {
53+
throw Utils.wrapInternalApiException(e);
54+
}
55+
}
56+
57+
public void delete(final String endpointId) throws ApiException {
58+
try {
59+
api.deleteOperationalWebhookEndpoint(endpointId);
60+
} catch (com.svix.internal.ApiException e) {
61+
throw Utils.wrapInternalApiException(e);
62+
}
63+
}
64+
65+
public OperationalWebhookEndpointSecretOut getSecret(final String endpointId) throws ApiException {
66+
try {
67+
return api.getOperationalWebhookEndpointSecret(endpointId);
68+
} catch (com.svix.internal.ApiException e) {
69+
throw Utils.wrapInternalApiException(e);
70+
}
71+
}
72+
73+
public void rotateSecret(final String endpointId,
74+
final OperationalWebhookEndpointSecretRotateIn endpointSecretRotateIn) throws ApiException {
75+
this.rotateSecret(endpointId, endpointSecretRotateIn, new PostOptions());
76+
}
77+
78+
public void rotateSecret(final String endpointId,
79+
final OperationalWebhookEndpointSecretRotateIn endpointSecretRotateIn, final PostOptions options) throws ApiException {
80+
try {
81+
api.rotateOperationalWebhookEndpointSecret(endpointId, endpointSecretRotateIn, options.getIdempotencyKey());
82+
} catch (com.svix.internal.ApiException e) {
83+
throw Utils.wrapInternalApiException(e);
84+
}
85+
}
86+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.svix;
2+
3+
import com.svix.models.Ordering;
4+
5+
public class OperationalWebhookEndpointListOptions extends ListOptions {
6+
private Ordering order;
7+
8+
public void setOrder(final Ordering order) {
9+
this.order = order;
10+
}
11+
12+
public Ordering getOrder() {
13+
return this.order;
14+
}
15+
}

java/lib/src/main/java/com/svix/Svix.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public final class Svix {
1414
private final Message message;
1515
private final MessageAttempt messageAttempt;
1616
private final Statistics statistics;
17+
private final OperationalWebhookEndpoint operationalWebhookEndpoint;
1718

1819
public Svix(final String token) {
1920
this(token, new SvixOptions());
@@ -55,6 +56,7 @@ public Svix(final String token, final SvixOptions options) {
5556
message = new Message();
5657
messageAttempt = new MessageAttempt();
5758
statistics = new Statistics();
59+
operationalWebhookEndpoint = new OperationalWebhookEndpoint();
5860
}
5961

6062
public Application getApplication() {
@@ -88,4 +90,8 @@ public MessageAttempt getMessageAttempt() {
8890
public Statistics getStatistics() {
8991
return statistics;
9092
}
93+
94+
public OperationalWebhookEndpoint getOperationalWebhookEndpoint() {
95+
return operationalWebhookEndpoint;
96+
}
9197
}

0 commit comments

Comments
 (0)