diff --git a/MIGRATION-GUIDE.md b/MIGRATION-GUIDE.md index d196eaefe..3fb49a37d 100644 --- a/MIGRATION-GUIDE.md +++ b/MIGRATION-GUIDE.md @@ -399,11 +399,11 @@ Use the new versioned API under `verification().v1()` to get access to [Verifica | verifications() `start` related APIs | [v1().verificationStart()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/api/v1/VerificationStartService.html) | | verifications() `report` related APIs | [v1().verificationReport()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/api/v1/VerificationReportService.html) | | verificationStatus() | [v1().verificationStatus()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/api/v1/VerificationStatusService.html) | -| webhooks() | [v1().webhooks()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/api/v1/WebHooksService.html) | +| webhooks() | [v1().sinchEvents()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/api/v1/SinchEventsService.html) | | VerificationStartService | [VerificationsStartService](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/api/v1/VerificationsStartService.html) | | VerificationReportService | [VerificationsReportService](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/api/v1/VerificationsReportService.html) | | VerificationStatusService | [VerificationsStatusService](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/api/v1/VerificationsStatusService.html) | -| WebHooksService | [WebhooksService](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/api/v1/WebhooksService.html) | +| WebHooksService | [SinchEventsService](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/api/v1/SinchEventsService.html) | #### Replacement models ##### Common Report @@ -461,17 +461,16 @@ Use the new versioned API under `verification().v1()` to get access to [Verifica | models/VerificationSourceType | [com.sinch.sdk.domains.verification.models.v1.status.StatusSource](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/status/StatusSource.html) | ##### Webhooks -| Old class | New class | -|---------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| models/webhooks/VerificationEvent | [com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationEvent](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationEvent.html) | -| models/webhooks/VerificationRequestEvent | [com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEvent](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEvent.html) | -| models/webhooks/VerificationResponse | [com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEventResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventResponse.html) | -| models/webhooks/VerificationResponseActionType | [com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationEventResponseAction](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationEventResponseAction.html) | -| models/webhooks/VerificationResponseCallout | [com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEventResponsePhoneCall](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventResponsePhoneCall.html) | -| models/webhooks/VerificationResponseCalloutSpeech | [com.sinch.sdk.domains.verification.models.v1.start.request.PhoneCallSpeech](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/request/PhoneCallSpeech.html) | -| models/webhooks/VerificationResponseFlashCall | [com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEventResponseFlashCall](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventResponseFlashCall.html) | -| models/webhooks/VerificationResponseSMS | [com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEventResponseSms](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventResponseSms.html) | -| models/webhooks/VerificationResultEvent | [com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationResultEvent](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationResultEvent.html) | +| Old class | New class | +|-----------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| models/webhooks/VerificationEvent | [com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationSinchEvent](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationSinchEvent.html) | +| models/webhooks/VerificationRequestEvent | [com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationStartEvent](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEvent.html) | +| models/webhooks/VerificationRequestEventResponse | [com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationStartEventResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventResponse.html) | +| models/webhooks/VerificationEventResponseAction | [com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationStartEventAction](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventAction.html) | +| models/webhooks/VerificationRequestEventResponsePhoneCall | [com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationStartEventResponsePhoneCall](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventResponsePhoneCall.html) | +| models/webhooks/VerificationRequestEventResponseFlashCall | [com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationStartEventResponseFlashCall](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventResponseFlashCall.html) | +| models/webhooks/VerificationRequestEventResponseSMS | [com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationStartEventResponseSms](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventResponseSms.html) | +| models/webhooks/VerificationResultEvent | [com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationResultEvent](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationResultEvent.html) | - `event` field removed from `VerificationRequestEvent`, `VerificationResultEvent` events. - `method` values based onto common `VerificationMethod` class. diff --git a/client/src/main/com/sinch/sdk/domains/verification/api/v1/WebhooksService.java b/client/src/main/com/sinch/sdk/domains/verification/api/v1/SinchEventsService.java similarity index 86% rename from client/src/main/com/sinch/sdk/domains/verification/api/v1/WebhooksService.java rename to client/src/main/com/sinch/sdk/domains/verification/api/v1/SinchEventsService.java index 1295ce870..5b0f829bd 100644 --- a/client/src/main/com/sinch/sdk/domains/verification/api/v1/WebhooksService.java +++ b/client/src/main/com/sinch/sdk/domains/verification/api/v1/SinchEventsService.java @@ -1,12 +1,12 @@ package com.sinch.sdk.domains.verification.api.v1; import com.sinch.sdk.core.exceptions.ApiMappingException; -import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationEvent; -import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEventResponse; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationSinchEvent; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationStartEventResponse; import java.util.Map; /** - * Webhooks service + * Sinch Events service * *

Callback events are used to authorize and manage your verification requests and return * verification results. @@ -16,7 +16,7 @@ * * @since 1.1 */ -public interface WebhooksService { +public interface SinchEventsService { /** * The Sinch Platform can initiate callback requests to a URL you define (Callback URL) on request @@ -48,7 +48,7 @@ boolean validateAuthenticationHeader( * href="https://developers.sinch.com/docs/verification/api-reference/verification/tag/Verification-callbacks/">https://developers.sinch.com/docs/verification/api-reference/verification/tag/Verification-callbacks/ * @since 1.1 */ - VerificationEvent parseEvent(String jsonPayload) throws ApiMappingException; + VerificationSinchEvent parseEvent(String jsonPayload) throws ApiMappingException; /** * This function can be called to serialize a verification response to be sent as JSON @@ -59,5 +59,5 @@ boolean validateAuthenticationHeader( * href="https://developers.sinch.com/docs/verification/api-reference/verification/tag/Verification-callbacks/">https://developers.sinch.com/docs/verification/api-reference/verification/tag/Verification-callbacks/ * @since 1.1 */ - String serializeResponse(VerificationRequestEventResponse response) throws ApiMappingException; + String serializeResponse(VerificationStartEventResponse response) throws ApiMappingException; } diff --git a/client/src/main/com/sinch/sdk/domains/verification/api/v1/VerificationService.java b/client/src/main/com/sinch/sdk/domains/verification/api/v1/VerificationService.java index fc01b4a52..5ab475d51 100644 --- a/client/src/main/com/sinch/sdk/domains/verification/api/v1/VerificationService.java +++ b/client/src/main/com/sinch/sdk/domains/verification/api/v1/VerificationService.java @@ -40,12 +40,12 @@ public interface VerificationService { VerificationsStatusService verificationStatus(); /** - * Webhooks helpers instance + * Sinch Events helpers instance * * @return service instance for project * @see Documentation - * @since 1.1 + * @since 2.0 */ - WebhooksService webhooks(); + SinchEventsService sinchEvents(); } diff --git a/client/src/main/com/sinch/sdk/domains/verification/api/v1/adapters/WebhooksService.java b/client/src/main/com/sinch/sdk/domains/verification/api/v1/adapters/SinchEventsService.java similarity index 70% rename from client/src/main/com/sinch/sdk/domains/verification/api/v1/adapters/WebhooksService.java rename to client/src/main/com/sinch/sdk/domains/verification/api/v1/adapters/SinchEventsService.java index 5917a1872..acda8c3c3 100644 --- a/client/src/main/com/sinch/sdk/domains/verification/api/v1/adapters/WebhooksService.java +++ b/client/src/main/com/sinch/sdk/domains/verification/api/v1/adapters/SinchEventsService.java @@ -6,19 +6,20 @@ import com.sinch.sdk.core.utils.MapUtils; import com.sinch.sdk.core.utils.StringUtil; import com.sinch.sdk.core.utils.databind.Mapper; -import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationEvent; -import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEventResponse; -import com.sinch.sdk.domains.verification.models.v1.webhooks.internal.VerificationEventInternalImpl; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationSinchEvent; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationStartEventResponse; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.internal.VerificationEventInternalImpl; import java.util.Map; import java.util.logging.Logger; -public class WebhooksService implements com.sinch.sdk.domains.verification.api.v1.WebhooksService { +public class SinchEventsService + implements com.sinch.sdk.domains.verification.api.v1.SinchEventsService { - private static final Logger LOGGER = Logger.getLogger(WebhooksService.class.getName()); + private static final Logger LOGGER = Logger.getLogger(SinchEventsService.class.getName()); private final Map authManagers; - public WebhooksService(Map authManagers) { + public SinchEventsService(Map authManagers) { this.authManagers = authManagers; } @@ -48,18 +49,18 @@ public boolean validateAuthenticationHeader( } @Override - public VerificationEvent parseEvent(String jsonPayload) throws ApiMappingException { + public VerificationSinchEvent parseEvent(String jsonPayload) throws ApiMappingException { try { VerificationEventInternalImpl dto = Mapper.getInstance().readValue(jsonPayload, VerificationEventInternalImpl.class); - return (VerificationEvent) dto.getActualInstance(); + return (VerificationSinchEvent) dto.getActualInstance(); } catch (JsonProcessingException e) { throw new ApiMappingException(jsonPayload, e); } } @Override - public String serializeResponse(VerificationRequestEventResponse response) + public String serializeResponse(VerificationStartEventResponse response) throws ApiMappingException { try { return Mapper.getInstance().writeValueAsString(response); diff --git a/client/src/main/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationService.java b/client/src/main/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationService.java index f2e40c8c2..261897728 100644 --- a/client/src/main/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationService.java +++ b/client/src/main/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationService.java @@ -38,10 +38,10 @@ public class VerificationService private volatile VerificationsStartService startService; private volatile VerificationsReportService reportService; private volatile VerificationsStatusService statusService; - private volatile WebhooksService webhooks; + private volatile SinchEventsService sinchEvents; private volatile Map clientAuthManagers; - private volatile Map webhooksAuthManagers; + private volatile Map sinchEventsAuthManagers; static { LocalLazyInit.init(); @@ -66,21 +66,22 @@ private void createAuthManagers(ApplicationCredentials credentials) { credentials.getApplicationKey(), credentials.getApplicationSecret()); boolean useApplicationAuth = true; - // to handle request from client we can only have "Basic" keyword behind the auth managers + // To handle request from client we can only have "Basic" keyword behind the auth managers // because of the OAS file only contains it; so we need to trick the application auth manager // hidden behind the "Basic" keyword - // we need both auth manager to handle webhooks because of customer will choose from his + // We need both auth manager to handle Sinch Events because of customer will choose from his // dashboard which scheme to be used clientAuthManagers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); clientAuthManagers.put( BASIC_SECURITY_SCHEME_KEYWORD_VERIFICATION, useApplicationAuth ? applicationAuthManager : basicAuthManager); - // here we need both auth managers to handle webhooks because we are receiving an Authorization + // here we need both auth managers to handle Sinch Events because we are receiving an + // Authorization // header with "Application" keyword - webhooksAuthManagers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); - webhooksAuthManagers.put(BASIC_SECURITY_SCHEME_KEYWORD_VERIFICATION, basicAuthManager); - webhooksAuthManagers.put( + sinchEventsAuthManagers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); + sinchEventsAuthManagers.put(BASIC_SECURITY_SCHEME_KEYWORD_VERIFICATION, basicAuthManager); + sinchEventsAuthManagers.put( APPLICATION_SECURITY_SCHEME_KEYWORD_VERIFICATION, applicationAuthManager); } @@ -123,20 +124,20 @@ public VerificationsStatusService verificationStatus() { return this.statusService; } - public WebhooksService webhooks() { - if (null == this.webhooks) { + public SinchEventsService sinchEvents() { + if (null == this.sinchEvents) { instanceLazyInit(); - this.webhooks = new WebhooksService(webhooksAuthManagers); + this.sinchEvents = new SinchEventsService(sinchEventsAuthManagers); } - return this.webhooks; + return this.sinchEvents; } private void instanceLazyInit() { - if (null != this.clientAuthManagers && null != this.webhooksAuthManagers) { + if (null != this.clientAuthManagers && null != this.sinchEventsAuthManagers) { return; } synchronized (this) { - if (null == this.clientAuthManagers || null == this.webhooksAuthManagers) { + if (null == this.clientAuthManagers || null == this.sinchEventsAuthManagers) { // Currently, we are not supporting unified credentials: ensure application credentials are // defined diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/package-info.java b/client/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/package-info.java new file mode 100644 index 000000000..a695f5170 --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/package-info.java @@ -0,0 +1,6 @@ +/** + * Models related to Verifications Sinch Events + * + * @since 2.0 + */ +package com.sinch.sdk.domains.verification.models.v1.sinchevents; diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/package-info.java b/client/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/package-info.java deleted file mode 100644 index b7ef2f8e4..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/package-info.java +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Models related to Verifications WebHooks - * - * @since 1.1 - */ -package com.sinch.sdk.domains.verification.models.v1.webhooks; diff --git a/client/src/test/java/com/sinch/sdk/domains/verification/api/v1/adapters/WebhooksServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/verification/api/v1/adapters/SinchEventsServiceTest.java similarity index 74% rename from client/src/test/java/com/sinch/sdk/domains/verification/api/v1/adapters/WebhooksServiceTest.java rename to client/src/test/java/com/sinch/sdk/domains/verification/api/v1/adapters/SinchEventsServiceTest.java index b61d9011b..446f5fdfc 100644 --- a/client/src/test/java/com/sinch/sdk/domains/verification/api/v1/adapters/WebhooksServiceTest.java +++ b/client/src/test/java/com/sinch/sdk/domains/verification/api/v1/adapters/SinchEventsServiceTest.java @@ -5,10 +5,10 @@ import com.sinch.sdk.core.TestHelpers; import com.sinch.sdk.core.exceptions.ApiException; import com.sinch.sdk.domains.verification.adapters.VerificationBaseTest; -import com.sinch.sdk.domains.verification.api.v1.WebhooksService; -import com.sinch.sdk.domains.verification.models.dto.v1.webhooks.VerificationRequestEventDtoTest; -import com.sinch.sdk.domains.verification.models.dto.v1.webhooks.VerificationResponseEventDtoTest; -import com.sinch.sdk.domains.verification.models.dto.v1.webhooks.VerificationResultEventDtoTest; +import com.sinch.sdk.domains.verification.api.v1.SinchEventsService; +import com.sinch.sdk.domains.verification.models.dto.v1.sinchevents.VerificationRequestEventDtoTest; +import com.sinch.sdk.domains.verification.models.dto.v1.sinchevents.VerificationResponseEventDtoTest; +import com.sinch.sdk.domains.verification.models.dto.v1.sinchevents.VerificationResultEventDtoTest; import com.sinch.sdk.models.ApplicationCredentials; import com.sinch.sdk.models.VerificationContext; import java.io.IOException; @@ -23,30 +23,34 @@ import org.skyscreamer.jsonassert.JSONAssert; @TestWithResources -public class WebhooksServiceTest extends VerificationBaseTest { +public class SinchEventsServiceTest extends VerificationBaseTest { String request = "{\"id\":\"018c25e1-7163-5677-b8fb-467d7b1cffa5\",\"event\":\"VerificationResultEvent\",\"method\":\"sms\",\"identity\":{\"verified\":false,\"type\":\"number\",\"endpoint\":\"+33628254417\"},\"status\":\"FAIL\",\"reason\":\"Expired\"}"; - @GivenTextResource("/domains/verification/v1/webhooks/VerificationRequestEventDto.json") + @GivenTextResource("/domains/verification/v1/sinchevents/VerificationStartEventDto.json") static String jsonVerificationRequestEventDto; - @GivenTextResource("/domains/verification/v1/webhooks/VerificationResultEventDto.json") + @GivenTextResource("/domains/verification/v1/sinchevents/VerificationResultEventDto.json") static String jsonVerificationResultEventDto; - @GivenTextResource("/domains/verification/v1/webhooks/VerificationResponsePhoneCall.json") + @GivenTextResource( + "/domains/verification/v1/sinchevents/VerificationStartEventResponsePhoneCallDto.json") String jsonResponsePhoneCall; - @GivenTextResource("/domains/verification/v1/webhooks/VerificationResponseFlashCall.json") + @GivenTextResource( + "/domains/verification/v1/sinchevents/VerificationStartEventResponseFlashCallDto.json") String jsonResponseFlashCall; - @GivenTextResource("/domains/verification/v1/webhooks/VerificationResponseSms.json") + @GivenTextResource( + "/domains/verification/v1/sinchevents/VerificationStartEventResponseSmsDto.json") String jsonResponseSms; - @GivenTextResource("/domains/verification/v1/webhooks/VerificationResponseWhatsApp.json") + @GivenTextResource( + "/domains/verification/v1/sinchevents/VerificationStartEventResponseWhatsAppDto.json") String jsonResponseWhatsApp; - WebhooksService webHooksService; + SinchEventsService sinchEventsService; @Test void checkApplicationAuthentication() throws ApiException { @@ -61,7 +65,7 @@ void checkApplicationAuthentication() throws ApiException { .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); boolean authenticationResult = - webHooksService.validateAuthenticationHeader( + sinchEventsService.validateAuthenticationHeader( "POST", "/VerificationRequestEvent", headers, request); Assertions.assertThat(authenticationResult).isEqualTo(true); @@ -78,7 +82,7 @@ void checkApplicationEmptyAuthorizationHeader() throws ApiException { .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); boolean authenticationResult = - webHooksService.validateAuthenticationHeader( + sinchEventsService.validateAuthenticationHeader( "POST", "/VerificationRequestEvent", headers, request); Assertions.assertThat(authenticationResult).isEqualTo(false); @@ -94,7 +98,7 @@ void checkApplicationNoAuthorizationHeader() throws ApiException { .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); boolean authenticationResult = - webHooksService.validateAuthenticationHeader( + sinchEventsService.validateAuthenticationHeader( "POST", "/VerificationRequestEvent", headers, request); Assertions.assertThat(authenticationResult).isEqualTo(false); @@ -104,15 +108,15 @@ void checkApplicationNoAuthorizationHeader() throws ApiException { void checkParseEventVerificationRequestEventDto() throws ApiException { TestHelpers.recursiveEquals( - webHooksService.parseEvent(jsonVerificationRequestEventDto), - VerificationRequestEventDtoTest.expectedRequestEventDto.getVerificationRequestEventImpl()); + sinchEventsService.parseEvent(jsonVerificationRequestEventDto), + VerificationRequestEventDtoTest.expectedRequestEventDto.getVerificationStartEventImpl()); } @Test void checkParseEventVerificationResultEventDto() throws ApiException { TestHelpers.recursiveEquals( - webHooksService.parseEvent(jsonVerificationResultEventDto), + sinchEventsService.parseEvent(jsonVerificationResultEventDto), VerificationResultEventDtoTest.expectedResultEvent.getVerificationResultEventImpl()); } @@ -120,7 +124,7 @@ void checkParseEventVerificationResultEventDto() throws ApiException { void checkSerializeResponsePhoneCall() throws JSONException { JSONAssert.assertEquals( - webHooksService.serializeResponse( + sinchEventsService.serializeResponse( VerificationResponseEventDtoTest.expectedPhoneCallRequestEventResponseDto), jsonResponsePhoneCall, true); @@ -130,7 +134,7 @@ void checkSerializeResponsePhoneCall() throws JSONException { void checkSerializeResponseFlashCall() throws JSONException { JSONAssert.assertEquals( - webHooksService.serializeResponse( + sinchEventsService.serializeResponse( VerificationResponseEventDtoTest.expectedFlashCallRequestEventResponseDto), jsonResponseFlashCall, true); @@ -140,7 +144,7 @@ void checkSerializeResponseFlashCall() throws JSONException { void checkSerializeResponseSms() throws JSONException { JSONAssert.assertEquals( - webHooksService.serializeResponse( + sinchEventsService.serializeResponse( VerificationResponseEventDtoTest.expectedSmsRequestEventResponseDto), jsonResponseSms, true); @@ -150,7 +154,7 @@ void checkSerializeResponseSms() throws JSONException { void checkSerializeResponseWhatsApp() throws JSONException { JSONAssert.assertEquals( - webHooksService.serializeResponse( + sinchEventsService.serializeResponse( VerificationResponseEventDtoTest.expectedWhatsAppRequestEventResponseDto), jsonResponseWhatsApp, true); @@ -165,6 +169,6 @@ public void setUp() throws IOException { .setApplicationSecret("9876543210") .build(); VerificationContext context = VerificationContext.builder().setVerificationUrl("foo").build(); - webHooksService = new VerificationService(credentials, context, null).webhooks(); + sinchEventsService = new VerificationService(credentials, context, null).sinchEvents(); } } diff --git a/client/src/test/java/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationServiceTest.java index 8894a2e26..534d1306c 100644 --- a/client/src/test/java/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationServiceTest.java +++ b/client/src/test/java/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationServiceTest.java @@ -28,7 +28,8 @@ void checkCredentialsVerificationStart() { } @Test - void checkCredentialsWebhooks() { - CredentialsValidationHelper.checkCredentials(() -> httpClient, VerificationService::webhooks); + void checkCredentialsSinchEvents() { + CredentialsValidationHelper.checkCredentials( + () -> httpClient, VerificationService::sinchEvents); } } diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/verification/v1/WebhooksEventsSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/verification/v1/SinchEventsEventsSteps.java similarity index 72% rename from client/src/test/java/com/sinch/sdk/e2e/domains/verification/v1/WebhooksEventsSteps.java rename to client/src/test/java/com/sinch/sdk/e2e/domains/verification/v1/SinchEventsEventsSteps.java index 09d9e7a3d..0d4c2b12e 100644 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/verification/v1/WebhooksEventsSteps.java +++ b/client/src/test/java/com/sinch/sdk/e2e/domains/verification/v1/SinchEventsEventsSteps.java @@ -1,16 +1,16 @@ package com.sinch.sdk.e2e.domains.verification.v1; import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.domains.verification.api.v1.WebhooksService; +import com.sinch.sdk.domains.verification.api.v1.SinchEventsService; import com.sinch.sdk.domains.verification.models.v1.NumberIdentity; import com.sinch.sdk.domains.verification.models.v1.Price; import com.sinch.sdk.domains.verification.models.v1.VerificationMethod; import com.sinch.sdk.domains.verification.models.v1.VerificationStatus; -import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationEvent; -import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEvent; -import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationResultEvent; -import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationSmsDeliveredEvent; -import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationSmsDeliveredEvent.SmsResultEnum; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationResultEvent; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationSinchEvent; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationSmsDeliveredEvent; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationSmsDeliveredEvent.SmsResultEnum; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationStartEvent; import com.sinch.sdk.e2e.Config; import com.sinch.sdk.e2e.domains.WebhooksHelper; import io.cucumber.java.en.Given; @@ -25,21 +25,21 @@ import java.util.stream.Stream; import org.junit.jupiter.api.Assertions; -public class WebhooksEventsSteps { +public class SinchEventsEventsSteps { static final String WEBHOOKS_PATH = Config.VERIFICATION_HOST_NAME + "/webhooks/verification/"; - WebhooksService service; + SinchEventsService service; - static VerificationEvent expectedVerificationRequestEvent = - VerificationRequestEvent.builder() + static VerificationSinchEvent expectedVerificationRequestEvent = + VerificationStartEvent.builder() .setId("1ce0ffee-c0de-5eed-d00d-f00dfeed1337") .setMethod(VerificationMethod.SMS) .setIdentity(NumberIdentity.builder().setEndpoint("+33612345678").build()) .setPrice(Price.builder().setCurrencyId("EUR").setAmount(0.0453F).build()) .build(); - static VerificationEvent expectedVerificationResultEvent = + static VerificationSinchEvent expectedVerificationResultEvent = VerificationResultEvent.builder() .setId("1ce0ffee-c0de-5eed-d00d-f00dfeed1337") .setMethod(VerificationMethod.SMS) @@ -47,7 +47,7 @@ public class WebhooksEventsSteps { .setStatus(VerificationStatus.SUCCESSFUL) .build(); - static VerificationEvent expectedVerificationSMSDeliveredEvent = + static VerificationSinchEvent expectedVerificationSMSDeliveredEvent = VerificationSmsDeliveredEvent.builder() .setSmsResult(SmsResultEnum.SUCCESSFUL) .setId("0198511c-d1d1-8bf3-109b-85455d310123") @@ -65,7 +65,7 @@ public class WebhooksEventsSteps { WEBHOOKS_PATH + "verification-sms-delivery-event")) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); - static Map triggerToExpectedEvents = + static Map triggerToExpectedEvents = Stream.of( new SimpleEntry<>("Verification Request", expectedVerificationRequestEvent), new SimpleEntry<>("Verification Result", expectedVerificationResultEvent), @@ -73,19 +73,19 @@ public class WebhooksEventsSteps { "Verification SMS Delivered Event", expectedVerificationSMSDeliveredEvent)) .collect(Collectors.toMap(SimpleEntry::getKey, SimpleEntry::getValue)); - Map> receivedEvents = + Map> receivedEvents = new ConcurrentHashMap<>(); @Given("^the Verification Webhooks handler is available$") public void serviceAvailable() { - service = Config.getSinchClient().verification().v1().webhooks(); + service = Config.getSinchClient().verification().v1().sinchEvents(); } @When("I send a request to trigger a {string} event") public void triggerEvent(String trigger) throws IOException { - WebhooksHelper.Response response = + WebhooksHelper.Response response = WebhooksHelper.callURL(new URL(triggerToURL.get(trigger)), service::parseEvent); receivedEvents.put(trigger, response); } @@ -93,7 +93,7 @@ public void triggerEvent(String trigger) throws IOException { @Then("the header of the Verification event {string} contains a valid authorization") public void validateEventSignature(String trigger) { - WebhooksHelper.Response receivedEvent = receivedEvents.get(trigger); + WebhooksHelper.Response receivedEvent = receivedEvents.get(trigger); boolean validated = service.validateAuthenticationHeader( @@ -104,8 +104,8 @@ public void validateEventSignature(String trigger) { @Then("the Verification event describes a {string} event type") public void validateResult(String trigger) { - VerificationEvent expected = triggerToExpectedEvents.get(trigger); - VerificationEvent receivedEvent = receivedEvents.get(trigger).event; + VerificationSinchEvent expected = triggerToExpectedEvents.get(trigger); + VerificationSinchEvent receivedEvent = receivedEvents.get(trigger).event; TestHelpers.recursiveEquals(receivedEvent, expected); } diff --git a/examples/webhooks/src/main/java/com/mycompany/app/verification/Controller.java b/examples/webhooks/src/main/java/com/mycompany/app/verification/Controller.java index def882d81..211329c7a 100644 --- a/examples/webhooks/src/main/java/com/mycompany/app/verification/Controller.java +++ b/examples/webhooks/src/main/java/com/mycompany/app/verification/Controller.java @@ -1,10 +1,10 @@ package com.mycompany.app.verification; import com.sinch.sdk.SinchClient; -import com.sinch.sdk.domains.verification.api.v1.WebhooksService; -import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEvent; -import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationResultEvent; -import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationSmsDeliveredEvent; +import com.sinch.sdk.domains.verification.api.v1.SinchEventsService; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationResultEvent; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationSmsDeliveredEvent; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationStartEvent; import java.util.Map; import java.util.logging.Logger; import org.springframework.beans.factory.annotation.Autowired; @@ -22,12 +22,12 @@ public class Controller { private static final Logger LOGGER = Logger.getLogger(Controller.class.getName()); private final SinchClient sinchClient; - private final ServerBusinessLogic webhooksBusinessLogic; + private final ServerBusinessLogic serverBusinessLogic; @Autowired - public Controller(SinchClient sinchClient, ServerBusinessLogic webhooksBusinessLogic) { + public Controller(SinchClient sinchClient, ServerBusinessLogic serverBusinessLogic) { this.sinchClient = sinchClient; - this.webhooksBusinessLogic = webhooksBusinessLogic; + this.serverBusinessLogic = serverBusinessLogic; } @PostMapping( @@ -37,7 +37,7 @@ public Controller(SinchClient sinchClient, ServerBusinessLogic webhooksBusinessL public ResponseEntity VerificationEvent( @RequestHeader Map headers, @RequestBody String body) { - WebhooksService webhooks = sinchClient.verification().v1().webhooks(); + SinchEventsService sinchEvents = sinchClient.verification().v1().sinchEvents(); // ensure valid authentication to handle request // set this value to true to validate request from Sinch servers @@ -47,7 +47,7 @@ public ResponseEntity VerificationEvent( boolean ensureValidAuthentication = false; if (ensureValidAuthentication) { var validAuth = - webhooks.validateAuthenticationHeader( + sinchEvents.validateAuthenticationHeader( // The HTTP verb this controller is managing "POST", // The URI this controller is managing @@ -64,19 +64,19 @@ public ResponseEntity VerificationEvent( } // decode the request payload - var event = webhooks.parseEvent(body); + var event = sinchEvents.parseEvent(body); // let business layer process the request var response = switch (event) { - case VerificationRequestEvent requestEvent -> - webhooksBusinessLogic.verificationEvent(requestEvent); + case VerificationStartEvent requestEvent -> + serverBusinessLogic.verificationEvent(requestEvent); case VerificationResultEvent resultEvent -> { - webhooksBusinessLogic.verificationEvent(resultEvent); + serverBusinessLogic.verificationEvent(resultEvent); yield null; } case VerificationSmsDeliveredEvent smsEvent -> { - webhooksBusinessLogic.verificationSmsDeliveredEvent(smsEvent); + serverBusinessLogic.verificationSmsDeliveredEvent(smsEvent); yield null; } default -> throw new IllegalStateException("Unexpected value: " + event); @@ -85,7 +85,7 @@ public ResponseEntity VerificationEvent( ResponseEntity responseEntity = ResponseEntity.ok().body(null); if (null != response) { - var serializedResponse = webhooks.serializeResponse(response); + var serializedResponse = sinchEvents.serializeResponse(response); LOGGER.finest("JSON response: " + serializedResponse); responseEntity = ResponseEntity.ok(serializedResponse); } diff --git a/examples/webhooks/src/main/java/com/mycompany/app/verification/ServerBusinessLogic.java b/examples/webhooks/src/main/java/com/mycompany/app/verification/ServerBusinessLogic.java index 203b7fa0f..3d34d6979 100644 --- a/examples/webhooks/src/main/java/com/mycompany/app/verification/ServerBusinessLogic.java +++ b/examples/webhooks/src/main/java/com/mycompany/app/verification/ServerBusinessLogic.java @@ -1,11 +1,11 @@ package com.mycompany.app.verification; -import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationEventResponseAction; -import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEvent; -import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEventResponse; -import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEventResponseSms; -import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationResultEvent; -import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationSmsDeliveredEvent; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationResultEvent; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationSmsDeliveredEvent; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationStartEvent; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationStartEventAction; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationStartEventResponse; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationStartEventResponseSms; import java.util.logging.Logger; import org.springframework.stereotype.Component; @@ -14,13 +14,13 @@ public class ServerBusinessLogic { private static final Logger LOGGER = Logger.getLogger(ServerBusinessLogic.class.getName()); - public VerificationRequestEventResponse verificationEvent(VerificationRequestEvent event) { + public VerificationStartEventResponse verificationEvent(VerificationStartEvent event) { LOGGER.info("Handle event :" + event); // add your logic here according to SMS, FlashCall, PhoneCall, ... verification - return VerificationRequestEventResponseSms.builder() - .setAction(VerificationEventResponseAction.ALLOW) + return VerificationStartEventResponseSms.builder() + .setAction(VerificationStartEventAction.ALLOW) .build(); } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationResultEvent.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationResultEvent.java similarity index 94% rename from openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationResultEvent.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationResultEvent.java index 852340cad..e49c667f1 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationResultEvent.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationResultEvent.java @@ -8,7 +8,7 @@ * Do not edit the class manually. */ -package com.sinch.sdk.domains.verification.models.v1.webhooks; +package com.sinch.sdk.domains.verification.models.v1.sinchevents; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.sinch.sdk.core.utils.EnumDynamic; @@ -24,7 +24,7 @@ /** VerificationResultEvent */ @JsonDeserialize(builder = VerificationResultEventImpl.Builder.class) public interface VerificationResultEvent - extends com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationEvent { + extends com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationSinchEvent { /** * The ID of the verification request. @@ -133,7 +133,8 @@ static Builder builder() { /** Dedicated Builder */ interface Builder - extends com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationEvent.Builder { + extends com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationSinchEvent + .Builder { /** * see getter diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationResultEventImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationResultEventImpl.java similarity index 98% rename from openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationResultEventImpl.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationResultEventImpl.java index bc36c5552..5fc7a6f0d 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationResultEventImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationResultEventImpl.java @@ -1,4 +1,4 @@ -package com.sinch.sdk.domains.verification.models.v1.webhooks; +package com.sinch.sdk.domains.verification.models.v1.sinchevents; import com.fasterxml.jackson.annotation.JsonFilter; import com.fasterxml.jackson.annotation.JsonIgnore; @@ -29,7 +29,7 @@ @JsonInclude(value = JsonInclude.Include.CUSTOM) public class VerificationResultEventImpl implements VerificationResultEvent, - com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationEvent { + com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationSinchEvent { private static final long serialVersionUID = 1L; public static final String JSON_PROPERTY_ID = "id"; diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationEvent.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationSinchEvent.java similarity index 93% rename from openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationEvent.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationSinchEvent.java index 6850f9226..0754464c9 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationEvent.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationSinchEvent.java @@ -8,13 +8,13 @@ * Do not edit the class manually. */ -package com.sinch.sdk.domains.verification.models.v1.webhooks; +package com.sinch.sdk.domains.verification.models.v1.sinchevents; import com.sinch.sdk.domains.verification.models.v1.Identity; import com.sinch.sdk.domains.verification.models.v1.VerificationMethod; -/** VerificationEvent */ -public interface VerificationEvent { +/** VerificationSinchEvent */ +public interface VerificationSinchEvent { /** * The ID of the verification request. @@ -116,6 +116,6 @@ interface Builder { * * @return The instance build with current builder values */ - VerificationEvent build(); + VerificationSinchEvent build(); } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationSmsDeliveredEvent.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationSmsDeliveredEvent.java similarity index 94% rename from openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationSmsDeliveredEvent.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationSmsDeliveredEvent.java index 9d976e545..b7b042056 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationSmsDeliveredEvent.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationSmsDeliveredEvent.java @@ -8,7 +8,7 @@ * Do not edit the class manually. */ -package com.sinch.sdk.domains.verification.models.v1.webhooks; +package com.sinch.sdk.domains.verification.models.v1.sinchevents; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.sinch.sdk.core.utils.EnumDynamic; @@ -21,7 +21,7 @@ /** VerificationSmsDeliveredEvent */ @JsonDeserialize(builder = VerificationSmsDeliveredEventImpl.Builder.class) public interface VerificationSmsDeliveredEvent - extends com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationEvent { + extends com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationSinchEvent { /** * The ID of the verification request. @@ -142,7 +142,8 @@ static Builder builder() { /** Dedicated Builder */ interface Builder - extends com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationEvent.Builder { + extends com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationSinchEvent + .Builder { /** * see getter diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationSmsDeliveredEventImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationSmsDeliveredEventImpl.java similarity index 98% rename from openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationSmsDeliveredEventImpl.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationSmsDeliveredEventImpl.java index 0ca9948b3..d05510007 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationSmsDeliveredEventImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationSmsDeliveredEventImpl.java @@ -1,4 +1,4 @@ -package com.sinch.sdk.domains.verification.models.v1.webhooks; +package com.sinch.sdk.domains.verification.models.v1.sinchevents; import com.fasterxml.jackson.annotation.JsonFilter; import com.fasterxml.jackson.annotation.JsonIgnore; @@ -24,7 +24,7 @@ @JsonInclude(value = JsonInclude.Include.CUSTOM) public class VerificationSmsDeliveredEventImpl implements VerificationSmsDeliveredEvent, - com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationEvent { + com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationSinchEvent { private static final long serialVersionUID = 1L; public static final String JSON_PROPERTY_ID = "id"; diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEvent.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEvent.java similarity index 90% rename from openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEvent.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEvent.java index ed8f18879..046594769 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEvent.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEvent.java @@ -8,7 +8,7 @@ * Do not edit the class manually. */ -package com.sinch.sdk.domains.verification.models.v1.webhooks; +package com.sinch.sdk.domains.verification.models.v1.sinchevents; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.sinch.sdk.core.utils.EnumDynamic; @@ -20,10 +20,10 @@ import java.util.List; import java.util.stream.Stream; -/** VerificationRequestEvent */ -@JsonDeserialize(builder = VerificationRequestEventImpl.Builder.class) -public interface VerificationRequestEvent - extends com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationEvent { +/** VerificationStartEvent */ +@JsonDeserialize(builder = VerificationStartEventImpl.Builder.class) +public interface VerificationStartEvent + extends com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationSinchEvent { /** * The ID of the verification request. @@ -125,12 +125,13 @@ public static String valueOf(EventEnum e) { * @return New Builder instance */ static Builder builder() { - return new VerificationRequestEventImpl.Builder(); + return new VerificationStartEventImpl.Builder(); } /** Dedicated Builder */ interface Builder - extends com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationEvent.Builder { + extends com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationSinchEvent + .Builder { /** * see getter @@ -201,6 +202,6 @@ interface Builder * * @return The instance build with current builder values */ - VerificationRequestEvent build(); + VerificationStartEvent build(); } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventAction.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventAction.java new file mode 100644 index 000000000..709880356 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventAction.java @@ -0,0 +1,40 @@ +package com.sinch.sdk.domains.verification.models.v1.sinchevents; + +import com.sinch.sdk.core.utils.EnumDynamic; +import com.sinch.sdk.core.utils.EnumSupportDynamic; +import java.util.Arrays; +import java.util.stream.Stream; + +/** Determines whether the verification can be executed. */ +public class VerificationStartEventAction + extends EnumDynamic { + + /** Verification allowed */ + public static final VerificationStartEventAction ALLOW = + new VerificationStartEventAction("allow"); + + /** Verification denied */ + public static final VerificationStartEventAction DENY = new VerificationStartEventAction("deny"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>( + VerificationStartEventAction.class, + VerificationStartEventAction::new, + Arrays.asList(ALLOW, DENY)); + + private VerificationStartEventAction(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static VerificationStartEventAction from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(VerificationStartEventAction e) { + return ENUM_SUPPORT.valueOf(e); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventImpl.java similarity index 88% rename from openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventImpl.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventImpl.java index 8b97b30db..697a905cc 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventImpl.java @@ -1,4 +1,4 @@ -package com.sinch.sdk.domains.verification.models.v1.webhooks; +package com.sinch.sdk.domains.verification.models.v1.sinchevents; import com.fasterxml.jackson.annotation.JsonFilter; import com.fasterxml.jackson.annotation.JsonIgnore; @@ -14,20 +14,20 @@ import java.util.Objects; @JsonPropertyOrder({ - VerificationRequestEventImpl.JSON_PROPERTY_ID, - VerificationRequestEventImpl.JSON_PROPERTY_EVENT, - VerificationRequestEventImpl.JSON_PROPERTY_METHOD, - VerificationRequestEventImpl.JSON_PROPERTY_IDENTITY, - VerificationRequestEventImpl.JSON_PROPERTY_REFERENCE, - VerificationRequestEventImpl.JSON_PROPERTY_CUSTOM, - VerificationRequestEventImpl.JSON_PROPERTY_PRICE, - VerificationRequestEventImpl.JSON_PROPERTY_ACCEPT_LANGUAGE + VerificationStartEventImpl.JSON_PROPERTY_ID, + VerificationStartEventImpl.JSON_PROPERTY_EVENT, + VerificationStartEventImpl.JSON_PROPERTY_METHOD, + VerificationStartEventImpl.JSON_PROPERTY_IDENTITY, + VerificationStartEventImpl.JSON_PROPERTY_REFERENCE, + VerificationStartEventImpl.JSON_PROPERTY_CUSTOM, + VerificationStartEventImpl.JSON_PROPERTY_PRICE, + VerificationStartEventImpl.JSON_PROPERTY_ACCEPT_LANGUAGE }) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) -public class VerificationRequestEventImpl - implements VerificationRequestEvent, - com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationEvent { +public class VerificationStartEventImpl + implements VerificationStartEvent, + com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationSinchEvent { private static final long serialVersionUID = 1L; public static final String JSON_PROPERTY_ID = "id"; @@ -62,9 +62,9 @@ public class VerificationRequestEventImpl private OptionalValue> acceptLanguage; - public VerificationRequestEventImpl() {} + public VerificationStartEventImpl() {} - protected VerificationRequestEventImpl( + protected VerificationStartEventImpl( OptionalValue id, OptionalValue event, OptionalValue method, @@ -180,7 +180,7 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - VerificationRequestEventImpl verificationRequestEvent = (VerificationRequestEventImpl) o; + VerificationStartEventImpl verificationRequestEvent = (VerificationStartEventImpl) o; return Objects.equals(this.id, verificationRequestEvent.id) && Objects.equals(this.event, verificationRequestEvent.event) && Objects.equals(this.method, verificationRequestEvent.method) @@ -199,7 +199,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class VerificationRequestEventImpl {\n"); + sb.append("class VerificationStartEventImpl {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" event: ").append(toIndentedString(event)).append("\n"); sb.append(" method: ").append(toIndentedString(method)).append("\n"); @@ -223,7 +223,7 @@ private String toIndentedString(Object o) { } @JsonPOJOBuilder(withPrefix = "set") - static class Builder implements VerificationRequestEvent.Builder { + static class Builder implements VerificationStartEvent.Builder { OptionalValue id = OptionalValue.empty(); OptionalValue event = OptionalValue.of(EventEnum.VERIFICATION_REQUEST_EVENT); OptionalValue method = OptionalValue.empty(); @@ -285,8 +285,8 @@ public Builder setAcceptLanguage(List acceptLanguage) { return this; } - public VerificationRequestEvent build() { - return new VerificationRequestEventImpl( + public VerificationStartEvent build() { + return new VerificationStartEventImpl( id, event, method, identity, reference, custom, price, acceptLanguage); } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventResponse.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventResponse.java similarity index 66% rename from openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventResponse.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventResponse.java index 51b14bf0f..c8acec0dd 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventResponse.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventResponse.java @@ -8,10 +8,10 @@ * Do not edit the class manually. */ -package com.sinch.sdk.domains.verification.models.v1.webhooks; +package com.sinch.sdk.domains.verification.models.v1.sinchevents; -/** VerificationRequestEventResponse */ -public interface VerificationRequestEventResponse { +/** VerificationStartEventResponse */ +public interface VerificationStartEventResponse { /** * Get action @@ -20,7 +20,7 @@ public interface VerificationRequestEventResponse { * * @return action */ - VerificationEventResponseAction getAction(); + VerificationStartEventAction getAction(); /** Dedicated Builder */ interface Builder { @@ -32,13 +32,13 @@ interface Builder { * @return Current builder * @see #getAction */ - Builder setAction(VerificationEventResponseAction action); + Builder setAction(VerificationStartEventAction action); /** * Create instance * * @return The instance build with current builder values */ - VerificationRequestEventResponse build(); + VerificationStartEventResponse build(); } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventResponseFlashCall.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventResponseFlashCall.java similarity index 80% rename from openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventResponseFlashCall.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventResponseFlashCall.java index a025a81b6..7597158a2 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventResponseFlashCall.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventResponseFlashCall.java @@ -8,14 +8,15 @@ * Do not edit the class manually. */ -package com.sinch.sdk.domains.verification.models.v1.webhooks; +package com.sinch.sdk.domains.verification.models.v1.sinchevents; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; /** Flash Call Request Event Response */ -@JsonDeserialize(builder = VerificationRequestEventResponseFlashCallImpl.Builder.class) -public interface VerificationRequestEventResponseFlashCall - extends com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEventResponse { +@JsonDeserialize(builder = VerificationStartEventResponseFlashCallImpl.Builder.class) +public interface VerificationStartEventResponseFlashCall + extends com.sinch.sdk.domains.verification.models.v1.sinchevents + .VerificationStartEventResponse { /** * Get action @@ -24,7 +25,7 @@ public interface VerificationRequestEventResponseFlashCall * * @return action */ - VerificationEventResponseAction getAction(); + VerificationStartEventAction getAction(); /** * The phone number that will be displayed to the user when the flash call is received on the @@ -71,13 +72,13 @@ public interface VerificationRequestEventResponseFlashCall * @return New Builder instance */ static Builder builder() { - return new VerificationRequestEventResponseFlashCallImpl.Builder(); + return new VerificationStartEventResponseFlashCallImpl.Builder(); } /** Dedicated Builder */ interface Builder - extends com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEventResponse - .Builder { + extends com.sinch.sdk.domains.verification.models.v1.sinchevents + .VerificationStartEventResponse.Builder { /** * see getter @@ -86,7 +87,7 @@ interface Builder * @return Current builder * @see #getAction */ - Builder setAction(VerificationEventResponseAction action); + Builder setAction(VerificationStartEventAction action); /** * see getter @@ -128,6 +129,6 @@ interface Builder * * @return The instance build with current builder values */ - VerificationRequestEventResponseFlashCall build(); + VerificationStartEventResponseFlashCall build(); } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventResponseFlashCallImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventResponseFlashCallImpl.java similarity index 61% rename from openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventResponseFlashCallImpl.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventResponseFlashCallImpl.java index f696767e6..7862dcaf7 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventResponseFlashCallImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventResponseFlashCallImpl.java @@ -1,4 +1,4 @@ -package com.sinch.sdk.domains.verification.models.v1.webhooks; +package com.sinch.sdk.domains.verification.models.v1.sinchevents; import com.fasterxml.jackson.annotation.JsonFilter; import com.fasterxml.jackson.annotation.JsonIgnore; @@ -13,59 +13,59 @@ import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.verification.models.v1.webhooks.internal.VerificationRequestEventResponseFlashCallContent; -import com.sinch.sdk.domains.verification.models.v1.webhooks.internal.VerificationRequestEventResponseFlashCallContentImpl; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.internal.VerificationStartEventResponseFlashCallContent; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.internal.VerificationStartEventResponseFlashCallContentImpl; import java.io.IOException; import java.util.Objects; import java.util.Optional; @JsonPropertyOrder({ - VerificationRequestEventResponseFlashCallImpl.JSON_PROPERTY_ACTION, - VerificationRequestEventResponseFlashCallImpl.JSON_PROPERTY_FLASH_CALL + VerificationStartEventResponseFlashCallImpl.JSON_PROPERTY_ACTION, + VerificationStartEventResponseFlashCallImpl.JSON_PROPERTY_FLASH_CALL }) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) -public class VerificationRequestEventResponseFlashCallImpl - implements VerificationRequestEventResponseFlashCall, - com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEventResponse { +public class VerificationStartEventResponseFlashCallImpl + implements VerificationStartEventResponseFlashCall, + com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationStartEventResponse { private static final long serialVersionUID = 1L; public static final String JSON_PROPERTY_ACTION = "action"; - private OptionalValue action; + private OptionalValue action; public static final String JSON_PROPERTY_FLASH_CALL = "flashCall"; - private OptionalValue flashCall; + private OptionalValue flashCall; - public VerificationRequestEventResponseFlashCallImpl() {} + public VerificationStartEventResponseFlashCallImpl() {} - protected VerificationRequestEventResponseFlashCallImpl( - OptionalValue action, - OptionalValue flashCall) { + protected VerificationStartEventResponseFlashCallImpl( + OptionalValue action, + OptionalValue flashCall) { this.action = action; this.flashCall = flashCall; } @JsonIgnore - public VerificationEventResponseAction getAction() { + public VerificationStartEventAction getAction() { return action.orElse(null); } @JsonProperty(JSON_PROPERTY_ACTION) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public OptionalValue action() { + public OptionalValue action() { return action; } @JsonIgnore - public VerificationRequestEventResponseFlashCallContent getFlashCall() { + public VerificationStartEventResponseFlashCallContent getFlashCall() { return flashCall.orElse(null); } @JsonProperty(JSON_PROPERTY_FLASH_CALL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OptionalValue flashCall() { + public OptionalValue flashCall() { return flashCall; } @@ -80,7 +80,7 @@ public String getCli() { public OptionalValue cli() { return null != flashCall && flashCall.isPresent() ? flashCall - .map(f -> ((VerificationRequestEventResponseFlashCallContentImpl) f).cli()) + .map(f -> ((VerificationStartEventResponseFlashCallContentImpl) f).cli()) .orElse(OptionalValue.empty()) : OptionalValue.empty(); } @@ -96,7 +96,7 @@ public Integer getDialTimeout() { public OptionalValue dialTimeout() { return null != flashCall && flashCall.isPresent() ? flashCall - .map(f -> ((VerificationRequestEventResponseFlashCallContentImpl) f).dialTimeout()) + .map(f -> ((VerificationStartEventResponseFlashCallContentImpl) f).dialTimeout()) .orElse(OptionalValue.empty()) : OptionalValue.empty(); } @@ -115,9 +115,7 @@ public OptionalValue interceptionTimeout() { return null != flashCall && flashCall.isPresent() ? flashCall .map( - f -> - ((VerificationRequestEventResponseFlashCallContentImpl) f) - .interceptionTimeout()) + f -> ((VerificationStartEventResponseFlashCallContentImpl) f).interceptionTimeout()) .orElse(OptionalValue.empty()) : OptionalValue.empty(); } @@ -136,8 +134,8 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - VerificationRequestEventResponseFlashCallImpl verificationRequestEventResponseFlashCall = - (VerificationRequestEventResponseFlashCallImpl) o; + VerificationStartEventResponseFlashCallImpl verificationRequestEventResponseFlashCall = + (VerificationStartEventResponseFlashCallImpl) o; return Objects.equals(this.action, verificationRequestEventResponseFlashCall.action) && Objects.equals(this.flashCall, verificationRequestEventResponseFlashCall.flashCall); } @@ -150,7 +148,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class VerificationRequestEventResponseFlashCallImpl {\n"); + sb.append("class VerificationStartEventResponseFlashCallImpl {\n"); sb.append(" action: ").append(toIndentedString(action)).append("\n"); sb.append(" flashCall: ").append(toIndentedString(flashCall)).append("\n"); sb.append("}"); @@ -168,21 +166,20 @@ private String toIndentedString(Object o) { } @JsonPOJOBuilder(withPrefix = "set") - static class Builder implements VerificationRequestEventResponseFlashCall.Builder { - OptionalValue action = OptionalValue.empty(); - OptionalValue flashCall = - OptionalValue.empty(); + static class Builder implements VerificationStartEventResponseFlashCall.Builder { + OptionalValue action = OptionalValue.empty(); + OptionalValue flashCall = OptionalValue.empty(); - VerificationRequestEventResponseFlashCallContent.Builder _delegatedBuilder = null; + VerificationStartEventResponseFlashCallContent.Builder _delegatedBuilder = null; @JsonProperty(value = JSON_PROPERTY_ACTION, required = true) - public Builder setAction(VerificationEventResponseAction action) { + public Builder setAction(VerificationStartEventAction action) { this.action = OptionalValue.of(action); return this; } @JsonProperty(JSON_PROPERTY_FLASH_CALL) - public Builder setFlashCall(VerificationRequestEventResponseFlashCallContent flashCall) { + public Builder setFlashCall(VerificationStartEventResponseFlashCallContent flashCall) { this.flashCall = OptionalValue.of(flashCall); return this; } @@ -210,27 +207,27 @@ public Builder putExtraOption(String key, Object value) { return this; } - private VerificationRequestEventResponseFlashCallContent.Builder getDelegatedBuilder() { + private VerificationStartEventResponseFlashCallContent.Builder getDelegatedBuilder() { if (null == _delegatedBuilder) { - this._delegatedBuilder = VerificationRequestEventResponseFlashCallContent.builder(); + this._delegatedBuilder = VerificationStartEventResponseFlashCallContent.builder(); } return this._delegatedBuilder; } - public VerificationRequestEventResponseFlashCall build() { + public VerificationStartEventResponseFlashCall build() { // delegated builder was used: filling the related source of delegation field if (null != this._delegatedBuilder) { this.flashCall = OptionalValue.of(this._delegatedBuilder.build()); } - return new VerificationRequestEventResponseFlashCallImpl(action, flashCall); + return new VerificationStartEventResponseFlashCallImpl(action, flashCall); } } public static class DelegatedSerializer - extends JsonSerializer> { + extends JsonSerializer> { @Override public void serialize( - OptionalValue value, + OptionalValue value, JsonGenerator jgen, SerializerProvider provider) throws IOException { @@ -238,29 +235,29 @@ public void serialize( if (!value.isPresent()) { return; } - VerificationRequestEventResponseFlashCallImpl impl = - (VerificationRequestEventResponseFlashCallImpl) value.get(); + VerificationStartEventResponseFlashCallImpl impl = + (VerificationStartEventResponseFlashCallImpl) value.get(); jgen.writeObject(null != impl ? impl.getFlashCall() : null); } } public static class DelegatedDeSerializer - extends JsonDeserializer { + extends JsonDeserializer { @Override - public VerificationRequestEventResponseFlashCall deserialize( + public VerificationStartEventResponseFlashCall deserialize( JsonParser jp, DeserializationContext ctxt) throws IOException { - VerificationRequestEventResponseFlashCallImpl.Builder builder = - new VerificationRequestEventResponseFlashCallImpl.Builder(); - VerificationRequestEventResponseFlashCallContentImpl deserialized = - jp.readValueAs(VerificationRequestEventResponseFlashCallContentImpl.class); + VerificationStartEventResponseFlashCallImpl.Builder builder = + new VerificationStartEventResponseFlashCallImpl.Builder(); + VerificationStartEventResponseFlashCallContentImpl deserialized = + jp.readValueAs(VerificationStartEventResponseFlashCallContentImpl.class); builder.setFlashCall(deserialized); return builder.build(); } } - public static Optional delegatedConverter( - VerificationRequestEventResponseFlashCallContent internal) { + public static Optional delegatedConverter( + VerificationStartEventResponseFlashCallContent internal) { if (null == internal) { return Optional.empty(); } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventResponsePhoneCall.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventResponsePhoneCall.java similarity index 74% rename from openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventResponsePhoneCall.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventResponsePhoneCall.java index 6e2cca4b3..fbc25d1b6 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventResponsePhoneCall.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventResponsePhoneCall.java @@ -8,15 +8,16 @@ * Do not edit the class manually. */ -package com.sinch.sdk.domains.verification.models.v1.webhooks; +package com.sinch.sdk.domains.verification.models.v1.sinchevents; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.sinch.sdk.domains.verification.models.v1.start.request.PhoneCallSpeech; /** Phone Call Request Event Response */ -@JsonDeserialize(builder = VerificationRequestEventResponsePhoneCallImpl.Builder.class) -public interface VerificationRequestEventResponsePhoneCall - extends com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEventResponse { +@JsonDeserialize(builder = VerificationStartEventResponsePhoneCallImpl.Builder.class) +public interface VerificationStartEventResponsePhoneCall + extends com.sinch.sdk.domains.verification.models.v1.sinchevents + .VerificationStartEventResponse { /** * Get action @@ -25,7 +26,7 @@ public interface VerificationRequestEventResponsePhoneCall * * @return action */ - VerificationEventResponseAction getAction(); + VerificationStartEventAction getAction(); /** * The Phone Call OTP code that should be entered by the user. Sinch servers automatically @@ -57,13 +58,13 @@ public interface VerificationRequestEventResponsePhoneCall * @return New Builder instance */ static Builder builder() { - return new VerificationRequestEventResponsePhoneCallImpl.Builder(); + return new VerificationStartEventResponsePhoneCallImpl.Builder(); } /** Dedicated Builder */ interface Builder - extends com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEventResponse - .Builder { + extends com.sinch.sdk.domains.verification.models.v1.sinchevents + .VerificationStartEventResponse.Builder { /** * see getter @@ -72,7 +73,7 @@ interface Builder * @return Current builder * @see #getAction */ - Builder setAction(VerificationEventResponseAction action); + Builder setAction(VerificationStartEventAction action); /** * see getter @@ -105,6 +106,6 @@ interface Builder * * @return The instance build with current builder values */ - VerificationRequestEventResponsePhoneCall build(); + VerificationStartEventResponsePhoneCall build(); } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventResponsePhoneCallImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventResponsePhoneCallImpl.java similarity index 60% rename from openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventResponsePhoneCallImpl.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventResponsePhoneCallImpl.java index 39a39dab3..c98c1f7c0 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventResponsePhoneCallImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventResponsePhoneCallImpl.java @@ -1,4 +1,4 @@ -package com.sinch.sdk.domains.verification.models.v1.webhooks; +package com.sinch.sdk.domains.verification.models.v1.sinchevents; import com.fasterxml.jackson.annotation.JsonFilter; import com.fasterxml.jackson.annotation.JsonIgnore; @@ -13,60 +13,60 @@ import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; import com.sinch.sdk.core.models.OptionalValue; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.internal.VerificationStartEventResponsePhoneCallContent; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.internal.VerificationStartEventResponsePhoneCallContentImpl; import com.sinch.sdk.domains.verification.models.v1.start.request.PhoneCallSpeech; -import com.sinch.sdk.domains.verification.models.v1.webhooks.internal.VerificationRequestEventResponsePhoneCallContent; -import com.sinch.sdk.domains.verification.models.v1.webhooks.internal.VerificationRequestEventResponsePhoneCallContentImpl; import java.io.IOException; import java.util.Objects; import java.util.Optional; @JsonPropertyOrder({ - VerificationRequestEventResponsePhoneCallImpl.JSON_PROPERTY_ACTION, - VerificationRequestEventResponsePhoneCallImpl.JSON_PROPERTY_CALLOUT + VerificationStartEventResponsePhoneCallImpl.JSON_PROPERTY_ACTION, + VerificationStartEventResponsePhoneCallImpl.JSON_PROPERTY_CALLOUT }) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) -public class VerificationRequestEventResponsePhoneCallImpl - implements VerificationRequestEventResponsePhoneCall, - com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEventResponse { +public class VerificationStartEventResponsePhoneCallImpl + implements VerificationStartEventResponsePhoneCall, + com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationStartEventResponse { private static final long serialVersionUID = 1L; public static final String JSON_PROPERTY_ACTION = "action"; - private OptionalValue action; + private OptionalValue action; public static final String JSON_PROPERTY_CALLOUT = "callout"; - private OptionalValue callout; + private OptionalValue callout; - public VerificationRequestEventResponsePhoneCallImpl() {} + public VerificationStartEventResponsePhoneCallImpl() {} - protected VerificationRequestEventResponsePhoneCallImpl( - OptionalValue action, - OptionalValue callout) { + protected VerificationStartEventResponsePhoneCallImpl( + OptionalValue action, + OptionalValue callout) { this.action = action; this.callout = callout; } @JsonIgnore - public VerificationEventResponseAction getAction() { + public VerificationStartEventAction getAction() { return action.orElse(null); } @JsonProperty(JSON_PROPERTY_ACTION) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public OptionalValue action() { + public OptionalValue action() { return action; } @JsonIgnore - public VerificationRequestEventResponsePhoneCallContent getCallout() { + public VerificationStartEventResponsePhoneCallContent getCallout() { return callout.orElse(null); } @JsonProperty(JSON_PROPERTY_CALLOUT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OptionalValue callout() { + public OptionalValue callout() { return callout; } @@ -81,7 +81,7 @@ public String getCode() { public OptionalValue code() { return null != callout && callout.isPresent() ? callout - .map(f -> ((VerificationRequestEventResponsePhoneCallContentImpl) f).code()) + .map(f -> ((VerificationStartEventResponsePhoneCallContentImpl) f).code()) .orElse(OptionalValue.empty()) : OptionalValue.empty(); } @@ -97,7 +97,7 @@ public PhoneCallSpeech getSpeech() { public OptionalValue speech() { return null != callout && callout.isPresent() ? callout - .map(f -> ((VerificationRequestEventResponsePhoneCallContentImpl) f).speech()) + .map(f -> ((VerificationStartEventResponsePhoneCallContentImpl) f).speech()) .orElse(OptionalValue.empty()) : OptionalValue.empty(); } @@ -116,8 +116,8 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - VerificationRequestEventResponsePhoneCallImpl verificationRequestEventResponsePhoneCall = - (VerificationRequestEventResponsePhoneCallImpl) o; + VerificationStartEventResponsePhoneCallImpl verificationRequestEventResponsePhoneCall = + (VerificationStartEventResponsePhoneCallImpl) o; return Objects.equals(this.action, verificationRequestEventResponsePhoneCall.action) && Objects.equals(this.callout, verificationRequestEventResponsePhoneCall.callout); } @@ -130,7 +130,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class VerificationRequestEventResponsePhoneCallImpl {\n"); + sb.append("class VerificationStartEventResponsePhoneCallImpl {\n"); sb.append(" action: ").append(toIndentedString(action)).append("\n"); sb.append(" callout: ").append(toIndentedString(callout)).append("\n"); sb.append("}"); @@ -148,20 +148,20 @@ private String toIndentedString(Object o) { } @JsonPOJOBuilder(withPrefix = "set") - static class Builder implements VerificationRequestEventResponsePhoneCall.Builder { - OptionalValue action = OptionalValue.empty(); - OptionalValue callout = OptionalValue.empty(); + static class Builder implements VerificationStartEventResponsePhoneCall.Builder { + OptionalValue action = OptionalValue.empty(); + OptionalValue callout = OptionalValue.empty(); - VerificationRequestEventResponsePhoneCallContent.Builder _delegatedBuilder = null; + VerificationStartEventResponsePhoneCallContent.Builder _delegatedBuilder = null; @JsonProperty(value = JSON_PROPERTY_ACTION, required = true) - public Builder setAction(VerificationEventResponseAction action) { + public Builder setAction(VerificationStartEventAction action) { this.action = OptionalValue.of(action); return this; } @JsonProperty(JSON_PROPERTY_CALLOUT) - public Builder setCallout(VerificationRequestEventResponsePhoneCallContent callout) { + public Builder setCallout(VerificationStartEventResponsePhoneCallContent callout) { this.callout = OptionalValue.of(callout); return this; } @@ -183,27 +183,27 @@ public Builder putExtraOption(String key, Object value) { return this; } - private VerificationRequestEventResponsePhoneCallContent.Builder getDelegatedBuilder() { + private VerificationStartEventResponsePhoneCallContent.Builder getDelegatedBuilder() { if (null == _delegatedBuilder) { - this._delegatedBuilder = VerificationRequestEventResponsePhoneCallContent.builder(); + this._delegatedBuilder = VerificationStartEventResponsePhoneCallContent.builder(); } return this._delegatedBuilder; } - public VerificationRequestEventResponsePhoneCall build() { + public VerificationStartEventResponsePhoneCall build() { // delegated builder was used: filling the related source of delegation field if (null != this._delegatedBuilder) { this.callout = OptionalValue.of(this._delegatedBuilder.build()); } - return new VerificationRequestEventResponsePhoneCallImpl(action, callout); + return new VerificationStartEventResponsePhoneCallImpl(action, callout); } } public static class DelegatedSerializer - extends JsonSerializer> { + extends JsonSerializer> { @Override public void serialize( - OptionalValue value, + OptionalValue value, JsonGenerator jgen, SerializerProvider provider) throws IOException { @@ -211,29 +211,29 @@ public void serialize( if (!value.isPresent()) { return; } - VerificationRequestEventResponsePhoneCallImpl impl = - (VerificationRequestEventResponsePhoneCallImpl) value.get(); + VerificationStartEventResponsePhoneCallImpl impl = + (VerificationStartEventResponsePhoneCallImpl) value.get(); jgen.writeObject(null != impl ? impl.getCallout() : null); } } public static class DelegatedDeSerializer - extends JsonDeserializer { + extends JsonDeserializer { @Override - public VerificationRequestEventResponsePhoneCall deserialize( + public VerificationStartEventResponsePhoneCall deserialize( JsonParser jp, DeserializationContext ctxt) throws IOException { - VerificationRequestEventResponsePhoneCallImpl.Builder builder = - new VerificationRequestEventResponsePhoneCallImpl.Builder(); - VerificationRequestEventResponsePhoneCallContentImpl deserialized = - jp.readValueAs(VerificationRequestEventResponsePhoneCallContentImpl.class); + VerificationStartEventResponsePhoneCallImpl.Builder builder = + new VerificationStartEventResponsePhoneCallImpl.Builder(); + VerificationStartEventResponsePhoneCallContentImpl deserialized = + jp.readValueAs(VerificationStartEventResponsePhoneCallContentImpl.class); builder.setCallout(deserialized); return builder.build(); } } - public static Optional delegatedConverter( - VerificationRequestEventResponsePhoneCallContent internal) { + public static Optional delegatedConverter( + VerificationStartEventResponsePhoneCallContent internal) { if (null == internal) { return Optional.empty(); } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventResponseSms.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventResponseSms.java similarity index 80% rename from openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventResponseSms.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventResponseSms.java index 53cc03285..4e6fd6881 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventResponseSms.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventResponseSms.java @@ -8,16 +8,17 @@ * Do not edit the class manually. */ -package com.sinch.sdk.domains.verification.models.v1.webhooks; +package com.sinch.sdk.domains.verification.models.v1.sinchevents; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.sinch.sdk.domains.verification.models.v1.SmsCodeType; import java.util.List; /** SMS Request Event Response */ -@JsonDeserialize(builder = VerificationRequestEventResponseSmsImpl.Builder.class) -public interface VerificationRequestEventResponseSms - extends com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEventResponse { +@JsonDeserialize(builder = VerificationStartEventResponseSmsImpl.Builder.class) +public interface VerificationStartEventResponseSms + extends com.sinch.sdk.domains.verification.models.v1.sinchevents + .VerificationStartEventResponse { /** * Get action @@ -26,7 +27,7 @@ public interface VerificationRequestEventResponseSms * * @return action */ - VerificationEventResponseAction getAction(); + VerificationStartEventAction getAction(); /** * The SMS OTP code that should be used. By default, the Sinch dashboard will automatically @@ -73,13 +74,13 @@ public interface VerificationRequestEventResponseSms * @return New Builder instance */ static Builder builder() { - return new VerificationRequestEventResponseSmsImpl.Builder(); + return new VerificationStartEventResponseSmsImpl.Builder(); } /** Dedicated Builder */ interface Builder - extends com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEventResponse - .Builder { + extends com.sinch.sdk.domains.verification.models.v1.sinchevents + .VerificationStartEventResponse.Builder { /** * see getter @@ -88,7 +89,7 @@ interface Builder * @return Current builder * @see #getAction */ - Builder setAction(VerificationEventResponseAction action); + Builder setAction(VerificationStartEventAction action); /** * see getter @@ -139,6 +140,6 @@ interface Builder * * @return The instance build with current builder values */ - VerificationRequestEventResponseSms build(); + VerificationStartEventResponseSms build(); } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventResponseSmsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventResponseSmsImpl.java similarity index 63% rename from openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventResponseSmsImpl.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventResponseSmsImpl.java index c7b42ad42..85691346a 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventResponseSmsImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventResponseSmsImpl.java @@ -1,4 +1,4 @@ -package com.sinch.sdk.domains.verification.models.v1.webhooks; +package com.sinch.sdk.domains.verification.models.v1.sinchevents; import com.fasterxml.jackson.annotation.JsonFilter; import com.fasterxml.jackson.annotation.JsonIgnore; @@ -14,60 +14,60 @@ import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; import com.sinch.sdk.core.models.OptionalValue; import com.sinch.sdk.domains.verification.models.v1.SmsCodeType; -import com.sinch.sdk.domains.verification.models.v1.webhooks.internal.VerificationRequestEventResponseSmsContent; -import com.sinch.sdk.domains.verification.models.v1.webhooks.internal.VerificationRequestEventResponseSmsContentImpl; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.internal.VerificationStartEventResponseSmsContent; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.internal.VerificationStartEventResponseSmsContentImpl; import java.io.IOException; import java.util.List; import java.util.Objects; import java.util.Optional; @JsonPropertyOrder({ - VerificationRequestEventResponseSmsImpl.JSON_PROPERTY_ACTION, - VerificationRequestEventResponseSmsImpl.JSON_PROPERTY_SMS + VerificationStartEventResponseSmsImpl.JSON_PROPERTY_ACTION, + VerificationStartEventResponseSmsImpl.JSON_PROPERTY_SMS }) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) -public class VerificationRequestEventResponseSmsImpl - implements VerificationRequestEventResponseSms, - com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEventResponse { +public class VerificationStartEventResponseSmsImpl + implements VerificationStartEventResponseSms, + com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationStartEventResponse { private static final long serialVersionUID = 1L; public static final String JSON_PROPERTY_ACTION = "action"; - private OptionalValue action; + private OptionalValue action; public static final String JSON_PROPERTY_SMS = "sms"; - private OptionalValue sms; + private OptionalValue sms; - public VerificationRequestEventResponseSmsImpl() {} + public VerificationStartEventResponseSmsImpl() {} - protected VerificationRequestEventResponseSmsImpl( - OptionalValue action, - OptionalValue sms) { + protected VerificationStartEventResponseSmsImpl( + OptionalValue action, + OptionalValue sms) { this.action = action; this.sms = sms; } @JsonIgnore - public VerificationEventResponseAction getAction() { + public VerificationStartEventAction getAction() { return action.orElse(null); } @JsonProperty(JSON_PROPERTY_ACTION) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public OptionalValue action() { + public OptionalValue action() { return action; } @JsonIgnore - public VerificationRequestEventResponseSmsContent getSms() { + public VerificationStartEventResponseSmsContent getSms() { return sms.orElse(null); } @JsonProperty(JSON_PROPERTY_SMS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OptionalValue sms() { + public OptionalValue sms() { return sms; } @@ -81,7 +81,7 @@ public String getCode() { public OptionalValue code() { return null != sms && sms.isPresent() - ? sms.map(f -> ((VerificationRequestEventResponseSmsContentImpl) f).code()) + ? sms.map(f -> ((VerificationStartEventResponseSmsContentImpl) f).code()) .orElse(OptionalValue.empty()) : OptionalValue.empty(); } @@ -96,7 +96,7 @@ public SmsCodeType getCodeType() { public OptionalValue codeType() { return null != sms && sms.isPresent() - ? sms.map(f -> ((VerificationRequestEventResponseSmsContentImpl) f).codeType()) + ? sms.map(f -> ((VerificationStartEventResponseSmsContentImpl) f).codeType()) .orElse(OptionalValue.empty()) : OptionalValue.empty(); } @@ -111,7 +111,7 @@ public String getExpiry() { public OptionalValue expiry() { return null != sms && sms.isPresent() - ? sms.map(f -> ((VerificationRequestEventResponseSmsContentImpl) f).expiry()) + ? sms.map(f -> ((VerificationStartEventResponseSmsContentImpl) f).expiry()) .orElse(OptionalValue.empty()) : OptionalValue.empty(); } @@ -126,7 +126,7 @@ public List getAcceptLanguage() { public OptionalValue> acceptLanguage() { return null != sms && sms.isPresent() - ? sms.map(f -> ((VerificationRequestEventResponseSmsContentImpl) f).acceptLanguage()) + ? sms.map(f -> ((VerificationStartEventResponseSmsContentImpl) f).acceptLanguage()) .orElse(OptionalValue.empty()) : OptionalValue.empty(); } @@ -145,8 +145,8 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - VerificationRequestEventResponseSmsImpl verificationRequestEventResponseSms = - (VerificationRequestEventResponseSmsImpl) o; + VerificationStartEventResponseSmsImpl verificationRequestEventResponseSms = + (VerificationStartEventResponseSmsImpl) o; return Objects.equals(this.action, verificationRequestEventResponseSms.action) && Objects.equals(this.sms, verificationRequestEventResponseSms.sms); } @@ -159,7 +159,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class VerificationRequestEventResponseSmsImpl {\n"); + sb.append("class VerificationStartEventResponseSmsImpl {\n"); sb.append(" action: ").append(toIndentedString(action)).append("\n"); sb.append(" sms: ").append(toIndentedString(sms)).append("\n"); sb.append("}"); @@ -177,20 +177,20 @@ private String toIndentedString(Object o) { } @JsonPOJOBuilder(withPrefix = "set") - static class Builder implements VerificationRequestEventResponseSms.Builder { - OptionalValue action = OptionalValue.empty(); - OptionalValue sms = OptionalValue.empty(); + static class Builder implements VerificationStartEventResponseSms.Builder { + OptionalValue action = OptionalValue.empty(); + OptionalValue sms = OptionalValue.empty(); - VerificationRequestEventResponseSmsContent.Builder _delegatedBuilder = null; + VerificationStartEventResponseSmsContent.Builder _delegatedBuilder = null; @JsonProperty(value = JSON_PROPERTY_ACTION, required = true) - public Builder setAction(VerificationEventResponseAction action) { + public Builder setAction(VerificationStartEventAction action) { this.action = OptionalValue.of(action); return this; } @JsonProperty(JSON_PROPERTY_SMS) - public Builder setSms(VerificationRequestEventResponseSmsContent sms) { + public Builder setSms(VerificationStartEventResponseSmsContent sms) { this.sms = OptionalValue.of(sms); return this; } @@ -224,27 +224,27 @@ public Builder putExtraOption(String key, Object value) { return this; } - private VerificationRequestEventResponseSmsContent.Builder getDelegatedBuilder() { + private VerificationStartEventResponseSmsContent.Builder getDelegatedBuilder() { if (null == _delegatedBuilder) { - this._delegatedBuilder = VerificationRequestEventResponseSmsContent.builder(); + this._delegatedBuilder = VerificationStartEventResponseSmsContent.builder(); } return this._delegatedBuilder; } - public VerificationRequestEventResponseSms build() { + public VerificationStartEventResponseSms build() { // delegated builder was used: filling the related source of delegation field if (null != this._delegatedBuilder) { this.sms = OptionalValue.of(this._delegatedBuilder.build()); } - return new VerificationRequestEventResponseSmsImpl(action, sms); + return new VerificationStartEventResponseSmsImpl(action, sms); } } public static class DelegatedSerializer - extends JsonSerializer> { + extends JsonSerializer> { @Override public void serialize( - OptionalValue value, + OptionalValue value, JsonGenerator jgen, SerializerProvider provider) throws IOException { @@ -252,29 +252,29 @@ public void serialize( if (!value.isPresent()) { return; } - VerificationRequestEventResponseSmsImpl impl = - (VerificationRequestEventResponseSmsImpl) value.get(); + VerificationStartEventResponseSmsImpl impl = + (VerificationStartEventResponseSmsImpl) value.get(); jgen.writeObject(null != impl ? impl.getSms() : null); } } public static class DelegatedDeSerializer - extends JsonDeserializer { + extends JsonDeserializer { @Override - public VerificationRequestEventResponseSms deserialize( - JsonParser jp, DeserializationContext ctxt) throws IOException { + public VerificationStartEventResponseSms deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException { - VerificationRequestEventResponseSmsImpl.Builder builder = - new VerificationRequestEventResponseSmsImpl.Builder(); - VerificationRequestEventResponseSmsContentImpl deserialized = - jp.readValueAs(VerificationRequestEventResponseSmsContentImpl.class); + VerificationStartEventResponseSmsImpl.Builder builder = + new VerificationStartEventResponseSmsImpl.Builder(); + VerificationStartEventResponseSmsContentImpl deserialized = + jp.readValueAs(VerificationStartEventResponseSmsContentImpl.class); builder.setSms(deserialized); return builder.build(); } } - public static Optional delegatedConverter( - VerificationRequestEventResponseSmsContent internal) { + public static Optional delegatedConverter( + VerificationStartEventResponseSmsContent internal) { if (null == internal) { return Optional.empty(); } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventResponseWhatsApp.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventResponseWhatsApp.java similarity index 74% rename from openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventResponseWhatsApp.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventResponseWhatsApp.java index 06dd6c0da..6a6f8ab88 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventResponseWhatsApp.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventResponseWhatsApp.java @@ -8,16 +8,17 @@ * Do not edit the class manually. */ -package com.sinch.sdk.domains.verification.models.v1.webhooks; +package com.sinch.sdk.domains.verification.models.v1.sinchevents; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.sinch.sdk.domains.verification.models.v1.WhatsAppCodeType; import java.util.List; /** WhatsApp Request Event Response */ -@JsonDeserialize(builder = VerificationRequestEventResponseWhatsAppImpl.Builder.class) -public interface VerificationRequestEventResponseWhatsApp - extends com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEventResponse { +@JsonDeserialize(builder = VerificationStartEventResponseWhatsAppImpl.Builder.class) +public interface VerificationStartEventResponseWhatsApp + extends com.sinch.sdk.domains.verification.models.v1.sinchevents + .VerificationStartEventResponse { /** * Get action @@ -26,7 +27,7 @@ public interface VerificationRequestEventResponseWhatsApp * * @return action */ - VerificationEventResponseAction getAction(); + VerificationStartEventAction getAction(); /** * Get codeType @@ -56,13 +57,13 @@ public interface VerificationRequestEventResponseWhatsApp * @return New Builder instance */ static Builder builder() { - return new VerificationRequestEventResponseWhatsAppImpl.Builder(); + return new VerificationStartEventResponseWhatsAppImpl.Builder(); } /** Dedicated Builder */ interface Builder - extends com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEventResponse - .Builder { + extends com.sinch.sdk.domains.verification.models.v1.sinchevents + .VerificationStartEventResponse.Builder { /** * see getter @@ -71,7 +72,7 @@ interface Builder * @return Current builder * @see #getAction */ - Builder setAction(VerificationEventResponseAction action); + Builder setAction(VerificationStartEventAction action); /** * see getter @@ -104,6 +105,6 @@ interface Builder * * @return The instance build with current builder values */ - VerificationRequestEventResponseWhatsApp build(); + VerificationStartEventResponseWhatsApp build(); } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventResponseWhatsAppImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventResponseWhatsAppImpl.java similarity index 60% rename from openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventResponseWhatsAppImpl.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventResponseWhatsAppImpl.java index 5730ee7bc..e63184210 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventResponseWhatsAppImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/VerificationStartEventResponseWhatsAppImpl.java @@ -1,4 +1,4 @@ -package com.sinch.sdk.domains.verification.models.v1.webhooks; +package com.sinch.sdk.domains.verification.models.v1.sinchevents; import com.fasterxml.jackson.annotation.JsonFilter; import com.fasterxml.jackson.annotation.JsonIgnore; @@ -14,60 +14,60 @@ import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; import com.sinch.sdk.core.models.OptionalValue; import com.sinch.sdk.domains.verification.models.v1.WhatsAppCodeType; -import com.sinch.sdk.domains.verification.models.v1.webhooks.internal.VerificationRequestEventResponseWhatsAppContent; -import com.sinch.sdk.domains.verification.models.v1.webhooks.internal.VerificationRequestEventResponseWhatsAppContentImpl; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.internal.VerificationStartEventResponseWhatsAppContent; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.internal.VerificationStartEventResponseWhatsAppContentImpl; import java.io.IOException; import java.util.List; import java.util.Objects; import java.util.Optional; @JsonPropertyOrder({ - VerificationRequestEventResponseWhatsAppImpl.JSON_PROPERTY_ACTION, - VerificationRequestEventResponseWhatsAppImpl.JSON_PROPERTY_WHATSAPP + VerificationStartEventResponseWhatsAppImpl.JSON_PROPERTY_ACTION, + VerificationStartEventResponseWhatsAppImpl.JSON_PROPERTY_WHATSAPP }) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) -public class VerificationRequestEventResponseWhatsAppImpl - implements VerificationRequestEventResponseWhatsApp, - com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEventResponse { +public class VerificationStartEventResponseWhatsAppImpl + implements VerificationStartEventResponseWhatsApp, + com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationStartEventResponse { private static final long serialVersionUID = 1L; public static final String JSON_PROPERTY_ACTION = "action"; - private OptionalValue action; + private OptionalValue action; public static final String JSON_PROPERTY_WHATSAPP = "whatsapp"; - private OptionalValue whatsapp; + private OptionalValue whatsapp; - public VerificationRequestEventResponseWhatsAppImpl() {} + public VerificationStartEventResponseWhatsAppImpl() {} - protected VerificationRequestEventResponseWhatsAppImpl( - OptionalValue action, - OptionalValue whatsapp) { + protected VerificationStartEventResponseWhatsAppImpl( + OptionalValue action, + OptionalValue whatsapp) { this.action = action; this.whatsapp = whatsapp; } @JsonIgnore - public VerificationEventResponseAction getAction() { + public VerificationStartEventAction getAction() { return action.orElse(null); } @JsonProperty(JSON_PROPERTY_ACTION) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public OptionalValue action() { + public OptionalValue action() { return action; } @JsonIgnore - public VerificationRequestEventResponseWhatsAppContent getWhatsapp() { + public VerificationStartEventResponseWhatsAppContent getWhatsapp() { return whatsapp.orElse(null); } @JsonProperty(JSON_PROPERTY_WHATSAPP) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OptionalValue whatsapp() { + public OptionalValue whatsapp() { return whatsapp; } @@ -82,7 +82,7 @@ public WhatsAppCodeType getCodeType() { public OptionalValue codeType() { return null != whatsapp && whatsapp.isPresent() ? whatsapp - .map(f -> ((VerificationRequestEventResponseWhatsAppContentImpl) f).codeType()) + .map(f -> ((VerificationStartEventResponseWhatsAppContentImpl) f).codeType()) .orElse(OptionalValue.empty()) : OptionalValue.empty(); } @@ -98,7 +98,7 @@ public List getAcceptLanguage() { public OptionalValue> acceptLanguage() { return null != whatsapp && whatsapp.isPresent() ? whatsapp - .map(f -> ((VerificationRequestEventResponseWhatsAppContentImpl) f).acceptLanguage()) + .map(f -> ((VerificationStartEventResponseWhatsAppContentImpl) f).acceptLanguage()) .orElse(OptionalValue.empty()) : OptionalValue.empty(); } @@ -117,8 +117,8 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - VerificationRequestEventResponseWhatsAppImpl verificationRequestEventResponseWhatsApp = - (VerificationRequestEventResponseWhatsAppImpl) o; + VerificationStartEventResponseWhatsAppImpl verificationRequestEventResponseWhatsApp = + (VerificationStartEventResponseWhatsAppImpl) o; return Objects.equals(this.action, verificationRequestEventResponseWhatsApp.action) && Objects.equals(this.whatsapp, verificationRequestEventResponseWhatsApp.whatsapp); } @@ -131,7 +131,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class VerificationRequestEventResponseWhatsAppImpl {\n"); + sb.append("class VerificationStartEventResponseWhatsAppImpl {\n"); sb.append(" action: ").append(toIndentedString(action)).append("\n"); sb.append(" whatsapp: ").append(toIndentedString(whatsapp)).append("\n"); sb.append("}"); @@ -149,20 +149,20 @@ private String toIndentedString(Object o) { } @JsonPOJOBuilder(withPrefix = "set") - static class Builder implements VerificationRequestEventResponseWhatsApp.Builder { - OptionalValue action = OptionalValue.empty(); - OptionalValue whatsapp = OptionalValue.empty(); + static class Builder implements VerificationStartEventResponseWhatsApp.Builder { + OptionalValue action = OptionalValue.empty(); + OptionalValue whatsapp = OptionalValue.empty(); - VerificationRequestEventResponseWhatsAppContent.Builder _delegatedBuilder = null; + VerificationStartEventResponseWhatsAppContent.Builder _delegatedBuilder = null; @JsonProperty(value = JSON_PROPERTY_ACTION, required = true) - public Builder setAction(VerificationEventResponseAction action) { + public Builder setAction(VerificationStartEventAction action) { this.action = OptionalValue.of(action); return this; } @JsonProperty(JSON_PROPERTY_WHATSAPP) - public Builder setWhatsapp(VerificationRequestEventResponseWhatsAppContent whatsapp) { + public Builder setWhatsapp(VerificationStartEventResponseWhatsAppContent whatsapp) { this.whatsapp = OptionalValue.of(whatsapp); return this; } @@ -184,27 +184,27 @@ public Builder putExtraOption(String key, Object value) { return this; } - private VerificationRequestEventResponseWhatsAppContent.Builder getDelegatedBuilder() { + private VerificationStartEventResponseWhatsAppContent.Builder getDelegatedBuilder() { if (null == _delegatedBuilder) { - this._delegatedBuilder = VerificationRequestEventResponseWhatsAppContent.builder(); + this._delegatedBuilder = VerificationStartEventResponseWhatsAppContent.builder(); } return this._delegatedBuilder; } - public VerificationRequestEventResponseWhatsApp build() { + public VerificationStartEventResponseWhatsApp build() { // delegated builder was used: filling the related source of delegation field if (null != this._delegatedBuilder) { this.whatsapp = OptionalValue.of(this._delegatedBuilder.build()); } - return new VerificationRequestEventResponseWhatsAppImpl(action, whatsapp); + return new VerificationStartEventResponseWhatsAppImpl(action, whatsapp); } } public static class DelegatedSerializer - extends JsonSerializer> { + extends JsonSerializer> { @Override public void serialize( - OptionalValue value, + OptionalValue value, JsonGenerator jgen, SerializerProvider provider) throws IOException { @@ -212,29 +212,29 @@ public void serialize( if (!value.isPresent()) { return; } - VerificationRequestEventResponseWhatsAppImpl impl = - (VerificationRequestEventResponseWhatsAppImpl) value.get(); + VerificationStartEventResponseWhatsAppImpl impl = + (VerificationStartEventResponseWhatsAppImpl) value.get(); jgen.writeObject(null != impl ? impl.getWhatsapp() : null); } } public static class DelegatedDeSerializer - extends JsonDeserializer { + extends JsonDeserializer { @Override - public VerificationRequestEventResponseWhatsApp deserialize( + public VerificationStartEventResponseWhatsApp deserialize( JsonParser jp, DeserializationContext ctxt) throws IOException { - VerificationRequestEventResponseWhatsAppImpl.Builder builder = - new VerificationRequestEventResponseWhatsAppImpl.Builder(); - VerificationRequestEventResponseWhatsAppContentImpl deserialized = - jp.readValueAs(VerificationRequestEventResponseWhatsAppContentImpl.class); + VerificationStartEventResponseWhatsAppImpl.Builder builder = + new VerificationStartEventResponseWhatsAppImpl.Builder(); + VerificationStartEventResponseWhatsAppContentImpl deserialized = + jp.readValueAs(VerificationStartEventResponseWhatsAppContentImpl.class); builder.setWhatsapp(deserialized); return builder.build(); } } - public static Optional delegatedConverter( - VerificationRequestEventResponseWhatsAppContent internal) { + public static Optional delegatedConverter( + VerificationStartEventResponseWhatsAppContent internal) { if (null == internal) { return Optional.empty(); } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/internal/VerificationEventInternal.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/internal/VerificationEventInternal.java similarity index 85% rename from openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/internal/VerificationEventInternal.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/internal/VerificationEventInternal.java index 5d09ef38b..5228cb19e 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/internal/VerificationEventInternal.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/internal/VerificationEventInternal.java @@ -8,7 +8,7 @@ * Do not edit the class manually. */ -package com.sinch.sdk.domains.verification.models.v1.webhooks.internal; +package com.sinch.sdk.domains.verification.models.v1.sinchevents.internal; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/internal/VerificationEventInternalImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/internal/VerificationEventInternalImpl.java similarity index 83% rename from openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/internal/VerificationEventInternalImpl.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/internal/VerificationEventInternalImpl.java index 294ee3116..3aa1df175 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/internal/VerificationEventInternalImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/internal/VerificationEventInternalImpl.java @@ -1,4 +1,4 @@ -package com.sinch.sdk.domains.verification.models.v1.webhooks.internal; +package com.sinch.sdk.domains.verification.models.v1.sinchevents.internal; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonParser; @@ -16,9 +16,9 @@ import com.fasterxml.jackson.databind.ser.std.StdSerializer; import com.sinch.sdk.core.models.AbstractOpenApiSchema; import com.sinch.sdk.core.utils.databind.JSONNavigator; -import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEventImpl; -import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationResultEventImpl; -import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationSmsDeliveredEventImpl; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationResultEventImpl; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationSmsDeliveredEventImpl; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationStartEventImpl; import java.io.IOException; import java.util.Collections; import java.util.HashMap; @@ -79,8 +79,7 @@ public VerificationEventInternalImpl deserialize(JsonParser jp, DeserializationC String discriminatorValue = (String) result2.get("event"); switch (discriminatorValue) { case "VerificationRequestEvent": - deserialized = - tree.traverse(jp.getCodec()).readValueAs(VerificationRequestEventImpl.class); + deserialized = tree.traverse(jp.getCodec()).readValueAs(VerificationStartEventImpl.class); newVerificationEventInternalImpl.setActualInstance(deserialized); return newVerificationEventInternalImpl; case "VerificationResultEvent": @@ -106,48 +105,6 @@ public VerificationEventInternalImpl deserialize(JsonParser jp, DeserializationC boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); int match = 0; JsonToken token = tree.traverse(jp.getCodec()).nextToken(); - // deserialize VerificationRequestEventImpl - try { - boolean attemptParsing = true; - // ensure that we respect type coercion as set on the client ObjectMapper - if (VerificationRequestEventImpl.class.equals(Integer.class) - || VerificationRequestEventImpl.class.equals(Long.class) - || VerificationRequestEventImpl.class.equals(Float.class) - || VerificationRequestEventImpl.class.equals(Double.class) - || VerificationRequestEventImpl.class.equals(Boolean.class) - || VerificationRequestEventImpl.class.equals(String.class)) { - attemptParsing = typeCoercion; - if (!attemptParsing) { - attemptParsing |= - ((VerificationRequestEventImpl.class.equals(Integer.class) - || VerificationRequestEventImpl.class.equals(Long.class)) - && token == JsonToken.VALUE_NUMBER_INT); - attemptParsing |= - ((VerificationRequestEventImpl.class.equals(Float.class) - || VerificationRequestEventImpl.class.equals(Double.class)) - && token == JsonToken.VALUE_NUMBER_FLOAT); - attemptParsing |= - (VerificationRequestEventImpl.class.equals(Boolean.class) - && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); - attemptParsing |= - (VerificationRequestEventImpl.class.equals(String.class) - && token == JsonToken.VALUE_STRING); - } - } - if (attemptParsing) { - deserialized = - tree.traverse(jp.getCodec()).readValueAs(VerificationRequestEventImpl.class); - // TODO: there is no validation against JSON schema constraints - // (min, max, enum, pattern...), this does not perform a strict JSON - // validation, which means the 'match' count may be higher than it should be. - match++; - log.log(Level.FINER, "Input data matches schema 'VerificationRequestEventImpl'"); - } - } catch (Exception e) { - // deserialization failed, continue - log.log(Level.FINER, "Input data does not match schema 'VerificationRequestEventImpl'", e); - } - // deserialize VerificationResultEventImpl try { boolean attemptParsing = true; @@ -233,6 +190,47 @@ public VerificationEventInternalImpl deserialize(JsonParser jp, DeserializationC Level.FINER, "Input data does not match schema 'VerificationSmsDeliveredEventImpl'", e); } + // deserialize VerificationStartEventImpl + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (VerificationStartEventImpl.class.equals(Integer.class) + || VerificationStartEventImpl.class.equals(Long.class) + || VerificationStartEventImpl.class.equals(Float.class) + || VerificationStartEventImpl.class.equals(Double.class) + || VerificationStartEventImpl.class.equals(Boolean.class) + || VerificationStartEventImpl.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((VerificationStartEventImpl.class.equals(Integer.class) + || VerificationStartEventImpl.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((VerificationStartEventImpl.class.equals(Float.class) + || VerificationStartEventImpl.class.equals(Double.class)) + && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= + (VerificationStartEventImpl.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (VerificationStartEventImpl.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(VerificationStartEventImpl.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'VerificationStartEventImpl'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'VerificationStartEventImpl'", e); + } + if (match == 1) { VerificationEventInternalImpl ret = new VerificationEventInternalImpl(); ret.setActualInstance(deserialized); @@ -261,30 +259,30 @@ public VerificationEventInternalImpl() { super("oneOf", Boolean.FALSE); } - public VerificationEventInternalImpl(VerificationRequestEventImpl o) { + public VerificationEventInternalImpl(VerificationResultEventImpl o) { super("oneOf", Boolean.FALSE); setActualInstance(o); } - public VerificationEventInternalImpl(VerificationResultEventImpl o) { + public VerificationEventInternalImpl(VerificationSmsDeliveredEventImpl o) { super("oneOf", Boolean.FALSE); setActualInstance(o); } - public VerificationEventInternalImpl(VerificationSmsDeliveredEventImpl o) { + public VerificationEventInternalImpl(VerificationStartEventImpl o) { super("oneOf", Boolean.FALSE); setActualInstance(o); } static { - schemas.put("VerificationRequestEventImpl", VerificationRequestEventImpl.class); schemas.put("VerificationResultEventImpl", VerificationResultEventImpl.class); schemas.put("VerificationSmsDeliveredEventImpl", VerificationSmsDeliveredEventImpl.class); + schemas.put("VerificationStartEventImpl", VerificationStartEventImpl.class); JSONNavigator.registerDescendants( VerificationEventInternalImpl.class, Collections.unmodifiableMap(schemas)); // Initialize and register the discriminator mappings. Map> mappings = new HashMap>(); - mappings.put("VerificationRequestEvent", VerificationRequestEventImpl.class); + mappings.put("VerificationRequestEvent", VerificationStartEventImpl.class); mappings.put("VerificationResultEvent", VerificationResultEventImpl.class); mappings.put("VerificationSmsDeliveredEvent", VerificationSmsDeliveredEventImpl.class); mappings.put("VerificationEvent", VerificationEventInternalImpl.class); @@ -298,8 +296,8 @@ public Map> getSchemas() { /** * Set the instance that matches the oneOf child schema, check the instance parameter is valid - * against the oneOf child schemas: VerificationRequestEventImpl, VerificationResultEventImpl, - * VerificationSmsDeliveredEventImpl + * against the oneOf child schemas: VerificationResultEventImpl, + * VerificationSmsDeliveredEventImpl, VerificationStartEventImpl * *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a * composed schema (allOf, anyOf, oneOf). @@ -307,51 +305,40 @@ public Map> getSchemas() { @Override public void setActualInstance(Object instance) { if (JSONNavigator.isInstanceOf( - VerificationRequestEventImpl.class, instance, new HashSet>())) { + VerificationResultEventImpl.class, instance, new HashSet>())) { super.setActualInstance(instance); return; } if (JSONNavigator.isInstanceOf( - VerificationResultEventImpl.class, instance, new HashSet>())) { + VerificationSmsDeliveredEventImpl.class, instance, new HashSet>())) { super.setActualInstance(instance); return; } if (JSONNavigator.isInstanceOf( - VerificationSmsDeliveredEventImpl.class, instance, new HashSet>())) { + VerificationStartEventImpl.class, instance, new HashSet>())) { super.setActualInstance(instance); return; } throw new RuntimeException( - "Invalid instance type. Must be VerificationRequestEventImpl, VerificationResultEventImpl," - + " VerificationSmsDeliveredEventImpl"); + "Invalid instance type. Must be VerificationResultEventImpl," + + " VerificationSmsDeliveredEventImpl, VerificationStartEventImpl"); } /** - * Get the actual instance, which can be the following: VerificationRequestEventImpl, - * VerificationResultEventImpl, VerificationSmsDeliveredEventImpl + * Get the actual instance, which can be the following: VerificationResultEventImpl, + * VerificationSmsDeliveredEventImpl, VerificationStartEventImpl * - * @return The actual instance (VerificationRequestEventImpl, VerificationResultEventImpl, - * VerificationSmsDeliveredEventImpl) + * @return The actual instance (VerificationResultEventImpl, VerificationSmsDeliveredEventImpl, + * VerificationStartEventImpl) */ @Override public Object getActualInstance() { return super.getActualInstance(); } - /** - * Get the actual instance of `VerificationRequestEventImpl`. If the actual instance is not - * `VerificationRequestEventImpl`, the ClassCastException will be thrown. - * - * @return The actual instance of `VerificationRequestEventImpl` - * @throws ClassCastException if the instance is not `VerificationRequestEventImpl` - */ - public VerificationRequestEventImpl getVerificationRequestEventImpl() throws ClassCastException { - return (VerificationRequestEventImpl) super.getActualInstance(); - } - /** * Get the actual instance of `VerificationResultEventImpl`. If the actual instance is not * `VerificationResultEventImpl`, the ClassCastException will be thrown. @@ -374,4 +361,15 @@ public VerificationSmsDeliveredEventImpl getVerificationSmsDeliveredEventImpl() throws ClassCastException { return (VerificationSmsDeliveredEventImpl) super.getActualInstance(); } + + /** + * Get the actual instance of `VerificationStartEventImpl`. If the actual instance is not + * `VerificationStartEventImpl`, the ClassCastException will be thrown. + * + * @return The actual instance of `VerificationStartEventImpl` + * @throws ClassCastException if the instance is not `VerificationStartEventImpl` + */ + public VerificationStartEventImpl getVerificationStartEventImpl() throws ClassCastException { + return (VerificationStartEventImpl) super.getActualInstance(); + } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/internal/VerificationRequestEventResponseFlashCallContent.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/internal/VerificationStartEventResponseFlashCallContent.java similarity index 83% rename from openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/internal/VerificationRequestEventResponseFlashCallContent.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/internal/VerificationStartEventResponseFlashCallContent.java index cb6ff0162..fd191ee8b 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/internal/VerificationRequestEventResponseFlashCallContent.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/internal/VerificationStartEventResponseFlashCallContent.java @@ -8,14 +8,14 @@ * Do not edit the class manually. */ -package com.sinch.sdk.domains.verification.models.v1.webhooks.internal; +package com.sinch.sdk.domains.verification.models.v1.sinchevents.internal; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.sinch.sdk.core.models.AdditionalProperties; -/** VerificationRequestEventResponseFlashCallContent */ -@JsonDeserialize(builder = VerificationRequestEventResponseFlashCallContentImpl.Builder.class) -public interface VerificationRequestEventResponseFlashCallContent extends AdditionalProperties { +/** VerificationStartEventResponseFlashCallContent */ +@JsonDeserialize(builder = VerificationStartEventResponseFlashCallContentImpl.Builder.class) +public interface VerificationStartEventResponseFlashCallContent extends AdditionalProperties { /** * The phone number that will be displayed to the user when the flash call is received on the @@ -54,7 +54,7 @@ public interface VerificationRequestEventResponseFlashCallContent extends Additi * @return New Builder instance */ static Builder builder() { - return new VerificationRequestEventResponseFlashCallContentImpl.Builder(); + return new VerificationStartEventResponseFlashCallContentImpl.Builder(); } /** Dedicated Builder */ @@ -100,6 +100,6 @@ interface Builder extends AdditionalProperties.Builder { * * @return The instance build with current builder values */ - VerificationRequestEventResponseFlashCallContent build(); + VerificationStartEventResponseFlashCallContent build(); } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/internal/VerificationRequestEventResponseFlashCallContentImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/internal/VerificationStartEventResponseFlashCallContentImpl.java similarity index 85% rename from openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/internal/VerificationRequestEventResponseFlashCallContentImpl.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/internal/VerificationStartEventResponseFlashCallContentImpl.java index 51a11cb3b..95d7739a5 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/internal/VerificationRequestEventResponseFlashCallContentImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/internal/VerificationStartEventResponseFlashCallContentImpl.java @@ -1,4 +1,4 @@ -package com.sinch.sdk.domains.verification.models.v1.webhooks.internal; +package com.sinch.sdk.domains.verification.models.v1.sinchevents.internal; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; @@ -14,14 +14,14 @@ import java.util.Objects; @JsonPropertyOrder({ - VerificationRequestEventResponseFlashCallContentImpl.JSON_PROPERTY_CLI, - VerificationRequestEventResponseFlashCallContentImpl.JSON_PROPERTY_DIAL_TIMEOUT, - VerificationRequestEventResponseFlashCallContentImpl.JSON_PROPERTY_INTERCEPTION_TIMEOUT + VerificationStartEventResponseFlashCallContentImpl.JSON_PROPERTY_CLI, + VerificationStartEventResponseFlashCallContentImpl.JSON_PROPERTY_DIAL_TIMEOUT, + VerificationStartEventResponseFlashCallContentImpl.JSON_PROPERTY_INTERCEPTION_TIMEOUT }) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) -public class VerificationRequestEventResponseFlashCallContentImpl - implements VerificationRequestEventResponseFlashCallContent { +public class VerificationStartEventResponseFlashCallContentImpl + implements VerificationStartEventResponseFlashCallContent { private static final long serialVersionUID = 1L; public static final String JSON_PROPERTY_CLI = "cli"; @@ -42,9 +42,9 @@ public class VerificationRequestEventResponseFlashCallContentImpl */ private OptionalValue> additionalProperties; - public VerificationRequestEventResponseFlashCallContentImpl() {} + public VerificationStartEventResponseFlashCallContentImpl() {} - protected VerificationRequestEventResponseFlashCallContentImpl( + protected VerificationStartEventResponseFlashCallContentImpl( OptionalValue cli, OptionalValue dialTimeout, OptionalValue interceptionTimeout, @@ -117,9 +117,9 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - VerificationRequestEventResponseFlashCallContentImpl + VerificationStartEventResponseFlashCallContentImpl verificationRequestEventResponseFlashCallAllOfFlashCall = - (VerificationRequestEventResponseFlashCallContentImpl) o; + (VerificationStartEventResponseFlashCallContentImpl) o; return Objects.equals(this.cli, verificationRequestEventResponseFlashCallAllOfFlashCall.cli) && Objects.equals( this.dialTimeout, verificationRequestEventResponseFlashCallAllOfFlashCall.dialTimeout) @@ -139,7 +139,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class VerificationRequestEventResponseFlashCallContentImpl {\n"); + sb.append("class VerificationStartEventResponseFlashCallContentImpl {\n"); sb.append(" cli: ").append(toIndentedString(cli)).append("\n"); sb.append(" dialTimeout: ").append(toIndentedString(dialTimeout)).append("\n"); sb.append(" interceptionTimeout: ") @@ -163,7 +163,7 @@ private String toIndentedString(Object o) { } @JsonPOJOBuilder(withPrefix = "set") - static class Builder implements VerificationRequestEventResponseFlashCallContent.Builder { + static class Builder implements VerificationStartEventResponseFlashCallContent.Builder { OptionalValue cli = OptionalValue.empty(); OptionalValue dialTimeout = OptionalValue.empty(); OptionalValue interceptionTimeout = OptionalValue.empty(); @@ -196,8 +196,8 @@ public Builder put(String key, Object value) { return this; } - public VerificationRequestEventResponseFlashCallContent build() { - return new VerificationRequestEventResponseFlashCallContentImpl( + public VerificationStartEventResponseFlashCallContent build() { + return new VerificationStartEventResponseFlashCallContentImpl( cli, dialTimeout, interceptionTimeout, additionalProperties); } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/internal/VerificationRequestEventResponsePhoneCallContent.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/internal/VerificationStartEventResponsePhoneCallContent.java similarity index 77% rename from openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/internal/VerificationRequestEventResponsePhoneCallContent.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/internal/VerificationStartEventResponsePhoneCallContent.java index 8faedeeb9..6fb629bb9 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/internal/VerificationRequestEventResponsePhoneCallContent.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/internal/VerificationStartEventResponsePhoneCallContent.java @@ -8,15 +8,15 @@ * Do not edit the class manually. */ -package com.sinch.sdk.domains.verification.models.v1.webhooks.internal; +package com.sinch.sdk.domains.verification.models.v1.sinchevents.internal; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.sinch.sdk.core.models.AdditionalProperties; import com.sinch.sdk.domains.verification.models.v1.start.request.PhoneCallSpeech; -/** VerificationRequestEventResponsePhoneCallContent */ -@JsonDeserialize(builder = VerificationRequestEventResponsePhoneCallContentImpl.Builder.class) -public interface VerificationRequestEventResponsePhoneCallContent extends AdditionalProperties { +/** VerificationStartEventResponsePhoneCallContent */ +@JsonDeserialize(builder = VerificationStartEventResponsePhoneCallContentImpl.Builder.class) +public interface VerificationStartEventResponsePhoneCallContent extends AdditionalProperties { /** * The Phone Call OTP code that should be entered by the user. Sinch servers automatically @@ -40,7 +40,7 @@ public interface VerificationRequestEventResponsePhoneCallContent extends Additi * @return New Builder instance */ static Builder builder() { - return new VerificationRequestEventResponsePhoneCallContentImpl.Builder(); + return new VerificationStartEventResponsePhoneCallContentImpl.Builder(); } /** Dedicated Builder */ @@ -77,6 +77,6 @@ interface Builder extends AdditionalProperties.Builder { * * @return The instance build with current builder values */ - VerificationRequestEventResponsePhoneCallContent build(); + VerificationStartEventResponsePhoneCallContent build(); } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/internal/VerificationRequestEventResponsePhoneCallContentImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/internal/VerificationStartEventResponsePhoneCallContentImpl.java similarity index 83% rename from openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/internal/VerificationRequestEventResponsePhoneCallContentImpl.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/internal/VerificationStartEventResponsePhoneCallContentImpl.java index c91b0cb45..e5411f827 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/internal/VerificationRequestEventResponsePhoneCallContentImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/internal/VerificationStartEventResponsePhoneCallContentImpl.java @@ -1,4 +1,4 @@ -package com.sinch.sdk.domains.verification.models.v1.webhooks.internal; +package com.sinch.sdk.domains.verification.models.v1.sinchevents.internal; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; @@ -15,13 +15,13 @@ import java.util.Objects; @JsonPropertyOrder({ - VerificationRequestEventResponsePhoneCallContentImpl.JSON_PROPERTY_CODE, - VerificationRequestEventResponsePhoneCallContentImpl.JSON_PROPERTY_SPEECH + VerificationStartEventResponsePhoneCallContentImpl.JSON_PROPERTY_CODE, + VerificationStartEventResponsePhoneCallContentImpl.JSON_PROPERTY_SPEECH }) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) -public class VerificationRequestEventResponsePhoneCallContentImpl - implements VerificationRequestEventResponsePhoneCallContent { +public class VerificationStartEventResponsePhoneCallContentImpl + implements VerificationStartEventResponsePhoneCallContent { private static final long serialVersionUID = 1L; public static final String JSON_PROPERTY_CODE = "code"; @@ -38,9 +38,9 @@ public class VerificationRequestEventResponsePhoneCallContentImpl */ private OptionalValue> additionalProperties; - public VerificationRequestEventResponsePhoneCallContentImpl() {} + public VerificationStartEventResponsePhoneCallContentImpl() {} - protected VerificationRequestEventResponsePhoneCallContentImpl( + protected VerificationStartEventResponsePhoneCallContentImpl( OptionalValue code, OptionalValue speech, OptionalValue> additionalProperties) { @@ -100,9 +100,9 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - VerificationRequestEventResponsePhoneCallContentImpl + VerificationStartEventResponsePhoneCallContentImpl verificationRequestEventResponsePhoneCallAllOfCallout = - (VerificationRequestEventResponsePhoneCallContentImpl) o; + (VerificationStartEventResponsePhoneCallContentImpl) o; return Objects.equals(this.code, verificationRequestEventResponsePhoneCallAllOfCallout.code) && Objects.equals(this.speech, verificationRequestEventResponsePhoneCallAllOfCallout.speech) && Objects.equals( @@ -118,7 +118,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class VerificationRequestEventResponsePhoneCallContentImpl {\n"); + sb.append("class VerificationStartEventResponsePhoneCallContentImpl {\n"); sb.append(" code: ").append(toIndentedString(code)).append("\n"); sb.append(" speech: ").append(toIndentedString(speech)).append("\n"); sb.append(" additionalProperties: ") @@ -139,7 +139,7 @@ private String toIndentedString(Object o) { } @JsonPOJOBuilder(withPrefix = "set") - static class Builder implements VerificationRequestEventResponsePhoneCallContent.Builder { + static class Builder implements VerificationStartEventResponsePhoneCallContent.Builder { OptionalValue code = OptionalValue.empty(); OptionalValue speech = OptionalValue.empty(); OptionalValue> additionalProperties = OptionalValue.empty(); @@ -165,8 +165,8 @@ public Builder put(String key, Object value) { return this; } - public VerificationRequestEventResponsePhoneCallContent build() { - return new VerificationRequestEventResponsePhoneCallContentImpl( + public VerificationStartEventResponsePhoneCallContent build() { + return new VerificationStartEventResponsePhoneCallContentImpl( code, speech, additionalProperties); } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/internal/VerificationRequestEventResponseSmsContent.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/internal/VerificationStartEventResponseSmsContent.java similarity index 84% rename from openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/internal/VerificationRequestEventResponseSmsContent.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/internal/VerificationStartEventResponseSmsContent.java index f473fc71e..f72538d91 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/internal/VerificationRequestEventResponseSmsContent.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/internal/VerificationStartEventResponseSmsContent.java @@ -8,16 +8,16 @@ * Do not edit the class manually. */ -package com.sinch.sdk.domains.verification.models.v1.webhooks.internal; +package com.sinch.sdk.domains.verification.models.v1.sinchevents.internal; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.sinch.sdk.core.models.AdditionalProperties; import com.sinch.sdk.domains.verification.models.v1.SmsCodeType; import java.util.List; -/** VerificationRequestEventResponseSmsContent */ -@JsonDeserialize(builder = VerificationRequestEventResponseSmsContentImpl.Builder.class) -public interface VerificationRequestEventResponseSmsContent extends AdditionalProperties { +/** VerificationStartEventResponseSmsContent */ +@JsonDeserialize(builder = VerificationStartEventResponseSmsContentImpl.Builder.class) +public interface VerificationStartEventResponseSmsContent extends AdditionalProperties { /** * The SMS OTP code that should be used. By default, the Sinch dashboard will automatically @@ -56,7 +56,7 @@ public interface VerificationRequestEventResponseSmsContent extends AdditionalPr * @return New Builder instance */ static Builder builder() { - return new VerificationRequestEventResponseSmsContentImpl.Builder(); + return new VerificationStartEventResponseSmsContentImpl.Builder(); } /** Dedicated Builder */ @@ -111,6 +111,6 @@ interface Builder extends AdditionalProperties.Builder { * * @return The instance build with current builder values */ - VerificationRequestEventResponseSmsContent build(); + VerificationStartEventResponseSmsContent build(); } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/internal/VerificationRequestEventResponseSmsContentImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/internal/VerificationStartEventResponseSmsContentImpl.java similarity index 86% rename from openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/internal/VerificationRequestEventResponseSmsContentImpl.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/internal/VerificationStartEventResponseSmsContentImpl.java index 1f03822f7..32ba6a802 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/internal/VerificationRequestEventResponseSmsContentImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/internal/VerificationStartEventResponseSmsContentImpl.java @@ -1,4 +1,4 @@ -package com.sinch.sdk.domains.verification.models.v1.webhooks.internal; +package com.sinch.sdk.domains.verification.models.v1.sinchevents.internal; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; @@ -16,15 +16,15 @@ import java.util.Objects; @JsonPropertyOrder({ - VerificationRequestEventResponseSmsContentImpl.JSON_PROPERTY_CODE, - VerificationRequestEventResponseSmsContentImpl.JSON_PROPERTY_CODE_TYPE, - VerificationRequestEventResponseSmsContentImpl.JSON_PROPERTY_EXPIRY, - VerificationRequestEventResponseSmsContentImpl.JSON_PROPERTY_ACCEPT_LANGUAGE + VerificationStartEventResponseSmsContentImpl.JSON_PROPERTY_CODE, + VerificationStartEventResponseSmsContentImpl.JSON_PROPERTY_CODE_TYPE, + VerificationStartEventResponseSmsContentImpl.JSON_PROPERTY_EXPIRY, + VerificationStartEventResponseSmsContentImpl.JSON_PROPERTY_ACCEPT_LANGUAGE }) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) -public class VerificationRequestEventResponseSmsContentImpl - implements VerificationRequestEventResponseSmsContent { +public class VerificationStartEventResponseSmsContentImpl + implements VerificationStartEventResponseSmsContent { private static final long serialVersionUID = 1L; public static final String JSON_PROPERTY_CODE = "code"; @@ -49,9 +49,9 @@ public class VerificationRequestEventResponseSmsContentImpl */ private OptionalValue> additionalProperties; - public VerificationRequestEventResponseSmsContentImpl() {} + public VerificationStartEventResponseSmsContentImpl() {} - protected VerificationRequestEventResponseSmsContentImpl( + protected VerificationStartEventResponseSmsContentImpl( OptionalValue code, OptionalValue codeType, OptionalValue expiry, @@ -134,8 +134,8 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - VerificationRequestEventResponseSmsContentImpl verificationRequestEventResponseSmsAllOfSms = - (VerificationRequestEventResponseSmsContentImpl) o; + VerificationStartEventResponseSmsContentImpl verificationRequestEventResponseSmsAllOfSms = + (VerificationStartEventResponseSmsContentImpl) o; return Objects.equals(this.code, verificationRequestEventResponseSmsAllOfSms.code) && Objects.equals(this.codeType, verificationRequestEventResponseSmsAllOfSms.codeType) && Objects.equals(this.expiry, verificationRequestEventResponseSmsAllOfSms.expiry) @@ -154,7 +154,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class VerificationRequestEventResponseSmsContentImpl {\n"); + sb.append("class VerificationStartEventResponseSmsContentImpl {\n"); sb.append(" code: ").append(toIndentedString(code)).append("\n"); sb.append(" codeType: ").append(toIndentedString(codeType)).append("\n"); sb.append(" expiry: ").append(toIndentedString(expiry)).append("\n"); @@ -177,7 +177,7 @@ private String toIndentedString(Object o) { } @JsonPOJOBuilder(withPrefix = "set") - static class Builder implements VerificationRequestEventResponseSmsContent.Builder { + static class Builder implements VerificationStartEventResponseSmsContent.Builder { OptionalValue code = OptionalValue.empty(); OptionalValue codeType = OptionalValue.empty(); OptionalValue expiry = OptionalValue.empty(); @@ -217,8 +217,8 @@ public Builder put(String key, Object value) { return this; } - public VerificationRequestEventResponseSmsContent build() { - return new VerificationRequestEventResponseSmsContentImpl( + public VerificationStartEventResponseSmsContent build() { + return new VerificationStartEventResponseSmsContentImpl( code, codeType, expiry, acceptLanguage, additionalProperties); } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/internal/VerificationRequestEventResponseWhatsAppContent.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/internal/VerificationStartEventResponseWhatsAppContent.java similarity index 77% rename from openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/internal/VerificationRequestEventResponseWhatsAppContent.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/internal/VerificationStartEventResponseWhatsAppContent.java index a0b7687be..8ed795fa5 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/internal/VerificationRequestEventResponseWhatsAppContent.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/internal/VerificationStartEventResponseWhatsAppContent.java @@ -8,16 +8,16 @@ * Do not edit the class manually. */ -package com.sinch.sdk.domains.verification.models.v1.webhooks.internal; +package com.sinch.sdk.domains.verification.models.v1.sinchevents.internal; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.sinch.sdk.core.models.AdditionalProperties; import com.sinch.sdk.domains.verification.models.v1.WhatsAppCodeType; import java.util.List; -/** VerificationRequestEventResponseWhatsAppContent */ -@JsonDeserialize(builder = VerificationRequestEventResponseWhatsAppContentImpl.Builder.class) -public interface VerificationRequestEventResponseWhatsAppContent extends AdditionalProperties { +/** VerificationStartEventResponseWhatsAppContent */ +@JsonDeserialize(builder = VerificationStartEventResponseWhatsAppContentImpl.Builder.class) +public interface VerificationStartEventResponseWhatsAppContent extends AdditionalProperties { /** * Get codeType @@ -39,7 +39,7 @@ public interface VerificationRequestEventResponseWhatsAppContent extends Additio * @return New Builder instance */ static Builder builder() { - return new VerificationRequestEventResponseWhatsAppContentImpl.Builder(); + return new VerificationStartEventResponseWhatsAppContentImpl.Builder(); } /** Dedicated Builder */ @@ -76,6 +76,6 @@ interface Builder extends AdditionalProperties.Builder { * * @return The instance build with current builder values */ - VerificationRequestEventResponseWhatsAppContent build(); + VerificationStartEventResponseWhatsAppContent build(); } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/internal/VerificationRequestEventResponseWhatsAppContentImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/internal/VerificationStartEventResponseWhatsAppContentImpl.java similarity index 84% rename from openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/internal/VerificationRequestEventResponseWhatsAppContentImpl.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/internal/VerificationStartEventResponseWhatsAppContentImpl.java index 142101863..0c1fb6e91 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/internal/VerificationRequestEventResponseWhatsAppContentImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/sinchevents/internal/VerificationStartEventResponseWhatsAppContentImpl.java @@ -1,4 +1,4 @@ -package com.sinch.sdk.domains.verification.models.v1.webhooks.internal; +package com.sinch.sdk.domains.verification.models.v1.sinchevents.internal; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; @@ -16,13 +16,13 @@ import java.util.Objects; @JsonPropertyOrder({ - VerificationRequestEventResponseWhatsAppContentImpl.JSON_PROPERTY_CODE_TYPE, - VerificationRequestEventResponseWhatsAppContentImpl.JSON_PROPERTY_ACCEPT_LANGUAGE + VerificationStartEventResponseWhatsAppContentImpl.JSON_PROPERTY_CODE_TYPE, + VerificationStartEventResponseWhatsAppContentImpl.JSON_PROPERTY_ACCEPT_LANGUAGE }) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) -public class VerificationRequestEventResponseWhatsAppContentImpl - implements VerificationRequestEventResponseWhatsAppContent { +public class VerificationStartEventResponseWhatsAppContentImpl + implements VerificationStartEventResponseWhatsAppContent { private static final long serialVersionUID = 1L; public static final String JSON_PROPERTY_CODE_TYPE = "codeType"; @@ -39,9 +39,9 @@ public class VerificationRequestEventResponseWhatsAppContentImpl */ private OptionalValue> additionalProperties; - public VerificationRequestEventResponseWhatsAppContentImpl() {} + public VerificationStartEventResponseWhatsAppContentImpl() {} - protected VerificationRequestEventResponseWhatsAppContentImpl( + protected VerificationStartEventResponseWhatsAppContentImpl( OptionalValue codeType, OptionalValue> acceptLanguage, OptionalValue> additionalProperties) { @@ -101,9 +101,9 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - VerificationRequestEventResponseWhatsAppContentImpl + VerificationStartEventResponseWhatsAppContentImpl verificationRequestEventResponseWhatsAppAllOfWhatsapp = - (VerificationRequestEventResponseWhatsAppContentImpl) o; + (VerificationStartEventResponseWhatsAppContentImpl) o; return Objects.equals( this.codeType, verificationRequestEventResponseWhatsAppAllOfWhatsapp.codeType) && Objects.equals( @@ -122,7 +122,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class VerificationRequestEventResponseWhatsAppContentImpl {\n"); + sb.append("class VerificationStartEventResponseWhatsAppContentImpl {\n"); sb.append(" codeType: ").append(toIndentedString(codeType)).append("\n"); sb.append(" acceptLanguage: ").append(toIndentedString(acceptLanguage)).append("\n"); sb.append(" additionalProperties: ") @@ -143,7 +143,7 @@ private String toIndentedString(Object o) { } @JsonPOJOBuilder(withPrefix = "set") - static class Builder implements VerificationRequestEventResponseWhatsAppContent.Builder { + static class Builder implements VerificationStartEventResponseWhatsAppContent.Builder { OptionalValue codeType = OptionalValue.empty(); OptionalValue> acceptLanguage = OptionalValue.empty(); OptionalValue> additionalProperties = OptionalValue.empty(); @@ -169,8 +169,8 @@ public Builder put(String key, Object value) { return this; } - public VerificationRequestEventResponseWhatsAppContent build() { - return new VerificationRequestEventResponseWhatsAppContentImpl( + public VerificationStartEventResponseWhatsAppContent build() { + return new VerificationStartEventResponseWhatsAppContentImpl( codeType, acceptLanguage, additionalProperties); } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationEventResponseAction.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationEventResponseAction.java deleted file mode 100644 index 1dc513692..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationEventResponseAction.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.sinch.sdk.domains.verification.models.v1.webhooks; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -/** Determines whether the verification can be executed. */ -public class VerificationEventResponseAction - extends EnumDynamic { - - /** Verification allowed */ - public static final VerificationEventResponseAction ALLOW = - new VerificationEventResponseAction("allow"); - - /** Verification denied */ - public static final VerificationEventResponseAction DENY = - new VerificationEventResponseAction("deny"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - VerificationEventResponseAction.class, - VerificationEventResponseAction::new, - Arrays.asList(ALLOW, DENY)); - - private VerificationEventResponseAction(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static VerificationEventResponseAction from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(VerificationEventResponseAction e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/webhooks/VerificationRequestEventDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/sinchevents/VerificationRequestEventDtoTest.java similarity index 66% rename from openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/webhooks/VerificationRequestEventDtoTest.java rename to openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/sinchevents/VerificationRequestEventDtoTest.java index e92dcd03f..2aead7015 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/webhooks/VerificationRequestEventDtoTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/sinchevents/VerificationRequestEventDtoTest.java @@ -1,4 +1,4 @@ -package com.sinch.sdk.domains.verification.models.dto.v1.webhooks; +package com.sinch.sdk.domains.verification.models.dto.v1.sinchevents; import com.adelean.inject.resources.junit.jupiter.GivenJsonResource; import com.adelean.inject.resources.junit.jupiter.TestWithResources; @@ -7,22 +7,22 @@ import com.sinch.sdk.domains.verification.models.v1.NumberIdentity; import com.sinch.sdk.domains.verification.models.v1.Price; import com.sinch.sdk.domains.verification.models.v1.VerificationMethod; -import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEvent; -import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEventImpl; -import com.sinch.sdk.domains.verification.models.v1.webhooks.internal.VerificationEventInternal; -import com.sinch.sdk.domains.verification.models.v1.webhooks.internal.VerificationEventInternalImpl; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationStartEvent; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationStartEventImpl; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.internal.VerificationEventInternal; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.internal.VerificationEventInternalImpl; import org.junit.jupiter.api.Test; @TestWithResources public class VerificationRequestEventDtoTest extends VerificationBaseTest { - @GivenJsonResource("/domains/verification/v1/webhooks/VerificationRequestEventDto.json") + @GivenJsonResource("/domains/verification/v1/sinchevents/VerificationStartEventDto.json") VerificationEventInternal requestEventDto; public static VerificationEventInternalImpl expectedRequestEventDto = new VerificationEventInternalImpl( - (VerificationRequestEventImpl) - VerificationRequestEvent.builder() + (VerificationStartEventImpl) + VerificationStartEvent.builder() .setId("1234567890") .setMethod(VerificationMethod.SMS) .setIdentity(NumberIdentity.valueOf("+11235551234")) diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/sinchevents/VerificationResponseEventDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/sinchevents/VerificationResponseEventDtoTest.java new file mode 100644 index 000000000..76b6f10d1 --- /dev/null +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/sinchevents/VerificationResponseEventDtoTest.java @@ -0,0 +1,177 @@ +package com.sinch.sdk.domains.verification.models.dto.v1.sinchevents; + +import com.adelean.inject.resources.junit.jupiter.GivenTextResource; +import com.adelean.inject.resources.junit.jupiter.TestWithResources; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.sinch.sdk.domains.verification.adapters.VerificationBaseTest; +import com.sinch.sdk.domains.verification.models.v1.SmsCodeType; +import com.sinch.sdk.domains.verification.models.v1.WhatsAppCodeType; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationStartEventAction; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationStartEventResponseFlashCall; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationStartEventResponsePhoneCall; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationStartEventResponseSms; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationStartEventResponseWhatsApp; +import com.sinch.sdk.domains.verification.models.v1.start.request.PhoneCallSpeech; +import java.util.Collections; +import org.json.JSONException; +import org.junit.jupiter.api.Test; +import org.skyscreamer.jsonassert.JSONAssert; + +@TestWithResources +public class VerificationResponseEventDtoTest extends VerificationBaseTest { + + public static VerificationStartEventResponsePhoneCall expectedPhoneCallRequestEventResponseDto = + VerificationStartEventResponsePhoneCall.builder() + .setAction(VerificationStartEventAction.ALLOW) + .setCode("4567") + .setSpeech(PhoneCallSpeech.builder().setLocale("the locale").build()) + .putExtraOption("my key", "my value") + .build(); + public static VerificationStartEventResponseFlashCall expectedFlashCallRequestEventResponseDto = + VerificationStartEventResponseFlashCall.builder() + .setAction(VerificationStartEventAction.ALLOW) + .setCli("cli code") + .setDialTimeout(123) + .setInterceptionTimeout(456) + .putExtraOption("my key", "my value") + .build(); + public static VerificationStartEventResponseSms expectedSmsRequestEventResponseDto = + VerificationStartEventResponseSms.builder() + .setAction(VerificationStartEventAction.ALLOW) + .setCode("5666") + .setCodeType(SmsCodeType.NUMERIC) + .setExpiry("01:02:03") + .setAcceptLanguage(Collections.singletonList("a language")) + .putExtraOption("my key", "my value") + .build(); + + public static VerificationStartEventResponseWhatsApp expectedWhatsAppRequestEventResponseDto = + VerificationStartEventResponseWhatsApp.builder() + .setAction(VerificationStartEventAction.ALLOW) + .setCodeType(WhatsAppCodeType.NUMERIC) + .setAcceptLanguage(Collections.singletonList("a language")) + .putExtraOption("my key", "my value") + .build(); + + @GivenTextResource( + "/domains/verification/v1/sinchevents/VerificationStartEventResponseSmsDto.json") + String verificationStartEventResponseSmsDto; + + @GivenTextResource( + "/domains/verification/v1/sinchevents/VerificationStartEventResponseSmsEmptySmsDto.json") + String verificationStartEventResponseSmsEmptySmsDto; + + @GivenTextResource( + "/domains/verification/v1/sinchevents/VerificationStartEventResponseFlashCallDto.json") + String verificationStartEventResponseFlashCallDto; + + @GivenTextResource( + "/domains/verification/v1/sinchevents/VerificationStartEventResponseFlashCallEmptyFlashCallDto.json") + String verificationStartEventResponseFlashCallEmptyFlashCallDto; + + @GivenTextResource( + "/domains/verification/v1/sinchevents/VerificationStartEventResponsePhoneCallDto.json") + String verificationStartEventResponsePhoneCallDto; + + @GivenTextResource( + "/domains/verification/v1/sinchevents/VerificationStartEventResponsePhoneCallEmptyCalloutDto.json") + String verificationStartEventResponsePhoneCallEmptyCalloutDto; + + @GivenTextResource( + "/domains/verification/v1/sinchevents/VerificationStartEventResponseWhatsAppDto.json") + String verificationStartEventResponseWhatsAppDto; + + @GivenTextResource( + "/domains/verification/v1/sinchevents/VerificationStartEventResponseWhatsAppEmptyWhatsAppDto.json") + String verificationStartEventResponseWhatsAppEmptyWhatsAppDto; + + @Test + void serializeSmsResponse() throws JsonProcessingException, JSONException { + + String serializedString = objectMapper.writeValueAsString(expectedSmsRequestEventResponseDto); + + JSONAssert.assertEquals(verificationStartEventResponseSmsDto, serializedString, true); + } + + @Test + void serializeSmsResponseEmptySms() throws JsonProcessingException, JSONException { + + VerificationStartEventResponseSms value = + VerificationStartEventResponseSms.builder() + .setAction(VerificationStartEventAction.ALLOW) + .build(); + + String serializedString = objectMapper.writeValueAsString(value); + + JSONAssert.assertEquals(verificationStartEventResponseSmsEmptySmsDto, serializedString, true); + } + + @Test + void serializeFlashCallResponse() throws JsonProcessingException, JSONException { + + String serializedString = + objectMapper.writeValueAsString(expectedFlashCallRequestEventResponseDto); + + JSONAssert.assertEquals(verificationStartEventResponseFlashCallDto, serializedString, true); + } + + @Test + void serializeFlashCallResponseEmptyFlashCall() throws JsonProcessingException, JSONException { + + VerificationStartEventResponseFlashCall value = + VerificationStartEventResponseFlashCall.builder() + .setAction(VerificationStartEventAction.ALLOW) + .build(); + + String serializedString = objectMapper.writeValueAsString(value); + + JSONAssert.assertEquals( + verificationStartEventResponseFlashCallEmptyFlashCallDto, serializedString, true); + } + + @Test + void serializePhoneCallResponse() throws JsonProcessingException, JSONException { + + String serializedString = + objectMapper.writeValueAsString(expectedPhoneCallRequestEventResponseDto); + + JSONAssert.assertEquals(verificationStartEventResponsePhoneCallDto, serializedString, true); + } + + @Test + void serializePhoneCallResponseEmptyCallout() throws JsonProcessingException, JSONException { + + VerificationStartEventResponsePhoneCall value = + VerificationStartEventResponsePhoneCall.builder() + .setAction(VerificationStartEventAction.ALLOW) + .build(); + + String serializedString = objectMapper.writeValueAsString(value); + + JSONAssert.assertEquals( + verificationStartEventResponsePhoneCallEmptyCalloutDto, serializedString, true); + } + + @Test + void serializeWhatsAppResponse() throws JsonProcessingException, JSONException { + + String serializedString = + objectMapper.writeValueAsString(expectedWhatsAppRequestEventResponseDto); + + JSONAssert.assertEquals(verificationStartEventResponseWhatsAppDto, serializedString, true); + } + + @Test + void serializeSmsResponseEmptyWhatsApp() throws JsonProcessingException, JSONException { + + VerificationStartEventResponseWhatsApp value = + VerificationStartEventResponseWhatsApp.builder() + .setAction(VerificationStartEventAction.ALLOW) + .build(); + + String serializedString = objectMapper.writeValueAsString(value); + + JSONAssert.assertEquals( + verificationStartEventResponseWhatsAppEmptyWhatsAppDto, serializedString, true); + } +} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/webhooks/VerificationResultEventDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/sinchevents/VerificationResultEventDtoTest.java similarity index 73% rename from openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/webhooks/VerificationResultEventDtoTest.java rename to openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/sinchevents/VerificationResultEventDtoTest.java index 956897048..0ff07ab54 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/webhooks/VerificationResultEventDtoTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/sinchevents/VerificationResultEventDtoTest.java @@ -1,4 +1,4 @@ -package com.sinch.sdk.domains.verification.models.dto.v1.webhooks; +package com.sinch.sdk.domains.verification.models.dto.v1.sinchevents; import com.adelean.inject.resources.junit.jupiter.GivenJsonResource; import com.adelean.inject.resources.junit.jupiter.TestWithResources; @@ -8,17 +8,17 @@ import com.sinch.sdk.domains.verification.models.v1.VerificationMethod; import com.sinch.sdk.domains.verification.models.v1.VerificationStatus; import com.sinch.sdk.domains.verification.models.v1.VerificationStatusReason; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationResultEvent; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationResultEventImpl; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.internal.VerificationEventInternal; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.internal.VerificationEventInternalImpl; import com.sinch.sdk.domains.verification.models.v1.status.StatusSource; -import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationResultEvent; -import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationResultEventImpl; -import com.sinch.sdk.domains.verification.models.v1.webhooks.internal.VerificationEventInternal; -import com.sinch.sdk.domains.verification.models.v1.webhooks.internal.VerificationEventInternalImpl; import org.junit.jupiter.api.Test; @TestWithResources public class VerificationResultEventDtoTest extends VerificationBaseTest { - @GivenJsonResource("/domains/verification/v1/webhooks/VerificationResultEventDto.json") + @GivenJsonResource("/domains/verification/v1/sinchevents/VerificationResultEventDto.json") VerificationEventInternal resultEventDto; public static VerificationEventInternalImpl expectedResultEvent = diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/webhooks/VerificationSmsDeliveredEventDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/sinchevents/VerificationSmsDeliveredEventDtoTest.java similarity index 64% rename from openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/webhooks/VerificationSmsDeliveredEventDtoTest.java rename to openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/sinchevents/VerificationSmsDeliveredEventDtoTest.java index 7fd0d26d7..e86c8ddd8 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/webhooks/VerificationSmsDeliveredEventDtoTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/sinchevents/VerificationSmsDeliveredEventDtoTest.java @@ -1,4 +1,4 @@ -package com.sinch.sdk.domains.verification.models.dto.v1.webhooks; +package com.sinch.sdk.domains.verification.models.dto.v1.sinchevents; import com.adelean.inject.resources.junit.jupiter.GivenJsonResource; import com.adelean.inject.resources.junit.jupiter.TestWithResources; @@ -6,17 +6,18 @@ import com.sinch.sdk.domains.verification.adapters.VerificationBaseTest; import com.sinch.sdk.domains.verification.models.v1.NumberIdentity; import com.sinch.sdk.domains.verification.models.v1.VerificationMethod; -import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationSmsDeliveredEvent; -import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationSmsDeliveredEvent.SmsResultEnum; -import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationSmsDeliveredEventImpl; -import com.sinch.sdk.domains.verification.models.v1.webhooks.internal.VerificationEventInternal; -import com.sinch.sdk.domains.verification.models.v1.webhooks.internal.VerificationEventInternalImpl; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationSmsDeliveredEvent; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationSmsDeliveredEvent.SmsResultEnum; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.VerificationSmsDeliveredEventImpl; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.internal.VerificationEventInternal; +import com.sinch.sdk.domains.verification.models.v1.sinchevents.internal.VerificationEventInternalImpl; import org.junit.jupiter.api.Test; @TestWithResources public class VerificationSmsDeliveredEventDtoTest extends VerificationBaseTest { - @GivenJsonResource("/domains/verification/v1/webhooks/VerificationSmsDeliveryEventEventDto.json") + @GivenJsonResource( + "/domains/verification/v1/sinchevents/VerificationSmsDeliveryEventEventDto.json") VerificationEventInternal resultEventDto; public static VerificationEventInternalImpl expectedResultEvent = diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/webhooks/VerificationResponseEventDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/webhooks/VerificationResponseEventDtoTest.java deleted file mode 100644 index d89ddf779..000000000 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/webhooks/VerificationResponseEventDtoTest.java +++ /dev/null @@ -1,169 +0,0 @@ -package com.sinch.sdk.domains.verification.models.dto.v1.webhooks; - -import com.adelean.inject.resources.junit.jupiter.GivenTextResource; -import com.adelean.inject.resources.junit.jupiter.TestWithResources; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.sinch.sdk.domains.verification.adapters.VerificationBaseTest; -import com.sinch.sdk.domains.verification.models.v1.SmsCodeType; -import com.sinch.sdk.domains.verification.models.v1.WhatsAppCodeType; -import com.sinch.sdk.domains.verification.models.v1.start.request.PhoneCallSpeech; -import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationEventResponseAction; -import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEventResponseFlashCall; -import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEventResponsePhoneCall; -import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEventResponseSms; -import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEventResponseWhatsApp; -import java.util.Collections; -import org.json.JSONException; -import org.junit.jupiter.api.Test; -import org.skyscreamer.jsonassert.JSONAssert; - -@TestWithResources -public class VerificationResponseEventDtoTest extends VerificationBaseTest { - - public static VerificationRequestEventResponsePhoneCall expectedPhoneCallRequestEventResponseDto = - VerificationRequestEventResponsePhoneCall.builder() - .setAction(VerificationEventResponseAction.ALLOW) - .setCode("4567") - .setSpeech(PhoneCallSpeech.builder().setLocale("the locale").build()) - .putExtraOption("my key", "my value") - .build(); - public static VerificationRequestEventResponseFlashCall expectedFlashCallRequestEventResponseDto = - VerificationRequestEventResponseFlashCall.builder() - .setAction(VerificationEventResponseAction.ALLOW) - .setCli("cli code") - .setDialTimeout(123) - .setInterceptionTimeout(456) - .putExtraOption("my key", "my value") - .build(); - public static VerificationRequestEventResponseSms expectedSmsRequestEventResponseDto = - VerificationRequestEventResponseSms.builder() - .setAction(VerificationEventResponseAction.ALLOW) - .setCode("5666") - .setCodeType(SmsCodeType.NUMERIC) - .setExpiry("01:02:03") - .setAcceptLanguage(Collections.singletonList("a language")) - .putExtraOption("my key", "my value") - .build(); - - public static VerificationRequestEventResponseWhatsApp expectedWhatsAppRequestEventResponseDto = - VerificationRequestEventResponseWhatsApp.builder() - .setAction(VerificationEventResponseAction.ALLOW) - .setCodeType(WhatsAppCodeType.NUMERIC) - .setAcceptLanguage(Collections.singletonList("a language")) - .putExtraOption("my key", "my value") - .build(); - - @GivenTextResource("/domains/verification/v1/webhooks/VerificationResponseSms.json") - String jsonResponseSms; - - @GivenTextResource("/domains/verification/v1/webhooks/VerificationResponseSmsEmptySms.json") - String jsonResponseSmsEmptySms; - - @GivenTextResource("/domains/verification/v1/webhooks/VerificationResponseFlashCall.json") - String jsonResponseFlashCall; - - @GivenTextResource( - "/domains/verification/v1/webhooks/VerificationResponseFlashCallEmptyFlashCall.json") - String jsonResponseFlashCallEmptyFlashCall; - - @GivenTextResource("/domains/verification/v1/webhooks/VerificationResponsePhoneCall.json") - String jsonResponsePhoneCall; - - @GivenTextResource( - "/domains/verification/v1/webhooks/VerificationResponsePhoneCallEmptyCallout.json") - String jsonResponsePhoneCallEmptyCallout; - - @GivenTextResource("/domains/verification/v1/webhooks/VerificationResponseWhatsApp.json") - String jsonResponseWhatsApp; - - @GivenTextResource( - "/domains/verification/v1/webhooks/VerificationResponseWhatsAppEmptyWhatsApp.json") - String jsonResponseWhatsAppEmptyWhatsApp; - - @Test - void serializeSmsResponse() throws JsonProcessingException, JSONException { - - String serializedString = objectMapper.writeValueAsString(expectedSmsRequestEventResponseDto); - - JSONAssert.assertEquals(jsonResponseSms, serializedString, true); - } - - @Test - void serializeSmsResponseEmptySms() throws JsonProcessingException, JSONException { - - VerificationRequestEventResponseSms value = - VerificationRequestEventResponseSms.builder() - .setAction(VerificationEventResponseAction.ALLOW) - .build(); - - String serializedString = objectMapper.writeValueAsString(value); - - JSONAssert.assertEquals(jsonResponseSmsEmptySms, serializedString, true); - } - - @Test - void serializeFlashCallResponse() throws JsonProcessingException, JSONException { - - String serializedString = - objectMapper.writeValueAsString(expectedFlashCallRequestEventResponseDto); - - JSONAssert.assertEquals(jsonResponseFlashCall, serializedString, true); - } - - @Test - void serializeFlashCallResponseEmptyFlashCall() throws JsonProcessingException, JSONException { - - VerificationRequestEventResponseFlashCall value = - VerificationRequestEventResponseFlashCall.builder() - .setAction(VerificationEventResponseAction.ALLOW) - .build(); - - String serializedString = objectMapper.writeValueAsString(value); - - JSONAssert.assertEquals(jsonResponseFlashCallEmptyFlashCall, serializedString, true); - } - - @Test - void serializePhoneCallResponse() throws JsonProcessingException, JSONException { - - String serializedString = - objectMapper.writeValueAsString(expectedPhoneCallRequestEventResponseDto); - - JSONAssert.assertEquals(jsonResponsePhoneCall, serializedString, true); - } - - @Test - void serializePhoneCallResponseEmptyCallout() throws JsonProcessingException, JSONException { - - VerificationRequestEventResponsePhoneCall value = - VerificationRequestEventResponsePhoneCall.builder() - .setAction(VerificationEventResponseAction.ALLOW) - .build(); - - String serializedString = objectMapper.writeValueAsString(value); - - JSONAssert.assertEquals(jsonResponsePhoneCallEmptyCallout, serializedString, true); - } - - @Test - void serializeWhatsAppResponse() throws JsonProcessingException, JSONException { - - String serializedString = - objectMapper.writeValueAsString(expectedWhatsAppRequestEventResponseDto); - - JSONAssert.assertEquals(jsonResponseWhatsApp, serializedString, true); - } - - @Test - void serializeSmsResponseEmptyWhatsApp() throws JsonProcessingException, JSONException { - - VerificationRequestEventResponseWhatsApp value = - VerificationRequestEventResponseWhatsApp.builder() - .setAction(VerificationEventResponseAction.ALLOW) - .build(); - - String serializedString = objectMapper.writeValueAsString(value); - - JSONAssert.assertEquals(jsonResponseWhatsAppEmptyWhatsApp, serializedString, true); - } -} diff --git a/openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResultEventDto.json b/openapi-contracts/src/test/resources/domains/verification/v1/sinchevents/VerificationResultEventDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResultEventDto.json rename to openapi-contracts/src/test/resources/domains/verification/v1/sinchevents/VerificationResultEventDto.json diff --git a/openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationSmsDeliveryEventEventDto.json b/openapi-contracts/src/test/resources/domains/verification/v1/sinchevents/VerificationSmsDeliveryEventEventDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationSmsDeliveryEventEventDto.json rename to openapi-contracts/src/test/resources/domains/verification/v1/sinchevents/VerificationSmsDeliveryEventEventDto.json diff --git a/openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationRequestEventDto.json b/openapi-contracts/src/test/resources/domains/verification/v1/sinchevents/VerificationStartEventDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationRequestEventDto.json rename to openapi-contracts/src/test/resources/domains/verification/v1/sinchevents/VerificationStartEventDto.json diff --git a/openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResponseFlashCall.json b/openapi-contracts/src/test/resources/domains/verification/v1/sinchevents/VerificationStartEventResponseFlashCallDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResponseFlashCall.json rename to openapi-contracts/src/test/resources/domains/verification/v1/sinchevents/VerificationStartEventResponseFlashCallDto.json diff --git a/openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResponseFlashCallEmptyFlashCall.json b/openapi-contracts/src/test/resources/domains/verification/v1/sinchevents/VerificationStartEventResponseFlashCallEmptyFlashCallDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResponseFlashCallEmptyFlashCall.json rename to openapi-contracts/src/test/resources/domains/verification/v1/sinchevents/VerificationStartEventResponseFlashCallEmptyFlashCallDto.json diff --git a/openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResponsePhoneCall.json b/openapi-contracts/src/test/resources/domains/verification/v1/sinchevents/VerificationStartEventResponsePhoneCallDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResponsePhoneCall.json rename to openapi-contracts/src/test/resources/domains/verification/v1/sinchevents/VerificationStartEventResponsePhoneCallDto.json diff --git a/openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResponsePhoneCallEmptyCallout.json b/openapi-contracts/src/test/resources/domains/verification/v1/sinchevents/VerificationStartEventResponsePhoneCallEmptyCalloutDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResponsePhoneCallEmptyCallout.json rename to openapi-contracts/src/test/resources/domains/verification/v1/sinchevents/VerificationStartEventResponsePhoneCallEmptyCalloutDto.json diff --git a/openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResponseSms.json b/openapi-contracts/src/test/resources/domains/verification/v1/sinchevents/VerificationStartEventResponseSmsDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResponseSms.json rename to openapi-contracts/src/test/resources/domains/verification/v1/sinchevents/VerificationStartEventResponseSmsDto.json diff --git a/openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResponseSmsEmptySms.json b/openapi-contracts/src/test/resources/domains/verification/v1/sinchevents/VerificationStartEventResponseSmsEmptySmsDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResponseSmsEmptySms.json rename to openapi-contracts/src/test/resources/domains/verification/v1/sinchevents/VerificationStartEventResponseSmsEmptySmsDto.json diff --git a/openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResponseWhatsApp.json b/openapi-contracts/src/test/resources/domains/verification/v1/sinchevents/VerificationStartEventResponseWhatsAppDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResponseWhatsApp.json rename to openapi-contracts/src/test/resources/domains/verification/v1/sinchevents/VerificationStartEventResponseWhatsAppDto.json diff --git a/openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResponseWhatsAppEmptyWhatsApp.json b/openapi-contracts/src/test/resources/domains/verification/v1/sinchevents/VerificationStartEventResponseWhatsAppEmptyWhatsAppDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResponseWhatsAppEmptyWhatsApp.json rename to openapi-contracts/src/test/resources/domains/verification/v1/sinchevents/VerificationStartEventResponseWhatsAppEmptyWhatsAppDto.json