|
| 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 OperationalWebhookEndpointSecretIn endpointSecretIn) throws ApiException { |
| 75 | + this.rotateSecret(endpointId, endpointSecretIn, new PostOptions()); |
| 76 | + } |
| 77 | + |
| 78 | + public void rotateSecret(final String endpointId, |
| 79 | + final OperationalWebhookEndpointSecretIn endpointSecretIn, final PostOptions options) throws ApiException { |
| 80 | + try { |
| 81 | + api.rotateOperationalWebhookEndpointSecret(endpointId, endpointSecretIn, options.getIdempotencyKey()); |
| 82 | + } catch (com.svix.internal.ApiException e) { |
| 83 | + throw Utils.wrapInternalApiException(e); |
| 84 | + } |
| 85 | + } |
| 86 | +} |
0 commit comments