From 22732979144ce33b5d3d81824f0dfdcefb7dbbc0 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier Date: Mon, 21 Jul 2025 13:17:09 +0200 Subject: [PATCH 001/122] build: Bump to V2.0 --- client/src/main/com/sinch/sdk/SDK.java | 2 +- pom.xml | 14 +------------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/client/src/main/com/sinch/sdk/SDK.java b/client/src/main/com/sinch/sdk/SDK.java index e91d13936..63a9e5b1a 100644 --- a/client/src/main/com/sinch/sdk/SDK.java +++ b/client/src/main/com/sinch/sdk/SDK.java @@ -3,6 +3,6 @@ public class SDK { public static final String NAME = "Sinch Java SDK"; - public static final String VERSION = "1.8.0-dev"; + public static final String VERSION = "2.0.0-dev"; public static final String AUXILIARY_FLAG = ""; } diff --git a/pom.xml b/pom.xml index fd412a003..b044c2469 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.sinch.sdk sinch-sdk-java - 1.8.0-SNAPSHOT + 2.0.0-SNAPSHOT Sinch Java SDK @@ -131,18 +131,6 @@ **.adapters*; **.internal; com.sinch.sdk.domains.numbers.models.v1.errors; - com.sinch.sdk.domains.sms.models; - com.sinch.sdk.domains.sms.models.requests; - com.sinch.sdk.domains.sms.models.responses; - com.sinch.sdk.domains.sms.models.webhooks; - com.sinch.sdk.domains.verification.models; - com.sinch.sdk.domains.verification.models.requests; - com.sinch.sdk.domains.verification.models.response; - com.sinch.sdk.domains.verification.models.webhooks; - com.sinch.sdk.domains.numbers.models; - com.sinch.sdk.domains.numbers.models.requests; - com.sinch.sdk.domains.numbers.models.responses; - com.sinch.sdk.domains.numbers.models.webhooks; **/pagination/Page*.java From cf27c7df7652cf744a648b41c8a70a9d54057192 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier <141755467+JPPortier@users.noreply.github.com> Date: Tue, 22 Jul 2025 08:10:04 +0200 Subject: [PATCH 002/122] DEVEXP-747: Numbers deprecation cleanup (#256) * feat (Numbers): Remove Numbers deprecated features --- MIGRATION-GUIDE.md | 83 +++++ .../domains/numbers/ActiveNumberService.java | 71 ---- .../numbers/AvailableNumberService.java | 98 ------ .../numbers/AvailableRegionService.java | 31 -- .../numbers/CallbackConfigurationService.java | 43 --- .../sdk/domains/numbers/NumbersService.java | 60 ---- .../sdk/domains/numbers/WebHooksService.java | 33 -- .../numbers/adapters/ActiveNumberService.java | 86 ----- .../adapters/AvailableNumberService.java | 98 ------ .../adapters/AvailableRegionService.java | 42 --- .../CallbackConfigurationService.java | 29 -- .../numbers/adapters/NumbersService.java | 42 --- .../numbers/adapters/WebHooksService.java | 26 -- .../converters/ActiveNumberDtoConverter.java | 49 --- ...erUpdateRequestParametersDtoConverter.java | 21 -- .../AvailableNumberDtoConverter.java | 39 --- .../AvailableRegionsDtoConverter.java | 34 -- ...eRentAnyRequestParametersDtoConverter.java | 64 ---- ...ableRentRequestParametersDtoConverter.java | 37 --- .../CallbackConfigurationDtoConverter.java | 18 -- ...onUpdateRequestParametersDtoConverter.java | 18 -- .../CallbackPayloadDtoConverter.java | 30 -- .../converters/MoneyDtoConverter.java | 14 - .../ScheduledSmsProvisioningDtoConverter.java | 57 ---- ...cheduledVoiceProvisioningDtoConverter.java | 47 --- .../SmsConfigurationDtoConverter.java | 32 -- .../VoiceConfigurationDtoConverter.java | 39 --- .../api/v1/AvailableRegionService.java | 31 -- .../numbers/api/v1/NumbersService.java | 37 --- .../api/v1/adapters/NumbersService.java | 13 - .../domains/numbers/models/ActiveNumber.java | 288 ----------------- .../numbers/models/AvailableNumber.java | 189 ----------- .../numbers/models/CallbackConfiguration.java | 69 ---- .../domains/numbers/models/Capability.java | 38 --- .../sdk/domains/numbers/models/Money.java | 61 ---- .../domains/numbers/models/NumberPattern.java | 67 ---- .../domains/numbers/models/NumberType.java | 43 --- .../sdk/domains/numbers/models/OrderBy.java | 39 --- .../numbers/models/ProvisioningStatus.java | 51 --- .../sdk/domains/numbers/models/Region.java | 88 ----- .../numbers/models/SMSConfiguration.java | 55 ---- .../models/ScheduledSmsProvisioning.java | 82 ----- .../models/ScheduledVoiceProvisioning.java | 55 ---- .../domains/numbers/models/SearchPattern.java | 38 --- .../domains/numbers/models/SmsErrorCode.java | 87 ----- .../numbers/models/VoiceConfiguration.java | 59 ---- .../ActiveNumberListRequestParameters.java | 192 ----------- .../ActiveNumberUpdateRequestParameters.java | 106 ------ ...dateSMSConfigurationRequestParameters.java | 76 ----- ...teVoiceConfigurationRequestParameters.java | 53 --- ...ailableNumberListAllRequestParameters.java | 118 ------- ...ailableNumberRentAnyRequestParameters.java | 164 ---------- .../AvailableNumberRentRequestParameters.java | 88 ----- ...ailableRegionListAllRequestParameters.java | 48 --- ...kConfigurationUpdateRequestParameters.java | 47 --- ...RentSMSConfigurationRequestParameters.java | 62 ---- ...ntVoiceConfigurationRequestParameters.java | 44 --- .../numbers/models/requests/package-info.java | 6 - .../responses/ActiveNumberListResponse.java | 51 --- .../AvailableNumberListResponse.java | 37 --- .../AvailableRegionListResponse.java | 37 --- .../models/responses/package-info.java | 6 - .../models/webhooks/EventNotification.java | 108 ------- .../numbers/models/webhooks/EventStatus.java | 40 --- .../numbers/models/webhooks/EventType.java | 68 ---- .../numbers/models/webhooks/ResourceType.java | 38 --- .../numbers/models/webhooks/package-info.java | 6 - .../java/com/sinch/sdk/SinchClientTestIT.java | 2 +- .../adapters/ActiveNumberServiceTest.java | 306 ------------------ .../adapters/AvailableNumberServiceTest.java | 195 ----------- .../CallbackConfigurationServiceTest.java | 64 ---- .../adapters/CredentialsValidationHelper.java | 126 -------- .../numbers/adapters/NumbersServiceTest.java | 43 --- .../numbers/adapters/RegionServiceTest.java | 66 ---- .../numbers/adapters/WebhooksServiceTest.java | 50 --- .../ActiveNumberDtoConverterTest.java | 37 --- ...dateRequestParametersDtoConverterTest.java | 38 --- .../AvailableNumberDtoConverterTest.java | 61 ---- ...tAnyRequestParametersDtoConverterTest.java | 67 ---- ...RentRequestParametersDtoConverterTest.java | 42 --- ...CallbackConfigurationDtoConverterTest.java | 22 -- ...ationUpdateParametersDtoConverterTest.java | 20 -- .../CallbackPayloadDtoConverterTest.java | 34 -- .../converters/MoneyDtoConverterTest.java | 19 -- .../converters/RegionsDtoConverterTest.java | 63 ---- ...eduledSmsProvisioningDtoConverterTest.java | 30 -- ...uledVoiceProvisioningDtoConverterTest.java | 26 -- .../SmsConfigurationDtoConverterTest.java | 21 -- .../VoiceConfigurationDtoConverterTest.java | 24 -- .../v1/adapters/ActiveNumberServiceTest.java | 117 ------- .../adapters/AvailableNumberServiceTest.java | 92 ------ .../adapters/AvailableRegionServiceTest.java | 90 ------ .../models/ActiveNumberBuilderTest.java | 126 -------- .../numbers/models/ActiveNumberTest.java | 125 ------- .../models/AvailableNumberBuilderTest.java | 73 ----- .../numbers/models/AvailableNumberTest.java | 72 ----- .../CallbackConfigurationBuilderTest.java | 23 -- .../models/CallbackConfigurationTest.java | 20 -- .../numbers/models/CapabilityTest.java | 30 -- .../numbers/models/MoneyBuilderTest.java | 19 -- .../sdk/domains/numbers/models/MoneyTest.java | 19 -- .../models/NumberPatternBuilderTest.java | 22 -- .../numbers/models/NumberPatternTest.java | 18 -- .../numbers/models/NumberTypeTest.java | 29 -- .../numbers/models/RegionBuilderTest.java | 28 -- .../domains/numbers/models/RegionTest.java | 27 -- ...umberListRequestParametersBuilderTest.java | 71 ---- ...erListAllRequestParametersBuilderTest.java | 58 ---- ...erRentRequestParametersAnyBuilderTest.java | 78 ----- ...umberRentRequestParametersBuilderTest.java | 42 --- ...onListAllRequestParametersBuilderTest.java | 20 -- ...ionUpdateRequestParametersBuilderTest.java | 15 - ...igurationRequestParametersBuilderTest.java | 31 -- ...igurationRequestParametersBuilderTest.java | 16 - .../ActiveNumberListResponseTest.java | 166 ---------- .../AvailableNumberListResponseTest.java | 69 ---- .../AvailableRegionListResponseTest.java | 61 ---- .../numbers/v1/AvailableRegionsSteps.java | 31 -- .../e2e/domains/numbers/v1/NumbersSteps.java | 23 -- .../api/v1/AvailableRegionsService.java | 3 +- .../adapters/AvailableRegionsServiceImpl.java | 15 - .../sample/numbers/NumbersSampleFlow.java | 25 +- 122 files changed, 96 insertions(+), 6940 deletions(-) create mode 100644 MIGRATION-GUIDE.md delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/ActiveNumberService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/AvailableNumberService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/AvailableRegionService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/CallbackConfigurationService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/WebHooksService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/adapters/ActiveNumberService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/adapters/AvailableNumberService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/adapters/AvailableRegionService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/adapters/CallbackConfigurationService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/adapters/WebHooksService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/ActiveNumberDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/ActiveNumberUpdateRequestParametersDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/AvailableNumberDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/AvailableRegionsDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/AvailableRentAnyRequestParametersDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/AvailableRentRequestParametersDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/CallbackConfigurationDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/CallbackConfigurationUpdateRequestParametersDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/CallbackPayloadDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/MoneyDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/ScheduledSmsProvisioningDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/ScheduledVoiceProvisioningDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/SmsConfigurationDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/VoiceConfigurationDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/api/v1/AvailableRegionService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/ActiveNumber.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/AvailableNumber.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/CallbackConfiguration.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/Capability.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/Money.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/NumberPattern.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/NumberType.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/OrderBy.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/ProvisioningStatus.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/Region.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/SMSConfiguration.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/ScheduledSmsProvisioning.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/ScheduledVoiceProvisioning.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/SearchPattern.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/SmsErrorCode.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/VoiceConfiguration.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/requests/ActiveNumberListRequestParameters.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/requests/ActiveNumberUpdateRequestParameters.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/requests/ActiveNumberUpdateSMSConfigurationRequestParameters.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/requests/ActiveNumberUpdateVoiceConfigurationRequestParameters.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/requests/AvailableNumberListAllRequestParameters.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/requests/AvailableNumberRentAnyRequestParameters.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/requests/AvailableNumberRentRequestParameters.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/requests/AvailableRegionListAllRequestParameters.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/requests/CallbackConfigurationUpdateRequestParameters.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/requests/RentSMSConfigurationRequestParameters.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/requests/RentVoiceConfigurationRequestParameters.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/requests/package-info.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/responses/ActiveNumberListResponse.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/responses/AvailableNumberListResponse.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/responses/AvailableRegionListResponse.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/responses/package-info.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/webhooks/EventNotification.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/webhooks/EventStatus.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/webhooks/EventType.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/webhooks/ResourceType.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/webhooks/package-info.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/adapters/ActiveNumberServiceTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/adapters/AvailableNumberServiceTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/adapters/CallbackConfigurationServiceTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/adapters/CredentialsValidationHelper.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/adapters/NumbersServiceTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/adapters/RegionServiceTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/adapters/WebhooksServiceTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/ActiveNumberDtoConverterTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/ActiveNumberUpdateRequestParametersDtoConverterTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/AvailableNumberDtoConverterTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/AvailableRentAnyRequestParametersDtoConverterTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/AvailableRentRequestParametersDtoConverterTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/CallbackConfigurationDtoConverterTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/CallbackConfigurationUpdateParametersDtoConverterTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/CallbackPayloadDtoConverterTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/MoneyDtoConverterTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/RegionsDtoConverterTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/ScheduledSmsProvisioningDtoConverterTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/ScheduledVoiceProvisioningDtoConverterTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/SmsConfigurationDtoConverterTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/VoiceConfigurationDtoConverterTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/api/v1/adapters/AvailableRegionServiceTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/models/ActiveNumberBuilderTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/models/ActiveNumberTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/models/AvailableNumberBuilderTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/models/AvailableNumberTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/models/CallbackConfigurationBuilderTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/models/CallbackConfigurationTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/models/CapabilityTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/models/MoneyBuilderTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/models/MoneyTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/models/NumberPatternBuilderTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/models/NumberPatternTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/models/NumberTypeTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/models/RegionBuilderTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/models/RegionTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/models/requests/ActiveNumberListRequestParametersBuilderTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/models/requests/AvailableNumberListAllRequestParametersBuilderTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/models/requests/AvailableNumberRentRequestParametersAnyBuilderTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/models/requests/AvailableNumberRentRequestParametersBuilderTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/models/requests/AvailableRegionListAllRequestParametersBuilderTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/models/requests/CallbackConfigurationUpdateRequestParametersBuilderTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/models/requests/RentSMSConfigurationRequestParametersBuilderTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/models/requests/RentVoiceConfigurationRequestParametersBuilderTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/models/responses/ActiveNumberListResponseTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/models/responses/AvailableNumberListResponseTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/numbers/models/responses/AvailableRegionListResponseTest.java diff --git a/MIGRATION-GUIDE.md b/MIGRATION-GUIDE.md new file mode 100644 index 000000000..55920b943 --- /dev/null +++ b/MIGRATION-GUIDE.md @@ -0,0 +1,83 @@ +# Sinch Java SDK Migration Guide + +## 2.0.0 + +This release removes legacy SDK support. + +This guide lists all removed classes and interfaces from V1 and how to migrate to their V2 equivalents. + + +### [`Numbers`](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/package-summary.html) + +#### Replacement models + +##### Common models +| Old class | New class | +|-----------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| models.ActiveNumber | [com.sinch.sdk.domains.numbers.models.v1.ActiveNumber](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/ActiveNumber.html) | +| models.AvailableNumber | [com.sinch.sdk.domains.numbers.models.v1.response/AvailableNumber](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/response/AvailableNumber.html) | +| models.CallbackConfiguration | [com.sinch.sdk.domains.numbers.models.v1.response/CallbackConfigurationResponse](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/response/CallbackConfigurationResponse.html) | +| models.Capability | [com.sinch.sdk.domains.numbers.models.v1.Capability](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/Capability.html) | +| models.Money | [com.sinch.sdk.domains.numbers.models.v1.Money](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/Money.html) | +| models.NumberPattern | [com.sinch.sdk.domains.numbers.models.v1.request.SearchPattern](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/SearchPattern.html) | +| models.NumberType | [com.sinch.sdk.domains.numbers.models.v1.NumberType](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/NumberType.html) | +| models.OrderBy | [com.sinch.sdk.domains.numbers.models.v1.request.OrderBy](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/OrderBy.html) | +| models.ProvisioningStatus | [com.sinch.sdk.domains.numbers.models.v1.ProvisioningStatus](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/ProvisioningStatus.html) | +| models.Region | Part of [com.sinch.sdk.domains.numbers.models.v1.regions.available.AvailableRegion](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/regions/available/AvailableRegion.html) | +| models.SMSConfiguration | [com.sinch.sdk.domains.numbers.models.v1.SmsConfiguration](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/SmsConfiguration.html) | +| models.ScheduledSmsProvisioning | [com.sinch.sdk.domains.numbers.models.v1.ScheduledSmsProvisioning](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/ScheduledSmsProvisioning.html) | +| models.ScheduledVoiceProvisioning | [com.sinch.sdk.domains.numbers.models.v1.request/ScheduledVoiceProvisioning](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/ScheduledVoiceProvisioning.html) | +| models.SearchPattern | [com.sinch.sdk.domains.numbers.models.v1.request/SearchPosition](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/SearchPosition.html) | +| models.SmsErrorCode | [com.sinch.sdk.domains.numbers.models.v1.SmsErrorCode](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/SmsErrorCode.html) | +| models.VoiceConfiguration | [com.sinch.sdk.domains.numbers.models.v1.VoiceConfiguration](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/VoiceConfiguration.html) | + +##### Active Numbers +| Old class | New class | +|-----------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| models.requests.ActiveNumberListRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumbersListQueryParameters](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/ActiveNumbersListQueryParameters.html) | +| models.requests.ActiveNumberUpdateRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumberUpdateRequest](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/ActiveNumberUpdateRequest.html) | +| models.requests.ActiveNumberUpdateSMSConfigurationRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.SmsConfiguration](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/SmsConfiguration.html) | +| models.requests.ActiveNumberUpdateVoiceConfigurationRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.VoiceConfiguration](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/VoiceConfiguration.html) | +| models.responses.ActiveNumberListResponse.java | [com.sinch.sdk.domains.numbers.models.v1.response.ActiveNumberListResponse](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/response/ActiveNumberListResponse.html) | + +##### Available Numbers +| Old class | New class | +|---------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| models.requests.AvailableNumberListAllRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumbersListQueryParameters](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/AvailableNumbersListQueryParameters.html) | +| models.requests.AvailableNumberRentAnyRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentAnyRequest](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/AvailableNumberRentAnyRequest.html) | +| models.requests.AvailableNumberRentRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentRequest](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/AvailableNumberRentRequest.html) | +| models.responses.AvailableNumberListResponse | [com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumberListResponse](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/response/AvailableNumberListResponse.html) | +| models.requests.RentSMSConfigurationRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.SmsConfiguration](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/SmsConfiguration.html) | +| models.requests.RentVoiceConfigurationRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.VoiceConfiguration](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/VoiceConfiguration.html) | + +##### Regions +| Old class | New class | +|---------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| models.requests.AvailableRegionListAllRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.regions.request.AvailableRegionsListQueryParameters](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/regions/request/AvailableRegionsListQueryParameters.html) | +| models.responses.AvailableRegionListResponse | [com.sinch.sdk.domains.numbers.models.v1.regions.available.response.AvailableRegionListResponse](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/regions/available/response/AvailableRegionListResponse.html) | + +##### Callbacks configuration +| Old class | New class | +|----------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| models.requests.CallbackConfigurationUpdateRequest | [com.sinch.sdk.domains.numbers.models.v1.callbacks.request.CallbackConfigurationUpdateRequest](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/callbacks/request/CallbackConfigurationUpdateRequest.html) | + +##### Webhooks +| Old class | New class | +|----------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| models.webhooks.EventNotification.java | [com.sinch.sdk.domains.numbers.models.v1.webhooks.NumberEvent](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/webhooks/NumberEvent.html) | +| models.webhooks.EventStatus.java | [com.sinch.sdk.domains.numbers.models.v1.webhooks.NumberEvent.StatusEnum](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/webhooks/NumberEvent.StatusEnum.html) | +| models.webhooks.EventType.java | [com.sinch.sdk.domains.numbers.models.v1.webhooks.NumberEvent.EventTypeEnum](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/webhooks/NumberEvent.EventTypeEnum.html) | +| models.webhooks.ResourceType.java | [com.sinch.sdk.domains.numbers.models.v1.webhooks.ResourceType](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/webhooks/ResourceType.html) | + +#### Replacement APIs + +Use the new versioned API under v1().numbers() to get access to [NumbersService](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/NumbersService.html): [`sinchClient.numbers.v1()`](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0./com/sinch/sdk/domains/numbers/NumbersService.html#v1()) + +| Old interface | New Equivalent in `numbers().v1()` | +|---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------| +| active() | [Direct access from v1()](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/NumbersService.html) | +| available() | [Direct access from v1()](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/NumbersService.html) | +| regions() | [v1().regions()](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/AvailableRegionsService.html) | +| callback() | [v1().callback()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/CallbackConfigurationService.html) | +| webhook() | [v1().webhooks()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/WebHooksService.html) | + diff --git a/client/src/main/com/sinch/sdk/domains/numbers/ActiveNumberService.java b/client/src/main/com/sinch/sdk/domains/numbers/ActiveNumberService.java deleted file mode 100644 index ae40a1509..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/ActiveNumberService.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.sinch.sdk.domains.numbers; - -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.domains.numbers.models.ActiveNumber; -import com.sinch.sdk.domains.numbers.models.requests.ActiveNumberListRequestParameters; -import com.sinch.sdk.domains.numbers.models.requests.ActiveNumberUpdateRequestParameters; -import com.sinch.sdk.domains.numbers.models.responses.ActiveNumberListResponse; -import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumberListRequest; -import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumberUpdateRequest; - -/** - * Active Numbers Service - * - * @see https://developers.sinch.com/docs/numbers/api-reference/numbers/tag/Active-Number - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.numbers.api.v1.NumbersService} instead. - */ -@Deprecated -public interface ActiveNumberService { - - /** - * Lists active numbers for a project - * - * @param parameters Filtering criteria - * @return List of active numbers - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.numbers.api.v1.NumbersService#list(ActiveNumberListRequest)} instead. - */ - @Deprecated - ActiveNumberListResponse list(ActiveNumberListRequestParameters parameters) throws ApiException; - - /** - * Get active number information by phone number - * - * @param phoneNumber Phone number - * @return Active number information - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.numbers.api.v1.NumbersService#get(String)} - * instead. - */ - @Deprecated - ActiveNumber get(String phoneNumber) throws ApiException; - - /** - * Release an active number from the project - * - * @param phoneNumber Phone number - * @return Released active number - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.numbers.api.v1.NumbersService#release(String)} - * instead. - */ - @Deprecated - ActiveNumber release(String phoneNumber) throws ApiException; - - /** - * Update an active phone number - * - * @param phoneNumber Phone number - * @param parameters Parameters to be updated - * @return Updated active number - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.numbers.api.v1.NumbersService#update(String, - * ActiveNumberUpdateRequest)} instead. - */ - @Deprecated - ActiveNumber update(String phoneNumber, ActiveNumberUpdateRequestParameters parameters) - throws ApiException; -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/AvailableNumberService.java b/client/src/main/com/sinch/sdk/domains/numbers/AvailableNumberService.java deleted file mode 100644 index f05b0c3fa..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/AvailableNumberService.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.sinch.sdk.domains.numbers; - -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.domains.numbers.models.ActiveNumber; -import com.sinch.sdk.domains.numbers.models.AvailableNumber; -import com.sinch.sdk.domains.numbers.models.requests.AvailableNumberListAllRequestParameters; -import com.sinch.sdk.domains.numbers.models.requests.AvailableNumberRentAnyRequestParameters; -import com.sinch.sdk.domains.numbers.models.requests.AvailableNumberRentRequestParameters; -import com.sinch.sdk.domains.numbers.models.responses.AvailableNumberListResponse; -import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberListRequest; -import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentAnyRequest; -import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentRequest; - -/** - * Available Number Service - * - * @see https://developers.sinch.com/docs/numbers/api-reference/numbers/tag/Available-Number - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.numbers.api.v1.NumbersService} instead. - */ -@Deprecated -public interface AvailableNumberService { - - /** - * Search for available phone numbers - * - *

Search for available phone numbers that are available for you to activate. You can filter by - * any property on the available number resource. - * - *

When searching, indicate the capability of the number in the array as SMS and/or VOICE. To - * search for a number capable of both, list both SMS and VOICE. - * - * @param parameters Filtering criteria - * @return List of available numbers according to search criteria - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.numbers.api.v1.NumbersService#searchForAvailableNumbers(AvailableNumberListRequest)} - * instead. - */ - @Deprecated - AvailableNumberListResponse list(AvailableNumberListAllRequestParameters parameters) - throws ApiException; - - /** - * Get available number information by phone number - * - *

This endpoint allows you to enter a specific phone number to check if it's available for use - * - * @param phoneNumber Phone number - * @return Available number information - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.numbers.api.v1.NumbersService#checkAvailability(String)} instead. - */ - @Deprecated - AvailableNumber checkAvailability(String phoneNumber) throws ApiException; - - /** - * Activate a new phone number - * - *

Activate a phone number to use with SMS products, Voice products, or both. - * - *

You'll use smsConfiguration to setup your number for SMS and voiceConfiguration for Voice. - * To setup for both, add both objects. See the dropdown menu (just under language selection) for - * code samples. - * - *

Note: You cannot add both objects if you only need to configure one object. For example, if - * you only need to configure smsConfiguration for SMS messaging, do not add the - * voiceConfiguration object or it will result in an error. - * - * @param phoneNumber Number to be activated - * @param parameters Activation parameters - * @return Activated number - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.numbers.api.v1.NumbersService#rent(String, - * AvailableNumberRentRequest)} instead. - */ - @Deprecated - ActiveNumber rent(String phoneNumber, AvailableNumberRentRequestParameters parameters) - throws ApiException; - - /** - * Rent any number that matches the criteria - * - *

Activates a phone number that matches the search criteria provided in the request. Currently - * the rentAny operation works only for US LOCAL numbers - * - * @param parameters Selection and activation parameters - * @return Activated number according to criteria - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.numbers.api.v1.NumbersService#rentAny(AvailableNumberRentAnyRequest)} - * instead. - */ - @Deprecated - ActiveNumber rentAny(AvailableNumberRentAnyRequestParameters parameters) throws ApiException; -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/AvailableRegionService.java b/client/src/main/com/sinch/sdk/domains/numbers/AvailableRegionService.java deleted file mode 100644 index b44a87615..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/AvailableRegionService.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.sinch.sdk.domains.numbers; - -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.domains.numbers.models.requests.AvailableRegionListAllRequestParameters; -import com.sinch.sdk.domains.numbers.models.responses.AvailableRegionListResponse; -import com.sinch.sdk.domains.numbers.models.v1.regions.available.request.AvailableRegionListRequest; - -/** - * Available Region Service - * - * @see https://developers.sinch.com/docs/numbers/api-reference/numbers/tag/Available-Regions - * @deprecated use {@link com.sinch.sdk.domains.numbers.api.v1.AvailableRegionService} instead. - */ -@Deprecated -public interface AvailableRegionService { - - /** - * List available regions - * - * @param parameters Filtering criteria - * @return List of available regions according to search criteria - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.numbers.api.v1.AvailableRegionService#list(AvailableRegionListRequest)} - * instead. - */ - @Deprecated - AvailableRegionListResponse list(AvailableRegionListAllRequestParameters parameters) - throws ApiException; -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/CallbackConfigurationService.java b/client/src/main/com/sinch/sdk/domains/numbers/CallbackConfigurationService.java deleted file mode 100644 index c04e73359..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/CallbackConfigurationService.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.sinch.sdk.domains.numbers; - -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.domains.numbers.models.CallbackConfiguration; -import com.sinch.sdk.domains.numbers.models.requests.CallbackConfigurationUpdateRequestParameters; -import com.sinch.sdk.domains.numbers.models.v1.callbacks.request.CallbackConfigurationUpdateRequest; - -/** - * Callback Configuration Service - * - * @see https://developers.sinch.com/docs/numbers/api-reference/numbers/tag/Callbacks/ - * @deprecated use {@link com.sinch.sdk.domains.numbers.api.v1.CallbackConfigurationService} - * instead. - */ -@Deprecated -public interface CallbackConfigurationService { - - /** - * Get callbacks configuration - * - * @return callbacks configuration for the project - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.numbers.api.v1.CallbackConfigurationService#get()} - * instead. - */ - @Deprecated - CallbackConfiguration get() throws ApiException; - - /** - * Update callbacks configuration - * - * @param parameters Parameters to be updated - * @return Updated callbacks configuration - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.numbers.api.v1.CallbackConfigurationService#update(CallbackConfigurationUpdateRequest)} - * instead. - */ - @Deprecated - CallbackConfiguration update(CallbackConfigurationUpdateRequestParameters parameters) - throws ApiException; -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/NumbersService.java b/client/src/main/com/sinch/sdk/domains/numbers/NumbersService.java index 28b38e795..3741c08aa 100644 --- a/client/src/main/com/sinch/sdk/domains/numbers/NumbersService.java +++ b/client/src/main/com/sinch/sdk/domains/numbers/NumbersService.java @@ -18,64 +18,4 @@ public interface NumbersService { * @since 1.2 */ com.sinch.sdk.domains.numbers.api.v1.NumbersService v1(); - - /** - * Non versioned Available Number Service instance - * - * @apiNote This version is no longer updated, to get updates use V1 version: {@link - * com.sinch.sdk.domains.numbers.api.v1.NumbersService} - * @return service instance for project - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.numbers.api.v1.NumbersService} instead. - */ - @Deprecated - AvailableNumberService available(); - - /** - * Non versioned Available Region Service instance - * - * @apiNote This version is no longer updated, to get updates use V1 version: {@link - * com.sinch.sdk.domains.numbers.api.v1.AvailableRegionService} - * @return service instance for project - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.numbers.api.v1.NumbersService#regions()} instead. - */ - @Deprecated - AvailableRegionService regions(); - - /** - * Non versioned Active Number Service instance - * - * @apiNote This version is no longer updated, to get updates use V1 version: {@link - * com.sinch.sdk.domains.numbers.api.v1.NumbersService} - * @return service instance for project - * @deprecated use {@link com.sinch.sdk.domains.numbers.api.v1.NumbersService} instead. - * @since 1.0 - */ - @Deprecated - ActiveNumberService active(); - - /** - * Non versioned Callbacks Configuration Service instance - * - * @apiNote This version is no longer updated, to get updates use V1 version: {@link - * com.sinch.sdk.domains.numbers.api.v1.CallbackConfigurationService} - * @return service instance for project - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.numbers.api.v1.NumbersService#callback()} instead. - */ - @Deprecated - CallbackConfigurationService callback(); - - /** - * Non versioned Webhooks helpers instance - * - * @apiNote This version is no longer updated, to get updates use V1 version: {@link - * com.sinch.sdk.domains.numbers.api.v1.WebHooksService} - * @return instance service related to webhooks helpers - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.numbers.api.v1.NumbersService#webhooks()} instead. - */ - @Deprecated - WebHooksService webhooks(); } diff --git a/client/src/main/com/sinch/sdk/domains/numbers/WebHooksService.java b/client/src/main/com/sinch/sdk/domains/numbers/WebHooksService.java deleted file mode 100644 index 0c73c6a8f..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/WebHooksService.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.sinch.sdk.domains.numbers; - -import com.sinch.sdk.core.exceptions.ApiMappingException; -import com.sinch.sdk.domains.numbers.models.webhooks.EventNotification; - -/** - * Webhooks service - * - *

Callback events are used to get notified about Numbers usage according to your configured - * callback URL - * - *

see https://developers.sinch.com/docs/numbers/api-reference/numbers/tag/Callbacks/#tag/Callbacks/operation/ImportedNumberService_EventsCallback - * - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.numbers.api.v1.WebHooksService} instead. - */ -@Deprecated -public interface WebHooksService { - - /** - * This function can be called to deserialize received payload onto callback. Function return Java - * class instance from un-serialized payload - * - * @param jsonPayload Received payload to be un-serialized - * @return The decoded event notification instance class - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.numbers.api.v1.WebHooksService#parseEvent(String)} - * instead. - */ - @Deprecated - EventNotification unserializeEventNotification(String jsonPayload) throws ApiMappingException; -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/adapters/ActiveNumberService.java b/client/src/main/com/sinch/sdk/domains/numbers/adapters/ActiveNumberService.java deleted file mode 100644 index b1f00b181..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/adapters/ActiveNumberService.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters; - -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.core.models.pagination.Page; -import com.sinch.sdk.core.models.pagination.TokenPageNavigator; -import com.sinch.sdk.core.utils.Pair; -import com.sinch.sdk.domains.numbers.adapters.converters.ActiveNumberDtoConverter; -import com.sinch.sdk.domains.numbers.adapters.converters.ActiveNumberUpdateRequestParametersDtoConverter; -import com.sinch.sdk.domains.numbers.models.ActiveNumber; -import com.sinch.sdk.domains.numbers.models.requests.ActiveNumberListRequestParameters; -import com.sinch.sdk.domains.numbers.models.requests.ActiveNumberUpdateRequestParameters; -import com.sinch.sdk.domains.numbers.models.responses.ActiveNumberListResponse; -import com.sinch.sdk.domains.numbers.models.v1.Capability; -import com.sinch.sdk.domains.numbers.models.v1.NumberType; -import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumberListRequest; -import com.sinch.sdk.domains.numbers.models.v1.request.OrderBy; -import com.sinch.sdk.domains.numbers.models.v1.request.SearchPosition; -import java.util.Collection; -import java.util.stream.Collectors; - -public class ActiveNumberService implements com.sinch.sdk.domains.numbers.ActiveNumberService { - - private final com.sinch.sdk.domains.numbers.api.v1.NumbersService v1; - - public ActiveNumberService(com.sinch.sdk.domains.numbers.api.v1.NumbersService v1) { - this.v1 = v1; - } - - public ActiveNumberListResponse list(ActiveNumberListRequestParameters parameters) - throws ApiException { - - ActiveNumberListRequest.Builder builder = ActiveNumberListRequest.builder(); - - parameters.getRegionCode().ifPresent(builder::setRegionCode); - parameters.getType().ifPresent(f -> builder.setType(NumberType.from(f.value()))); - - parameters - .getNumberPattern() - .ifPresent( - f -> { - com.sinch.sdk.domains.numbers.models.v1.request.SearchPattern.Builder spBuilder = - com.sinch.sdk.domains.numbers.models.v1.request.SearchPattern.builder(); - spBuilder.setPattern(f.getPattern()); - spBuilder.setPosition( - null != f.getSearchPattern() - ? SearchPosition.from(f.getSearchPattern().value()) - : null); - builder.setSearchPattern(spBuilder.build()); - }); - - parameters - .getCapabilities() - .ifPresent( - f -> - builder.setCapabilities( - f.stream().map(c -> Capability.from(c.value())).collect(Collectors.toList()))); - - parameters.getPageSize().ifPresent(builder::setPageSize); - parameters.getOrderBy().ifPresent(f -> builder.setOrderBy(OrderBy.from(f.value()))); - - parameters.getPageToken().ifPresent(builder::setPageToken); - - com.sinch.sdk.domains.numbers.models.v1.response.ActiveNumberListResponse response = - v1.list(builder.build()); - Pair, TokenPageNavigator> content = - ActiveNumberDtoConverter.convert(response); - return new ActiveNumberListResponse( - this, new Page<>(parameters, content.getLeft(), content.getRight())); - } - - public ActiveNumber get(String phoneNumber) throws ApiException { - return ActiveNumberDtoConverter.convert(v1.get(phoneNumber)); - } - - public ActiveNumber release(String phoneNumber) throws ApiException { - return ActiveNumberDtoConverter.convert(v1.release(phoneNumber)); - } - - public ActiveNumber update(String phoneNumber, ActiveNumberUpdateRequestParameters parameters) - throws ApiException { - - return ActiveNumberDtoConverter.convert( - v1.update( - phoneNumber, ActiveNumberUpdateRequestParametersDtoConverter.convert(parameters))); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/adapters/AvailableNumberService.java b/client/src/main/com/sinch/sdk/domains/numbers/adapters/AvailableNumberService.java deleted file mode 100644 index bb355e180..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/adapters/AvailableNumberService.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters; - -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.domains.numbers.adapters.converters.ActiveNumberDtoConverter; -import com.sinch.sdk.domains.numbers.adapters.converters.AvailableNumberDtoConverter; -import com.sinch.sdk.domains.numbers.adapters.converters.AvailableRentAnyRequestParametersDtoConverter; -import com.sinch.sdk.domains.numbers.adapters.converters.AvailableRentRequestParametersDtoConverter; -import com.sinch.sdk.domains.numbers.models.ActiveNumber; -import com.sinch.sdk.domains.numbers.models.AvailableNumber; -import com.sinch.sdk.domains.numbers.models.requests.AvailableNumberListAllRequestParameters; -import com.sinch.sdk.domains.numbers.models.requests.AvailableNumberRentAnyRequestParameters; -import com.sinch.sdk.domains.numbers.models.requests.AvailableNumberRentRequestParameters; -import com.sinch.sdk.domains.numbers.models.responses.AvailableNumberListResponse; -import com.sinch.sdk.domains.numbers.models.v1.Capability; -import com.sinch.sdk.domains.numbers.models.v1.NumberType; -import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberListRequest; -import com.sinch.sdk.domains.numbers.models.v1.request.SearchPosition; -import java.util.Collection; -import java.util.stream.Collectors; - -public class AvailableNumberService - implements com.sinch.sdk.domains.numbers.AvailableNumberService { - - private final com.sinch.sdk.domains.numbers.api.v1.NumbersService v1; - - public AvailableNumberService(com.sinch.sdk.domains.numbers.api.v1.NumbersService v1) { - this.v1 = v1; - } - - public AvailableNumberListResponse list(AvailableNumberListAllRequestParameters parameters) - throws ApiException { - - AvailableNumberListRequest.Builder builder = AvailableNumberListRequest.builder(); - - parameters.getRegionCode().ifPresent(builder::setRegionCode); - parameters.getType().ifPresent(f -> builder.setType(NumberType.from(f.value()))); - - parameters - .getNumberPattern() - .ifPresent( - f -> { - com.sinch.sdk.domains.numbers.models.v1.request.SearchPattern.Builder spBuilder = - com.sinch.sdk.domains.numbers.models.v1.request.SearchPattern.builder(); - spBuilder.setPattern(f.getPattern()); - spBuilder.setPosition( - null != f.getSearchPattern() - ? SearchPosition.from(f.getSearchPattern().value()) - : null); - builder.setSearchPattern(spBuilder.build()); - }); - - parameters - .getCapabilities() - .ifPresent( - f -> - builder.setCapabilities( - f.stream().map(c -> Capability.from(c.value())).collect(Collectors.toList()))); - - parameters.getSize().ifPresent(builder::setSize); - - com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumberListResponse response = - v1.searchForAvailableNumbers(builder.build()); - - Collection entities = AvailableNumberDtoConverter.convert(response); - - return new AvailableNumberListResponse(entities); - } - - public AvailableNumber checkAvailability(String phoneNumber) throws ApiException { - - com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumber response = - v1.checkAvailability(phoneNumber); - return AvailableNumberDtoConverter.convert(response); - } - - public ActiveNumber rent(String phoneNumber, AvailableNumberRentRequestParameters parameters) - throws ApiException { - - AvailableNumberRentRequestParameters guardParameters = - null != parameters ? parameters : AvailableNumberRentRequestParameters.builder().build(); - - com.sinch.sdk.domains.numbers.models.v1.ActiveNumber response = - v1.rent(phoneNumber, AvailableRentRequestParametersDtoConverter.convert(guardParameters)); - - return ActiveNumberDtoConverter.convert(response); - } - - public ActiveNumber rentAny(AvailableNumberRentAnyRequestParameters parameters) - throws ApiException { - - AvailableNumberRentAnyRequestParameters guardParameters = - null != parameters ? parameters : AvailableNumberRentAnyRequestParameters.builder().build(); - - com.sinch.sdk.domains.numbers.models.v1.ActiveNumber response = - v1.rentAny(AvailableRentAnyRequestParametersDtoConverter.convert(guardParameters)); - return ActiveNumberDtoConverter.convert(response); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/adapters/AvailableRegionService.java b/client/src/main/com/sinch/sdk/domains/numbers/adapters/AvailableRegionService.java deleted file mode 100644 index 88bb7d040..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/adapters/AvailableRegionService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters; - -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.domains.numbers.adapters.converters.AvailableRegionsDtoConverter; -import com.sinch.sdk.domains.numbers.models.Region; -import com.sinch.sdk.domains.numbers.models.requests.AvailableRegionListAllRequestParameters; -import com.sinch.sdk.domains.numbers.models.responses.AvailableRegionListResponse; -import com.sinch.sdk.domains.numbers.models.v1.NumberType; -import com.sinch.sdk.domains.numbers.models.v1.regions.available.request.AvailableRegionListRequest; -import java.util.Collection; -import java.util.stream.Collectors; - -public class AvailableRegionService - implements com.sinch.sdk.domains.numbers.AvailableRegionService { - - private final com.sinch.sdk.domains.numbers.api.v1.AvailableRegionService v1; - - public AvailableRegionService(com.sinch.sdk.domains.numbers.api.v1.AvailableRegionService v1) { - this.v1 = v1; - } - - public AvailableRegionListResponse list(AvailableRegionListAllRequestParameters parameters) - throws ApiException { - - AvailableRegionListRequest dto = null; - if (null != parameters && parameters.getTypes().isPresent()) { - dto = - AvailableRegionListRequest.builder() - .setTypes( - parameters.getTypes().get().stream() - .map(f -> NumberType.from(f.value())) - .collect(Collectors.toList())) - .build(); - } - - com.sinch.sdk.domains.numbers.models.v1.regions.available.response.AvailableRegionListResponse - response = v1.list(dto); - Collection entities = AvailableRegionsDtoConverter.convert(response); - - return new AvailableRegionListResponse(entities); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/adapters/CallbackConfigurationService.java b/client/src/main/com/sinch/sdk/domains/numbers/adapters/CallbackConfigurationService.java deleted file mode 100644 index 18c69bc19..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/adapters/CallbackConfigurationService.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters; - -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.domains.numbers.adapters.converters.CallbackConfigurationDtoConverter; -import com.sinch.sdk.domains.numbers.adapters.converters.CallbackConfigurationUpdateRequestParametersDtoConverter; -import com.sinch.sdk.domains.numbers.models.CallbackConfiguration; -import com.sinch.sdk.domains.numbers.models.requests.CallbackConfigurationUpdateRequestParameters; - -public class CallbackConfigurationService - implements com.sinch.sdk.domains.numbers.CallbackConfigurationService { - - com.sinch.sdk.domains.numbers.api.v1.CallbackConfigurationService v1; - - public CallbackConfigurationService( - com.sinch.sdk.domains.numbers.api.v1.CallbackConfigurationService v1) { - this.v1 = v1; - } - - public CallbackConfiguration get() throws ApiException { - return CallbackConfigurationDtoConverter.convert(v1.get()); - } - - public CallbackConfiguration update(CallbackConfigurationUpdateRequestParameters parameters) - throws ApiException { - - return CallbackConfigurationDtoConverter.convert( - v1.update(CallbackConfigurationUpdateRequestParametersDtoConverter.convert(parameters))); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/adapters/NumbersService.java b/client/src/main/com/sinch/sdk/domains/numbers/adapters/NumbersService.java index 74dd0e1f1..397d2d94c 100644 --- a/client/src/main/com/sinch/sdk/domains/numbers/adapters/NumbersService.java +++ b/client/src/main/com/sinch/sdk/domains/numbers/adapters/NumbersService.java @@ -10,12 +10,6 @@ public class NumbersService implements com.sinch.sdk.domains.numbers.NumbersServ private final com.sinch.sdk.domains.numbers.api.v1.NumbersService v1; - private AvailableNumberService available; - private ActiveNumberService active; - private AvailableRegionService regions; - private CallbackConfigurationService callback; - private WebHooksService webhooks; - public NumbersService( UnifiedCredentials credentials, NumbersContext context, @@ -30,40 +24,4 @@ public NumbersService( public com.sinch.sdk.domains.numbers.api.v1.NumbersService v1() { return v1; } - - public AvailableNumberService available() { - if (null == this.available) { - this.available = new AvailableNumberService(v1); - } - return this.available; - } - - public AvailableRegionService regions() { - if (null == this.regions) { - this.regions = new AvailableRegionService(v1.regions()); - } - return this.regions; - } - - public ActiveNumberService active() { - if (null == this.active) { - this.active = new ActiveNumberService(v1); - } - return this.active; - } - - public CallbackConfigurationService callback() { - if (null == this.callback) { - this.callback = new CallbackConfigurationService(v1().callback()); - } - return this.callback; - } - - public WebHooksService webhooks() { - - if (null == this.webhooks) { - this.webhooks = new WebHooksService(v1().webhooks()); - } - return this.webhooks; - } } diff --git a/client/src/main/com/sinch/sdk/domains/numbers/adapters/WebHooksService.java b/client/src/main/com/sinch/sdk/domains/numbers/adapters/WebHooksService.java deleted file mode 100644 index a1bc25895..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/adapters/WebHooksService.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters; - -import com.sinch.sdk.core.exceptions.ApiMappingException; -import com.sinch.sdk.domains.numbers.adapters.converters.CallbackPayloadDtoConverter; -import com.sinch.sdk.domains.numbers.models.v1.webhooks.NumberEvent; -import com.sinch.sdk.domains.numbers.models.webhooks.EventNotification; - -public class WebHooksService implements com.sinch.sdk.domains.numbers.WebHooksService { - - com.sinch.sdk.domains.numbers.api.v1.WebHooksService v1; - - public WebHooksService(com.sinch.sdk.domains.numbers.api.v1.WebHooksService v1) { - this.v1 = v1; - } - - @Override - public EventNotification unserializeEventNotification(String jsonPayload) - throws ApiMappingException { - - NumberEvent dto = v1.parseEvent(jsonPayload); - if (null != dto) { - return CallbackPayloadDtoConverter.convert(dto); - } - throw new ApiMappingException(jsonPayload, null); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/ActiveNumberDtoConverter.java b/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/ActiveNumberDtoConverter.java deleted file mode 100644 index 52f75f608..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/ActiveNumberDtoConverter.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters.converters; - -import com.sinch.sdk.core.models.pagination.TokenPageNavigator; -import com.sinch.sdk.core.utils.Pair; -import com.sinch.sdk.domains.numbers.models.ActiveNumber; -import com.sinch.sdk.domains.numbers.models.Capability; -import com.sinch.sdk.domains.numbers.models.NumberType; -import com.sinch.sdk.domains.numbers.models.v1.response.ActiveNumberListResponse; -import java.util.Collection; -import java.util.Collections; -import java.util.stream.Collectors; - -public class ActiveNumberDtoConverter { - - public static Pair, TokenPageNavigator> convert( - ActiveNumberListResponse dto) { - String nextPageToken = dto.getNextPageToken(); - Collection pageContent = Collections.emptyList(); - if (null != dto.getContent()) { - pageContent = - dto.getContent().stream() - .map(ActiveNumberDtoConverter::convert) - .collect(Collectors.toList()); - } - return new Pair<>(pageContent, new TokenPageNavigator(nextPageToken)); - } - - public static ActiveNumber convert(com.sinch.sdk.domains.numbers.models.v1.ActiveNumber dto) { - - return new ActiveNumber( - dto.getPhoneNumber(), - dto.getProjectId(), - dto.getDisplayName(), - dto.getRegionCode(), - null == dto.getType() ? null : NumberType.from(dto.getType().value()), - null != dto.getCapability() - ? dto.getCapability().stream() - .map(f -> Capability.from(f.value())) - .collect(Collectors.toList()) - : null, - MoneyDtoConverter.convert(dto.getMoney()), - dto.getPaymentIntervalMonths(), - dto.getNextChargeDate(), - dto.getExpireAt(), - SmsConfigurationDtoConverter.convert(dto.getSmsConfiguration()), - VoiceConfigurationDtoConverter.convert(dto.getVoiceConfiguration()), - dto.getCallbackUrl()); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/ActiveNumberUpdateRequestParametersDtoConverter.java b/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/ActiveNumberUpdateRequestParametersDtoConverter.java deleted file mode 100644 index 81fba27b9..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/ActiveNumberUpdateRequestParametersDtoConverter.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters.converters; - -import com.sinch.sdk.domains.numbers.models.requests.ActiveNumberUpdateRequestParameters; -import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumberUpdateRequest; - -public class ActiveNumberUpdateRequestParametersDtoConverter { - - public static ActiveNumberUpdateRequest convert(ActiveNumberUpdateRequestParameters parameters) { - ActiveNumberUpdateRequest.Builder dto = ActiveNumberUpdateRequest.builder(); - parameters.getDisplayName().ifPresent(dto::setDisplayName); - parameters - .getSmsConfiguration() - .ifPresent(value -> dto.setSmsConfiguration(SmsConfigurationDtoConverter.convert(value))); - parameters - .getVoiceConfiguration() - .ifPresent( - value -> dto.setVoiceConfiguration(VoiceConfigurationDtoConverter.convert(value))); - parameters.getCallback().ifPresent(dto::setCallbackUrl); - return dto.build(); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/AvailableNumberDtoConverter.java b/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/AvailableNumberDtoConverter.java deleted file mode 100644 index 917057f2f..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/AvailableNumberDtoConverter.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters.converters; - -import com.sinch.sdk.domains.numbers.models.AvailableNumber; -import com.sinch.sdk.domains.numbers.models.Capability; -import com.sinch.sdk.domains.numbers.models.NumberType; -import com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumberListResponse; -import java.util.Collection; -import java.util.Collections; -import java.util.stream.Collectors; - -public class AvailableNumberDtoConverter { - - public static Collection convert(AvailableNumberListResponse dto) { - Collection list = - dto.getContent(); - if (null == list) { - return Collections.emptyList(); - } - return list.stream().map(AvailableNumberDtoConverter::convert).collect(Collectors.toList()); - } - - public static AvailableNumber convert( - com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumber dto) { - - return new AvailableNumber( - dto.getPhoneNumber(), - dto.getRegionCode(), - null == dto.getType() ? null : NumberType.from(dto.getType().value()), - null != dto.getCapability() - ? dto.getCapability().stream() - .map(f -> Capability.from(f.value())) - .collect(Collectors.toList()) - : null, - MoneyDtoConverter.convert(dto.getSetupPrice()), - MoneyDtoConverter.convert(dto.getMonthlyPrice()), - dto.getPaymentIntervalMonths(), - dto.getSupportingDocumentationRequired()); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/AvailableRegionsDtoConverter.java b/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/AvailableRegionsDtoConverter.java deleted file mode 100644 index 831526207..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/AvailableRegionsDtoConverter.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters.converters; - -import com.sinch.sdk.domains.numbers.models.NumberType; -import com.sinch.sdk.domains.numbers.models.Region; -import com.sinch.sdk.domains.numbers.models.v1.regions.available.response.AvailableRegion; -import com.sinch.sdk.domains.numbers.models.v1.regions.available.response.AvailableRegionListResponse; -import java.util.Collection; -import java.util.Collections; -import java.util.stream.Collectors; - -public class AvailableRegionsDtoConverter { - - public static Collection convert(AvailableRegionListResponse dto) { - Collection list = dto.getContent(); - if (null == list) { - return Collections.emptyList(); - } - return list.stream().map(AvailableRegionsDtoConverter::convert).collect(Collectors.toList()); - } - - public static Region convert(AvailableRegion dto) { - - return Region.builder() - .setRegionCode(dto.getRegionCode()) - .setRegionName(dto.getRegionName()) - .setTypes( - null != dto.getTypes() - ? dto.getTypes().stream() - .map(f -> NumberType.from(f.value())) - .collect(Collectors.toList()) - : null) - .build(); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/AvailableRentAnyRequestParametersDtoConverter.java b/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/AvailableRentAnyRequestParametersDtoConverter.java deleted file mode 100644 index 58e1e0c2d..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/AvailableRentAnyRequestParametersDtoConverter.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters.converters; - -import com.sinch.sdk.domains.numbers.models.requests.AvailableNumberRentAnyRequestParameters; -import com.sinch.sdk.domains.numbers.models.v1.Capability; -import com.sinch.sdk.domains.numbers.models.v1.NumberType; -import com.sinch.sdk.domains.numbers.models.v1.SmsConfiguration; -import com.sinch.sdk.domains.numbers.models.v1.VoiceConfigurationRTC; -import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentAnyRequest; -import com.sinch.sdk.domains.numbers.models.v1.request.SearchPosition; -import java.util.stream.Collectors; - -public class AvailableRentAnyRequestParametersDtoConverter { - public static AvailableNumberRentAnyRequest convert( - AvailableNumberRentAnyRequestParameters parameters) { - - AvailableNumberRentAnyRequest.Builder dto = AvailableNumberRentAnyRequest.builder(); - - parameters.getRegionCode().ifPresent(dto::setRegionCode); - parameters.getType().ifPresent(f -> dto.setType(NumberType.from(f.value()))); - - parameters - .getNumberPattern() - .ifPresent( - f -> { - com.sinch.sdk.domains.numbers.models.v1.request.SearchPattern.Builder spBuilder = - com.sinch.sdk.domains.numbers.models.v1.request.SearchPattern.builder(); - com.sinch.sdk.domains.numbers.models.v1.request.SearchPattern.builder(); - spBuilder.setPattern(f.getPattern()); - spBuilder.setPosition( - null != f.getSearchPattern() - ? SearchPosition.from(f.getSearchPattern().value()) - : null); - dto.setNumberPattern(spBuilder.build()); - }); - - parameters - .getCapabilities() - .ifPresent( - f -> - dto.setCapabilities( - f.stream().map(c -> Capability.from(c.value())).collect(Collectors.toList()))); - - parameters - .getSmsConfiguration() - .ifPresent( - value -> { - SmsConfiguration.Builder config = SmsConfiguration.builder(); - value.getServicePlanId().ifPresent(config::setServicePlanId); - value.getCampaignId().ifPresent(config::setCampaignId); - dto.setSmsConfiguration(config.build()); - }); - - parameters - .getVoiceConfiguration() - .ifPresent( - value -> { - VoiceConfigurationRTC.Builder config = VoiceConfigurationRTC.builder(); - value.getAppId().ifPresent(config::setAppId); - dto.setVoiceConfiguration(config.build()); - }); - parameters.getCallBackUrl().ifPresent(dto::setCallbackUrl); - return dto.build(); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/AvailableRentRequestParametersDtoConverter.java b/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/AvailableRentRequestParametersDtoConverter.java deleted file mode 100644 index c85323147..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/AvailableRentRequestParametersDtoConverter.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters.converters; - -import com.sinch.sdk.domains.numbers.models.requests.AvailableNumberRentRequestParameters; -import com.sinch.sdk.domains.numbers.models.v1.SmsConfiguration; -import com.sinch.sdk.domains.numbers.models.v1.VoiceConfigurationRTC; -import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentRequest; - -public class AvailableRentRequestParametersDtoConverter { - - public static AvailableNumberRentRequest convert( - AvailableNumberRentRequestParameters parameters) { - - AvailableNumberRentRequest.Builder dto = AvailableNumberRentRequest.builder(); - - parameters - .getSmsConfiguration() - .ifPresent( - value -> { - SmsConfiguration.Builder config = SmsConfiguration.builder(); - value.getServicePlanId().ifPresent(config::setServicePlanId); - value.getCampaignId().ifPresent(config::setCampaignId); - dto.setSmsConfiguration(config.build()); - }); - - parameters - .getVoiceConfiguration() - .ifPresent( - value -> { - VoiceConfigurationRTC.Builder config = VoiceConfigurationRTC.builder(); - value.getAppId().ifPresent(config::setAppId); - dto.setVoiceConfiguration(config.build()); - }); - - parameters.getCallBackUrl().ifPresent(dto::setCallbackUrl); - return dto.build(); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/CallbackConfigurationDtoConverter.java b/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/CallbackConfigurationDtoConverter.java deleted file mode 100644 index 51194d4c0..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/CallbackConfigurationDtoConverter.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters.converters; - -import com.sinch.sdk.domains.numbers.models.CallbackConfiguration; -import com.sinch.sdk.domains.numbers.models.v1.callbacks.response.CallbackConfigurationResponse; - -public class CallbackConfigurationDtoConverter { - - public static CallbackConfiguration convert(CallbackConfigurationResponse dto) { - - if (null == dto) { - return null; - } - return CallbackConfiguration.builder() - .setProjectId(dto.getProjectId()) - .setHMACSecret(dto.getHmacSecret()) - .build(); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/CallbackConfigurationUpdateRequestParametersDtoConverter.java b/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/CallbackConfigurationUpdateRequestParametersDtoConverter.java deleted file mode 100644 index ecb0ea197..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/CallbackConfigurationUpdateRequestParametersDtoConverter.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters.converters; - -import com.sinch.sdk.domains.numbers.models.requests.CallbackConfigurationUpdateRequestParameters; -import com.sinch.sdk.domains.numbers.models.v1.callbacks.request.CallbackConfigurationUpdateRequest; - -public class CallbackConfigurationUpdateRequestParametersDtoConverter { - - public static CallbackConfigurationUpdateRequest convert( - CallbackConfigurationUpdateRequestParameters parameters) { - - if (null == parameters) { - return null; - } - CallbackConfigurationUpdateRequest.Builder dto = CallbackConfigurationUpdateRequest.builder(); - parameters.getHMACSecret().ifPresent(dto::setHmacSecret); - return dto.build(); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/CallbackPayloadDtoConverter.java b/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/CallbackPayloadDtoConverter.java deleted file mode 100644 index a1fd68ff9..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/CallbackPayloadDtoConverter.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters.converters; - -import com.sinch.sdk.domains.numbers.models.SmsErrorCode; -import com.sinch.sdk.domains.numbers.models.v1.webhooks.NumberEvent; -import com.sinch.sdk.domains.numbers.models.webhooks.EventNotification; -import com.sinch.sdk.domains.numbers.models.webhooks.EventStatus; -import com.sinch.sdk.domains.numbers.models.webhooks.EventType; -import com.sinch.sdk.domains.numbers.models.webhooks.ResourceType; -import java.time.Instant; - -public class CallbackPayloadDtoConverter { - - public static EventNotification convert(NumberEvent dto) { - - String eventId = dto.getEventId(); - Instant timestamp = dto.getTimestamp(); - String projectId = dto.getProjectId(); - String resourceId = dto.getResourceId(); - ResourceType resourceType = - null == dto.getResourceType() ? null : ResourceType.from(dto.getResourceType().value()); - EventType eventType = - null == dto.getEventType() ? null : EventType.from(dto.getEventType().value()); - EventStatus status = null == dto.getStatus() ? null : EventStatus.from(dto.getStatus().value()); - SmsErrorCode failureCode = - null == dto.getFailureCode() ? null : SmsErrorCode.from(dto.getFailureCode().value()); - - return new EventNotification( - eventId, timestamp, projectId, resourceId, resourceType, eventType, status, failureCode); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/MoneyDtoConverter.java b/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/MoneyDtoConverter.java deleted file mode 100644 index 8723cb6df..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/MoneyDtoConverter.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters.converters; - -import com.sinch.sdk.domains.numbers.models.Money; - -public class MoneyDtoConverter { - - public static Money convert(com.sinch.sdk.domains.numbers.models.v1.Money dto) { - - if (null == dto) { - return null; - } - return new Money(dto.getCurrencyCode(), dto.getAmount()); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/ScheduledSmsProvisioningDtoConverter.java b/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/ScheduledSmsProvisioningDtoConverter.java deleted file mode 100644 index 15e4afee5..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/ScheduledSmsProvisioningDtoConverter.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters.converters; - -import com.sinch.sdk.domains.common.adapters.converters.EnumDynamicConverter; -import com.sinch.sdk.domains.numbers.models.ProvisioningStatus; -import com.sinch.sdk.domains.numbers.models.ScheduledSmsProvisioning; -import com.sinch.sdk.domains.numbers.models.SmsErrorCode; -import java.util.stream.Collectors; - -public class ScheduledSmsProvisioningDtoConverter { - - public static ScheduledSmsProvisioning convert( - com.sinch.sdk.domains.numbers.models.v1.ScheduledSmsProvisioning dto) { - - if (null == dto) { - return null; - } - return new ScheduledSmsProvisioning( - dto.getServicePlanId(), - dto.getCampaignId(), - null == dto.getStatus() ? null : ProvisioningStatus.from(dto.getStatus().value()), - dto.getLastUpdatedTime(), - dto.getErrorCodes().stream() - .map(e -> SmsErrorCode.from(e.value())) - .collect(Collectors.toList())); - } - - public static com.sinch.sdk.domains.numbers.models.v1.ScheduledSmsProvisioning convert( - ScheduledSmsProvisioning provisioning) { - - if (null == provisioning) { - return null; - } - - com.sinch.sdk.domains.numbers.models.v1.ScheduledSmsProvisioning.Builder builder = - com.sinch.sdk.domains.numbers.models.v1.ScheduledSmsProvisioning.builder(); - - if (null != provisioning.getServicePlanId()) { - builder.setServicePlanId(provisioning.getServicePlanId()); - } - if (null != provisioning.getCampaignId()) { - builder.setCampaignId(provisioning.getCampaignId()); - } - if (null != provisioning.getLastUpdatedTime()) { - builder.setLastUpdatedTime(provisioning.getLastUpdatedTime()); - } - if (null != provisioning.getErrorCodes()) { - builder.setErrorCodes( - provisioning.getErrorCodes().stream() - .map( - e -> - com.sinch.sdk.domains.numbers.models.v1.SmsErrorCode.from( - EnumDynamicConverter.convert(e))) - .collect(Collectors.toList())); - } - return builder.build(); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/ScheduledVoiceProvisioningDtoConverter.java b/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/ScheduledVoiceProvisioningDtoConverter.java deleted file mode 100644 index 60d2a0057..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/ScheduledVoiceProvisioningDtoConverter.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters.converters; - -import com.sinch.sdk.domains.common.adapters.converters.EnumDynamicConverter; -import com.sinch.sdk.domains.numbers.models.ProvisioningStatus; -import com.sinch.sdk.domains.numbers.models.ScheduledVoiceProvisioning; -import com.sinch.sdk.domains.numbers.models.v1.ScheduledVoiceProvisioningRTC; - -public class ScheduledVoiceProvisioningDtoConverter { - - public static ScheduledVoiceProvisioning convert( - com.sinch.sdk.domains.numbers.models.v1.ScheduledVoiceProvisioning _dto) { - - if (null == _dto) { - return null; - } - - if (!(_dto instanceof ScheduledVoiceProvisioningRTC)) { - return null; - } - - ScheduledVoiceProvisioningRTC dto = (ScheduledVoiceProvisioningRTC) _dto; - return new ScheduledVoiceProvisioning( - dto.getAppId(), - null == dto.getStatus() ? null : ProvisioningStatus.from(dto.getStatus().value()), - dto.getLastUpdatedTime()); - } - - public static com.sinch.sdk.domains.numbers.models.v1.ScheduledVoiceProvisioning convert( - ScheduledVoiceProvisioning provisioning) { - - if (null == provisioning) { - return null; - } - - com.sinch.sdk.domains.numbers.models.v1.ScheduledVoiceProvisioningRTC.Builder dto = - com.sinch.sdk.domains.numbers.models.v1.ScheduledVoiceProvisioningRTC.builder(); - - dto.setAppId(provisioning.getAppId()); - dto.setLastUpdatedTime(provisioning.getLastUpdatedTime()); - if (null != provisioning.getStatus()) { - dto.setStatus( - com.sinch.sdk.domains.numbers.models.v1.ProvisioningStatus.from( - EnumDynamicConverter.convert(provisioning.getStatus()))); - } - return dto.build(); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/SmsConfigurationDtoConverter.java b/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/SmsConfigurationDtoConverter.java deleted file mode 100644 index e3aad58a8..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/SmsConfigurationDtoConverter.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters.converters; - -import com.sinch.sdk.domains.numbers.models.SMSConfiguration; -import com.sinch.sdk.domains.numbers.models.requests.ActiveNumberUpdateSMSConfigurationRequestParameters; -import com.sinch.sdk.domains.numbers.models.v1.SmsConfiguration; - -public class SmsConfigurationDtoConverter { - - public static SMSConfiguration convert( - com.sinch.sdk.domains.numbers.models.v1.SmsConfiguration dto) { - - if (null == dto) { - return null; - } - return new SMSConfiguration( - dto.getServicePlanId(), - dto.getCampaignId(), - ScheduledSmsProvisioningDtoConverter.convert(dto.getScheduledProvisioning())); - } - - public static com.sinch.sdk.domains.numbers.models.v1.SmsConfiguration convert( - ActiveNumberUpdateSMSConfigurationRequestParameters configuration) { - - if (null == configuration) { - return null; - } - SmsConfiguration.Builder dto = SmsConfiguration.builder(); - configuration.getServicePlanId().ifPresent(dto::setServicePlanId); - configuration.getCampaignId().ifPresent(dto::setCampaignId); - return dto.build(); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/VoiceConfigurationDtoConverter.java b/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/VoiceConfigurationDtoConverter.java deleted file mode 100644 index 64ae116de..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/adapters/converters/VoiceConfigurationDtoConverter.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters.converters; - -import com.sinch.sdk.domains.numbers.models.VoiceConfiguration; -import com.sinch.sdk.domains.numbers.models.requests.ActiveNumberUpdateVoiceConfigurationRequestParameters; -import com.sinch.sdk.domains.numbers.models.v1.VoiceConfigurationRTC; - -public class VoiceConfigurationDtoConverter { - - public static VoiceConfiguration convert( - com.sinch.sdk.domains.numbers.models.v1.VoiceConfiguration _dto) { - - if (null == _dto) { - return null; - } - if (!(_dto instanceof VoiceConfigurationRTC)) { - return null; - } - - com.sinch.sdk.domains.numbers.models.v1.VoiceConfigurationRTC dto = - (com.sinch.sdk.domains.numbers.models.v1.VoiceConfigurationRTC) _dto; - return new VoiceConfiguration( - dto.getAppId(), - dto.getLastUpdatedTime(), - ScheduledVoiceProvisioningDtoConverter.convert(dto.getScheduledProvisioning())); - } - - public static com.sinch.sdk.domains.numbers.models.v1.VoiceConfigurationRTC convert( - ActiveNumberUpdateVoiceConfigurationRequestParameters configuration) { - - if (null == configuration) { - return null; - } - - com.sinch.sdk.domains.numbers.models.v1.VoiceConfigurationRTC.Builder dto = - com.sinch.sdk.domains.numbers.models.v1.VoiceConfigurationRTC.builder(); - configuration.getAppId().ifPresent(dto::setAppId); - return dto.build(); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/api/v1/AvailableRegionService.java b/client/src/main/com/sinch/sdk/domains/numbers/api/v1/AvailableRegionService.java deleted file mode 100644 index b6b677b01..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/api/v1/AvailableRegionService.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.sinch.sdk.domains.numbers.api.v1; - -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.domains.numbers.models.v1.regions.available.request.AvailableRegionListRequest; -import com.sinch.sdk.domains.numbers.models.v1.regions.available.response.AvailableRegionListResponse; -import com.sinch.sdk.domains.numbers.models.v1.regions.request.AvailableRegionsListQueryParameters; - -/** - * Available Region Service - * - * @see online - * documentation - * @since 1.2 - * @deprecated As of release 2.0, replaced by {@link AvailableRegionsService} - */ -@Deprecated -public interface AvailableRegionService { - - /** - * List available regions - * - * @param parameters Filtering criteria - * @return List of available regions according to search criteria - * @since 1.2 - * @deprecated As of release 2.0, replaced by {@link - * AvailableRegionsService#list(AvailableRegionsListQueryParameters)} - */ - @Deprecated - AvailableRegionListResponse list(AvailableRegionListRequest parameters) throws ApiException; -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/api/v1/NumbersService.java b/client/src/main/com/sinch/sdk/domains/numbers/api/v1/NumbersService.java index 42afd1d2c..908abf1d9 100644 --- a/client/src/main/com/sinch/sdk/domains/numbers/api/v1/NumbersService.java +++ b/client/src/main/com/sinch/sdk/domains/numbers/api/v1/NumbersService.java @@ -2,13 +2,7 @@ import com.sinch.sdk.core.exceptions.ApiException; import com.sinch.sdk.domains.numbers.models.v1.ActiveNumber; -import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumberListRequest; -import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumbersListQueryParameters; -import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberListRequest; import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentRequest; -import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumbersListQueryParameters; -import com.sinch.sdk.domains.numbers.models.v1.response.ActiveNumberListResponse; -import com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumberListResponse; /** * Numbers Service @@ -19,25 +13,6 @@ */ public interface NumbersService extends ActiveNumberService, AvailableNumberService { - /** - * Search for available phone numbers - * - *

Search for available phone numbers that are available for you to activate. You can filter by - * any property on the available number resource. - * - *

When searching, indicate the capability of the number in the array as SMS and/or VOICE. To - * search for a number capable of both, list both SMS and VOICE. - * - * @param parameters Filtering criteria - * @return List of available numbers according to search criteria - * @since 1.2 - * @deprecated As of release 2.0, replaced by {@link - * AvailableNumberService#searchForAvailableNumbers(AvailableNumbersListQueryParameters)} - */ - @Deprecated - AvailableNumberListResponse searchForAvailableNumbers(AvailableNumberListRequest parameters) - throws ApiException; - /** * Activate a new phone number * @@ -47,18 +22,6 @@ AvailableNumberListResponse searchForAvailableNumbers(AvailableNumberListRequest */ ActiveNumber rent(String phoneNumber) throws ApiException; - /** - * Lists active numbers for a project - * - * @param parameters Filtering criteria - * @return List of active numbers - * @since 1.2 - * @deprecated As of release 2.0, replaced by {@link - * ActiveNumberService#list(ActiveNumbersListQueryParameters)} - */ - @Deprecated - ActiveNumberListResponse list(ActiveNumberListRequest parameters) throws ApiException; - /** * Available Region Service instance * diff --git a/client/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/NumbersService.java b/client/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/NumbersService.java index cfc48b2f8..f530cee27 100644 --- a/client/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/NumbersService.java +++ b/client/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/NumbersService.java @@ -11,10 +11,8 @@ import com.sinch.sdk.domains.numbers.api.v1.CallbackConfigurationService; import com.sinch.sdk.domains.numbers.models.v1.ActiveNumber; import com.sinch.sdk.domains.numbers.models.v1.EmergencyAddress; -import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumberListRequest; import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumberUpdateRequest; import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumbersListQueryParameters; -import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberListRequest; import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentAnyRequest; import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentRequest; import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumbersListQueryParameters; @@ -125,12 +123,6 @@ public AvailableNumberListResponse searchForAvailableNumbers( return available().searchForAvailableNumbers(parameters); } - @Deprecated - public AvailableNumberListResponse searchForAvailableNumbers( - AvailableNumberListRequest parameters) throws ApiException { - return available().searchForAvailableNumbers(parameters); - } - public AvailableNumber checkAvailability(String phoneNumber) throws ApiException { return available().checkAvailability(phoneNumber); } @@ -148,11 +140,6 @@ public ActiveNumber rentAny(AvailableNumberRentAnyRequest parameters) throws Api return available().rentAny(parameters); } - @Deprecated - public ActiveNumberListResponse list(ActiveNumberListRequest parameters) throws ApiException { - return active().list(parameters); - } - @Override public ActiveNumberListResponse list(ActiveNumbersListQueryParameters queryParameter) throws ApiException { diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/ActiveNumber.java b/client/src/main/com/sinch/sdk/domains/numbers/models/ActiveNumber.java deleted file mode 100644 index 854c4dcdd..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/ActiveNumber.java +++ /dev/null @@ -1,288 +0,0 @@ -package com.sinch.sdk.domains.numbers.models; - -import java.time.Instant; -import java.util.Collection; - -/** - * Active Number - * - * @since 1.0 - */ -public class ActiveNumber { - private final String phoneNumber; - - private final String projectId; - - private final String displayName; - - private final String regionCode; - - private final NumberType type; - - private final Collection capability; - - private final Money money; - - private final Integer paymentIntervalMonths; - - private final Instant nextChargeDate; - - private final Instant expireAt; - - private final SMSConfiguration smsConfiguration; - - private final VoiceConfiguration voiceConfiguration; - - private final String callbackUrl; - - /** - * @param phoneNumber The phone number in E.164 format with leading +. Example: +12025550134. - * @param projectId Project ID. Your project ID can be found on your Sinch Customer Dashboard. - * @param displayName User supplied name for the phone number. - * @param regionCode ISO 3166-1 alpha-2 country code of the phone number. Example US, UK or SE. - * @param type The number type. - * @param capability The capability of the number - * @param money An object giving details on currency code and the amount charged. - * @param paymentIntervalMonths How often the recurring price is charged in months. - * @param nextChargeDate The date of the next charge - * @param expireAt The timestamp when the subscription will expire if an expiration date has been - * set. - * @param smsConfiguration The current SMS configuration for this number. - * @param voiceConfiguration The current voice configuration for this number. - * @param callbackUrl The callback URL to be called for a rented number's provisioning / - * deprovisioning operations. - */ - public ActiveNumber( - String phoneNumber, - String projectId, - String displayName, - String regionCode, - NumberType type, - Collection capability, - Money money, - Integer paymentIntervalMonths, - Instant nextChargeDate, - Instant expireAt, - SMSConfiguration smsConfiguration, - VoiceConfiguration voiceConfiguration, - String callbackUrl) { - this.phoneNumber = phoneNumber; - this.projectId = projectId; - this.displayName = displayName; - this.regionCode = regionCode; - this.type = type; - this.capability = capability; - this.money = money; - this.paymentIntervalMonths = paymentIntervalMonths; - this.nextChargeDate = nextChargeDate; - this.expireAt = expireAt; - this.smsConfiguration = smsConfiguration; - this.voiceConfiguration = voiceConfiguration; - this.callbackUrl = callbackUrl; - } - - public String getPhoneNumber() { - return phoneNumber; - } - - public String getProjectId() { - return projectId; - } - - public String getDisplayName() { - return displayName; - } - - public String getRegionCode() { - return regionCode; - } - - public NumberType getType() { - return type; - } - - public Collection getCapability() { - return capability; - } - - public Money getMoney() { - return money; - } - - public Integer getPaymentIntervalMonths() { - return paymentIntervalMonths; - } - - public Instant getNextChargeDate() { - return nextChargeDate; - } - - public Instant getExpireAt() { - return expireAt; - } - - public SMSConfiguration getSmsConfiguration() { - return smsConfiguration; - } - - public VoiceConfiguration getVoiceConfiguration() { - return voiceConfiguration; - } - - public String getCallbackUrl() { - return callbackUrl; - } - - public static Builder builder() { - return new Builder(); - } - - @Override - public String toString() { - return "ActiveNumber{" - + "phoneNumber='" - + phoneNumber - + '\'' - + ", projectId='" - + projectId - + '\'' - + ", displayName='" - + displayName - + '\'' - + ", regionCode='" - + regionCode - + '\'' - + ", type=" - + type - + ", capability=" - + capability - + ", money=" - + money - + ", paymentIntervalMonths=" - + paymentIntervalMonths - + ", nextChargeDate=" - + nextChargeDate - + ", expireAt=" - + expireAt - + ", smsConfiguration=" - + smsConfiguration - + ", voiceConfiguration=" - + voiceConfiguration - + ", callbackUrl='" - + callbackUrl - + '\'' - + '}'; - } - - public static class Builder { - private String phoneNumber; - - private String projectId; - - private String displayName; - - private String regionCode; - - private NumberType type; - - private Collection capability; - - private Money money; - - private Integer paymentIntervalMonths; - - private Instant nextChargeDate; - - private Instant expireAt; - - private SMSConfiguration smsConfiguration; - - private VoiceConfiguration voiceConfiguration; - - private String callbackUrl; - - private Builder() {} - - public ActiveNumber build() { - return new ActiveNumber( - phoneNumber, - projectId, - displayName, - regionCode, - type, - capability, - money, - paymentIntervalMonths, - nextChargeDate, - expireAt, - smsConfiguration, - voiceConfiguration, - callbackUrl); - } - - public Builder setPhoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - return this; - } - - public Builder setProjectId(String projectId) { - this.projectId = projectId; - return this; - } - - public Builder setDisplayName(String displayName) { - this.displayName = displayName; - return this; - } - - public Builder setRegionCode(String regionCode) { - this.regionCode = regionCode; - return this; - } - - public Builder setType(NumberType type) { - this.type = type; - return this; - } - - public Builder setCapability(Collection capability) { - this.capability = capability; - return this; - } - - public Builder setMoney(Money money) { - this.money = money; - return this; - } - - public Builder setPaymentIntervalMonths(Integer paymentIntervalMonths) { - this.paymentIntervalMonths = paymentIntervalMonths; - return this; - } - - public Builder setNextChargeDate(Instant nextChargeDate) { - this.nextChargeDate = nextChargeDate; - return this; - } - - public Builder setExpireAt(Instant expireAt) { - this.expireAt = expireAt; - return this; - } - - public Builder setSmsConfiguration(SMSConfiguration smsConfiguration) { - this.smsConfiguration = smsConfiguration; - return this; - } - - public Builder setVoiceConfiguration(VoiceConfiguration voiceConfiguration) { - this.voiceConfiguration = voiceConfiguration; - return this; - } - - public Builder setCallbackUrl(String callbackUrl) { - this.callbackUrl = callbackUrl; - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/AvailableNumber.java b/client/src/main/com/sinch/sdk/domains/numbers/models/AvailableNumber.java deleted file mode 100644 index 77f929409..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/AvailableNumber.java +++ /dev/null @@ -1,189 +0,0 @@ -package com.sinch.sdk.domains.numbers.models; - -import java.util.Collection; - -/** - * Active Number - * - * @since 1.0 - */ -public class AvailableNumber { - private final String phoneNumber; - - private final String regionCode; - - private final NumberType type; - - private final Collection capability; - - private final Money setupPrice; - - private final Money monthlyPrice; - - private final Integer paymentIntervalMonths; - - private final Boolean supportingDocumentationRequired; - - /** - * @param phoneNumber The phone number in E.164 format with leading +. Example +12025550134. - * @param regionCode ISO 3166-1 alpha-2 country code of the phone number. Example: US, UK or SE. - * @param type The number type. - * @param capability The capability of the number. - * @param setupPrice An object giving details on currency code and the amount charged. - * @param monthlyPrice An object giving details on currency code and the amount charged. - * @param paymentIntervalMonths How often the recurring price is charged in months. - * @param supportingDocumentationRequired Whether or not supplementary documentation will be - * required to complete the number rental. - */ - public AvailableNumber( - String phoneNumber, - String regionCode, - NumberType type, - Collection capability, - Money setupPrice, - Money monthlyPrice, - Integer paymentIntervalMonths, - Boolean supportingDocumentationRequired) { - this.phoneNumber = phoneNumber; - this.regionCode = regionCode; - this.type = type; - this.capability = capability; - this.setupPrice = setupPrice; - this.monthlyPrice = monthlyPrice; - this.paymentIntervalMonths = paymentIntervalMonths; - this.supportingDocumentationRequired = supportingDocumentationRequired; - } - - public String getPhoneNumber() { - return phoneNumber; - } - - public String getRegionCode() { - return regionCode; - } - - public NumberType getType() { - return type; - } - - public Collection getCapability() { - return capability; - } - - public Money getSetupPrice() { - return setupPrice; - } - - public Money getMonthlyPrice() { - return monthlyPrice; - } - - public Integer getPaymentIntervalMonths() { - return paymentIntervalMonths; - } - - public Boolean getSupportingDocumentationRequired() { - return supportingDocumentationRequired; - } - - public static Builder builder() { - return new Builder(); - } - - @Override - public String toString() { - return "AvailableNumber{" - + "phoneNumber='" - + phoneNumber - + '\'' - + ", regionCode='" - + regionCode - + '\'' - + ", type='" - + type - + '\'' - + ", capability=" - + capability - + ", setupPrice=" - + setupPrice - + ", monthlyPrice=" - + monthlyPrice - + ", paymentIntervalMonths=" - + paymentIntervalMonths - + ", supportingDocumentationRequired=" - + supportingDocumentationRequired - + '}'; - } - - public static class Builder { - private String phoneNumber; - - private String regionCode; - - private NumberType type; - - private Collection capability; - - private Money setupPrice; - - private Money monthlyPrice; - - private Integer paymentIntervalMonths; - - private Boolean supportingDocumentationRequired; - - private Builder() {} - - public AvailableNumber build() { - return new AvailableNumber( - phoneNumber, - regionCode, - type, - capability, - setupPrice, - monthlyPrice, - paymentIntervalMonths, - supportingDocumentationRequired); - } - - public Builder setPhoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - return this; - } - - public Builder setRegionCode(String regionCode) { - this.regionCode = regionCode; - return this; - } - - public Builder setType(NumberType type) { - this.type = type; - return this; - } - - public Builder setCapability(Collection capability) { - this.capability = capability; - return this; - } - - public Builder setSetupPrice(Money setupPrice) { - this.setupPrice = setupPrice; - return this; - } - - public Builder setMonthlyPrice(Money monthlyPrice) { - this.monthlyPrice = monthlyPrice; - return this; - } - - public Builder setPaymentIntervalMonths(Integer paymentIntervalMonths) { - this.paymentIntervalMonths = paymentIntervalMonths; - return this; - } - - public Builder setSupportingDocumentationRequired(Boolean supportingDocumentationRequired) { - this.supportingDocumentationRequired = supportingDocumentationRequired; - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/CallbackConfiguration.java b/client/src/main/com/sinch/sdk/domains/numbers/models/CallbackConfiguration.java deleted file mode 100644 index f24915c25..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/CallbackConfiguration.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.sinch.sdk.domains.numbers.models; - -/** - * Callback configuration - * - * @since 1.0 - */ -public class CallbackConfiguration { - private final String projectId; - - private final String hmacSecret; - - /** - * @param projectId ID of the project the configuration belongs to. - * @param hmacSecret The HMAC secret used for creating the callbacks X-Sinch-Signature header. - */ - public CallbackConfiguration(String projectId, String hmacSecret) { - this.projectId = projectId; - this.hmacSecret = hmacSecret; - } - - public String getProjectId() { - return projectId; - } - - public String getHMACSecret() { - return hmacSecret; - } - - @Override - public String toString() { - // do not output secret ! - return "CallbackConfiguration{" - + "projectId='" - + projectId - + '\'' - + ", hmacSecret='" - + "..." - + '\'' - + '}'; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - private String projectId; - - private String hmacSecret; - - private Builder() {} - - public CallbackConfiguration build() { - return new CallbackConfiguration(projectId, hmacSecret); - } - - public Builder setProjectId(String projectId) { - this.projectId = projectId; - return this; - } - - public Builder setHMACSecret(String hmacSecret) { - this.hmacSecret = hmacSecret; - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/Capability.java b/client/src/main/com/sinch/sdk/domains/numbers/models/Capability.java deleted file mode 100644 index 801d31379..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/Capability.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.sinch.sdk.domains.numbers.models; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -/** - * Capability of a phone number - * - * @since 1.0 - */ -public final class Capability extends EnumDynamic { - /** The SMS product can use the number. */ - public static final Capability SMS = new Capability("SMS"); - - /** The Voice product can use the number. */ - public static final Capability VOICE = new Capability("VOICE"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>(Capability.class, Capability::new, Arrays.asList(SMS, VOICE)); - - private Capability(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static Capability from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(Capability e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/Money.java b/client/src/main/com/sinch/sdk/domains/numbers/models/Money.java deleted file mode 100644 index 83e5da434..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/Money.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.sinch.sdk.domains.numbers.models; - -/** - * An object giving details on currency code and the amount charged. - * - * @since 1.0 - */ -public class Money { - private final String currencyCode; - - private final Double amount; - - /** - * @param currencyCode The 3-letter currency code defined in ISO 4217. - * @param amount The amount. There are no guarantees on the precision unless documented by the - * message origin. The amount cannot be updated and is read-only. - */ - public Money(String currencyCode, Double amount) { - this.currencyCode = currencyCode; - this.amount = amount; - } - - public String getCurrencyCode() { - return currencyCode; - } - - public Double getAmount() { - return amount; - } - - public static Builder builder() { - return new Builder(); - } - - @Override - public String toString() { - return "Money{" + "currencyCode='" + currencyCode + '\'' + ", amount='" + amount + '\'' + '}'; - } - - public static class Builder { - private String currencyCode; - - private Double amount; - - private Builder() {} - - public Builder setCurrencyCode(String value) { - this.currencyCode = value; - return this; - } - - public Builder setAmount(Double value) { - this.amount = value; - return this; - } - - public Money build() { - return new Money(this.currencyCode, this.amount); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/NumberPattern.java b/client/src/main/com/sinch/sdk/domains/numbers/models/NumberPattern.java deleted file mode 100644 index 4d589a2ec..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/NumberPattern.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.sinch.sdk.domains.numbers.models; - -/** - * An object enabling to identify number by pattern - * - * @since 1.0 - */ -public class NumberPattern { - - private final String pattern; - private final SearchPattern searchPattern; - - /** - * @param pattern Sequence of digits to search for. - * @param searchPattern The pattern to apply to searches - */ - public NumberPattern(String pattern, SearchPattern searchPattern) { - this.pattern = pattern; - this.searchPattern = searchPattern; - } - - public String getPattern() { - return pattern; - } - - public SearchPattern getSearchPattern() { - return searchPattern; - } - - public static Builder builder() { - return new Builder(); - } - - @Override - public String toString() { - return "NumberPattern{" - + "pattern='" - + pattern - + '\'' - + ", searchPattern='" - + searchPattern - + '\'' - + '}'; - } - - public static class Builder { - private String pattern; - - private SearchPattern searchPattern; - - private Builder() {} - - public Builder setPattern(String value) { - this.pattern = value; - return this; - } - - public Builder setSearchPattern(SearchPattern value) { - this.searchPattern = value; - return this; - } - - public NumberPattern build() { - return new NumberPattern(this.pattern, this.searchPattern); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/NumberType.java b/client/src/main/com/sinch/sdk/domains/numbers/models/NumberType.java deleted file mode 100644 index 0b354cfbd..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/NumberType.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.sinch.sdk.domains.numbers.models; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -/** - * Type of phone number - * - * @since 1.0 - */ -public final class NumberType extends EnumDynamic { - - /** Numbers that belong to a specific range. */ - public static final NumberType MOBILE = new NumberType("MOBILE"); - - /** Numbers that are assigned to a specific geographic region. */ - public static final NumberType LOCAL = new NumberType("LOCAL"); - - /** Numbers that are free of charge for the calling party but billed for all arriving calls. */ - public static final NumberType TOLL_FREE = new NumberType("TOLL_FREE"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - NumberType.class, NumberType::new, Arrays.asList(MOBILE, LOCAL, TOLL_FREE)); - - private NumberType(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static NumberType from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(NumberType e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/OrderBy.java b/client/src/main/com/sinch/sdk/domains/numbers/models/OrderBy.java deleted file mode 100644 index 056274e14..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/OrderBy.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.sinch.sdk.domains.numbers.models; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -/** - * Supported fields for ordering - * - * @since 1.0 - */ -public final class OrderBy extends EnumDynamic { - /** Ordering by phoneNumber */ - public static final OrderBy PHONE_NUMBER = new OrderBy("phoneNumber"); - - /** Ordering by displayName */ - public static final OrderBy DISPLAY_NAME = new OrderBy("displayName"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - OrderBy.class, OrderBy::new, Arrays.asList(PHONE_NUMBER, DISPLAY_NAME)); - - private OrderBy(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static OrderBy from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(OrderBy e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/ProvisioningStatus.java b/client/src/main/com/sinch/sdk/domains/numbers/models/ProvisioningStatus.java deleted file mode 100644 index 4bd5e95b6..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/ProvisioningStatus.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.sinch.sdk.domains.numbers.models; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -/** - * Provisioning Status - * - * @see https://developers.sinch.com/docs/numbers/api-reference/error-codes/provisioning-errors/ - * @since 1.0 - */ -public final class ProvisioningStatus extends EnumDynamic { - - public static final ProvisioningStatus PROVISIONING_STATUS_UNSPECIFIED = - new ProvisioningStatus("PROVISIONING_STATUS_UNSPECIFIED"); - public static final ProvisioningStatus WAITING = new ProvisioningStatus("WAITING"); - public static final ProvisioningStatus IN_PROGRESS = new ProvisioningStatus("IN_PROGRESS"); - public static final ProvisioningStatus FAILED = new ProvisioningStatus("FAILED"); - public static final ProvisioningStatus UNKNOWN_DEFAULT_OPEN_API = - new ProvisioningStatus("UNKNOWN_DEFAULT_OPEN_API"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - ProvisioningStatus.class, - ProvisioningStatus::new, - Arrays.asList( - PROVISIONING_STATUS_UNSPECIFIED, - WAITING, - IN_PROGRESS, - FAILED, - UNKNOWN_DEFAULT_OPEN_API)); - - ProvisioningStatus(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static ProvisioningStatus from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(ProvisioningStatus e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/Region.java b/client/src/main/com/sinch/sdk/domains/numbers/models/Region.java deleted file mode 100644 index dba8f7ca3..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/Region.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.sinch.sdk.domains.numbers.models; - -import java.util.Collection; - -/** - * Region information related to assigned numbers - * - * @since 1.0 - */ -public class Region { - private final String regionCode; - - private final String regionName; - - private final Collection types; - - /** - * @param regionCode ISO 3166-1 alpha-2 region code. Examples: US, UK or SE. - * @param regionName Display name of the region. Examples: United States, United Kingdom or - * Sweden. - * @param types A list of the different number types available. - */ - public Region(String regionCode, String regionName, Collection types) { - this.regionCode = regionCode; - this.regionName = regionName; - this.types = types; - } - - public String getRegionCode() { - return regionCode; - } - - public String getRegionName() { - return regionName; - } - - public Collection getTypes() { - return types; - } - - @Override - public String toString() { - return "AvailableRegion{" - + "regionCode='" - + regionCode - + '\'' - + ", regionName='" - + regionName - + '\'' - + ", types=" - + types - + '}'; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - private String regionCode; - - private String regionName; - - private Collection types; - - private Builder() {} - - public Region build() { - return new Region(regionCode, regionName, types); - } - - public Builder setRegionCode(String regionCode) { - this.regionCode = regionCode; - return this; - } - - public Builder setRegionName(String regionName) { - this.regionName = regionName; - return this; - } - - public Builder setTypes(Collection types) { - this.types = types; - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/SMSConfiguration.java b/client/src/main/com/sinch/sdk/domains/numbers/models/SMSConfiguration.java deleted file mode 100644 index 678d92c7b..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/SMSConfiguration.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.sinch.sdk.domains.numbers.models; - -import java.util.Optional; - -/** The SMS configuration for a number */ -public class SMSConfiguration { - private final String servicePlanId; - - private final String campaignId; - - private final ScheduledSmsProvisioning scheduledSmsProvisioning; - - /** - * @param servicePlanId The servicePlanId can be found in the Sinch Customer Dashboard. The - * service plan ID is what ties this to the configured SMS service. - * @param campaignId Only for US phone numbers. This campaignId is required to send SMS traffic to - * US; click here to read more about 10DLC A2P messaging. So, it is the current campaign ID - * for this number. The campaignId is found on your TCR platform. - * @param scheduledSmsProvisioning This object is temporary and will appear while the scheduled - * provisioning for SMS is processing. Once it has successfully processed, only the ID of the - * SMS configuration will display. - */ - public SMSConfiguration( - String servicePlanId, String campaignId, ScheduledSmsProvisioning scheduledSmsProvisioning) { - this.servicePlanId = servicePlanId; - this.campaignId = campaignId; - this.scheduledSmsProvisioning = scheduledSmsProvisioning; - } - - public String getServicePlanId() { - return servicePlanId; - } - - public Optional getCampaignId() { - return Optional.ofNullable(campaignId); - } - - public Optional getScheduledSmsProvisioning() { - return Optional.ofNullable(scheduledSmsProvisioning); - } - - @Override - public String toString() { - return "SMSConfiguration{" - + "servicePlanId='" - + servicePlanId - + '\'' - + ", campaignId='" - + campaignId - + '\'' - + ", scheduledSmsProvisioning=" - + scheduledSmsProvisioning - + '}'; - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/ScheduledSmsProvisioning.java b/client/src/main/com/sinch/sdk/domains/numbers/models/ScheduledSmsProvisioning.java deleted file mode 100644 index 33f57ca07..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/ScheduledSmsProvisioning.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.sinch.sdk.domains.numbers.models; - -import java.time.Instant; -import java.util.Collection; - -/** - * Scheduled SMS provisioning information - * - *

This object is temporary and will appear while the scheduled provisioning for SMS is - * processing. Once it has successfully processed, only the ID of the SMS configuration will - * display. - */ -public class ScheduledSmsProvisioning { - private final String servicePlanId; - - private final String campaignId; - - private final ProvisioningStatus status; - - private final Instant lastUpdatedTime; - - private final Collection errorCodes; - - /** - * @param servicePlanId Service plan of the scheduled provisioning task. - * @param campaignId Campaign ID of the scheduled provisioning task. Note that the campaign ID is - * only for US numbers as it relates to 10DLC. - * @param status The provisioning status - * @param lastUpdatedTime when the status was last updated - * @param errorCodes The provisioning error codes - */ - public ScheduledSmsProvisioning( - String servicePlanId, - String campaignId, - ProvisioningStatus status, - Instant lastUpdatedTime, - Collection errorCodes) { - this.servicePlanId = servicePlanId; - this.campaignId = campaignId; - this.status = status; - this.lastUpdatedTime = lastUpdatedTime; - this.errorCodes = errorCodes; - } - - public String getServicePlanId() { - return servicePlanId; - } - - public String getCampaignId() { - return campaignId; - } - - public ProvisioningStatus getStatus() { - return status; - } - - public Instant getLastUpdatedTime() { - return lastUpdatedTime; - } - - public Collection getErrorCodes() { - return errorCodes; - } - - @Override - public String toString() { - return "ScheduledSmsProvisioning{" - + "servicePlanId='" - + servicePlanId - + '\'' - + ", campaignId='" - + campaignId - + '\'' - + ", status=" - + status - + ", lastUpdatedTime=" - + lastUpdatedTime - + ", errorCodes=" - + errorCodes - + '}'; - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/ScheduledVoiceProvisioning.java b/client/src/main/com/sinch/sdk/domains/numbers/models/ScheduledVoiceProvisioning.java deleted file mode 100644 index 9f38c6044..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/ScheduledVoiceProvisioning.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.sinch.sdk.domains.numbers.models; - -import java.time.Instant; - -/** - * Scheduled Voice provisioning information - * - *

This object is temporary and will appear while the scheduled voice provisioning is processing. - * Once it has successfully processed, only the ID of the Voice configuration will display. - */ -public class ScheduledVoiceProvisioning { - - private final String appId; - - private final ProvisioningStatus status; - - private final Instant lastUpdatedTime; - - /** - * @param appId RTC application ID of the scheduled provisioning task. - * @param status The provisioning status - * @param lastUpdatedTime when the status was last updated - */ - public ScheduledVoiceProvisioning( - String appId, ProvisioningStatus status, Instant lastUpdatedTime) { - this.appId = appId; - this.status = status; - this.lastUpdatedTime = lastUpdatedTime; - } - - public String getAppId() { - return appId; - } - - public ProvisioningStatus getStatus() { - return status; - } - - public Instant getLastUpdatedTime() { - return lastUpdatedTime; - } - - @Override - public String toString() { - return "ScheduledVoiceProvisioning{" - + "appId='" - + appId - + '\'' - + ", status=" - + status - + ", lastUpdatedTime=" - + lastUpdatedTime - + '}'; - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/SearchPattern.java b/client/src/main/com/sinch/sdk/domains/numbers/models/SearchPattern.java deleted file mode 100644 index 36f232933..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/SearchPattern.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.sinch.sdk.domains.numbers.models; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; - -/** - * Search pattern for numbers - * - * @since 1.0 - */ -public final class SearchPattern extends EnumDynamic { - /** - * Numbers that begin with the @see NumberPattern.getPattern entered. - * - *

Often used to search for a specific area code. When using START, a plus sign (+) must be - * included and URL encoded, so %2B. - * - *

For example, to search for area code 206 in the US, you would enter, %2b1206 - */ - public static final SearchPattern START = new SearchPattern("START"); - - /** - * The number pattern entered is contained somewhere in the number, the location being undefined. - */ - public static final SearchPattern CONTAINS = new SearchPattern("CONTAINS"); - - /** The number ends with the number pattern entered. */ - public static final SearchPattern END = new SearchPattern("END"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - SearchPattern.class, SearchPattern::new, Arrays.asList(START, CONTAINS, END)); - - private SearchPattern(String value) { - super(value); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/SmsErrorCode.java b/client/src/main/com/sinch/sdk/domains/numbers/models/SmsErrorCode.java deleted file mode 100644 index 6b84e001b..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/SmsErrorCode.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.sinch.sdk.domains.numbers.models; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -/** - * Errors used in SMS Scheduled Provisioning configuration by the Numbers API - * - * @see https://developers.sinch.com/docs/numbers/api-reference/error-codes/provisioning-errors/ - * @since 1.0 - */ -public final class SmsErrorCode extends EnumDynamic { - public static final SmsErrorCode ERROR_CODE_UNSPECIFIED = - new SmsErrorCode("ERROR_CODE_UNSPECIFIED"); - public static final SmsErrorCode INTERNAL_ERROR = new SmsErrorCode("INTERNAL_ERROR"); - public static final SmsErrorCode SMS_PROVISIONING_FAILED = - new SmsErrorCode("SMS_PROVISIONING_FAILED"); - public static final SmsErrorCode CAMPAIGN_PROVISIONING_FAILED = - new SmsErrorCode("CAMPAIGN_PROVISIONING_FAILED"); - public static final SmsErrorCode CAMPAIGN_NOT_AVAILABLE = - new SmsErrorCode("CAMPAIGN_NOT_AVAILABLE"); - public static final SmsErrorCode EXCEEDED_10DLC_LIMIT = new SmsErrorCode("EXCEEDED_10DLC_LIMIT"); - public static final SmsErrorCode NUMBER_PROVISIONING_FAILED = - new SmsErrorCode("NUMBER_PROVISIONING_FAILED"); - public static final SmsErrorCode PARTNER_SERVICE_UNAVAILABLE = - new SmsErrorCode("PARTNER_SERVICE_UNAVAILABLE"); - public static final SmsErrorCode CAMPAIGN_PENDING_ACCEPTANCE = - new SmsErrorCode("CAMPAIGN_PENDING_ACCEPTANCE"); - public static final SmsErrorCode MNO_SHARING_ERROR = new SmsErrorCode("MNO_SHARING_ERROR"); - public static final SmsErrorCode CAMPAIGN_EXPIRED = new SmsErrorCode("CAMPAIGN_EXPIRED"); - public static final SmsErrorCode CAMPAIGN_MNO_REJECTED = - new SmsErrorCode("CAMPAIGN_MNO_REJECTED"); - public static final SmsErrorCode CAMPAIGN_MNO_SUSPENDED = - new SmsErrorCode("CAMPAIGN_MNO_SUSPENDED"); - public static final SmsErrorCode CAMPAIGN_MNO_REVIEW = new SmsErrorCode("CAMPAIGN_MNO_REVIEW"); - public static final SmsErrorCode INSUFFICIENT_BALANCE = new SmsErrorCode("INSUFFICIENT_BALANCE"); - public static final SmsErrorCode MOCK_CAMPAIGN_NOT_ALLOWED = - new SmsErrorCode("MOCK_CAMPAIGN_NOT_ALLOWED"); - public static final SmsErrorCode TFN_NOT_ALLOWED = new SmsErrorCode("TFN_NOT_ALLOWED"); - public static final SmsErrorCode INVALID_NNID = new SmsErrorCode("INVALID_NNID"); - public static final SmsErrorCode UNKNOWN_DEFAULT_OPEN_API = - new SmsErrorCode("UNKNOWN_DEFAULT_OPEN_API"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - SmsErrorCode.class, - SmsErrorCode::new, - Arrays.asList( - ERROR_CODE_UNSPECIFIED, - INTERNAL_ERROR, - SMS_PROVISIONING_FAILED, - CAMPAIGN_PROVISIONING_FAILED, - CAMPAIGN_NOT_AVAILABLE, - EXCEEDED_10DLC_LIMIT, - NUMBER_PROVISIONING_FAILED, - PARTNER_SERVICE_UNAVAILABLE, - CAMPAIGN_PENDING_ACCEPTANCE, - MNO_SHARING_ERROR, - CAMPAIGN_EXPIRED, - CAMPAIGN_MNO_REJECTED, - CAMPAIGN_MNO_SUSPENDED, - CAMPAIGN_MNO_REVIEW, - INSUFFICIENT_BALANCE, - MOCK_CAMPAIGN_NOT_ALLOWED, - TFN_NOT_ALLOWED, - INVALID_NNID, - UNKNOWN_DEFAULT_OPEN_API)); - - SmsErrorCode(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static SmsErrorCode from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(SmsErrorCode e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/VoiceConfiguration.java b/client/src/main/com/sinch/sdk/domains/numbers/models/VoiceConfiguration.java deleted file mode 100644 index d596c3803..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/VoiceConfiguration.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.sinch.sdk.domains.numbers.models; - -import java.time.Instant; -import java.util.Optional; - -/** - * The voice configuration for a number - * - * @since 1.0 - */ -public class VoiceConfiguration { - private final String appId; - - private final Instant lastUpdatedTime; - - private final ScheduledVoiceProvisioning scheduledVoiceProvisioning; - - /** - * @param appId Your app ID for the Voice API. The appId can be found in your Sinch Customer - * Dashboard under Voice, then apps. - * @param lastUpdatedTime when the status was last updated - * @param scheduledVoiceProvisioning This object is temporary and will appear while the scheduled - * voice provisioning is processing. Once it has successfully processed, only the ID of the - * Voice configuration will display. - */ - public VoiceConfiguration( - String appId, - Instant lastUpdatedTime, - ScheduledVoiceProvisioning scheduledVoiceProvisioning) { - this.appId = appId; - this.lastUpdatedTime = lastUpdatedTime; - this.scheduledVoiceProvisioning = scheduledVoiceProvisioning; - } - - public String getAppId() { - return appId; - } - - public Optional getLastUpdatedTime() { - return Optional.ofNullable(lastUpdatedTime); - } - - public Optional getScheduledVoiceProvisioning() { - return Optional.ofNullable(scheduledVoiceProvisioning); - } - - @Override - public String toString() { - return "VoiceConfiguration{" - + "appId='" - + appId - + '\'' - + ", lastUpdatedTime=" - + lastUpdatedTime - + ", scheduledVoiceProvisioning=" - + scheduledVoiceProvisioning - + '}'; - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/requests/ActiveNumberListRequestParameters.java b/client/src/main/com/sinch/sdk/domains/numbers/models/requests/ActiveNumberListRequestParameters.java deleted file mode 100644 index 43f7cbed4..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/requests/ActiveNumberListRequestParameters.java +++ /dev/null @@ -1,192 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.numbers.models.Capability; -import com.sinch.sdk.domains.numbers.models.NumberPattern; -import com.sinch.sdk.domains.numbers.models.NumberType; -import com.sinch.sdk.domains.numbers.models.OrderBy; -import java.util.Collection; - -/** - * Parameters request to list active numbers for a project - * - * @see https://developers.sinch.com/docs/numbers/api-reference/numbers/tag/Active-Number/ - * @since 1.0 - */ -public class ActiveNumberListRequestParameters { - - private final OptionalValue regionCode; - private final OptionalValue type; - private final OptionalValue numberPattern; - private final OptionalValue> capabilities; - private final OptionalValue pageSize; - private final OptionalValue pageToken; - private final OptionalValue orderBy; - - private ActiveNumberListRequestParameters( - OptionalValue regionCode, - OptionalValue type, - OptionalValue numberPattern, - OptionalValue> capabilities, - OptionalValue pageSize, - OptionalValue pageToken, - OptionalValue orderBy) { - this.regionCode = regionCode; - this.type = type; - this.numberPattern = numberPattern; - this.capabilities = capabilities; - this.pageSize = pageSize; - this.pageToken = pageToken; - this.orderBy = orderBy; - } - - public OptionalValue getRegionCode() { - return regionCode; - } - - public OptionalValue getType() { - return type; - } - - public OptionalValue getNumberPattern() { - return numberPattern; - } - - public OptionalValue> getCapabilities() { - return capabilities; - } - - public OptionalValue getPageSize() { - return pageSize; - } - - public OptionalValue getPageToken() { - return pageToken; - } - - public OptionalValue getOrderBy() { - return orderBy; - } - - @Override - public String toString() { - return "ActiveNumberListRequestParameters{" - + "regionCode='" - + regionCode - + '\'' - + ", type=" - + type - + ", numberPattern=" - + numberPattern - + ", capabilities=" - + capabilities - + ", pageSize=" - + pageSize - + ", pageToken=" - + pageToken - + ", orderBy=" - + orderBy - + '}'; - } - - public static Builder builder() { - return new Builder(); - } - - public static Builder builder(ActiveNumberListRequestParameters parameters) { - return new Builder(parameters); - } - - public static class Builder { - - OptionalValue regionCode = OptionalValue.empty(); - OptionalValue type = OptionalValue.empty(); - OptionalValue numberPattern = OptionalValue.empty(); - OptionalValue> capabilities = OptionalValue.empty(); - OptionalValue pageSize = OptionalValue.empty(); - OptionalValue pageToken = OptionalValue.empty(); - OptionalValue orderBy = OptionalValue.empty(); - - private Builder() {} - - private Builder(ActiveNumberListRequestParameters parameters) { - parameters.regionCode.ifPresent(this::setRegionCode); - parameters.type.ifPresent(this::setType); - parameters.numberPattern.ifPresent(this::setNumberPattern); - parameters.capabilities.ifPresent(this::setCapabilities); - parameters.pageSize.ifPresent(this::setPageSize); - parameters.pageToken.ifPresent(this::setPageToken); - parameters.orderBy.ifPresent(this::setOrderBy); - } - - /** - * @param regionCode Region code to filter by. ISO 3166-1 alpha-2 country code of the phone - * number. Example: US, GB or SE. - * @return Current builder - */ - public Builder setRegionCode(String regionCode) { - this.regionCode = OptionalValue.of(regionCode); - return this; - } - - /** - * @param type Number type to filter by - * @return Current builder - */ - public Builder setType(NumberType type) { - this.type = OptionalValue.of(type); - return this; - } - - /** - * @param numberPattern Pattern to search for - * @return Current builder - */ - public Builder setNumberPattern(NumberPattern numberPattern) { - this.numberPattern = OptionalValue.of(numberPattern); - return this; - } - - /** - * @param capabilities Number capabilities to filter by - * @return Current builder - */ - public Builder setCapabilities(Collection capabilities) { - this.capabilities = OptionalValue.of(capabilities); - return this; - } - - /** - * @param pageSize The maximum number of items to return. - * @return Current builder - */ - public Builder setPageSize(Integer pageSize) { - this.pageSize = OptionalValue.of(pageSize); - return this; - } - - /** - * @param pageToken The next page token value returned from a previous List request, if any - * @return Current builder - */ - public Builder setPageToken(String pageToken) { - this.pageToken = OptionalValue.of(pageToken); - return this; - } - - /** - * @param orderBy Ordering results - * @return Current builder - */ - public Builder setOrderBy(OrderBy orderBy) { - this.orderBy = OptionalValue.of(orderBy); - return this; - } - - public ActiveNumberListRequestParameters build() { - return new ActiveNumberListRequestParameters( - regionCode, type, numberPattern, capabilities, pageSize, pageToken, orderBy); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/requests/ActiveNumberUpdateRequestParameters.java b/client/src/main/com/sinch/sdk/domains/numbers/models/requests/ActiveNumberUpdateRequestParameters.java deleted file mode 100644 index 8c5253a96..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/requests/ActiveNumberUpdateRequestParameters.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; - -/** - * Parameters request to update an active number for a project - * - * @see https://developers.sinch.com/docs/numbers/api-reference/numbers/tag/Active-Number/#tag/Active-Number/operation/NumberService_UpdateActiveNumber - * @since 1.0 - */ -public class ActiveNumberUpdateRequestParameters { - private final OptionalValue displayName; - private final OptionalValue smsConfiguration; - private final OptionalValue - voiceConfiguration; - private final OptionalValue callback; - - private ActiveNumberUpdateRequestParameters( - OptionalValue displayName, - OptionalValue smsConfiguration, - OptionalValue voiceConfiguration, - OptionalValue callback) { - this.displayName = displayName; - this.smsConfiguration = smsConfiguration; - this.voiceConfiguration = voiceConfiguration; - this.callback = callback; - } - - public OptionalValue getDisplayName() { - return displayName; - } - - public OptionalValue getSmsConfiguration() { - return smsConfiguration; - } - - public OptionalValue - getVoiceConfiguration() { - return voiceConfiguration; - } - - public OptionalValue getCallback() { - return callback; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - OptionalValue displayName = OptionalValue.empty(); - OptionalValue smsConfiguration = - OptionalValue.empty(); - OptionalValue voiceConfiguration = - OptionalValue.empty(); - OptionalValue callback = OptionalValue.empty(); - - private Builder() {} - - /** - * @param displayName User supplied name for the phone number - * @return current builder - */ - public Builder setDisplayName(String displayName) { - this.displayName = OptionalValue.of(displayName); - return this; - } - - /** - * @param smsConfiguration The current SMS configuration for this number - * @return current builder - */ - public Builder setSmsConfiguration( - ActiveNumberUpdateSMSConfigurationRequestParameters smsConfiguration) { - this.smsConfiguration = OptionalValue.of(smsConfiguration); - return this; - } - - /** - * @param voiceConfiguration The current voice configuration for this number - * @return current builder - */ - public Builder setVoiceConfiguration( - ActiveNumberUpdateVoiceConfigurationRequestParameters voiceConfiguration) { - this.voiceConfiguration = OptionalValue.of(voiceConfiguration); - return this; - } - - /** - * @param callback The callback URL to be called for a rented number's provisioning / - * deprovisioning operations ({@link com.sinch.sdk.domains.numbers.WebHooksService see - * WebHooksService}) - * @return current builder - */ - public Builder setCallback(String callback) { - this.callback = OptionalValue.of(callback); - return this; - } - - public ActiveNumberUpdateRequestParameters build() { - return new ActiveNumberUpdateRequestParameters( - displayName, smsConfiguration, voiceConfiguration, callback); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/requests/ActiveNumberUpdateSMSConfigurationRequestParameters.java b/client/src/main/com/sinch/sdk/domains/numbers/models/requests/ActiveNumberUpdateSMSConfigurationRequestParameters.java deleted file mode 100644 index 74e936caf..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/requests/ActiveNumberUpdateSMSConfigurationRequestParameters.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; - -/*** - * SMS configuration parameters request to update an active number for a project - * @since 1.0 - */ -public class ActiveNumberUpdateSMSConfigurationRequestParameters { - - private final OptionalValue servicePlanId; - private final OptionalValue campaignId; - - private ActiveNumberUpdateSMSConfigurationRequestParameters( - OptionalValue servicePlanId, OptionalValue campaignId) { - this.servicePlanId = servicePlanId; - this.campaignId = campaignId; - } - - public OptionalValue getServicePlanId() { - return servicePlanId; - } - - public OptionalValue getCampaignId() { - return campaignId; - } - - @Override - public String toString() { - return "ActiveNumberUpdateSMSConfigurationRequestParameters{" - + "servicePlanId='" - + servicePlanId - + '\'' - + ", campaignId=" - + campaignId - + '}'; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - OptionalValue servicePlanId = OptionalValue.empty(); - - OptionalValue campaignId = OptionalValue.empty(); - - private Builder() {} - - /** - * @param servicePlanId The servicePlanId can be found in the Sinch Customer Dashboard. The - * service plan ID is what ties this number to the configured SMS service. - * @return current builder - */ - public Builder setServicePlanId(String servicePlanId) { - this.servicePlanId = OptionalValue.of(servicePlanId); - return this; - } - - /** - * @param campaignId Only for US phone numbers. This campaignId is required to send SMS traffic - * to US; click here to read more about 10DLC A2P messaging. So, it is the current campaign - * ID for this number. The campaignId is found on your TCR platform. - * @return current builder - */ - public Builder setCampaignId(String campaignId) { - this.campaignId = OptionalValue.of(campaignId); - return this; - } - - public ActiveNumberUpdateSMSConfigurationRequestParameters build() { - return new ActiveNumberUpdateSMSConfigurationRequestParameters(servicePlanId, campaignId); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/requests/ActiveNumberUpdateVoiceConfigurationRequestParameters.java b/client/src/main/com/sinch/sdk/domains/numbers/models/requests/ActiveNumberUpdateVoiceConfigurationRequestParameters.java deleted file mode 100644 index 0c8c9fdea..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/requests/ActiveNumberUpdateVoiceConfigurationRequestParameters.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; - -/*** - * SMS configuration parameters request to update an active number for a project - * @since 1.0 - */ - -public class ActiveNumberUpdateVoiceConfigurationRequestParameters { - private final OptionalValue appId; - - private ActiveNumberUpdateVoiceConfigurationRequestParameters(OptionalValue appId) { - this.appId = appId; - } - - public OptionalValue getAppId() { - return appId; - } - - @Override - public String toString() { - return "ActiveNumberUpdateVoiceConfigurationRequestParameters{" - + "appId='" - + appId - + '\'' - + '}'; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - OptionalValue appId = OptionalValue.empty(); - - private Builder() {} - - /** - * @param appId Your app ID for the Voice API. The appId can be found in your Sinch Customer - * Dashboard under Voice, then apps. - * @return current builder - */ - public Builder setAppId(String appId) { - this.appId = OptionalValue.of(appId); - return this; - } - - public ActiveNumberUpdateVoiceConfigurationRequestParameters build() { - return new ActiveNumberUpdateVoiceConfigurationRequestParameters(appId); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/requests/AvailableNumberListAllRequestParameters.java b/client/src/main/com/sinch/sdk/domains/numbers/models/requests/AvailableNumberListAllRequestParameters.java deleted file mode 100644 index 4e00bf779..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/requests/AvailableNumberListAllRequestParameters.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.numbers.models.Capability; -import com.sinch.sdk.domains.numbers.models.NumberPattern; -import com.sinch.sdk.domains.numbers.models.NumberType; -import java.util.Collection; - -/** - * Parameters request to list available numbers for a project - * - * @see https://developers.sinch.com/docs/numbers/api-reference/numbers/tag/Available-Number/#tag/Available-Number/operation/NumberService_ListAvailableNumbers/ - * @since 1.0 - */ -public class AvailableNumberListAllRequestParameters { - private final OptionalValue regionCode; - private final OptionalValue type; - private final OptionalValue numberPattern; - private final OptionalValue> capabilities; - private final OptionalValue size; - - private AvailableNumberListAllRequestParameters( - OptionalValue regionCode, - OptionalValue type, - OptionalValue numberPattern, - OptionalValue> capabilities, - OptionalValue size) { - this.regionCode = regionCode; - this.type = type; - this.numberPattern = numberPattern; - this.capabilities = capabilities; - this.size = size; - } - - public OptionalValue getRegionCode() { - return regionCode; - } - - public OptionalValue getType() { - return type; - } - - public OptionalValue getNumberPattern() { - return numberPattern; - } - - public OptionalValue> getCapabilities() { - return capabilities; - } - - public OptionalValue getSize() { - return size; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - OptionalValue regionCode = OptionalValue.empty(); - OptionalValue type = OptionalValue.empty(); - OptionalValue numberPattern = OptionalValue.empty(); - OptionalValue> capabilities = OptionalValue.empty(); - OptionalValue size = OptionalValue.empty(); - - private Builder() {} - - /** - * @param regionCode Region code to filter by. ISO 3166-1 alpha-2 country code of the phone - * number. Example: US, GB or SE. - * @return current builder - */ - public Builder setRegionCode(String regionCode) { - this.regionCode = OptionalValue.of(regionCode); - return this; - } - - /** - * @param type Number type to filter by - * @return current builder - */ - public Builder setType(NumberType type) { - this.type = OptionalValue.of(type); - return this; - } - - /** - * @return current builder - */ - public Builder setNumberPattern(NumberPattern numberPattern) { - this.numberPattern = OptionalValue.of(numberPattern); - return this; - } - - /** - * @return current builder - */ - public Builder setCapabilities(Collection capabilities) { - this.capabilities = OptionalValue.of(capabilities); - return this; - } - - /** - * @param size Optional. The maximum number of items to return. - * @return current builder - */ - public Builder setSize(Integer size) { - this.size = OptionalValue.of(size); - return this; - } - - public AvailableNumberListAllRequestParameters build() { - return new AvailableNumberListAllRequestParameters( - regionCode, type, numberPattern, capabilities, size); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/requests/AvailableNumberRentAnyRequestParameters.java b/client/src/main/com/sinch/sdk/domains/numbers/models/requests/AvailableNumberRentAnyRequestParameters.java deleted file mode 100644 index 9a53b7e53..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/requests/AvailableNumberRentAnyRequestParameters.java +++ /dev/null @@ -1,164 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.numbers.models.Capability; -import com.sinch.sdk.domains.numbers.models.NumberPattern; -import com.sinch.sdk.domains.numbers.models.NumberType; -import java.util.Collection; - -/** - * Parameters request to rent a number using criteria - * - * @see https://developers.sinch.com/docs/numbers/api-reference/numbers/tag/Available-Number/#tag/Available-Number/operation/NumberService_ListAvailableNumbers/ - * @since 1.0 - */ -public class AvailableNumberRentAnyRequestParameters { - private final OptionalValue regionCode; - private final OptionalValue type; - private final OptionalValue numberPattern; - private final OptionalValue> capabilities; - private final OptionalValue smsConfiguration; - private final OptionalValue voiceConfiguration; - private final OptionalValue callbackUrl; - - private AvailableNumberRentAnyRequestParameters( - OptionalValue regionCode, - OptionalValue type, - OptionalValue numberPattern, - OptionalValue> capabilities, - OptionalValue smsConfiguration, - OptionalValue voiceConfiguration, - OptionalValue callbackUrl) { - this.regionCode = regionCode; - this.type = type; - this.numberPattern = numberPattern; - this.capabilities = capabilities; - this.smsConfiguration = smsConfiguration; - this.voiceConfiguration = voiceConfiguration; - this.callbackUrl = callbackUrl; - } - - public OptionalValue getRegionCode() { - return regionCode; - } - - public OptionalValue getType() { - return type; - } - - public OptionalValue getNumberPattern() { - return numberPattern; - } - - public OptionalValue> getCapabilities() { - return capabilities; - } - - public OptionalValue getSmsConfiguration() { - return smsConfiguration; - } - - public OptionalValue getVoiceConfiguration() { - return voiceConfiguration; - } - - public OptionalValue getCallBackUrl() { - return callbackUrl; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - OptionalValue regionCode = OptionalValue.empty(); - OptionalValue type = OptionalValue.empty(); - OptionalValue numberPattern = OptionalValue.empty(); - OptionalValue> capabilities = OptionalValue.empty(); - OptionalValue smsConfiguration = OptionalValue.empty(); - OptionalValue voiceConfiguration = - OptionalValue.empty(); - OptionalValue callbackUrl = OptionalValue.empty(); - - private Builder() {} - - /** - * @param regionCode Region code to filter by. ISO 3166-1 alpha-2 country code of the phone - * number. Example: US, GB or SE. - * @return current builder - */ - public Builder setRegionCode(String regionCode) { - this.regionCode = OptionalValue.of(regionCode); - return this; - } - - /** - * @param type Number type to filter by - * @return current builder - */ - public Builder setType(NumberType type) { - this.type = OptionalValue.of(type); - return this; - } - - /** - * @param numberPattern Search pattern - * @return current builder - */ - public Builder setNumberPattern(NumberPattern numberPattern) { - this.numberPattern = OptionalValue.of(numberPattern); - return this; - } - - /** - * @param capabilities Capabilities to filter by - * @return current builder - */ - public Builder setCapabilities(Collection capabilities) { - this.capabilities = OptionalValue.of(capabilities); - return this; - } - - /** - * @param smsConfiguration The current SMS configuration for this number - * @return current builder - */ - public Builder setSmsConfiguration(RentSMSConfigurationRequestParameters smsConfiguration) { - this.smsConfiguration = OptionalValue.of(smsConfiguration); - return this; - } - - /** - * @param voiceConfiguration The current voice configuration for this number - * @return current builder - */ - public Builder setVoiceConfiguration( - RentVoiceConfigurationRequestParameters voiceConfiguration) { - this.voiceConfiguration = OptionalValue.of(voiceConfiguration); - return this; - } - - /** - * @param callbackUrl The callback URL to be called for a rented number's provisioning / - * de-provisioning operations ({@link com.sinch.sdk.domains.numbers.WebHooksService see - * WebHooksService}) - * @return current builder - */ - public Builder setCallbackUrl(String callbackUrl) { - this.callbackUrl = OptionalValue.of(callbackUrl); - return this; - } - - public AvailableNumberRentAnyRequestParameters build() { - return new AvailableNumberRentAnyRequestParameters( - regionCode, - type, - numberPattern, - capabilities, - smsConfiguration, - voiceConfiguration, - callbackUrl); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/requests/AvailableNumberRentRequestParameters.java b/client/src/main/com/sinch/sdk/domains/numbers/models/requests/AvailableNumberRentRequestParameters.java deleted file mode 100644 index 065d4624e..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/requests/AvailableNumberRentRequestParameters.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; - -/** - * Parameters request to rent a number - * - * @see https://developers.sinch.com/docs/numbers/api-reference/numbers/tag/Available-Number/#tag/Available-Number/operation/NumberService_RentNumber - * @since 1.0 - */ -public class AvailableNumberRentRequestParameters { - private final OptionalValue smsConfiguration; - private final OptionalValue voiceConfiguration; - private final OptionalValue callbackUrl; - - private AvailableNumberRentRequestParameters( - OptionalValue smsConfiguration, - OptionalValue voiceConfiguration, - OptionalValue callbackUrl) { - this.smsConfiguration = smsConfiguration; - this.voiceConfiguration = voiceConfiguration; - this.callbackUrl = callbackUrl; - } - - public OptionalValue getSmsConfiguration() { - return smsConfiguration; - } - - public OptionalValue getVoiceConfiguration() { - return voiceConfiguration; - } - - public OptionalValue getCallBackUrl() { - return callbackUrl; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - OptionalValue smsConfiguration = OptionalValue.empty(); - OptionalValue voiceConfiguration = - OptionalValue.empty(); - OptionalValue callbackUrl = OptionalValue.empty(); - - private Builder() {} - - /** - * @param smsConfiguration The current SMS configuration for this number - * @return current builder - */ - public Builder setSmsConfiguration(RentSMSConfigurationRequestParameters smsConfiguration) { - this.smsConfiguration = OptionalValue.of(smsConfiguration); - return this; - } - - /** - * @param voiceConfiguration The current voice configuration for this number. During scheduled - * provisioning, the app ID value may be empty in a response if it is still processing or if - * it has failed. The status of scheduled provisioning will show under a - * scheduledVoiceProvisioning object if it's still running. Once processed successfully, the - * appId sent will appear directly under the voiceConfiguration object. - * @return current builder - */ - public Builder setVoiceConfiguration( - RentVoiceConfigurationRequestParameters voiceConfiguration) { - this.voiceConfiguration = OptionalValue.of(voiceConfiguration); - return this; - } - - /** - * @param callbackUrl The callback URL to be called for a rented number's provisioning / - * de-provisioning operations. - * @return current builder - */ - public Builder setCallbackUrl(String callbackUrl) { - this.callbackUrl = OptionalValue.of(callbackUrl); - return this; - } - - public AvailableNumberRentRequestParameters build() { - return new AvailableNumberRentRequestParameters( - smsConfiguration, voiceConfiguration, callbackUrl); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/requests/AvailableRegionListAllRequestParameters.java b/client/src/main/com/sinch/sdk/domains/numbers/models/requests/AvailableRegionListAllRequestParameters.java deleted file mode 100644 index 771392203..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/requests/AvailableRegionListAllRequestParameters.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.numbers.models.NumberType; -import java.util.Collection; - -/** - * Parameters request to list all regions by criteria - * - * @see https://developers.sinch.com/docs/numbers/api-reference/numbers/tag/Available-Regions/ - * @since 1.0 - */ -public class AvailableRegionListAllRequestParameters { - - private final OptionalValue> types; - - private AvailableRegionListAllRequestParameters(OptionalValue> types) { - this.types = types; - } - - public OptionalValue> getTypes() { - return types; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - OptionalValue> types = OptionalValue.empty(); - - private Builder() {} - - /** - * @param types Only return regions for which numbers are provided with the given types - * @return current builder - */ - public Builder setTypes(Collection types) { - this.types = OptionalValue.of(types); - return this; - } - - public AvailableRegionListAllRequestParameters build() { - return new AvailableRegionListAllRequestParameters(types); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/requests/CallbackConfigurationUpdateRequestParameters.java b/client/src/main/com/sinch/sdk/domains/numbers/models/requests/CallbackConfigurationUpdateRequestParameters.java deleted file mode 100644 index 8b0402d7c..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/requests/CallbackConfigurationUpdateRequestParameters.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; - -/** - * Parameters request to update callback configuration - * - * @see https://developers.sinch.com/docs/numbers/api-reference/callbacks-numbers/tag/Callback-Configuration/#tag/Callback-Configuration/operation/UpdateCallbackConfiguration - * @since 1.0 - */ -public class CallbackConfigurationUpdateRequestParameters { - /** */ - private final OptionalValue hmacSecret; - - private CallbackConfigurationUpdateRequestParameters(OptionalValue hmacSecret) { - this.hmacSecret = hmacSecret; - } - - public OptionalValue getHMACSecret() { - return hmacSecret; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - OptionalValue hmacSecret = OptionalValue.empty(); - - private Builder() {} - - /*** - * - * @param hmacSecret The HMAC secret to be updated for the specified project - * @return current builder - */ - public Builder setHMACSecret(String hmacSecret) { - this.hmacSecret = OptionalValue.of(hmacSecret); - return this; - } - - public CallbackConfigurationUpdateRequestParameters build() { - return new CallbackConfigurationUpdateRequestParameters(hmacSecret); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/requests/RentSMSConfigurationRequestParameters.java b/client/src/main/com/sinch/sdk/domains/numbers/models/requests/RentSMSConfigurationRequestParameters.java deleted file mode 100644 index 5361c7ef0..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/requests/RentSMSConfigurationRequestParameters.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; - -/** - * SMS configuration parameters request to rent a number - * - * @since 1.0 - */ -public class RentSMSConfigurationRequestParameters { - private final OptionalValue servicePlanId; - private final OptionalValue campaignId; - - private RentSMSConfigurationRequestParameters( - OptionalValue servicePlanId, OptionalValue campaignId) { - this.servicePlanId = servicePlanId; - this.campaignId = campaignId; - } - - public OptionalValue getServicePlanId() { - return servicePlanId; - } - - public OptionalValue getCampaignId() { - return this.campaignId; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - OptionalValue servicePlanId = OptionalValue.empty(); - OptionalValue campaignId = OptionalValue.empty(); - - private Builder() {} - - /** - * @param servicePlanId The servicePlanId can be found in the Sinch Customer Dashboard. The - * service plan ID is what ties this number to the configured SMS service. - * @return current builder - */ - public Builder setServicePlanId(String servicePlanId) { - this.servicePlanId = OptionalValue.of(servicePlanId); - return this; - } - - /** - * @param campaignId Only for US phone numbers. This campaignId is required to send SMS traffic - * to US; click here to read more about 10DLC A2P messaging. So, it is the current campaign - * ID for this number. The campaignId is found on your TCR platform. - */ - public Builder setCampaignId(String campaignId) { - this.campaignId = OptionalValue.of(campaignId); - return this; - } - - public RentSMSConfigurationRequestParameters build() { - return new RentSMSConfigurationRequestParameters(servicePlanId, campaignId); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/requests/RentVoiceConfigurationRequestParameters.java b/client/src/main/com/sinch/sdk/domains/numbers/models/requests/RentVoiceConfigurationRequestParameters.java deleted file mode 100644 index 50e870f96..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/requests/RentVoiceConfigurationRequestParameters.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; - -/** - * Voice configuration parameters request to rent a number - * - * @since 1.0 - */ -public class RentVoiceConfigurationRequestParameters { - private final OptionalValue appId; - - private RentVoiceConfigurationRequestParameters(OptionalValue appId) { - this.appId = appId; - } - - public OptionalValue getAppId() { - return appId; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - OptionalValue appId = OptionalValue.empty(); - - private Builder() {} - - /** - * @param appId Your app ID for the Voice API. The appId can be found in your Sinch Customer - * Dashboard under Voice, then apps. - * @return current builder - */ - public Builder setAppId(String appId) { - this.appId = OptionalValue.of(appId); - return this; - } - - public RentVoiceConfigurationRequestParameters build() { - return new RentVoiceConfigurationRequestParameters(appId); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/requests/package-info.java b/client/src/main/com/sinch/sdk/domains/numbers/models/requests/package-info.java deleted file mode 100644 index baf5491db..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/requests/package-info.java +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Numbers API requests related models - * - * @since 1.0 - */ -package com.sinch.sdk.domains.numbers.models.requests; diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/responses/ActiveNumberListResponse.java b/client/src/main/com/sinch/sdk/domains/numbers/models/responses/ActiveNumberListResponse.java deleted file mode 100644 index 4321f1509..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/responses/ActiveNumberListResponse.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.responses; - -import com.sinch.sdk.core.models.pagination.ListResponse; -import com.sinch.sdk.core.models.pagination.Page; -import com.sinch.sdk.core.utils.StringUtil; -import com.sinch.sdk.domains.numbers.ActiveNumberService; -import com.sinch.sdk.domains.numbers.models.ActiveNumber; -import com.sinch.sdk.domains.numbers.models.requests.ActiveNumberListRequestParameters; -import java.util.Collection; -import java.util.NoSuchElementException; - -/** - * Lists all active numbers for a project - * - * @since 1.0 - */ -public class ActiveNumberListResponse extends ListResponse { - - private final Page page; - private final ActiveNumberService service; - - public ActiveNumberListResponse( - ActiveNumberService service, - Page page) { - this.service = service; - this.page = page; - } - - public boolean hasNextPage() { - return (null != page.getNextPageToken() && !StringUtil.isEmpty(page.getNextPageToken())); - } - - public ActiveNumberListResponse nextPage() { - if (!hasNextPage()) { - throw new NoSuchElementException("Reached the last page of the API response"); - } - ActiveNumberListRequestParameters.Builder newParameters = - ActiveNumberListRequestParameters.builder(page.getParameters()); - newParameters.setPageToken(page.getNextPageToken()); - return service.list(newParameters.build()); - } - - public Collection getContent() { - return page.getEntities(); - } - - @Override - public String toString() { - return "ActiveNumberListResponse{" + "page=" + page + '}'; - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/responses/AvailableNumberListResponse.java b/client/src/main/com/sinch/sdk/domains/numbers/models/responses/AvailableNumberListResponse.java deleted file mode 100644 index b33104958..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/responses/AvailableNumberListResponse.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.responses; - -import com.sinch.sdk.core.models.pagination.ListResponse; -import com.sinch.sdk.domains.numbers.models.AvailableNumber; -import java.util.Collection; -import java.util.NoSuchElementException; - -/** - * Lists all available numbers - * - * @since 1.0 - */ -public class AvailableNumberListResponse extends ListResponse { - - Collection content; - - public AvailableNumberListResponse(Collection list) { - this.content = list; - } - - public boolean hasNextPage() { - return false; - } - - public AvailableNumberListResponse nextPage() { - throw new NoSuchElementException("Reached the last page of the API response"); - } - - public Collection getContent() { - return content; - } - - @Override - public String toString() { - return "AvailableNumberListResponse{" + "content=" + content + '}'; - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/responses/AvailableRegionListResponse.java b/client/src/main/com/sinch/sdk/domains/numbers/models/responses/AvailableRegionListResponse.java deleted file mode 100644 index 927a6ede2..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/responses/AvailableRegionListResponse.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.responses; - -import com.sinch.sdk.core.models.pagination.ListResponse; -import com.sinch.sdk.domains.numbers.models.Region; -import java.util.Collection; -import java.util.NoSuchElementException; - -/** - * Lists all regions for numbers provided for the project ID. - * - * @since 1.0 - */ -public class AvailableRegionListResponse extends ListResponse { - - Collection content; - - public AvailableRegionListResponse(Collection list) { - this.content = list; - } - - public boolean hasNextPage() { - return false; - } - - public AvailableRegionListResponse nextPage() { - throw new NoSuchElementException("Reached the last page of the API response"); - } - - public Collection getContent() { - return content; - } - - @Override - public String toString() { - return "AvailableRegionListResponse{" + "content=" + content + '}'; - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/responses/package-info.java b/client/src/main/com/sinch/sdk/domains/numbers/models/responses/package-info.java deleted file mode 100644 index 9fa13e9f4..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/responses/package-info.java +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Numbers API response related models - * - * @since 1.0 - */ -package com.sinch.sdk.domains.numbers.models.responses; diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/webhooks/EventNotification.java b/client/src/main/com/sinch/sdk/domains/numbers/models/webhooks/EventNotification.java deleted file mode 100644 index 3b973281f..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/webhooks/EventNotification.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.webhooks; - -import com.sinch.sdk.domains.numbers.models.SmsErrorCode; -import java.time.Instant; - -/** A notification of an event sent to your configured callback URL. */ -public class EventNotification { - - private final String eventId; - private final Instant timestamp; - private final String projectId; - private final String resourceId; - private final ResourceType resourceType; - private final EventType eventType; - private final EventStatus status; - private final SmsErrorCode failureCode; - - /** - * @param eventId The ID of the event - * @param timestamp The date and time when the callback was created and added to the callbacks - * queue - * @param projectId The ID of the project to which the event belongs - * @param resourceId The unique identifier of the resource, depending on the resource type. For - * example, a phone number, a hosting order ID, or a brand ID. - * @param resourceType The type of the resource - * @param eventType The type of the event - * @param status The status of the event - * @param failureCode If the status is FAILED, a failure code will be provided. For numbers - * provisioning to SMS platform, there won't be any extra failureCode, as the result is - * binary. For campaign provisioning-related failures, refer to the list for the possible - * values. - */ - public EventNotification( - String eventId, - Instant timestamp, - String projectId, - String resourceId, - ResourceType resourceType, - EventType eventType, - EventStatus status, - SmsErrorCode failureCode) { - this.eventId = eventId; - this.timestamp = timestamp; - this.projectId = projectId; - this.resourceId = resourceId; - this.resourceType = resourceType; - this.eventType = eventType; - this.status = status; - this.failureCode = failureCode; - } - - public String getEventId() { - return eventId; - } - - public Instant getTimestamp() { - return timestamp; - } - - public String getProjectId() { - return projectId; - } - - public String getResourceId() { - return resourceId; - } - - public ResourceType getResourceType() { - return resourceType; - } - - public EventType getEventType() { - return eventType; - } - - public EventStatus getStatus() { - return status; - } - - public SmsErrorCode getFailureCode() { - return failureCode; - } - - @Override - public String toString() { - return "EventNotification{" - + "eventId='" - + eventId - + '\'' - + ", timestamp=" - + timestamp - + ", projectId='" - + projectId - + '\'' - + ", resourceId='" - + resourceId - + '\'' - + ", resourceType=" - + resourceType - + ", eventType=" - + eventType - + ", status=" - + status - + ", failureCode=" - + failureCode - + '}'; - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/webhooks/EventStatus.java b/client/src/main/com/sinch/sdk/domains/numbers/models/webhooks/EventStatus.java deleted file mode 100644 index e37950021..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/webhooks/EventStatus.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.webhooks; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -public final class EventStatus extends EnumDynamic { - - /** - * The status of the event - * - * @see https://developers.sinch.com/docs/numbers/api-reference/numbers/tag/Callbacks/#tag/Callbacks/operation/ImportedNumberService_EventsCallback!path=status&t=request/ - * @since 1.0 - */ - public static final EventStatus SUCCEEDED = new EventStatus("SUCCEEDED"); - - public static final EventStatus FAILED = new EventStatus("FAILED"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - EventStatus.class, EventStatus::new, Arrays.asList(SUCCEEDED, FAILED)); - - EventStatus(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static EventStatus from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(EventStatus e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/webhooks/EventType.java b/client/src/main/com/sinch/sdk/domains/numbers/models/webhooks/EventType.java deleted file mode 100644 index b80898f15..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/webhooks/EventType.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.webhooks; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -/** - * The type of the event - * - * @see https://developers.sinch.com/docs/numbers/api-reference/numbers/tag/Callbacks/#tag/Callbacks/operation/ImportedNumberService_EventsCallback!path=eventType&t=request - * @since 1.0 - */ -public final class EventType extends EnumDynamic { - - /** An event that occurs when a number is linked to a Service Plan ID. */ - public static final EventType PROVISIONING_TO_SMS_PLATFORM = - new EventType("PROVISIONING_TO_SMS_PLATFORM"); - - /** An event that occurs when a number is unlinked from a Service Plan ID */ - public static final EventType DEPROVISIONING_FROM_SMS_PLATFORM = - new EventType("DEPROVISIONING_FROM_SMS_PLATFORM"); - - /** An event that occurs when a number is linked to a Campaign */ - public static final EventType PROVISIONING_TO_CAMPAIGN = - new EventType("PROVISIONING_TO_CAMPAIGN"); - - /** An event that occurs when a number is unlinked from a Campaign */ - public static final EventType DEPROVISIONING_FROM_CAMPAIGN = - new EventType("DEPROVISIONING_FROM_CAMPAIGN"); - - /** An event that occurs when a number is enabled for Voice operations. */ - public static final EventType PROVISIONING_TO_VOICE_PLATFORM = - new EventType("PROVISIONING_TO_VOICE_PLATFORM"); - - /** An event that occurs when a number is disabled for Voice operations */ - public static final EventType DEPROVISIONING_TO_VOICE_PLATFORM = - new EventType("DEPROVISIONING_TO_VOICE_PLATFORM"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - EventType.class, - EventType::new, - Arrays.asList( - PROVISIONING_TO_SMS_PLATFORM, - DEPROVISIONING_FROM_SMS_PLATFORM, - PROVISIONING_TO_CAMPAIGN, - DEPROVISIONING_FROM_CAMPAIGN, - PROVISIONING_TO_VOICE_PLATFORM, - DEPROVISIONING_TO_VOICE_PLATFORM)); - - EventType(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static EventType from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(EventType e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/webhooks/ResourceType.java b/client/src/main/com/sinch/sdk/domains/numbers/models/webhooks/ResourceType.java deleted file mode 100644 index f6e9d860d..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/webhooks/ResourceType.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.webhooks; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -/** - * The type of the resource - * - * @see https://developers.sinch.com/docs/numbers/api-reference/numbers/tag/Callbacks/#tag/Callbacks/operation/ImportedNumberService_EventsCallback!path=resourceType&t=request - * @since 1.0 - */ -public final class ResourceType extends EnumDynamic { - - /** Numbers which are already active and updated with new campaign IDs or service plan IDs. */ - public static final ResourceType ACTIVE_NUMBER = new ResourceType("ACTIVE_NUMBER"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>(ResourceType.class, ResourceType::new, Arrays.asList(ACTIVE_NUMBER)); - - ResourceType(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static ResourceType from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(ResourceType e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/webhooks/package-info.java b/client/src/main/com/sinch/sdk/domains/numbers/models/webhooks/package-info.java deleted file mode 100644 index cb0c2db7b..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/webhooks/package-info.java +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Numbers API webhooks (callback) related models - * - * @since 1.0 - */ -package com.sinch.sdk.domains.numbers.models.webhooks; diff --git a/client/src/test/java/com/sinch/sdk/SinchClientTestIT.java b/client/src/test/java/com/sinch/sdk/SinchClientTestIT.java index 5075c6c19..c95624e5e 100644 --- a/client/src/test/java/com/sinch/sdk/SinchClientTestIT.java +++ b/client/src/test/java/com/sinch/sdk/SinchClientTestIT.java @@ -47,7 +47,7 @@ void sdkUserAgent() throws InterruptedException { new MockResponse().setBody("foo").addHeader("Content-Type", "application/json")); try { - sinchClient.numbers().available().checkAvailability("foo"); + sinchClient.numbers().v1().checkAvailability("foo"); } catch (ApiException ae) { // noop } diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/ActiveNumberServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/ActiveNumberServiceTest.java deleted file mode 100644 index ae69dd04f..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/ActiveNumberServiceTest.java +++ /dev/null @@ -1,306 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters; - -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - -import com.adelean.inject.resources.junit.jupiter.TestWithResources; -import com.sinch.sdk.BaseTest; -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.core.models.pagination.Page; -import com.sinch.sdk.core.models.pagination.TokenPageNavigator; -import com.sinch.sdk.domains.numbers.models.ActiveNumber; -import com.sinch.sdk.domains.numbers.models.Capability; -import com.sinch.sdk.domains.numbers.models.Money; -import com.sinch.sdk.domains.numbers.models.NumberPattern; -import com.sinch.sdk.domains.numbers.models.NumberType; -import com.sinch.sdk.domains.numbers.models.OrderBy; -import com.sinch.sdk.domains.numbers.models.ProvisioningStatus; -import com.sinch.sdk.domains.numbers.models.SMSConfiguration; -import com.sinch.sdk.domains.numbers.models.ScheduledSmsProvisioning; -import com.sinch.sdk.domains.numbers.models.ScheduledVoiceProvisioning; -import com.sinch.sdk.domains.numbers.models.SearchPattern; -import com.sinch.sdk.domains.numbers.models.SmsErrorCode; -import com.sinch.sdk.domains.numbers.models.VoiceConfiguration; -import com.sinch.sdk.domains.numbers.models.requests.ActiveNumberListRequestParameters; -import com.sinch.sdk.domains.numbers.models.requests.ActiveNumberUpdateRequestParameters; -import com.sinch.sdk.domains.numbers.models.requests.ActiveNumberUpdateSMSConfigurationRequestParameters; -import com.sinch.sdk.domains.numbers.models.requests.ActiveNumberUpdateVoiceConfigurationRequestParameters; -import com.sinch.sdk.domains.numbers.models.responses.ActiveNumberListResponse; -import com.sinch.sdk.domains.numbers.models.v1.ActiveNumberDtoTest; -import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumberListRequest; -import java.time.Instant; -import java.util.ArrayList; -import java.util.Arrays; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentMatchers; -import org.mockito.Mock; - -@TestWithResources -class ActiveNumberServiceTest extends BaseTest { - - @Mock com.sinch.sdk.domains.numbers.api.v1.NumbersService v1; - - ActiveNumberService service; - - ActiveNumber expectedNumberResponse = - ActiveNumber.builder() - .setPhoneNumber("+447520651116XYZ") - .setProjectId("project id") - .setRegionCode("GB") - .setType(NumberType.MOBILE) - .setCapability(Arrays.asList(Capability.SMS, Capability.VOICE)) - .setDisplayName("a display") - .setMoney(new Money("EUR", 0.80)) - .setPaymentIntervalMonths(1) - .setNextChargeDate(Instant.parse("2023-09-22T15:49:58.813424Z")) - .setExpireAt(Instant.parse("2023-10-06T15:49:58.813381Z")) - .setSmsConfiguration( - new SMSConfiguration( - "service plan id", - "campaign id", - new ScheduledSmsProvisioning( - "service plan id from scheduled", - "campaign id from scheduled", - ProvisioningStatus.PROVISIONING_STATUS_UNSPECIFIED, - Instant.parse("2023-09-25T12:08:02.115Z"), - Arrays.asList(SmsErrorCode.ERROR_CODE_UNSPECIFIED)))) - .setVoiceConfiguration( - new VoiceConfiguration( - "AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEE", - Instant.parse("2024-06-30T07:08:09.100Z"), - new ScheduledVoiceProvisioning( - "EEEEEEEEEE-DDDD-CCCC-BBBB-AAAAAAAA", - ProvisioningStatus.WAITING, - Instant.parse("2024-07-01T11:58:35.610198Z")))) - .setCallbackUrl("foo callback") - .build(); - - @BeforeEach - public void initMocks() { - service = spy(new ActiveNumberService(v1)); - } - - @Test - void list() throws ApiException { - - com.sinch.sdk.domains.numbers.models.v1.response.ActiveNumberListResponse responseV1 = - new com.sinch.sdk.domains.numbers.models.v1.response.ActiveNumberListResponse( - v1, - new Page<>( - ActiveNumberListRequest.builder() - .setRegionCode("another region") - .setType(com.sinch.sdk.domains.numbers.models.v1.NumberType.MOBILE) - .build(), - ActiveNumberDtoTest.activeNumberListLight.getActiveNumbers(), - new TokenPageNavigator(""))); - - when(v1.list( - ActiveNumberListRequest.builder() - .setRegionCode("region") - .setType(com.sinch.sdk.domains.numbers.models.v1.NumberType.MOBILE) - .build())) - .thenReturn(responseV1); - - ActiveNumberListResponse response = - service.list( - ActiveNumberListRequestParameters.builder() - .setRegionCode("region") - .setType(NumberType.MOBILE) - .build()); - - Page expected = - new Page<>( - ActiveNumberListRequestParameters.builder() - .setRegionCode("region") - .setType(NumberType.MOBILE) - .build(), - new ArrayList<>( - Arrays.asList( - ActiveNumber.builder() - .setPhoneNumber("+447520651116XYZ") - .setProjectId("project id") - .setRegionCode("GB") - .setType(NumberType.MOBILE) - .setCapability(Arrays.asList(Capability.SMS, Capability.VOICE)) - .setDisplayName("") - .setMoney(new Money("EUR", 0.80)) - .setPaymentIntervalMonths(1) - .setNextChargeDate(Instant.parse("2023-09-22T15:49:58.813424Z")) - .setExpireAt(Instant.parse("2023-10-06T15:49:58.813381Z")) - .setSmsConfiguration(new SMSConfiguration("service plan id", "", null)) - .setVoiceConfiguration(new VoiceConfiguration("app id", null, null)) - .setCallbackUrl("") - .build())), - new TokenPageNavigator("")); - - TestHelpers.recursiveEquals(response.getContent(), expected.getEntities()); - } - - @Test - void listWithParameters() throws ApiException { - - com.sinch.sdk.domains.numbers.models.v1.response.ActiveNumberListResponse responseV1 = - new com.sinch.sdk.domains.numbers.models.v1.response.ActiveNumberListResponse( - v1, - new Page<>( - ActiveNumberListRequest.builder() - .setRegionCode("another region") - .setType(com.sinch.sdk.domains.numbers.models.v1.NumberType.TOLL_FREE) - .setSearchPattern( - com.sinch.sdk.domains.numbers.models.v1.request.SearchPattern.builder() - .setPattern("pattern value") - .setPosition( - com.sinch.sdk.domains.numbers.models.v1.request.SearchPosition.END) - .build()) - .setCapabilities( - Arrays.asList(com.sinch.sdk.domains.numbers.models.v1.Capability.VOICE)) - .setPageSize(5) - .setPageToken("foo") - .setOrderBy( - com.sinch.sdk.domains.numbers.models.v1.request.OrderBy.PHONE_NUMBER) - .build(), - ActiveNumberDtoTest.activeNumberList.getActiveNumbers(), - new TokenPageNavigator("foo"))); - - when(v1.list( - ActiveNumberListRequest.builder() - .setRegionCode("another region") - .setType(com.sinch.sdk.domains.numbers.models.v1.NumberType.TOLL_FREE) - .setSearchPattern( - com.sinch.sdk.domains.numbers.models.v1.request.SearchPattern.builder() - .setPattern("pattern value") - .setPosition( - com.sinch.sdk.domains.numbers.models.v1.request.SearchPosition.END) - .build()) - .setCapabilities( - Arrays.asList(com.sinch.sdk.domains.numbers.models.v1.Capability.VOICE)) - .setPageSize(5) - .setPageToken("foo") - .setOrderBy(com.sinch.sdk.domains.numbers.models.v1.request.OrderBy.PHONE_NUMBER) - .build())) - .thenReturn(responseV1); - - ActiveNumberListRequestParameters parameters = - ActiveNumberListRequestParameters.builder() - .setRegionCode("another region") - .setType(NumberType.TOLL_FREE) - .setNumberPattern( - NumberPattern.builder() - .setPattern("pattern value") - .setSearchPattern(SearchPattern.END) - .build()) - .setCapabilities(Arrays.asList(Capability.VOICE)) - .setPageSize(5) - .setPageToken("foo") - .setOrderBy(OrderBy.PHONE_NUMBER) - .build(); - - Page expected = - new Page<>( - ActiveNumberListRequestParameters.builder() - .setRegionCode("another region") - .setType(NumberType.TOLL_FREE) - .setNumberPattern( - NumberPattern.builder() - .setPattern("pattern value") - .setSearchPattern(SearchPattern.END) - .build()) - .setCapabilities(Arrays.asList(Capability.VOICE)) - .setPageSize(5) - .setPageToken("foo") - .setOrderBy(OrderBy.PHONE_NUMBER) - .build(), - new ArrayList<>( - Arrays.asList( - ActiveNumber.builder() - .setPhoneNumber("+447520651116XYZ") - .setProjectId("project id") - .setRegionCode("GB") - .setType(NumberType.MOBILE) - .setCapability(Arrays.asList(Capability.SMS, Capability.VOICE)) - .setDisplayName("a display") - .setMoney(new Money("EUR", 0.80)) - .setPaymentIntervalMonths(1) - .setNextChargeDate(Instant.parse("2023-09-22T15:49:58.813424Z")) - .setExpireAt(Instant.parse("2023-10-06T15:49:58.813381Z")) - .setSmsConfiguration( - new SMSConfiguration( - "service plan id", - "campaign id", - new ScheduledSmsProvisioning( - "service plan id from scheduled", - "campaign id from scheduled", - ProvisioningStatus.PROVISIONING_STATUS_UNSPECIFIED, - Instant.parse("2023-09-25T12:08:02.115Z"), - Arrays.asList(SmsErrorCode.ERROR_CODE_UNSPECIFIED)))) - .setVoiceConfiguration( - new VoiceConfiguration( - "AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEE", - Instant.parse("2024-06-30T07:08:09.10Z"), - new ScheduledVoiceProvisioning( - "EEEEEEEEEE-DDDD-CCCC-BBBB-AAAAAAAA", - ProvisioningStatus.WAITING, - Instant.parse("2024-07-01T11:58:35.610198Z")))) - .setCallbackUrl("foo callback") - .build())), - new TokenPageNavigator("foo")); - - ActiveNumberListResponse response = service.list(parameters); - - TestHelpers.recursiveEquals(response.getContent(), expected.getEntities()); - } - - @Test - void get() throws ApiException { - - when(v1.get(eq("foo phone number"))).thenReturn(ActiveNumberDtoTest.activeNumber); - - ActiveNumber response = service.get("foo phone number"); - - TestHelpers.recursiveEquals(response, expectedNumberResponse); - } - - @Test - void release() throws ApiException { - - when(v1.release(eq("foo phone number"))).thenReturn(ActiveNumberDtoTest.activeNumber); - - ActiveNumber response = service.release("foo phone number"); - - TestHelpers.recursiveEquals(response, expectedNumberResponse); - } - - @Test - void update() { - - ActiveNumberUpdateSMSConfigurationRequestParameters smsConfiguration = - ActiveNumberUpdateSMSConfigurationRequestParameters.builder() - .setServicePlanId("service plan id") - .setCampaignId("campaign id") - .build(); - - ActiveNumberUpdateVoiceConfigurationRequestParameters voiceConfiguration = - ActiveNumberUpdateVoiceConfigurationRequestParameters.builder() - .setAppId("AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEE") - .build(); - ActiveNumberUpdateRequestParameters parameters = - ActiveNumberUpdateRequestParameters.builder() - .setDisplayName("a display") - .setSmsConfiguration(smsConfiguration) - .setVoiceConfiguration(voiceConfiguration) - .setCallback("foo callback") - .build(); - - when(v1.update( - eq("foo phone number"), - ArgumentMatchers.eq(ActiveNumberDtoTest.activeNumberUpdateRequest))) - .thenReturn(ActiveNumberDtoTest.activeNumber); - - ActiveNumber response = service.update("foo phone number", parameters); - - TestHelpers.recursiveEquals(response, expectedNumberResponse); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/AvailableNumberServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/AvailableNumberServiceTest.java deleted file mode 100644 index e82e2f63a..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/AvailableNumberServiceTest.java +++ /dev/null @@ -1,195 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters; - -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - -import com.adelean.inject.resources.junit.jupiter.TestWithResources; -import com.sinch.sdk.BaseTest; -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.domains.numbers.adapters.converters.ActiveNumberDtoConverterTest; -import com.sinch.sdk.domains.numbers.models.*; -import com.sinch.sdk.domains.numbers.models.requests.*; -import com.sinch.sdk.domains.numbers.models.responses.AvailableNumberListResponse; -import com.sinch.sdk.domains.numbers.models.v1.ActiveNumberDtoTest; -import com.sinch.sdk.domains.numbers.models.v1.AvailableNumberDtoTest; -import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberListRequest; -import com.sinch.sdk.domains.numbers.models.v1.request.SearchPosition; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.NoSuchElementException; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.mockito.Mock; - -@TestWithResources -class AvailableNumberServiceTest extends BaseTest { - - AvailableNumberService service; - @Mock com.sinch.sdk.domains.numbers.api.v1.NumbersService v1; - - @BeforeEach - public void initMocks() { - service = spy(new AvailableNumberService(v1)); - } - - @Test - void list() throws ApiException { - - when(v1.searchForAvailableNumbers( - eq( - AvailableNumberListRequest.builder() - .setRegionCode("region") - .setType(com.sinch.sdk.domains.numbers.models.v1.NumberType.MOBILE) - .build()))) - .thenReturn( - new com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumberListResponse( - AvailableNumberDtoTest.availableNumberList.getAvailableNumbers())); - - AvailableNumberListAllRequestParameters parameters = - AvailableNumberListAllRequestParameters.builder() - .setRegionCode("region") - .setType(NumberType.MOBILE) - .build(); - - Collection expected = - new ArrayList<>( - Collections.singletonList( - AvailableNumber.builder() - .setPhoneNumber("+46650553763") - .setRegionCode("SE") - .setType(NumberType.LOCAL) - .setCapability(new ArrayList<>(Collections.singletonList(Capability.VOICE))) - .setSetupPrice(new Money("DOLLAR", 0.57)) - .setMonthlyPrice(new Money("EUR", 0.80)) - .setPaymentIntervalMonths(1) - .setSupportingDocumentationRequired(true) - .build())); - - AvailableNumberListResponse response = service.list(parameters); - - assertFalse(response.hasNextPage(), "Has no next page"); - assertThrows(NoSuchElementException.class, response::nextPage); - TestHelpers.recursiveEquals(response.getContent(), expected); - } - - @Test - void listWithParameters() throws ApiException { - - when(v1.searchForAvailableNumbers( - eq( - AvailableNumberListRequest.builder() - .setRegionCode("another region") - .setType(com.sinch.sdk.domains.numbers.models.v1.NumberType.TOLL_FREE) - .setSearchPattern( - com.sinch.sdk.domains.numbers.models.v1.request.SearchPattern.builder() - .setPattern("pattern value") - .setPosition(SearchPosition.END) - .build()) - .setCapabilities( - Collections.singletonList( - com.sinch.sdk.domains.numbers.models.v1.Capability.VOICE)) - .setSize(45) - .build()))) - .thenReturn( - new com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumberListResponse( - AvailableNumberDtoTest.availableNumberList.getAvailableNumbers())); - - AvailableNumberListAllRequestParameters parameters = - AvailableNumberListAllRequestParameters.builder() - .setRegionCode("another region") - .setType(NumberType.TOLL_FREE) - .setNumberPattern( - NumberPattern.builder() - .setPattern("pattern value") - .setSearchPattern(SearchPattern.END) - .build()) - .setCapabilities(Collections.singletonList(Capability.VOICE)) - .setSize(45) - .build(); - - Collection expected = - new ArrayList<>( - Collections.singletonList( - AvailableNumber.builder() - .setPhoneNumber("+46650553763") - .setRegionCode("SE") - .setType(NumberType.LOCAL) - .setCapability(new ArrayList<>(Collections.singletonList(Capability.VOICE))) - .setSetupPrice(new Money("DOLLAR", 0.57)) - .setMonthlyPrice(new Money("EUR", 0.80)) - .setPaymentIntervalMonths(1) - .setSupportingDocumentationRequired(true) - .build())); - - AvailableNumberListResponse response = service.list(parameters); - - assertFalse(response.hasNextPage(), "Has no next page"); - assertThrows(NoSuchElementException.class, response::nextPage); - TestHelpers.recursiveEquals(response.getContent(), expected); - } - - @Test - void get() { - - when(v1.checkAvailability(eq("foo"))).thenReturn(AvailableNumberDtoTest.availableNumber); - - AvailableNumber response = service.checkAvailability("foo"); - - AvailableNumber expected = - AvailableNumber.builder() - .setPhoneNumber("+46650553763") - .setRegionCode("SE") - .setType(NumberType.LOCAL) - .setCapability(Collections.singletonList(Capability.VOICE)) - .setSetupPrice(new Money("DOLLAR", 0.57)) - .setMonthlyPrice(new Money("EUR", 0.80)) - .setPaymentIntervalMonths(1) - .setSupportingDocumentationRequired(true) - .build(); - - TestHelpers.recursiveEquals(response, expected); - } - - @Test - void rent() { - - when(v1.rent(eq("foo"), any())).thenReturn(ActiveNumberDtoTest.activeNumber); - - ActiveNumber response = - service.rent( - "foo", - AvailableNumberRentRequestParameters.builder() - .setSmsConfiguration( - RentSMSConfigurationRequestParameters.builder() - .setServicePlanId("") - .setCampaignId("") - .build()) - .setVoiceConfiguration( - RentVoiceConfigurationRequestParameters.builder().setAppId("").build()) - .setCallbackUrl("foo") - .build()); - - TestHelpers.recursiveEquals(response, ActiveNumberDtoConverterTest.activeNumber); - } - - @Test - void rentAny() { - - when(v1.rentAny(any())).thenReturn(ActiveNumberDtoTest.activeNumber); - - AvailableNumberRentAnyRequestParameters parameters = - AvailableNumberRentAnyRequestParameters.builder() - .setRegionCode("foo region") - .setType(NumberType.MOBILE) - .build(); - ActiveNumber response = service.rentAny(parameters); - - TestHelpers.recursiveEquals(response, ActiveNumberDtoConverterTest.activeNumber); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/CallbackConfigurationServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/CallbackConfigurationServiceTest.java deleted file mode 100644 index 2d8ede286..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/CallbackConfigurationServiceTest.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters; - -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - -import com.adelean.inject.resources.junit.jupiter.TestWithResources; -import com.sinch.sdk.BaseTest; -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.domains.numbers.models.CallbackConfiguration; -import com.sinch.sdk.domains.numbers.models.requests.CallbackConfigurationUpdateRequestParameters; -import com.sinch.sdk.domains.numbers.models.v1.CallbackConfigurationDtoTest; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.mockito.Mock; - -@TestWithResources -class CallbackConfigurationServiceTest extends BaseTest { - - @Mock com.sinch.sdk.domains.numbers.api.v1.CallbackConfigurationService v1; - - CallbackConfigurationService service; - - @BeforeEach - public void initMocks() { - service = spy(new CallbackConfigurationService(v1)); - } - - @Test - void get() throws ApiException { - - when(v1.get()).thenReturn(CallbackConfigurationDtoTest.getResponse); - - CallbackConfiguration response = service.get(); - - CallbackConfiguration expected = - CallbackConfiguration.builder() - .setProjectId("Project ID value") - .setHMACSecret("HMAC value") - .build(); - - TestHelpers.recursiveEquals(response, expected); - } - - @Test - void update() throws ApiException { - - when(v1.update(eq(CallbackConfigurationDtoTest.updateRequest))) - .thenReturn(CallbackConfigurationDtoTest.getResponse); - - CallbackConfigurationUpdateRequestParameters parameters = - CallbackConfigurationUpdateRequestParameters.builder().setHMACSecret("HMAC value").build(); - CallbackConfiguration response = service.update(parameters); - - CallbackConfiguration expected = - CallbackConfiguration.builder() - .setProjectId("Project ID value") - .setHMACSecret("HMAC value") - .build(); - - TestHelpers.recursiveEquals(response, expected); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/CredentialsValidationHelper.java b/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/CredentialsValidationHelper.java deleted file mode 100644 index 6b1e1f7e7..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/CredentialsValidationHelper.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters; - -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import com.sinch.sdk.core.http.HttpClient; -import com.sinch.sdk.core.models.ServerConfiguration; -import com.sinch.sdk.models.NumbersContext; -import com.sinch.sdk.models.UnifiedCredentials; -import java.util.function.Consumer; -import java.util.function.Supplier; - -public class CredentialsValidationHelper { - - static ServerConfiguration oAuthServer = new ServerConfiguration("https://oauth.foo.url"); - - static void checkCredentials( - Supplier httpClientSupplier, Consumer service) { - doNotAcceptNullKey(httpClientSupplier, service); - doNotAcceptNullKeySecret(httpClientSupplier, service); - doNotAcceptNullProject(httpClientSupplier, service); - doNotAcceptNullContext(httpClientSupplier, service); - doNotAcceptNullNumbersUrl(httpClientSupplier, service); - initPassed(httpClientSupplier, service); - } - - static void doNotAcceptNullKey( - Supplier httpClientSupplier, Consumer service) { - UnifiedCredentials credentials = - UnifiedCredentials.builder().setKeyId(null).setKeySecret("foo").setProjectId("foo").build(); - NumbersContext context = NumbersContext.builder().setNumbersUrl("foo url").build(); - - Exception exception = - assertThrows( - IllegalArgumentException.class, - () -> - service.accept( - new NumbersService(credentials, context, oAuthServer, httpClientSupplier))); - assertTrue(exception.getMessage().contains("keyId")); - } - - static void doNotAcceptNullKeySecret( - Supplier httpClientSupplier, Consumer service) { - UnifiedCredentials credentials = - UnifiedCredentials.builder().setKeyId("foo").setKeySecret(null).setProjectId("foo").build(); - NumbersContext context = NumbersContext.builder().setNumbersUrl("foo url").build(); - - Exception exception = - assertThrows( - IllegalArgumentException.class, - () -> - service.accept( - new NumbersService(credentials, context, oAuthServer, httpClientSupplier))); - assertTrue(exception.getMessage().contains("keySecret")); - } - - static void doNotAcceptNullProject( - Supplier httpClientSupplier, Consumer service) { - UnifiedCredentials credentials = - UnifiedCredentials.builder().setKeyId("foo").setKeySecret("foo").setProjectId(null).build(); - NumbersContext context = NumbersContext.builder().setNumbersUrl("foo url").build(); - - Exception exception = - assertThrows( - IllegalArgumentException.class, - () -> - service.accept( - new NumbersService(credentials, context, oAuthServer, httpClientSupplier))); - assertTrue(exception.getMessage().contains("projectId")); - } - - static void doNotAcceptNullContext( - Supplier httpClientSupplier, Consumer service) { - UnifiedCredentials credentials = - UnifiedCredentials.builder() - .setKeyId("foo") - .setKeySecret("foo") - .setProjectId("foo") - .build(); - - Exception exception = - assertThrows( - NullPointerException.class, - () -> - service.accept( - new NumbersService(credentials, null, oAuthServer, httpClientSupplier))); - assertTrue(exception.getMessage().contains("Numbers service requires context to be defined")); - } - - static void doNotAcceptNullNumbersUrl( - Supplier httpClientSupplier, Consumer service) { - UnifiedCredentials credentials = - UnifiedCredentials.builder() - .setKeyId("foo") - .setKeySecret("foo") - .setProjectId("foo") - .build(); - NumbersContext context = NumbersContext.builder().build(); - - Exception exception = - assertThrows( - IllegalArgumentException.class, - () -> - service.accept( - new NumbersService(credentials, context, oAuthServer, httpClientSupplier))); - assertTrue(exception.getMessage().contains("numbersUrl")); - } - - static void initPassed( - Supplier httpClientSupplier, Consumer service) { - UnifiedCredentials credentials = - UnifiedCredentials.builder() - .setKeyId("foo") - .setKeySecret("foo") - .setProjectId("foo") - .build(); - NumbersContext context = NumbersContext.builder().setNumbersUrl("foo url").build(); - - assertDoesNotThrow( - () -> - service.accept( - new NumbersService(credentials, context, oAuthServer, httpClientSupplier)), - "Init passed"); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/NumbersServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/NumbersServiceTest.java deleted file mode 100644 index 63c1b18ca..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/NumbersServiceTest.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters; - -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; - -import com.sinch.sdk.core.http.HttpClient; -import org.junit.jupiter.api.Test; -import org.mockito.Mock; - -class NumbersServiceTest { - - @Mock HttpClient httpClient; - - /* - Due to V1 wrapper usage context: credentials are checked at request level when calling a dedicated V1 function - So test do not have sense here and is covered by V1 unit tests - @Test - void checkCredentialsAvailable() { - CredentialsValidationHelper.checkCredentials(() -> httpClient, NumbersService::available); - }*/ - - /* - Due to V1 wrapper usage context: credentials are checked at request level when calling a dedicated V1 function - So test do not have sense here and is covered by V1 unit tests @Test - void checkCredentialsActive() { - CredentialsValidationHelper.checkCredentials(() -> httpClient, NumbersService::active); - } - */ - - @Test - void checkCredentialsRegions() { - CredentialsValidationHelper.checkCredentials(() -> httpClient, NumbersService::regions); - } - - @Test - void checkCredentialsCallback() { - CredentialsValidationHelper.checkCredentials(() -> httpClient, NumbersService::callback); - } - - @Test - void checkCredentialsWebhooks() { - assertDoesNotThrow(() -> new NumbersService(null, null, null, null).webhooks(), "Init passed"); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/RegionServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/RegionServiceTest.java deleted file mode 100644 index 0f1bdc001..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/RegionServiceTest.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters; - -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - -import com.adelean.inject.resources.junit.jupiter.TestWithResources; -import com.sinch.sdk.BaseTest; -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.domains.numbers.models.NumberType; -import com.sinch.sdk.domains.numbers.models.Region; -import com.sinch.sdk.domains.numbers.models.requests.AvailableRegionListAllRequestParameters; -import com.sinch.sdk.domains.numbers.models.responses.AvailableRegionListResponse; -import com.sinch.sdk.domains.numbers.models.v1.AvailableRegionsDtoTest; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.NoSuchElementException; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.mockito.Mock; - -@TestWithResources -class RegionServiceTest extends BaseTest { - - AvailableRegionService service; - - @Mock com.sinch.sdk.domains.numbers.api.v1.AvailableRegionService v1; - - @BeforeEach - public void initMocks() { - service = spy(new AvailableRegionService(v1)); - } - - @Test - void list() throws ApiException { - - when(v1.list(any())) - .thenReturn( - new com.sinch.sdk.domains.numbers.models.v1.regions.available.response - .AvailableRegionListResponse( - AvailableRegionsDtoTest.availableRegionList.getAvailableRegions())); - - AvailableRegionListResponse response = - service.list( - AvailableRegionListAllRequestParameters.builder() - .setTypes(Collections.singletonList(NumberType.MOBILE)) - .build()); - - Collection expected = - new ArrayList<>( - Collections.singletonList( - Region.builder() - .setRegionName("Australia") - .setRegionCode("AU") - .setTypes(new ArrayList<>(Collections.singletonList(NumberType.MOBILE))) - .build())); - - assertFalse(response.hasNextPage(), "Has no next page"); - assertThrows(NoSuchElementException.class, response::nextPage); - TestHelpers.recursiveEquals(response.getContent(), expected); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/WebhooksServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/WebhooksServiceTest.java deleted file mode 100644 index c3b015a09..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/WebhooksServiceTest.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters; - -import com.adelean.inject.resources.junit.jupiter.GivenTextResource; -import com.adelean.inject.resources.junit.jupiter.TestWithResources; -import com.sinch.sdk.BaseTest; -import com.sinch.sdk.SinchClient; -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.domains.numbers.WebHooksService; -import com.sinch.sdk.domains.numbers.adapters.converters.CallbackPayloadDtoConverter; -import com.sinch.sdk.domains.numbers.models.v1.WebhooksDtoTest; -import com.sinch.sdk.domains.numbers.models.webhooks.EventNotification; -import com.sinch.sdk.models.Configuration; -import java.io.IOException; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -@TestWithResources -public class WebhooksServiceTest extends BaseTest { - - @GivenTextResource("/domains/numbers/v1/webhooks/number-event.json") - String incomingCallbackPayloadDtoJsonString; - - WebHooksService webHooksService; - - @Test - void incomingEventNotification() throws ApiException { - - EventNotification response = - webHooksService.unserializeEventNotification(incomingCallbackPayloadDtoJsonString); - - Assertions.assertThat(response).isInstanceOf(EventNotification.class); - Assertions.assertThat(response) - .usingRecursiveComparison() - .isEqualTo(CallbackPayloadDtoConverter.convert(WebhooksDtoTest.numberEvent)); - } - - @BeforeEach - public void setUp() throws IOException { - - Configuration configuration = - Configuration.builder() - .setProjectId("unused") - .setKeyId("unused") - .setKeySecret("unused") - .build(); - - webHooksService = new SinchClient(configuration).numbers().webhooks(); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/ActiveNumberDtoConverterTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/ActiveNumberDtoConverterTest.java deleted file mode 100644 index 6ac22763e..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/ActiveNumberDtoConverterTest.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters.converters; - -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.domains.numbers.models.ActiveNumber; -import com.sinch.sdk.domains.numbers.models.Capability; -import com.sinch.sdk.domains.numbers.models.Money; -import com.sinch.sdk.domains.numbers.models.NumberType; -import com.sinch.sdk.domains.numbers.models.v1.ActiveNumberDtoTest; -import java.time.Instant; -import java.util.Arrays; -import org.junit.jupiter.api.Test; - -public class ActiveNumberDtoConverterTest { - - public static com.sinch.sdk.domains.numbers.models.ActiveNumber activeNumber = - com.sinch.sdk.domains.numbers.models.ActiveNumber.builder() - .setPhoneNumber("+447520651116XYZ") - .setProjectId("project id") - .setDisplayName("a display") - .setRegionCode("GB") - .setType(NumberType.MOBILE) - .setCapability(Arrays.asList(Capability.SMS, Capability.VOICE)) - .setMoney(Money.builder().setCurrencyCode("EUR").setAmount(0.8).build()) - .setPaymentIntervalMonths(1) - .setNextChargeDate(Instant.parse("2023-09-22T15:49:58.813424Z")) - .setExpireAt(Instant.parse("2023-10-06T15:49:58.813381Z")) - .setSmsConfiguration(SmsConfigurationDtoConverterTest.configuration) - .setVoiceConfiguration(VoiceConfigurationDtoConverterTest.configuration) - .setCallbackUrl("foo callback") - .build(); - - @Test - void convertActiveNumberDto() { - ActiveNumber converted = ActiveNumberDtoConverter.convert(ActiveNumberDtoTest.activeNumber); - TestHelpers.recursiveEquals(converted, activeNumber); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/ActiveNumberUpdateRequestParametersDtoConverterTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/ActiveNumberUpdateRequestParametersDtoConverterTest.java deleted file mode 100644 index 5bbe3d770..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/ActiveNumberUpdateRequestParametersDtoConverterTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters.converters; - -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.domains.numbers.models.requests.ActiveNumberUpdateRequestParameters; -import com.sinch.sdk.domains.numbers.models.requests.ActiveNumberUpdateSMSConfigurationRequestParameters; -import com.sinch.sdk.domains.numbers.models.requests.ActiveNumberUpdateVoiceConfigurationRequestParameters; -import com.sinch.sdk.domains.numbers.models.v1.ActiveNumberDtoTest; -import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumberUpdateRequest; -import org.junit.jupiter.api.Test; - -class ActiveNumberUpdateRequestParametersDtoConverterTest { - - @Test - void convert() { - - ActiveNumberUpdateSMSConfigurationRequestParameters smsConfiguration = - ActiveNumberUpdateSMSConfigurationRequestParameters.builder() - .setServicePlanId("service plan id") - .setCampaignId("campaign id") - .build(); - - ActiveNumberUpdateVoiceConfigurationRequestParameters voiceConfiguration = - ActiveNumberUpdateVoiceConfigurationRequestParameters.builder() - .setAppId("AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEE") - .build(); - ActiveNumberUpdateRequestParameters item = - ActiveNumberUpdateRequestParameters.builder() - .setDisplayName("a display") - .setSmsConfiguration(smsConfiguration) - .setVoiceConfiguration(voiceConfiguration) - .setCallback("foo callback") - .build(); - - ActiveNumberUpdateRequest converted = - ActiveNumberUpdateRequestParametersDtoConverter.convert(item); - TestHelpers.recursiveEquals(converted, ActiveNumberDtoTest.activeNumberUpdateRequest); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/AvailableNumberDtoConverterTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/AvailableNumberDtoConverterTest.java deleted file mode 100644 index d78fed7af..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/AvailableNumberDtoConverterTest.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters.converters; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.domains.numbers.models.AvailableNumber; -import com.sinch.sdk.domains.numbers.models.Capability; -import com.sinch.sdk.domains.numbers.models.Money; -import com.sinch.sdk.domains.numbers.models.NumberType; -import com.sinch.sdk.domains.numbers.models.v1.AvailableNumberDtoTest; -import com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumberListResponse; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import org.junit.jupiter.api.Test; - -class AvailableNumberDtoConverterTest { - - AvailableNumber expectedItem = - AvailableNumber.builder() - .setPhoneNumber("+46650553763") - .setRegionCode("SE") - .setPaymentIntervalMonths(1) - .setSupportingDocumentationRequired(true) - .setType(NumberType.LOCAL) - .setCapability(Collections.singletonList(Capability.VOICE)) - .setSetupPrice(Money.builder().setCurrencyCode("DOLLAR").setAmount(0.57).build()) - .setMonthlyPrice(Money.builder().setCurrencyCode("EUR").setAmount(0.80).build()) - .build(); - - @Test - void convertAvailableNumberListResponse() { - - Collection expected = new ArrayList<>(Arrays.asList(expectedItem)); - - AvailableNumberListResponse dto = - new AvailableNumberListResponse( - AvailableNumberDtoTest.availableNumberList.getAvailableNumbers()); - - Collection converted = AvailableNumberDtoConverter.convert(dto); - - TestHelpers.recursiveEquals(converted, expected); - } - - @Test - void convertEmptyAvailableNumberListResponse() { - AvailableNumberListResponse dto = new AvailableNumberListResponse(null); - Collection converted = AvailableNumberDtoConverter.convert(dto); - - assertEquals(converted.size(), 0); - } - - @Test - void convertAvailableNumberDto() { - - AvailableNumber converted = - AvailableNumberDtoConverter.convert(AvailableNumberDtoTest.availableNumber); - TestHelpers.recursiveEquals(converted, expectedItem); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/AvailableRentAnyRequestParametersDtoConverterTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/AvailableRentAnyRequestParametersDtoConverterTest.java deleted file mode 100644 index 86c1e766c..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/AvailableRentAnyRequestParametersDtoConverterTest.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters.converters; - -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.domains.numbers.models.Capability; -import com.sinch.sdk.domains.numbers.models.NumberPattern; -import com.sinch.sdk.domains.numbers.models.NumberType; -import com.sinch.sdk.domains.numbers.models.SearchPattern; -import com.sinch.sdk.domains.numbers.models.requests.AvailableNumberRentAnyRequestParameters; -import com.sinch.sdk.domains.numbers.models.requests.RentSMSConfigurationRequestParameters; -import com.sinch.sdk.domains.numbers.models.requests.RentVoiceConfigurationRequestParameters; -import com.sinch.sdk.domains.numbers.models.v1.SmsConfiguration; -import com.sinch.sdk.domains.numbers.models.v1.VoiceConfigurationRTC; -import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentAnyRequest; -import com.sinch.sdk.domains.numbers.models.v1.request.SearchPosition; -import java.util.Collections; -import org.junit.jupiter.api.Test; - -class AvailableRentAnyRequestParametersDtoConverterTest { - - @Test - void convert() { - AvailableNumberRentAnyRequestParameters parameters = - AvailableNumberRentAnyRequestParameters.builder() - .setRegionCode("region code") - .setType(NumberType.from("foo type")) - .setNumberPattern( - NumberPattern.builder() - .setPattern("pattern") - .setSearchPattern(SearchPattern.CONTAINS) - .build()) - .setCapabilities(Collections.singletonList(Capability.SMS)) - .setSmsConfiguration( - RentSMSConfigurationRequestParameters.builder() - .setCampaignId("campaign id") - .setServicePlanId("service plan") - .build()) - .setVoiceConfiguration( - RentVoiceConfigurationRequestParameters.builder().setAppId("app id").build()) - .setCallbackUrl("callback url") - .build(); - - AvailableNumberRentAnyRequest expected = - AvailableNumberRentAnyRequest.builder() - .setRegionCode("region code") - .setType(com.sinch.sdk.domains.numbers.models.v1.NumberType.from("foo type")) - .setNumberPattern( - com.sinch.sdk.domains.numbers.models.v1.request.SearchPattern.builder() - .setPattern("pattern") - .setPosition(SearchPosition.CONTAINS) - .build()) - .setCapabilities( - Collections.singletonList(com.sinch.sdk.domains.numbers.models.v1.Capability.SMS)) - .setSmsConfiguration( - SmsConfiguration.builder() - .setCampaignId("campaign id") - .setServicePlanId("service plan") - .build()) - .setVoiceConfiguration(VoiceConfigurationRTC.builder().setAppId("app id").build()) - .setCallbackUrl("callback url") - .build(); - - AvailableNumberRentAnyRequest converted = - AvailableRentAnyRequestParametersDtoConverter.convert(parameters); - - TestHelpers.recursiveEquals(converted, expected); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/AvailableRentRequestParametersDtoConverterTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/AvailableRentRequestParametersDtoConverterTest.java deleted file mode 100644 index 57d835a21..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/AvailableRentRequestParametersDtoConverterTest.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters.converters; - -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.domains.numbers.models.requests.AvailableNumberRentRequestParameters; -import com.sinch.sdk.domains.numbers.models.requests.RentSMSConfigurationRequestParameters; -import com.sinch.sdk.domains.numbers.models.requests.RentVoiceConfigurationRequestParameters; -import com.sinch.sdk.domains.numbers.models.v1.SmsConfiguration; -import com.sinch.sdk.domains.numbers.models.v1.VoiceConfigurationRTC; -import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentRequest; -import org.junit.jupiter.api.Test; - -class AvailableRentRequestParametersDtoConverterTest { - - @Test - void convert() { - AvailableNumberRentRequestParameters parameters = - AvailableNumberRentRequestParameters.builder() - .setSmsConfiguration( - RentSMSConfigurationRequestParameters.builder() - .setCampaignId("campaign id") - .setServicePlanId("service plan") - .build()) - .setVoiceConfiguration( - RentVoiceConfigurationRequestParameters.builder().setAppId("app id").build()) - .setCallbackUrl("callback url") - .build(); - - AvailableNumberRentRequest expected = - AvailableNumberRentRequest.builder() - .setSmsConfiguration( - SmsConfiguration.builder() - .setCampaignId("campaign id") - .setServicePlanId("service plan") - .build()) - .setVoiceConfiguration(VoiceConfigurationRTC.builder().setAppId("app id").build()) - .setCallbackUrl("callback url") - .build(); - AvailableNumberRentRequest converted = - AvailableRentRequestParametersDtoConverter.convert(parameters); - TestHelpers.recursiveEquals(converted, expected); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/CallbackConfigurationDtoConverterTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/CallbackConfigurationDtoConverterTest.java deleted file mode 100644 index 8489cffe9..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/CallbackConfigurationDtoConverterTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters.converters; - -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.domains.numbers.models.CallbackConfiguration; -import com.sinch.sdk.domains.numbers.models.v1.CallbackConfigurationDtoTest; -import org.junit.jupiter.api.Test; - -class CallbackConfigurationDtoConverterTest { - - @Test - void convert() { - CallbackConfiguration item = - CallbackConfiguration.builder() - .setProjectId("Project ID value") - .setHMACSecret("HMAC value") - .build(); - - CallbackConfiguration converted = - CallbackConfigurationDtoConverter.convert(CallbackConfigurationDtoTest.getResponse); - TestHelpers.recursiveEquals(converted, item); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/CallbackConfigurationUpdateParametersDtoConverterTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/CallbackConfigurationUpdateParametersDtoConverterTest.java deleted file mode 100644 index 6971ecb32..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/CallbackConfigurationUpdateParametersDtoConverterTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters.converters; - -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.domains.numbers.models.requests.CallbackConfigurationUpdateRequestParameters; -import com.sinch.sdk.domains.numbers.models.v1.CallbackConfigurationDtoTest; -import com.sinch.sdk.domains.numbers.models.v1.callbacks.request.CallbackConfigurationUpdateRequest; -import org.junit.jupiter.api.Test; - -class CallbackConfigurationUpdateParametersDtoConverterTest { - - @Test - void convert() { - CallbackConfigurationUpdateRequest converted = - CallbackConfigurationUpdateRequestParametersDtoConverter.convert( - CallbackConfigurationUpdateRequestParameters.builder() - .setHMACSecret("HMAC value") - .build()); - TestHelpers.recursiveEquals(converted, CallbackConfigurationDtoTest.updateRequest); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/CallbackPayloadDtoConverterTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/CallbackPayloadDtoConverterTest.java deleted file mode 100644 index 6e2cd2278..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/CallbackPayloadDtoConverterTest.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters.converters; - -import com.sinch.sdk.domains.numbers.models.SmsErrorCode; -import com.sinch.sdk.domains.numbers.models.v1.WebhooksDtoTest; -import com.sinch.sdk.domains.numbers.models.webhooks.EventNotification; -import com.sinch.sdk.domains.numbers.models.webhooks.EventStatus; -import com.sinch.sdk.domains.numbers.models.webhooks.EventType; -import com.sinch.sdk.domains.numbers.models.webhooks.ResourceType; -import java.time.LocalDateTime; -import java.time.ZoneOffset; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class CallbackPayloadDtoConverterTest { - - @Test - void convertCallbackPayloadDtoWithLocalDate() { - - EventNotification client = - new EventNotification( - "abcd1234efghijklmnop567890", - LocalDateTime.parse("2023-06-06T07:45:27.78789").toInstant(ZoneOffset.UTC), - "abcd12ef-ab12-ab12-bc34-abcdef123456", - "+12345612345", - ResourceType.ACTIVE_NUMBER, - EventType.PROVISIONING_TO_CAMPAIGN, - EventStatus.FAILED, - SmsErrorCode.CAMPAIGN_NOT_AVAILABLE); - - Assertions.assertThat(CallbackPayloadDtoConverter.convert(WebhooksDtoTest.numberEvent)) - .usingRecursiveComparison() - .isEqualTo(client); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/MoneyDtoConverterTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/MoneyDtoConverterTest.java deleted file mode 100644 index 79be3cafc..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/MoneyDtoConverterTest.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters.converters; - -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.domains.numbers.models.Money; -import org.junit.jupiter.api.Test; - -class MoneyDtoConverterTest { - - @Test - void convert() { - com.sinch.sdk.domains.numbers.models.v1.Money.Builder builder = - com.sinch.sdk.domains.numbers.models.v1.Money.builder(); - builder.setAmount(15.37); - builder.setCurrencyCode("currency code"); - - Money expected = new Money("currency code", 15.37); - TestHelpers.recursiveEquals(expected, MoneyDtoConverter.convert(builder.build())); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/RegionsDtoConverterTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/RegionsDtoConverterTest.java deleted file mode 100644 index 3bbb1545f..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/RegionsDtoConverterTest.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters.converters; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.domains.numbers.models.NumberType; -import com.sinch.sdk.domains.numbers.models.Region; -import com.sinch.sdk.domains.numbers.models.v1.regions.available.response.AvailableRegion; -import com.sinch.sdk.domains.numbers.models.v1.regions.available.response.AvailableRegionListResponse; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -class RegionsDtoConverterTest { - - AvailableRegion dtoItem; - - @Test - void convertListAvailableRegionsResponseDto() { - AvailableRegionListResponse dto = - new AvailableRegionListResponse(Collections.singletonList(dtoItem)); - - Collection converted = AvailableRegionsDtoConverter.convert(dto); - - assertEquals(dto.getContent().size(), converted.size()); - } - - @Test - void convertEmptyListAvailableRegionsResponseDto() { - AvailableRegionListResponse dto = new AvailableRegionListResponse(null); - Collection converted = AvailableRegionsDtoConverter.convert(dto); - - assertEquals(converted.size(), 0); - } - - @Test - void convertAvailableNumberDto() { - Region expected = - Region.builder() - .setRegionCode("region code") - .setRegionName("region name") - .setTypes(Arrays.asList(NumberType.MOBILE, NumberType.from("foo"))) - .build(); - - Region converted = AvailableRegionsDtoConverter.convert(dtoItem); - TestHelpers.recursiveEquals(converted, expected); - } - - @BeforeEach - void setUp() { - dtoItem = - AvailableRegion.builder() - .setRegionCode("region code") - .setRegionName("region name") - .setTypes( - Arrays.asList( - com.sinch.sdk.domains.numbers.models.v1.NumberType.MOBILE, - com.sinch.sdk.domains.numbers.models.v1.NumberType.from("foo"))) - .build(); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/ScheduledSmsProvisioningDtoConverterTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/ScheduledSmsProvisioningDtoConverterTest.java deleted file mode 100644 index 1e5f302b0..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/ScheduledSmsProvisioningDtoConverterTest.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters.converters; - -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.domains.numbers.models.ProvisioningStatus; -import com.sinch.sdk.domains.numbers.models.ScheduledSmsProvisioning; -import com.sinch.sdk.domains.numbers.models.SmsErrorCode; -import com.sinch.sdk.domains.numbers.models.v1.SmsConfigurationDtoTest; -import java.time.Instant; -import java.util.Collections; -import org.junit.jupiter.api.Test; - -class ScheduledSmsProvisioningDtoConverterTest { - - static ScheduledSmsProvisioning provisioning = - new ScheduledSmsProvisioning( - "service plan id from scheduled", - "campaign id from scheduled", - ProvisioningStatus.PROVISIONING_STATUS_UNSPECIFIED, - Instant.parse("2023-09-25T12:08:02.115Z"), - Collections.singletonList(SmsErrorCode.ERROR_CODE_UNSPECIFIED)); - - @Test - void convert() { - - ScheduledSmsProvisioning converted = - ScheduledSmsProvisioningDtoConverter.convert( - SmsConfigurationDtoTest.configurationResponse.getScheduledProvisioning()); - TestHelpers.recursiveEquals(provisioning, converted); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/ScheduledVoiceProvisioningDtoConverterTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/ScheduledVoiceProvisioningDtoConverterTest.java deleted file mode 100644 index 222852dfe..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/ScheduledVoiceProvisioningDtoConverterTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters.converters; - -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.domains.numbers.models.ProvisioningStatus; -import com.sinch.sdk.domains.numbers.models.ScheduledVoiceProvisioning; -import com.sinch.sdk.domains.numbers.models.v1.VoiceConfigurationDtoTest; -import java.time.Instant; -import org.junit.jupiter.api.Test; - -class ScheduledVoiceProvisioningDtoConverterTest { - - static ScheduledVoiceProvisioning provisioning = - new ScheduledVoiceProvisioning( - "EEEEEEEEEE-DDDD-CCCC-BBBB-AAAAAAAA", - ProvisioningStatus.WAITING, - Instant.parse("2024-07-01T11:58:35.610198Z")); - - @Test - void convert() { - - ScheduledVoiceProvisioning converted = - ScheduledVoiceProvisioningDtoConverter.convert( - VoiceConfigurationDtoTest.configurationResponseRTC.getScheduledProvisioning()); - TestHelpers.recursiveEquals(provisioning, converted); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/SmsConfigurationDtoConverterTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/SmsConfigurationDtoConverterTest.java deleted file mode 100644 index 094ee4f29..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/SmsConfigurationDtoConverterTest.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters.converters; - -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.domains.numbers.models.SMSConfiguration; -import com.sinch.sdk.domains.numbers.models.v1.SmsConfigurationDtoTest; -import org.junit.jupiter.api.Test; - -class SmsConfigurationDtoConverterTest { - - static SMSConfiguration configuration = - new SMSConfiguration( - "service plan id", "campaign id", ScheduledSmsProvisioningDtoConverterTest.provisioning); - - @Test - void convertDto() { - - SMSConfiguration converted = - SmsConfigurationDtoConverter.convert(SmsConfigurationDtoTest.configurationResponse); - TestHelpers.recursiveEquals(configuration, converted); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/VoiceConfigurationDtoConverterTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/VoiceConfigurationDtoConverterTest.java deleted file mode 100644 index 4b2bedfe4..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/converters/VoiceConfigurationDtoConverterTest.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.sinch.sdk.domains.numbers.adapters.converters; - -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.domains.numbers.models.VoiceConfiguration; -import com.sinch.sdk.domains.numbers.models.v1.VoiceConfigurationDtoTest; -import java.time.Instant; -import org.junit.jupiter.api.Test; - -class VoiceConfigurationDtoConverterTest { - - static VoiceConfiguration configuration = - new VoiceConfiguration( - "AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEE", - Instant.parse("2024-06-30T07:08:09.10Z"), - ScheduledVoiceProvisioningDtoConverterTest.provisioning); - - @Test - void convert() { - - VoiceConfiguration converted = - VoiceConfigurationDtoConverter.convert(VoiceConfigurationDtoTest.configurationResponseRTC); - TestHelpers.recursiveEquals(configuration, converted); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/api/v1/adapters/ActiveNumberServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/api/v1/adapters/ActiveNumberServiceTest.java index 0834f8ecb..780a8b583 100644 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/api/v1/adapters/ActiveNumberServiceTest.java +++ b/client/src/test/java/com/sinch/sdk/domains/numbers/api/v1/adapters/ActiveNumberServiceTest.java @@ -34,13 +34,10 @@ import com.sinch.sdk.domains.numbers.models.v1.SmsConfiguration; import com.sinch.sdk.domains.numbers.models.v1.VoiceConfiguration; import com.sinch.sdk.domains.numbers.models.v1.VoiceConfigurationRTC; -import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumberListRequest; import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumberUpdateRequest; import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumbersListQueryParameters; import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumbersListQueryParameters.OrderByEnum; import com.sinch.sdk.domains.numbers.models.v1.request.EmergencyAddressRequestDtoTest; -import com.sinch.sdk.domains.numbers.models.v1.request.OrderBy; -import com.sinch.sdk.domains.numbers.models.v1.request.SearchPattern; import com.sinch.sdk.domains.numbers.models.v1.request.SearchPosition; import com.sinch.sdk.domains.numbers.models.v1.response.ActiveNumberListResponse; import com.sinch.sdk.domains.numbers.models.v1.response.ValidateAddressResponse; @@ -115,52 +112,6 @@ public void initMocks() { credentials, context, oAuthServer, httpClientSupplier); } - @Test - void listWithRequiredParametersDeprecated() throws ApiException { - - HttpRequest httpRequest = - new HttpRequest( - "/v1/projects/" + URLPathUtils.encodePathSegment(URI_UUID) + "/activeNumbers", - HttpMethod.GET, - Arrays.asList( - new URLParameter("regionCode", "region", STYLE.FORM, true), - new URLParameter("type", NumberType.MOBILE, STYLE.FORM, true)), - (String) null, - Collections.emptyMap(), - Collections.singletonList(HttpContentType.APPLICATION_JSON), - Collections.emptyList(), - NUMBERS_AUTH_NAMES); - HttpResponse httpResponse = - new HttpResponse( - 200, null, Collections.emptyMap(), jsonActiveNumberListLightResponse.getBytes()); - - when(httpClient.invokeAPI( - argThat(new ServerConfigurationMatcher(serverConfiguration)), - argThat(new AuthManagersMatcher(authManagers)), - argThat(new HttpRequestMatcher(httpRequest)))) - .thenReturn(httpResponse); - - ActiveNumberListResponse expected = - new ActiveNumberListResponse( - service, - new Page<>( - ActiveNumberListRequest.builder() - .setRegionCode("region") - .setType(NumberType.MOBILE) - .build(), - ActiveNumberDtoTest.activeNumberListLight.getActiveNumbers(), - new TokenPageNavigator(""))); - - ActiveNumberListResponse response = - service.list( - ActiveNumberListRequest.builder() - .setRegionCode("region") - .setType(NumberType.MOBILE) - .build()); - - TestHelpers.recursiveEquals(response, expected); - } - @Test void listWithRequiredParameters() throws ApiException { @@ -207,74 +158,6 @@ void listWithRequiredParameters() throws ApiException { TestHelpers.recursiveEquals(response, expected); } - @Test - void listWithOptionalParametersDeprecated() throws ApiException { - - HttpRequest httpRequest = - new HttpRequest( - "/v1/projects/" + URLPathUtils.encodePathSegment(URI_UUID) + "/activeNumbers", - HttpMethod.GET, - Arrays.asList( - new URLParameter("regionCode", "another region", STYLE.FORM, true), - new URLParameter("numberPattern.pattern", "pattern value", STYLE.FORM, true), - new URLParameter( - "numberPattern.searchPattern", SearchPosition.END, STYLE.FORM, true), - new URLParameter("type", NumberType.TOLL_FREE, STYLE.FORM, true), - new URLParameter("capability", Arrays.asList(Capability.VOICE), STYLE.FORM, true), - new URLParameter("pageSize", 5, STYLE.FORM, true), - new URLParameter("pageToken", "foo", STYLE.FORM, true), - new URLParameter("orderBy", OrderByEnum.PHONE_NUMBER, STYLE.FORM, true)), - (String) null, - Collections.emptyMap(), - Collections.singletonList(HttpContentType.APPLICATION_JSON), - Collections.emptyList(), - NUMBERS_AUTH_NAMES); - HttpResponse httpResponse = - new HttpResponse( - 200, null, Collections.emptyMap(), jsonActiveNumberListResponse.getBytes()); - - when(httpClient.invokeAPI( - argThat(new ServerConfigurationMatcher(serverConfiguration)), - argThat(new AuthManagersMatcher(authManagers)), - argThat(new HttpRequestMatcher(httpRequest)))) - .thenReturn(httpResponse); - - ActiveNumberListResponse expected = - new ActiveNumberListResponse( - new Page<>( - ActiveNumbersListQueryParameters.builder() - .setRegionCode("another region") - .setType(NumberType.TOLL_FREE) - .setSearchPattern("pattern value") - .setSearchPosition(SearchPosition.END) - .setCapabilities(Arrays.asList(Capability.VOICE)) - .setPageSize(5) - .setPageToken("foo") - .setOrderBy(OrderByEnum.PHONE_NUMBER) - .build(), - ActiveNumberDtoTest.activeNumberList.getActiveNumbers(), - new TokenPageNavigator("foo")), - service); - - ActiveNumberListResponse response = - service.list( - ActiveNumberListRequest.builder() - .setRegionCode("another region") - .setType(NumberType.TOLL_FREE) - .setSearchPattern( - SearchPattern.builder() - .setPattern("pattern value") - .setPosition(SearchPosition.END) - .build()) - .setCapabilities(Arrays.asList(Capability.VOICE)) - .setPageSize(5) - .setPageToken("foo") - .setOrderBy(OrderBy.PHONE_NUMBER) - .build()); - - TestHelpers.recursiveEquals(response, expected); - } - @Test void listWithOptionalParameters() throws ApiException { diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/api/v1/adapters/AvailableNumberServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/api/v1/adapters/AvailableNumberServiceTest.java index 534fa8031..b0e9d7b36 100644 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/api/v1/adapters/AvailableNumberServiceTest.java +++ b/client/src/test/java/com/sinch/sdk/domains/numbers/api/v1/adapters/AvailableNumberServiceTest.java @@ -31,11 +31,9 @@ import com.sinch.sdk.domains.numbers.models.v1.NumberType; import com.sinch.sdk.domains.numbers.models.v1.SmsConfiguration; import com.sinch.sdk.domains.numbers.models.v1.VoiceConfigurationRTC; -import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberListRequest; import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentAnyRequest; import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentRequest; import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumbersListQueryParameters; -import com.sinch.sdk.domains.numbers.models.v1.request.SearchPattern; import com.sinch.sdk.domains.numbers.models.v1.request.SearchPosition; import com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumberListResponse; import com.sinch.sdk.models.NumbersContext; @@ -99,45 +97,6 @@ public void initMocks() { credentials, context, oAuthServer, httpClientSupplier); } - @Test - void searchForAvailableNumbersWithRequiredParametersDeprecated() throws ApiException { - - AvailableNumberListRequest parameters = - AvailableNumberListRequest.builder() - .setRegionCode("region") - .setType(NumberType.MOBILE) - .build(); - - HttpRequest httpRequest = - new HttpRequest( - "/v1/projects/" + URLPathUtils.encodePathSegment(URI_UUID) + "/availableNumbers", - HttpMethod.GET, - Arrays.asList( - new URLParameter("regionCode", "region", STYLE.FORM, true), - new URLParameter("type", NumberType.MOBILE, STYLE.FORM, true)), - (String) null, - Collections.emptyMap(), - Collections.singletonList(HttpContentType.APPLICATION_JSON), - Collections.emptyList(), - NUMBERS_AUTH_NAMES); - HttpResponse httpResponse = - new HttpResponse(200, null, Collections.emptyMap(), jsonAvailableListResponse.getBytes()); - - when(httpClient.invokeAPI( - argThat(new ServerConfigurationMatcher(serverConfiguration)), - argThat(new AuthManagersMatcher(authManagers)), - argThat(new HttpRequestMatcher(httpRequest)))) - .thenReturn(httpResponse); - - AvailableNumberListResponse response = service.searchForAvailableNumbers(parameters); - - AvailableNumberListResponse expected = - new AvailableNumberListResponse( - AvailableNumberDtoTest.availableNumberList.getAvailableNumbers()); - - TestHelpers.recursiveEquals(response, expected); - } - @Test void searchForAvailableNumbersWithRequiredParameters() throws ApiException { @@ -225,57 +184,6 @@ void searchForAvailableNumbersWithOptionalParameters() throws ApiException { TestHelpers.recursiveEquals(response, expected); } - @Test - void searchForAvailableNumbersWithOptionalParametersDeprecated() throws ApiException { - - AvailableNumberListRequest parameters = - AvailableNumberListRequest.builder() - .setRegionCode("another region") - .setType(NumberType.TOLL_FREE) - .setSearchPattern( - SearchPattern.builder() - .setPattern("pattern value") - .setPosition(SearchPosition.END) - .build()) - .setCapabilities(Arrays.asList(Capability.VOICE)) - .setSize(5) - .build(); - - HttpRequest httpRequest = - new HttpRequest( - "/v1/projects/" + URLPathUtils.encodePathSegment(URI_UUID) + "/availableNumbers", - HttpMethod.GET, - Arrays.asList( - new URLParameter("numberPattern.pattern", "pattern value", STYLE.FORM, true), - new URLParameter( - "numberPattern.searchPattern", SearchPosition.END, STYLE.FORM, true), - new URLParameter("regionCode", "another region", STYLE.FORM, true), - new URLParameter("type", NumberType.TOLL_FREE, STYLE.FORM, true), - new URLParameter("capabilities", Arrays.asList(Capability.VOICE), STYLE.FORM, true), - new URLParameter("size", 5, STYLE.FORM, true)), - (String) null, - Collections.emptyMap(), - Collections.singletonList(HttpContentType.APPLICATION_JSON), - Collections.emptyList(), - NUMBERS_AUTH_NAMES); - HttpResponse httpResponse = - new HttpResponse(200, null, Collections.emptyMap(), jsonAvailableListResponse.getBytes()); - - when(httpClient.invokeAPI( - argThat(new ServerConfigurationMatcher(serverConfiguration)), - argThat(new AuthManagersMatcher(authManagers)), - argThat(new HttpRequestMatcher(httpRequest)))) - .thenReturn(httpResponse); - - AvailableNumberListResponse response = service.searchForAvailableNumbers(parameters); - - AvailableNumberListResponse expected = - new AvailableNumberListResponse( - AvailableNumberDtoTest.availableNumberList.getAvailableNumbers()); - - TestHelpers.recursiveEquals(response, expected); - } - @Test void rentWithoutConfiguration() { diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/api/v1/adapters/AvailableRegionServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/api/v1/adapters/AvailableRegionServiceTest.java deleted file mode 100644 index 40a3945ce..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/api/v1/adapters/AvailableRegionServiceTest.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.sinch.sdk.domains.numbers.api.v1.adapters; - -import static org.mockito.ArgumentMatchers.argThat; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.when; - -import com.adelean.inject.resources.junit.jupiter.GivenTextResource; -import com.adelean.inject.resources.junit.jupiter.TestWithResources; -import com.sinch.sdk.BaseTest; -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.core.http.AuthManager; -import com.sinch.sdk.core.http.HttpClient; -import com.sinch.sdk.core.http.HttpContentType; -import com.sinch.sdk.core.http.HttpMapper; -import com.sinch.sdk.core.http.HttpMethod; -import com.sinch.sdk.core.http.HttpRequest; -import com.sinch.sdk.core.http.HttpRequestTest.HttpRequestMatcher; -import com.sinch.sdk.core.http.HttpResponse; -import com.sinch.sdk.core.http.URLParameter; -import com.sinch.sdk.core.http.URLParameter.STYLE; -import com.sinch.sdk.core.http.URLPathUtils; -import com.sinch.sdk.core.models.ServerConfiguration; -import com.sinch.sdk.domains.numbers.api.v1.AvailableRegionService; -import com.sinch.sdk.domains.numbers.models.v1.AvailableRegionsDtoTest; -import com.sinch.sdk.domains.numbers.models.v1.NumberType; -import com.sinch.sdk.domains.numbers.models.v1.regions.available.request.AvailableRegionListRequest; -import com.sinch.sdk.domains.numbers.models.v1.regions.available.response.AvailableRegionListResponse; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Map; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.mockito.Mock; - -@TestWithResources -class AvailableRegionServiceTest extends BaseTest { - - @Mock HttpClient httpClient; - @Mock ServerConfiguration serverConfiguration; - @Mock Map authManagers; - AvailableRegionService service; - - static final String uriUUID = "foo"; - static final Collection NUMBERS_AUTH_NAMES = Arrays.asList("Basic", "OAuth2.0"); - - @GivenTextResource("/domains/numbers/v1/regions/available-regions-list.json") - String jsonRegionsResponseDto; - - @BeforeEach - public void initMocks() { - service = - new AvailableRegionsServiceImpl( - httpClient, serverConfiguration, authManagers, HttpMapper.getInstance(), uriUUID); - } - - @Test - void list() throws ApiException { - - HttpRequest httpRequest = - new HttpRequest( - "/v1/projects/" + URLPathUtils.encodePathSegment(uriUUID) + "/availableRegions", - HttpMethod.GET, - Arrays.asList( - new URLParameter("types", Arrays.asList(NumberType.MOBILE), STYLE.FORM, true)), - (String) null, - Collections.emptyMap(), - Collections.singletonList(HttpContentType.APPLICATION_JSON), - Collections.emptyList(), - NUMBERS_AUTH_NAMES); - HttpResponse httpResponse = - new HttpResponse(200, null, Collections.emptyMap(), jsonRegionsResponseDto.getBytes()); - - when(httpClient.invokeAPI( - eq(serverConfiguration), - eq(authManagers), - argThat(new HttpRequestMatcher(httpRequest)))) - .thenReturn(httpResponse); - - AvailableRegionListResponse response = - service.list( - AvailableRegionListRequest.builder() - .setTypes(Arrays.asList(NumberType.MOBILE)) - .build()); - - TestHelpers.recursiveEquals( - response.getContent(), AvailableRegionsDtoTest.availableRegionList.getAvailableRegions()); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/models/ActiveNumberBuilderTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/models/ActiveNumberBuilderTest.java deleted file mode 100644 index f3b0fa6bc..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/models/ActiveNumberBuilderTest.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.sinch.sdk.domains.numbers.models; - -import java.time.Instant; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class ActiveNumberBuilderTest { - - final String phoneNumber = "01234"; - final String projectId = "project id"; - final String displayName = "display name"; - final String regionCode = "region"; - final NumberType type = NumberType.MOBILE; - final Collection capability = Arrays.asList(Capability.VOICE, Capability.SMS); - - final Money money = new Money("foo money", 0.50); - - final Integer paymentIntervalMonths = 5; - - final Instant nextChargeDate = Instant.now(); - - final Instant expireAt = Instant.now(); - - final SMSConfiguration smsConfiguration = - new SMSConfiguration( - "service plan id", - "campaign id", - new ScheduledSmsProvisioning( - "service plan id from scheduled", - "campaign id from scheduled", - ProvisioningStatus.FAILED, - Instant.now(), - Collections.singletonList(SmsErrorCode.ERROR_CODE_UNSPECIFIED))); - final VoiceConfiguration voiceConfiguration = - new VoiceConfiguration( - "app id", - Instant.now(), - new ScheduledVoiceProvisioning( - "app id from scheduled", ProvisioningStatus.IN_PROGRESS, Instant.now())); - - final String callbackUrl = "foo callback"; - final ActiveNumber value = - ActiveNumber.builder() - .setPhoneNumber(phoneNumber) - .setProjectId(projectId) - .setDisplayName(displayName) - .setRegionCode(regionCode) - .setType(type) - .setCapability(capability) - .setMoney(money) - .setPaymentIntervalMonths(paymentIntervalMonths) - .setNextChargeDate(nextChargeDate) - .setExpireAt(expireAt) - .setSmsConfiguration(smsConfiguration) - .setVoiceConfiguration(voiceConfiguration) - .setCallbackUrl(callbackUrl) - .build(); - - @Test - void getPhoneNumber() { - Assertions.assertThat(value.getPhoneNumber()).isEqualTo(phoneNumber); - } - - @Test - void getProjectId() { - Assertions.assertThat(value.getProjectId()).isEqualTo(projectId); - } - - @Test - void getDisplayName() { - Assertions.assertThat(value.getDisplayName()).isEqualTo(displayName); - } - - @Test - void getRegionCode() { - Assertions.assertThat(value.getRegionCode()).isEqualTo(regionCode); - } - - @Test - void getType() { - Assertions.assertThat(value.getType()).usingRecursiveComparison().isEqualTo(type); - } - - @Test - void getCapability() { - Assertions.assertThat(value.getCapability()).usingRecursiveComparison().isEqualTo(capability); - } - - @Test - void getMoney() { - Assertions.assertThat(value.getMoney()).isEqualTo(money); - } - - @Test - void getPaymentIntervalMonths() { - Assertions.assertThat(value.getPaymentIntervalMonths()).isEqualTo(paymentIntervalMonths); - } - - @Test - void getNextChargeDate() { - Assertions.assertThat(value.getNextChargeDate()).isEqualTo(nextChargeDate); - } - - @Test - void getExpireAt() { - Assertions.assertThat(value.getExpireAt()).isEqualTo(expireAt); - } - - @Test - void getSmsConfiguration() { - Assertions.assertThat(value.getSmsConfiguration()).isEqualTo(smsConfiguration); - } - - @Test - void getVoiceConfiguration() { - Assertions.assertThat(value.getVoiceConfiguration()).isEqualTo(voiceConfiguration); - } - - @Test - void getCallbackUrl() { - Assertions.assertThat(value.getCallbackUrl()).isEqualTo(callbackUrl); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/models/ActiveNumberTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/models/ActiveNumberTest.java deleted file mode 100644 index a598ed46f..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/models/ActiveNumberTest.java +++ /dev/null @@ -1,125 +0,0 @@ -package com.sinch.sdk.domains.numbers.models; - -import java.time.Instant; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class ActiveNumberTest { - - final String phoneNumber = "01234"; - final String projectId = "project id"; - final String displayName = "display name"; - final String regionCode = "region"; - final NumberType type = NumberType.MOBILE; - final Collection capability = Arrays.asList(Capability.VOICE, Capability.SMS); - - final Money money = new Money("foo money", 0.50); - - final Integer paymentIntervalMonths = 5; - - final Instant nextChargeDate = Instant.now(); - - final Instant expireAt = Instant.now(); - - final SMSConfiguration smsConfiguration = - new SMSConfiguration( - "service plan id", - "campaign id", - new ScheduledSmsProvisioning( - "service plan id from scheduled", - "campaign id from scheduled", - ProvisioningStatus.FAILED, - Instant.now(), - Collections.singletonList(SmsErrorCode.ERROR_CODE_UNSPECIFIED))); - final VoiceConfiguration voiceConfiguration = - new VoiceConfiguration( - "app id", - Instant.now(), - new ScheduledVoiceProvisioning( - "app id from scheduled", ProvisioningStatus.IN_PROGRESS, Instant.now())); - - final String callbackUrl = "foo callback"; - final ActiveNumber value = - new ActiveNumber( - phoneNumber, - projectId, - displayName, - regionCode, - type, - capability, - money, - paymentIntervalMonths, - nextChargeDate, - expireAt, - smsConfiguration, - voiceConfiguration, - callbackUrl); - - @Test - void getPhoneNumber() { - Assertions.assertThat(value.getPhoneNumber()).isEqualTo(phoneNumber); - } - - @Test - void getProjectId() { - Assertions.assertThat(value.getProjectId()).isEqualTo(projectId); - } - - @Test - void getDisplayName() { - Assertions.assertThat(value.getDisplayName()).isEqualTo(displayName); - } - - @Test - void getRegionCode() { - Assertions.assertThat(value.getRegionCode()).isEqualTo(regionCode); - } - - @Test - void getType() { - Assertions.assertThat(value.getType()).usingRecursiveComparison().isEqualTo(type); - } - - @Test - void getCapability() { - Assertions.assertThat(value.getCapability()).usingRecursiveComparison().isEqualTo(capability); - } - - @Test - void getMoney() { - Assertions.assertThat(value.getMoney()).isEqualTo(money); - } - - @Test - void getPaymentIntervalMonths() { - Assertions.assertThat(value.getPaymentIntervalMonths()).isEqualTo(paymentIntervalMonths); - } - - @Test - void getNextChargeDate() { - Assertions.assertThat(value.getNextChargeDate()).isEqualTo(nextChargeDate); - } - - @Test - void getExpireAt() { - Assertions.assertThat(value.getExpireAt()).isEqualTo(expireAt); - } - - @Test - void getSmsConfiguration() { - Assertions.assertThat(value.getSmsConfiguration()).isEqualTo(smsConfiguration); - } - - @Test - void getVoiceConfiguration() { - Assertions.assertThat(value.getVoiceConfiguration()).isEqualTo(voiceConfiguration); - } - - @Test - void getCallbackUrl() { - Assertions.assertThat(value.getCallbackUrl()).isEqualTo(callbackUrl); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/models/AvailableNumberBuilderTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/models/AvailableNumberBuilderTest.java deleted file mode 100644 index c7016f868..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/models/AvailableNumberBuilderTest.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.sinch.sdk.domains.numbers.models; - -import java.util.Arrays; -import java.util.Collection; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class AvailableNumberBuilderTest { - - final String phoneNumber = "01234"; - final String regionCode = "region"; - final NumberType type = NumberType.MOBILE; - final Collection capability = Arrays.asList(Capability.VOICE, Capability.SMS); - final Money setupPrice = new Money("setup currency", .5); - final Money monthlyPrice = new Money("monthly currency", 1.5); - final Integer paymentIntervalMonths = 23; - final Boolean supportingDocumentationRequired = true; - - final AvailableNumber value = - AvailableNumber.builder() - .setPhoneNumber(phoneNumber) - .setRegionCode(regionCode) - .setType(type) - .setCapability(capability) - .setSetupPrice(setupPrice) - .setMonthlyPrice(monthlyPrice) - .setPaymentIntervalMonths(paymentIntervalMonths) - .setSupportingDocumentationRequired(supportingDocumentationRequired) - .build(); - - @Test - void getPhoneNumber() { - Assertions.assertThat(value.getPhoneNumber()).isEqualTo(phoneNumber); - } - - @Test - void getRegionCode() { - Assertions.assertThat(value.getRegionCode()).isEqualTo(regionCode); - } - - @Test - void getType() { - Assertions.assertThat(value.getType()).usingRecursiveComparison().isEqualTo(type); - } - - @Test - void getCapability() { - Assertions.assertThat(value.getCapability()).usingRecursiveComparison().isEqualTo(capability); - } - - @Test - void getSetupPrice() { - Assertions.assertThat(value.getSetupPrice()).usingRecursiveComparison().isEqualTo(setupPrice); - } - - @Test - void getMonthlyPrice() { - Assertions.assertThat(value.getMonthlyPrice()) - .usingRecursiveComparison() - .isEqualTo(monthlyPrice); - } - - @Test - void getPaymentIntervalMonths() { - Assertions.assertThat(value.getPaymentIntervalMonths()).isEqualTo(paymentIntervalMonths); - } - - @Test - void getSupportingDocumentationRequired() { - Assertions.assertThat(value.getSupportingDocumentationRequired()) - .isEqualTo(supportingDocumentationRequired); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/models/AvailableNumberTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/models/AvailableNumberTest.java deleted file mode 100644 index a72ba19d7..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/models/AvailableNumberTest.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.sinch.sdk.domains.numbers.models; - -import java.util.Arrays; -import java.util.Collection; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class AvailableNumberTest { - - final String phoneNumber = "01234"; - final String regionCode = "region"; - final NumberType type = NumberType.MOBILE; - final Collection capability = Arrays.asList(Capability.VOICE, Capability.SMS); - final Money setupPrice = new Money("setup currency", .5); - final Money monthlyPrice = new Money("monthly currency", 1.5); - final Integer paymentIntervalMonths = 23; - final Boolean supportingDocumentationRequired = true; - - final AvailableNumber value = - new AvailableNumber( - phoneNumber, - regionCode, - type, - capability, - setupPrice, - monthlyPrice, - paymentIntervalMonths, - supportingDocumentationRequired); - - @Test - void getPhoneNumber() { - Assertions.assertThat(value.getPhoneNumber()).isEqualTo(phoneNumber); - } - - @Test - void getRegionCode() { - Assertions.assertThat(value.getRegionCode()).isEqualTo(regionCode); - } - - @Test - void getType() { - Assertions.assertThat(value.getType()).usingRecursiveComparison().isEqualTo(type); - } - - @Test - void getCapability() { - Assertions.assertThat(value.getCapability()).usingRecursiveComparison().isEqualTo(capability); - } - - @Test - void getSetupPrice() { - Assertions.assertThat(value.getSetupPrice()).usingRecursiveComparison().isEqualTo(setupPrice); - } - - @Test - void getMonthlyPrice() { - Assertions.assertThat(value.getMonthlyPrice()) - .usingRecursiveComparison() - .isEqualTo(monthlyPrice); - } - - @Test - void getPaymentIntervalMonths() { - Assertions.assertThat(value.getPaymentIntervalMonths()).isEqualTo(paymentIntervalMonths); - } - - @Test - void getSupportingDocumentationRequired() { - Assertions.assertThat(value.getSupportingDocumentationRequired()) - .isEqualTo(supportingDocumentationRequired); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/models/CallbackConfigurationBuilderTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/models/CallbackConfigurationBuilderTest.java deleted file mode 100644 index cd4d0c327..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/models/CallbackConfigurationBuilderTest.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.sinch.sdk.domains.numbers.models; - -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class CallbackConfigurationBuilderTest { - - final CallbackConfiguration value = - CallbackConfiguration.builder() - .setProjectId("project id") - .setHMACSecret("a HMAC secret") - .build(); - - @Test - void getProjectId() { - Assertions.assertThat(value.getProjectId()).isEqualTo("project id"); - } - - @Test - void getHMACSecret() { - Assertions.assertThat(value.getHMACSecret()).isEqualTo("a HMAC secret"); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/models/CallbackConfigurationTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/models/CallbackConfigurationTest.java deleted file mode 100644 index 85153ff6f..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/models/CallbackConfigurationTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.sinch.sdk.domains.numbers.models; - -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class CallbackConfigurationTest { - - final CallbackConfiguration value = - new CallbackConfiguration("the project id", "the secret HMAC"); - - @Test - void getProjectId() { - Assertions.assertThat(value.getProjectId()).isEqualTo("the project id"); - } - - @Test - void getHMACSecret() { - Assertions.assertThat(value.getHMACSecret()).isEqualTo("the secret HMAC"); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/models/CapabilityTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/models/CapabilityTest.java deleted file mode 100644 index 6aa0a3a39..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/models/CapabilityTest.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.sinch.sdk.domains.numbers.models; - -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class CapabilityTest { - - final Capability newDefinedValue = Capability.from("foo"); - - @Test - void values() { - Assertions.assertThat(Capability.values()).contains(Capability.SMS); - } - - @Test - void fromDefined() { - Assertions.assertThat(Capability.from("SMS")).isEqualTo(Capability.SMS); - } - - @Test - void fromUndefined() { - Assertions.assertThat(newDefinedValue.value()).isEqualTo("foo"); - Assertions.assertThat(Capability.values()).contains(newDefinedValue); - } - - @Test - void valueOf() { - Assertions.assertThat(Capability.valueOf(newDefinedValue)).isEqualTo("foo"); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/models/MoneyBuilderTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/models/MoneyBuilderTest.java deleted file mode 100644 index 8a9822d46..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/models/MoneyBuilderTest.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.sinch.sdk.domains.numbers.models; - -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class MoneyBuilderTest { - - final Money value = Money.builder().setAmount(.9).setCurrencyCode("currency").build(); - - @Test - void getCurrencyCode() { - Assertions.assertThat(value.getCurrencyCode()).isEqualTo("currency"); - } - - @Test - void getAmount() { - Assertions.assertThat(value.getAmount()).isEqualTo(.9); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/models/MoneyTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/models/MoneyTest.java deleted file mode 100644 index 0b93a741f..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/models/MoneyTest.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.sinch.sdk.domains.numbers.models; - -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class MoneyTest { - - final Money value = new Money("currency", .9); - - @Test - void getCurrencyCode() { - Assertions.assertThat(value.getCurrencyCode()).isEqualTo("currency"); - } - - @Test - void getAmount() { - Assertions.assertThat(value.getAmount()).isEqualTo(.9); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/models/NumberPatternBuilderTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/models/NumberPatternBuilderTest.java deleted file mode 100644 index c0217d77e..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/models/NumberPatternBuilderTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.sinch.sdk.domains.numbers.models; - -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class NumberPatternBuilderTest { - final NumberPattern value = - NumberPattern.builder() - .setPattern("a pattern") - .setSearchPattern(SearchPattern.CONTAINS) - .build(); - - @Test - void getPattern() { - Assertions.assertThat(value.getPattern()).isEqualTo("a pattern"); - } - - @Test - void getSearchPattern() { - Assertions.assertThat(value.getSearchPattern()).isEqualTo(SearchPattern.CONTAINS); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/models/NumberPatternTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/models/NumberPatternTest.java deleted file mode 100644 index 9d46994b3..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/models/NumberPatternTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.sinch.sdk.domains.numbers.models; - -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class NumberPatternTest { - final NumberPattern value = new NumberPattern("a pattern", SearchPattern.CONTAINS); - - @Test - void getPattern() { - Assertions.assertThat(value.getPattern()).isEqualTo("a pattern"); - } - - @Test - void getSearchPattern() { - Assertions.assertThat(value.getSearchPattern()).isEqualTo(SearchPattern.CONTAINS); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/models/NumberTypeTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/models/NumberTypeTest.java deleted file mode 100644 index 5b9f5bd9a..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/models/NumberTypeTest.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.sinch.sdk.domains.numbers.models; - -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class NumberTypeTest { - final NumberType newDefinedValue = NumberType.from("foo"); - - @Test - void values() { - Assertions.assertThat(NumberType.values()).contains(NumberType.LOCAL); - } - - @Test - void fromDefined() { - Assertions.assertThat(NumberType.from("LOCAL")).isEqualTo(NumberType.LOCAL); - } - - @Test - void fromUndefined() { - Assertions.assertThat(newDefinedValue.value()).isEqualTo("foo"); - Assertions.assertThat(NumberType.values()).contains(newDefinedValue); - } - - @Test - void valueOf() { - Assertions.assertThat(NumberType.valueOf(newDefinedValue)).isEqualTo("foo"); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/models/RegionBuilderTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/models/RegionBuilderTest.java deleted file mode 100644 index 852e46d07..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/models/RegionBuilderTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.sinch.sdk.domains.numbers.models; - -import java.util.Collection; -import java.util.Collections; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class RegionBuilderTest { - - Collection types = Collections.singletonList(NumberType.TOLL_FREE); - final Region value = - Region.builder().setRegionCode("foo code").setRegionName("foo name").setTypes(types).build(); - - @Test - void getRegionCode() { - Assertions.assertThat(value.getRegionCode()).isEqualTo("foo code"); - } - - @Test - void getRegionName() { - Assertions.assertThat(value.getRegionName()).isEqualTo("foo name"); - } - - @Test - void getTypes() { - Assertions.assertThat(value.getTypes()).usingRecursiveComparison().isEqualTo(types); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/models/RegionTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/models/RegionTest.java deleted file mode 100644 index de19a9477..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/models/RegionTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.sinch.sdk.domains.numbers.models; - -import java.util.Collection; -import java.util.Collections; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class RegionTest { - - Collection types = Collections.singletonList(NumberType.TOLL_FREE); - final Region value = new Region("foo code", "foo name", types); - - @Test - void getRegionCode() { - Assertions.assertThat(value.getRegionCode()).isEqualTo("foo code"); - } - - @Test - void getRegionName() { - Assertions.assertThat(value.getRegionName()).isEqualTo("foo name"); - } - - @Test - void getTypes() { - Assertions.assertThat(value.getTypes()).usingRecursiveComparison().isEqualTo(types); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/models/requests/ActiveNumberListRequestParametersBuilderTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/models/requests/ActiveNumberListRequestParametersBuilderTest.java deleted file mode 100644 index 08a50fe2c..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/models/requests/ActiveNumberListRequestParametersBuilderTest.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.requests; - -import com.sinch.sdk.domains.numbers.models.*; -import java.util.Arrays; -import java.util.Collection; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -public class ActiveNumberListRequestParametersBuilderTest { - - static final String regionCode = "foo region"; - static final NumberType type = NumberType.MOBILE; - static final NumberPattern numberPattern = - NumberPattern.builder().setPattern("a pattern").setSearchPattern(SearchPattern.END).build(); - static final Collection capabilities = - Arrays.asList(Capability.VOICE, Capability.SMS); - static final Integer pageSize = 45; - - static final String pageToken = "page token"; - - static final OrderBy orderBy = OrderBy.PHONE_NUMBER; - public static final ActiveNumberListRequestParameters value = - ActiveNumberListRequestParameters.builder() - .setRegionCode(regionCode) - .setType(type) - .setNumberPattern(numberPattern) - .setCapabilities(capabilities) - .setPageSize(pageSize) - .setPageToken(pageToken) - .setOrderBy(orderBy) - .build(); - - @Test - void getRegionCode() { - Assertions.assertThat(value.getRegionCode().get()).isEqualTo(regionCode); - } - - @Test - void getType() { - Assertions.assertThat(value.getType().get()).usingRecursiveComparison().isEqualTo(type); - } - - @Test - void getNumberPattern() { - Assertions.assertThat(value.getNumberPattern().get()) - .usingRecursiveComparison() - .isEqualTo(numberPattern); - } - - @Test - void getCapabilities() { - Assertions.assertThat(value.getCapabilities().get()) - .usingRecursiveComparison() - .isEqualTo(capabilities); - } - - @Test - void getPageSize() { - Assertions.assertThat(value.getPageSize().get()).isEqualTo(pageSize); - } - - @Test - void getPageToken() { - Assertions.assertThat(value.getPageToken().get()).isEqualTo(pageToken); - } - - @Test - void getOrderBy() { - Assertions.assertThat(value.getOrderBy().get()).isEqualTo(orderBy); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/models/requests/AvailableNumberListAllRequestParametersBuilderTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/models/requests/AvailableNumberListAllRequestParametersBuilderTest.java deleted file mode 100644 index 547217679..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/models/requests/AvailableNumberListAllRequestParametersBuilderTest.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.requests; - -import com.sinch.sdk.domains.numbers.models.Capability; -import com.sinch.sdk.domains.numbers.models.NumberPattern; -import com.sinch.sdk.domains.numbers.models.NumberType; -import com.sinch.sdk.domains.numbers.models.SearchPattern; -import java.util.Arrays; -import java.util.Collection; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class AvailableNumberListAllRequestParametersBuilderTest { - - final String regionCode = "foo region"; - final NumberType type = NumberType.MOBILE; - final NumberPattern numberPattern = - NumberPattern.builder().setPattern("a pattern").setSearchPattern(SearchPattern.END).build(); - final Collection capabilities = Arrays.asList(Capability.VOICE, Capability.SMS); - final Integer size = 145; - - final AvailableNumberListAllRequestParameters value = - AvailableNumberListAllRequestParameters.builder() - .setRegionCode(regionCode) - .setType(type) - .setNumberPattern(numberPattern) - .setCapabilities(capabilities) - .setSize(size) - .build(); - - @Test - void getRegionCode() { - Assertions.assertThat(value.getRegionCode().get()).isEqualTo(regionCode); - } - - @Test - void getType() { - Assertions.assertThat(value.getType().get()).usingRecursiveComparison().isEqualTo(type); - } - - @Test - void getNumberPattern() { - Assertions.assertThat(value.getNumberPattern().get()) - .usingRecursiveComparison() - .isEqualTo(numberPattern); - } - - @Test - void getCapabilities() { - Assertions.assertThat(value.getCapabilities().get()) - .usingRecursiveComparison() - .isEqualTo(capabilities); - } - - @Test - void getSize() { - Assertions.assertThat(value.getSize().get()).isEqualTo(size); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/models/requests/AvailableNumberRentRequestParametersAnyBuilderTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/models/requests/AvailableNumberRentRequestParametersAnyBuilderTest.java deleted file mode 100644 index 30003afdc..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/models/requests/AvailableNumberRentRequestParametersAnyBuilderTest.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.numbers.models.Capability; -import com.sinch.sdk.domains.numbers.models.NumberPattern; -import com.sinch.sdk.domains.numbers.models.NumberType; -import com.sinch.sdk.domains.numbers.models.SearchPattern; -import java.util.Arrays; -import java.util.Collection; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class AvailableNumberRentRequestParametersAnyBuilderTest { - - final String regionCode = "foo region"; - final NumberType type = NumberType.MOBILE; - final NumberPattern numberPattern = - NumberPattern.builder().setPattern("a pattern").setSearchPattern(SearchPattern.END).build(); - final Collection capabilities = Arrays.asList(Capability.VOICE, Capability.SMS); - - final RentSMSConfigurationRequestParameters smsConfiguration = - RentSMSConfigurationRequestParameters.builder() - .setServicePlanId("plan id") - .setCampaignId("campaign id") - .build(); - - final RentVoiceConfigurationRequestParameters voiceConfiguration = - RentVoiceConfigurationRequestParameters.builder().setAppId("app id").build(); - final String callbackUrl = " the callback"; - - final AvailableNumberRentAnyRequestParameters value = - AvailableNumberRentAnyRequestParameters.builder() - .setRegionCode(regionCode) - .setType(type) - .setNumberPattern(numberPattern) - .setCapabilities(capabilities) - .setSmsConfiguration(smsConfiguration) - .setVoiceConfiguration(voiceConfiguration) - .setCallbackUrl(callbackUrl) - .build(); - - @Test - void getRegionCode() { - Assertions.assertThat(value.getRegionCode().get()).isEqualTo(regionCode); - } - - @Test - void getType() { - Assertions.assertThat(value.getType().get()).isEqualTo(type); - } - - @Test - void getNumberPattern() { - Assertions.assertThat(value.getNumberPattern()).isEqualTo(OptionalValue.of(numberPattern)); - } - - @Test - void getCapabilities() { - Assertions.assertThat(value.getCapabilities()).isEqualTo(OptionalValue.of(capabilities)); - } - - @Test - void getSmsConfiguration() { - Assertions.assertThat(value.getSmsConfiguration()) - .isEqualTo(OptionalValue.of(smsConfiguration)); - } - - @Test - void getVoiceConfiguration() { - Assertions.assertThat(value.getVoiceConfiguration()) - .isEqualTo(OptionalValue.of(voiceConfiguration)); - } - - @Test - void getCallBackUrl() { - Assertions.assertThat(value.getCallBackUrl()).isEqualTo(OptionalValue.of(callbackUrl)); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/models/requests/AvailableNumberRentRequestParametersBuilderTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/models/requests/AvailableNumberRentRequestParametersBuilderTest.java deleted file mode 100644 index 85c720f2d..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/models/requests/AvailableNumberRentRequestParametersBuilderTest.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class AvailableNumberRentRequestParametersBuilderTest { - - RentSMSConfigurationRequestParameters smsConfiguration = - RentSMSConfigurationRequestParameters.builder() - .setServicePlanId("plan id") - .setCampaignId("campaign id") - .build(); - - RentVoiceConfigurationRequestParameters voiceConfiguration = - RentVoiceConfigurationRequestParameters.builder().setAppId("app id").build(); - String callbackUrl = "the callback"; - - final AvailableNumberRentRequestParameters value = - AvailableNumberRentRequestParameters.builder() - .setSmsConfiguration(smsConfiguration) - .setVoiceConfiguration(voiceConfiguration) - .setCallbackUrl(callbackUrl) - .build(); - - @Test - void getSmsConfiguration() { - Assertions.assertThat(value.getSmsConfiguration()) - .isEqualTo(OptionalValue.of(smsConfiguration)); - } - - @Test - void getVoiceConfiguration() { - Assertions.assertThat(value.getVoiceConfiguration()) - .isEqualTo(OptionalValue.of(voiceConfiguration)); - } - - @Test - void getCallBackUrl() { - Assertions.assertThat(value.getCallBackUrl()).isEqualTo(OptionalValue.of(callbackUrl)); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/models/requests/AvailableRegionListAllRequestParametersBuilderTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/models/requests/AvailableRegionListAllRequestParametersBuilderTest.java deleted file mode 100644 index 2edc31e60..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/models/requests/AvailableRegionListAllRequestParametersBuilderTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.requests; - -import com.sinch.sdk.domains.numbers.models.NumberType; -import java.util.Arrays; -import java.util.Collection; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class AvailableRegionListAllRequestParametersBuilderTest { - - final Collection types = Arrays.asList(NumberType.MOBILE, NumberType.TOLL_FREE); - - final AvailableRegionListAllRequestParameters value = - AvailableRegionListAllRequestParameters.builder().setTypes(types).build(); - - @Test - void getTypes() { - Assertions.assertThat(value.getTypes().get()).usingRecursiveComparison().isEqualTo(types); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/models/requests/CallbackConfigurationUpdateRequestParametersBuilderTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/models/requests/CallbackConfigurationUpdateRequestParametersBuilderTest.java deleted file mode 100644 index 4524f767c..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/models/requests/CallbackConfigurationUpdateRequestParametersBuilderTest.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.requests; - -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class CallbackConfigurationUpdateRequestParametersBuilderTest { - - final CallbackConfigurationUpdateRequestParameters value = - CallbackConfigurationUpdateRequestParameters.builder().setHMACSecret("hmac value").build(); - - @Test - void getHMACSecret() { - Assertions.assertThat(value.getHMACSecret().get()).isEqualTo("hmac value"); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/models/requests/RentSMSConfigurationRequestParametersBuilderTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/models/requests/RentSMSConfigurationRequestParametersBuilderTest.java deleted file mode 100644 index 2d66dc6a0..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/models/requests/RentSMSConfigurationRequestParametersBuilderTest.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class RentSMSConfigurationRequestParametersBuilderTest { - RentSMSConfigurationRequestParameters value = - RentSMSConfigurationRequestParameters.builder() - .setServicePlanId("plan id") - .setCampaignId("campaign id") - .build(); - - RentSMSConfigurationRequestParameters valueNoCampaign = - RentSMSConfigurationRequestParameters.builder().setServicePlanId("plan id").build(); - - @Test - void getServicePlanId() { - Assertions.assertThat(value.getServicePlanId()).isEqualTo(OptionalValue.of("plan id")); - } - - @Test - void getCampaignId() { - Assertions.assertThat(value.getCampaignId()).isEqualTo(OptionalValue.of("campaign id")); - } - - @Test - void geCampaignIdEmpty() { - Assertions.assertThat(valueNoCampaign.getCampaignId()).isEqualTo(OptionalValue.empty()); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/models/requests/RentVoiceConfigurationRequestParametersBuilderTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/models/requests/RentVoiceConfigurationRequestParametersBuilderTest.java deleted file mode 100644 index 541de77f5..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/models/requests/RentVoiceConfigurationRequestParametersBuilderTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class RentVoiceConfigurationRequestParametersBuilderTest { - - RentVoiceConfigurationRequestParameters value = - RentVoiceConfigurationRequestParameters.builder().setAppId("app id").build(); - - @Test - void getAppId() { - Assertions.assertThat(value.getAppId()).isEqualTo(OptionalValue.of("app id")); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/models/responses/ActiveNumberListResponseTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/models/responses/ActiveNumberListResponseTest.java deleted file mode 100644 index a646b460b..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/models/responses/ActiveNumberListResponseTest.java +++ /dev/null @@ -1,166 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.responses; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.when; - -import com.sinch.sdk.BaseTest; -import com.sinch.sdk.core.models.pagination.Page; -import com.sinch.sdk.core.models.pagination.TokenPageNavigator; -import com.sinch.sdk.domains.numbers.ActiveNumberService; -import com.sinch.sdk.domains.numbers.models.ActiveNumber; -import com.sinch.sdk.domains.numbers.models.Capability; -import com.sinch.sdk.domains.numbers.models.Money; -import com.sinch.sdk.domains.numbers.models.NumberType; -import com.sinch.sdk.domains.numbers.models.ProvisioningStatus; -import com.sinch.sdk.domains.numbers.models.SMSConfiguration; -import com.sinch.sdk.domains.numbers.models.ScheduledSmsProvisioning; -import com.sinch.sdk.domains.numbers.models.ScheduledVoiceProvisioning; -import com.sinch.sdk.domains.numbers.models.SmsErrorCode; -import com.sinch.sdk.domains.numbers.models.VoiceConfiguration; -import com.sinch.sdk.domains.numbers.models.requests.ActiveNumberListRequestParameters; -import com.sinch.sdk.domains.numbers.models.requests.ActiveNumberListRequestParametersBuilderTest; -import java.time.Instant; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.NoSuchElementException; -import java.util.concurrent.ThreadLocalRandom; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.Mock; - -class ActiveNumberListResponseTest extends BaseTest { - - @Mock ActiveNumberService service; - - List list = - Stream.generate( - () -> - ActiveNumber.builder() - .setPhoneNumber(String.valueOf(Math.random())) - .setProjectId(String.valueOf(Math.random())) - .setDisplayName(String.valueOf(Math.random())) - .setRegionCode(String.valueOf(Math.random())) - .setType(NumberType.from(String.valueOf(Math.random()))) - .setCapability(Arrays.asList(Capability.VOICE, Capability.SMS)) - .setMoney(new Money(String.valueOf(Math.random()), Math.random())) - .setPaymentIntervalMonths((int) (Math.random() * 12)) - .setNextChargeDate( - Instant.ofEpochMilli(ThreadLocalRandom.current().nextLong())) - .setExpireAt(Instant.ofEpochMilli(ThreadLocalRandom.current().nextLong())) - .setSmsConfiguration( - new SMSConfiguration( - String.valueOf(Math.random()), - String.valueOf(Math.random()), - new ScheduledSmsProvisioning( - String.valueOf(Math.random()), - String.valueOf(Math.random()), - ProvisioningStatus.FAILED, - Instant.ofEpochMilli(ThreadLocalRandom.current().nextLong()), - Collections.singletonList(SmsErrorCode.ERROR_CODE_UNSPECIFIED)))) - .setVoiceConfiguration( - new VoiceConfiguration( - String.valueOf(Math.random()), - Instant.ofEpochMilli(ThreadLocalRandom.current().nextLong()), - new ScheduledVoiceProvisioning( - String.valueOf(Math.random()), - ProvisioningStatus.IN_PROGRESS, - Instant.ofEpochMilli(ThreadLocalRandom.current().nextLong())))) - .setCallbackUrl(String.valueOf(Math.random())) - .build()) - .limit(13) - .collect(Collectors.toList()); - - List> pages = - Arrays.asList( - new Page<>( - ActiveNumberListRequestParametersBuilderTest.value, - list.stream().limit(5).collect(Collectors.toList()), - new TokenPageNavigator("foo page2")), - new Page<>( - ActiveNumberListRequestParametersBuilderTest.value, - list.stream().skip(5).limit(5).collect(Collectors.toList()), - new TokenPageNavigator("foo page3")), - new Page<>( - ActiveNumberListRequestParametersBuilderTest.value, - list.stream().skip(10).collect(Collectors.toList()), - null)); - - @Test - void autoPageIter() { - setupMockedService(); - AtomicInteger count = new AtomicInteger(); - ActiveNumberListResponse response = new ActiveNumberListResponse(service, pages.get(0)); - response - .iterator() - .forEachRemaining( - value -> { - Assertions.assertThat(value) - .usingRecursiveComparison() - .isEqualTo(list.get(count.get())); - count.getAndIncrement(); - }); - assertEquals(count.get(), list.size()); - } - - @Test - void hasNextPage() { - - ActiveNumberListResponse response = new ActiveNumberListResponse(service, pages.get(0)); - assertTrue(response.hasNextPage()); - response = new ActiveNumberListResponse(service, pages.get(1)); - assertTrue(response.hasNextPage()); - response = new ActiveNumberListResponse(service, pages.get(2)); - assertFalse(response.hasNextPage()); - } - - @Test - void nextPage() { - - setupMockedService(); - ActiveNumberListResponse response = new ActiveNumberListResponse(service, pages.get(0)); - int page = 1; - while (response.hasNextPage()) { - response = response.nextPage(); - Assertions.assertThat(response.getContent()) - .usingRecursiveComparison() - .isEqualTo(pages.get(page).getEntities()); - page++; - } - assertThrows(NoSuchElementException.class, response::nextPage); - } - - @Test - void getContent() { - - for (Page page : pages) { - ActiveNumberListResponse response = new ActiveNumberListResponse(service, page); - Assertions.assertThat(response.getContent()) - .usingRecursiveComparison() - .isEqualTo(page.getEntities()); - } - } - - void setupMockedService() { - when(service.list(any(ActiveNumberListRequestParameters.class))) - .thenAnswer( - invocation -> { - ActiveNumberListRequestParameters parameters = - invocation.getArgument(0, ActiveNumberListRequestParameters.class); - switch (parameters.getPageToken().get()) { - case "foo page2": - return new ActiveNumberListResponse(service, pages.get(1)); - case "foo page3": - return new ActiveNumberListResponse(service, pages.get(2)); - } - return null; - }); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/models/responses/AvailableNumberListResponseTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/models/responses/AvailableNumberListResponseTest.java deleted file mode 100644 index 3af92d8b6..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/models/responses/AvailableNumberListResponseTest.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.responses; - -import static java.lang.String.valueOf; -import static org.junit.jupiter.api.Assertions.*; - -import com.sinch.sdk.domains.numbers.models.AvailableNumber; -import com.sinch.sdk.domains.numbers.models.Capability; -import com.sinch.sdk.domains.numbers.models.Money; -import com.sinch.sdk.domains.numbers.models.NumberType; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.NoSuchElementException; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class AvailableNumberListResponseTest { - - List list = - Stream.generate( - () -> - AvailableNumber.builder() - .setPhoneNumber(valueOf(Math.random())) - .setRegionCode(valueOf(Math.random())) - .setType(NumberType.LOCAL) - .setCapability(Collections.singletonList(Capability.VOICE)) - .setSetupPrice(new Money(valueOf(Math.random()), Math.random() * 100)) - .setMonthlyPrice(new Money(valueOf(Math.random()), Math.random() * 100)) - .setPaymentIntervalMonths((int) (Math.random() * 12)) - .setSupportingDocumentationRequired(true) - .build()) - .limit(15) - .collect(Collectors.toList()); - - AvailableNumberListResponse response = new AvailableNumberListResponse(new ArrayList<>(list)); - - @Test - void autoPageIter() { - AtomicInteger count = new AtomicInteger(); - response - .iterator() - .forEachRemaining( - value -> { - Assertions.assertThat(value) - .usingRecursiveComparison() - .isEqualTo(list.get(count.get())); - count.getAndIncrement(); - }); - assertEquals(count.get(), list.size()); - } - - @Test - void hasNextPage() { - assertFalse(response.hasNextPage(), "Has no next page"); - } - - @Test - void nextPage() { - assertThrows(NoSuchElementException.class, response::nextPage); - } - - @Test - void getContent() { - Assertions.assertThat(response.getContent()).usingRecursiveComparison().isEqualTo(list); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/models/responses/AvailableRegionListResponseTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/models/responses/AvailableRegionListResponseTest.java deleted file mode 100644 index dd5f58138..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/models/responses/AvailableRegionListResponseTest.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.responses; - -import static org.junit.jupiter.api.Assertions.*; - -import com.sinch.sdk.domains.numbers.models.NumberType; -import com.sinch.sdk.domains.numbers.models.Region; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.NoSuchElementException; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class AvailableRegionListResponseTest { - - List list = - Stream.generate( - () -> - Region.builder() - .setRegionCode(String.valueOf(Math.random())) - .setRegionName(String.valueOf(Math.random())) - .setTypes(Collections.singletonList(NumberType.TOLL_FREE)) - .build()) - .limit(15) - .collect(Collectors.toList()); - - AvailableRegionListResponse response = new AvailableRegionListResponse(new ArrayList<>(list)); - - @Test - void autoPageIter() { - AtomicInteger count = new AtomicInteger(); - response - .iterator() - .forEachRemaining( - value -> { - Assertions.assertThat(value) - .usingRecursiveComparison() - .isEqualTo(list.get(count.get())); - count.getAndIncrement(); - }); - assertEquals(count.get(), list.size()); - } - - @Test - void hasNextPage() { - assertFalse(response.hasNextPage(), "Has no next page"); - } - - @Test - void nextPage() { - assertThrows(NoSuchElementException.class, response::nextPage); - } - - @Test - void getContent() { - Assertions.assertThat(response.getContent()).usingRecursiveComparison().isEqualTo(list); - } -} diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/numbers/v1/AvailableRegionsSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/numbers/v1/AvailableRegionsSteps.java index 8d027dbb5..9b31dcf5c 100644 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/numbers/v1/AvailableRegionsSteps.java +++ b/client/src/test/java/com/sinch/sdk/e2e/domains/numbers/v1/AvailableRegionsSteps.java @@ -1,6 +1,5 @@ package com.sinch.sdk.e2e.domains.numbers.v1; -import com.sinch.sdk.domains.numbers.api.v1.AvailableRegionService; import com.sinch.sdk.domains.numbers.api.v1.AvailableRegionsService; import com.sinch.sdk.domains.numbers.models.v1.NumberType; import com.sinch.sdk.domains.numbers.models.v1.regions.available.request.AvailableRegionListRequest; @@ -15,16 +14,13 @@ public class AvailableRegionsSteps { - AvailableRegionService serviceDeprecated; AvailableRegionsService service; - AvailableRegionListResponse listResponseDeprecated; AvailableRegionListResponse listResponse; @Given("^the Numbers service \"Regions\" is available$") public void serviceAvailable() { - serviceDeprecated = Config.getSinchClient().numbers().v1().regions(); service = Config.getSinchClient().numbers().v1().regions(); } @@ -32,7 +28,6 @@ public void serviceAvailable() { public void list() { AvailableRegionListRequest parametersDeprecated = AvailableRegionListRequest.builder().build(); - listResponseDeprecated = serviceDeprecated.list(parametersDeprecated); AvailableRegionsListQueryParameters parameters = AvailableRegionsListQueryParameters.builder().build(); @@ -44,7 +39,6 @@ public void listTollFree() { AvailableRegionListRequest parametersDeprecated = AvailableRegionListRequest.builder().setTypes(Arrays.asList(NumberType.TOLL_FREE)).build(); - listResponseDeprecated = serviceDeprecated.list(parametersDeprecated); AvailableRegionsListQueryParameters parameters = AvailableRegionsListQueryParameters.builder() @@ -56,12 +50,6 @@ public void listTollFree() { @When("^I send a request to list the TOLL_FREE or MOBILE regions$") public void listTollOrMobileFree() { - AvailableRegionListRequest parametersDeprecated = - AvailableRegionListRequest.builder() - .setTypes(Arrays.asList(NumberType.TOLL_FREE, NumberType.MOBILE)) - .build(); - listResponseDeprecated = serviceDeprecated.list(parametersDeprecated); - AvailableRegionsListQueryParameters parameters = AvailableRegionsListQueryParameters.builder() .setTypes(Arrays.asList(NumberType.TOLL_FREE, NumberType.MOBILE)) @@ -72,19 +60,12 @@ public void listTollOrMobileFree() { @Then("the response contains \"{int}\" regions") public void listAllRegionsCountResult(int count) { - Assertions.assertEquals(count, listResponseDeprecated.stream().count()); Assertions.assertEquals(count, listResponse.stream().count()); } @Then("the response contains \"{int}\" TOLL_FREE regions") public void listTollFreeRegionsCountResult(int count) { - Assertions.assertEquals( - count, - listResponseDeprecated.stream() - .filter(f -> f.getTypes().contains(NumberType.TOLL_FREE)) - .count()); - Assertions.assertEquals( count, listResponse.stream().filter(f -> f.getTypes().contains(NumberType.TOLL_FREE)).count()); @@ -93,12 +74,6 @@ public void listTollFreeRegionsCountResult(int count) { @Then("the response contains \"{int}\" MOBILE regions") public void listMobileRegionsCountResult(int count) { - Assertions.assertEquals( - count, - listResponseDeprecated.stream() - .filter(f -> f.getTypes().contains(NumberType.MOBILE)) - .count()); - Assertions.assertEquals( count, listResponse.stream().filter(f -> f.getTypes().contains(NumberType.MOBILE)).count()); } @@ -106,12 +81,6 @@ public void listMobileRegionsCountResult(int count) { @Then("the response contains \"{int}\" LOCAL regions") public void listLocaleRegionsCountResult(int count) { - Assertions.assertEquals( - count, - listResponseDeprecated.stream() - .filter(f -> f.getTypes().contains(NumberType.LOCAL)) - .count()); - Assertions.assertEquals( count, listResponse.stream().filter(f -> f.getTypes().contains(NumberType.LOCAL)).count()); } diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/numbers/v1/NumbersSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/numbers/v1/NumbersSteps.java index db692c702..64faec050 100644 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/numbers/v1/NumbersSteps.java +++ b/client/src/test/java/com/sinch/sdk/e2e/domains/numbers/v1/NumbersSteps.java @@ -15,10 +15,8 @@ import com.sinch.sdk.domains.numbers.models.v1.VoiceConfigurationEST; import com.sinch.sdk.domains.numbers.models.v1.VoiceConfigurationFAX; import com.sinch.sdk.domains.numbers.models.v1.VoiceConfigurationRTC; -import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumberListRequest; import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumberUpdateRequest; import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumbersListQueryParameters; -import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberListRequest; import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentAnyRequest; import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentRequest; import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumbersListQueryParameters; @@ -41,17 +39,14 @@ public class NumbersSteps { NumbersService service; AvailableNumberListResponse searchForAvailableNumbersResponse; - AvailableNumberListResponse searchForAvailableNumbersResponseDeprecated; AvailableNumber checkAvailabilityResponse; ApiException availabilityResponseException; ActiveNumber rentAnyResponse; ActiveNumber rentResponse; ActiveNumberListResponse activeNumberListResponse; - ActiveNumberListResponse activeNumberListResponseDeprecated; ActiveNumberListResponse activeNumberListAllResponse; - ActiveNumberListResponse activeNumberListAllResponseDeprecated; ActiveNumber updateResponse; ActiveNumber getResponse; @@ -67,11 +62,6 @@ public void serviceAvailable() { @When("^I send a request to search for available phone numbers$") public void searchForAvailableNumbers() { - AvailableNumberListRequest parametersDeprecated = - AvailableNumberListRequest.builder().setRegionCode("US").setType(NumberType.LOCAL).build(); - searchForAvailableNumbersResponseDeprecated = - service.searchForAvailableNumbers(parametersDeprecated); - AvailableNumbersListQueryParameters parameters = AvailableNumbersListQueryParameters.builder() .setRegionCode("US") @@ -150,10 +140,6 @@ public void rentUnavailable(String phoneNumber) { @When("I send a request to list the phone numbers") public void list() { - ActiveNumberListRequest requestDeprecated = - ActiveNumberListRequest.builder().setRegionCode("US").setType(NumberType.LOCAL).build(); - activeNumberListResponseDeprecated = service.list(requestDeprecated); - ActiveNumbersListQueryParameters request = ActiveNumbersListQueryParameters.builder() .setRegionCode("US") @@ -165,10 +151,6 @@ public void list() { @When("I send a request to list all the phone numbers") public void listAll() { - ActiveNumberListRequest requestDeprecated = - ActiveNumberListRequest.builder().setRegionCode("US").setType(NumberType.LOCAL).build(); - activeNumberListAllResponseDeprecated = service.list(requestDeprecated); - ActiveNumbersListQueryParameters request = ActiveNumbersListQueryParameters.builder() .setRegionCode("US") @@ -210,7 +192,6 @@ public void release(String phoneNumber) { @Then("the response contains \"{int}\" available phone numbers") public void searchForAvailableNumbersResponse(int count) { - Assertions.assertEquals(count, searchForAvailableNumbersResponseDeprecated.stream().count()); Assertions.assertEquals(count, searchForAvailableNumbersResponse.stream().count()); } @@ -227,8 +208,6 @@ public void searchForAvailableNumbersOneItemResponse() { .setPaymentIntervalMonths(1) .setSupportingDocumentationRequired(true) .build(); - Assertions.assertEquals( - expected, searchForAvailableNumbersResponseDeprecated.stream().findFirst().orElse(null)); Assertions.assertEquals( expected, searchForAvailableNumbersResponse.stream().findFirst().orElse(null)); } @@ -351,14 +330,12 @@ public void rentResponse(String phoneNumber) { @Then("the response contains \"{int}\" phone numbers") public void listResult(int expected) { - Assertions.assertEquals(expected, activeNumberListResponseDeprecated.getContent().size()); Assertions.assertEquals(expected, activeNumberListResponse.getContent().size()); } @Then("the phone numbers list contains \"{int}\" phone numbers") public void listAllResult(int expected) { - Assertions.assertEquals(expected, activeNumberListAllResponseDeprecated.stream().count()); Assertions.assertEquals(expected, activeNumberListAllResponse.stream().count()); } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/AvailableRegionsService.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/AvailableRegionsService.java index 63999b3c3..894bf6ffe 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/AvailableRegionsService.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/AvailableRegionsService.java @@ -15,8 +15,7 @@ import com.sinch.sdk.domains.numbers.models.v1.regions.request.AvailableRegionsListQueryParameters; /** Available Regions Service */ -public interface AvailableRegionsService - extends com.sinch.sdk.domains.numbers.api.v1.AvailableRegionService { +public interface AvailableRegionsService { /** * List available regions (using default parameters) diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/AvailableRegionsServiceImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/AvailableRegionsServiceImpl.java index 5e173b604..dc9809c69 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/AvailableRegionsServiceImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/AvailableRegionsServiceImpl.java @@ -24,7 +24,6 @@ import com.sinch.sdk.core.http.URLParameterUtils; import com.sinch.sdk.core.http.URLPathUtils; import com.sinch.sdk.core.models.ServerConfiguration; -import com.sinch.sdk.domains.numbers.models.v1.regions.available.request.AvailableRegionListRequest; import com.sinch.sdk.domains.numbers.models.v1.regions.available.response.AvailableRegionListResponse; import com.sinch.sdk.domains.numbers.models.v1.regions.available.response.internal.AvailableRegionListResponseInternal; import com.sinch.sdk.domains.numbers.models.v1.regions.request.AvailableRegionsListQueryParameters; @@ -134,18 +133,4 @@ private HttpRequest listRequestBuilder(AvailableRegionsListQueryParameters query localVarContentTypes, localVarAuthNames); } - - @Override - public AvailableRegionListResponse list(AvailableRegionListRequest parameters) - throws ApiException { - - AvailableRegionsListQueryParameters queryParameters = null; - if (null != parameters) { - AvailableRegionsListQueryParameters.Builder builder = - AvailableRegionsListQueryParameters.builder(); - parameters.getTypes().ifPresent(t -> builder.setTypes(new ArrayList<>(t))); - queryParameters = builder.build(); - } - return list(queryParameters); - } } diff --git a/sample-app/src/main/java/com/sinch/sample/numbers/NumbersSampleFlow.java b/sample-app/src/main/java/com/sinch/sample/numbers/NumbersSampleFlow.java index 2891bff16..7ff80718a 100644 --- a/sample-app/src/main/java/com/sinch/sample/numbers/NumbersSampleFlow.java +++ b/sample-app/src/main/java/com/sinch/sample/numbers/NumbersSampleFlow.java @@ -6,16 +6,16 @@ import com.sinch.sample.Utils; import com.sinch.sdk.SinchClient; import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.domains.numbers.api.v1.AvailableRegionService; +import com.sinch.sdk.domains.numbers.api.v1.AvailableRegionsService; import com.sinch.sdk.domains.numbers.api.v1.NumbersService; import com.sinch.sdk.domains.numbers.models.v1.ActiveNumber; import com.sinch.sdk.domains.numbers.models.v1.NumberType; -import com.sinch.sdk.domains.numbers.models.v1.regions.available.request.AvailableRegionListRequest; -import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumberListRequest; +import com.sinch.sdk.domains.numbers.models.v1.regions.request.AvailableRegionsListQueryParameters; import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumberUpdateRequest; -import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberListRequest; +import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumbersListQueryParameters; import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentAnyRequest; import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentRequest; +import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumbersListQueryParameters; import com.sinch.sdk.domains.numbers.models.v1.request.SearchPattern; import com.sinch.sdk.domains.numbers.models.v1.request.SearchPosition; import com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumber; @@ -86,7 +86,7 @@ public void run(Configuration configuration) { } String checkAndGetRegionCodeAvailability( - int step, AvailableRegionService service, String regionCode) { + int step, AvailableRegionsService service, String regionCode) { echoStep( step, @@ -97,7 +97,7 @@ String checkAndGetRegionCodeAvailability( // 1. Build the request data for listing the regions that support 'LOCAL' numbers var availableRegionsRequestData = - AvailableRegionListRequest.builder() + AvailableRegionsListQueryParameters.builder() .setTypes(Collections.singletonList(NumberType.LOCAL)) .build(); @@ -151,14 +151,11 @@ String getAvailablePhoneNumber( // 1. Build the request data for listing the numbers of type 'LOCAL' in the regionCode with an // area code pattern var availableNumbersRequestData = - AvailableNumberListRequest.builder() + AvailableNumbersListQueryParameters.builder() .setRegionCode(regionCode) .setType(NumberType.LOCAL) - .setSearchPattern( - SearchPattern.builder() - .setPosition(SearchPosition.START) - .setPattern(codePattern) - .build()) + .setSearchPattern(codePattern) + .setSearchPosition(SearchPosition.START) .build(); // 2. Request for available numbers using the built-in SDK method @@ -264,7 +261,7 @@ void verifyActiveNumberByPagination( // 1. Build the request data var listActiveNumbersRequestData = - ActiveNumberListRequest.builder() + ActiveNumbersListQueryParameters.builder() .setRegionCode(regionCode) .setType(NumberType.LOCAL) .setPageSize(2) // Set a low number to demonstrate the pagination later on @@ -318,7 +315,7 @@ void verifyActiveNumberByAutoPagination( // 1. Build the request data var listActiveNumbersRequestData = - ActiveNumberListRequest.builder() + ActiveNumbersListQueryParameters.builder() .setRegionCode(regionCode) .setType(NumberType.LOCAL) .setPageSize(2) // Set a low number to demonstrate the pagination later on From 648372477c8b9f199cfea3216540fc2ecae79b76 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier Date: Tue, 22 Jul 2025 10:11:33 +0200 Subject: [PATCH 003/122] feat (SMS): Remove SMS deprecated features --- MIGRATION-GUIDE.md | 84 ++ .../sinch/sdk/domains/sms/BatchesService.java | 192 ---- .../domains/sms/DeliveryReportsService.java | 86 -- .../sinch/sdk/domains/sms/GroupsService.java | 164 ---- .../sdk/domains/sms/InboundsService.java | 56 -- .../com/sinch/sdk/domains/sms/SMSService.java | 50 - .../sdk/domains/sms/WebHooksService.java | 55 -- .../domains/sms/adapters/BatchesService.java | 103 --- .../sms/adapters/DeliveryReportsService.java | 118 --- .../domains/sms/adapters/GroupsService.java | 109 --- .../domains/sms/adapters/InboundsService.java | 71 -- .../sdk/domains/sms/adapters/SMSService.java | 115 +-- .../domains/sms/adapters/WebHooksService.java | 70 -- .../converters/BatchDtoConverter.java | 299 ------ .../DeliveryReportDtoConverter.java | 95 -- .../converters/DryRunDtoConverter.java | 30 - .../converters/GroupsDtoConverter.java | 215 ----- .../converters/InboundsDtoConverter.java | 67 -- .../converters/ParametersDtoConverter.java | 82 -- .../sdk/domains/sms/models/BaseBatch.java | 251 ----- .../sms/models/BaseDeliveryReport.java | 67 -- .../sinch/sdk/domains/sms/models/Batch.java | 303 ------- .../sdk/domains/sms/models/BatchBinary.java | 204 ----- .../sdk/domains/sms/models/BatchMedia.java | 138 --- .../sdk/domains/sms/models/BatchText.java | 203 ----- .../sms/models/DeliveryReportBatch.java | 76 -- .../sms/models/DeliveryReportBatchMMS.java | 47 - .../sms/models/DeliveryReportBatchSMS.java | 47 - .../sms/models/DeliveryReportErrorCode.java | 142 --- .../sms/models/DeliveryReportRecipient.java | 197 ---- .../DeliveryReportRecipientEncoding.java | 44 - .../models/DeliveryReportRecipientMMS.java | 93 -- .../models/DeliveryReportRecipientSMS.java | 93 -- .../sms/models/DeliveryReportStatus.java | 94 -- .../models/DeliveryReportStatusDetails.java | 102 --- .../sms/models/DeliveryReportType.java | 64 -- .../sinch/sdk/domains/sms/models/DryRun.java | 84 -- .../sms/models/DryRunPerRecipientDetails.java | 157 ---- .../sinch/sdk/domains/sms/models/Group.java | 149 --- .../domains/sms/models/GroupAutoUpdate.java | 68 -- .../sms/models/GroupAutoUpdateKeyword.java | 66 -- .../sinch/sdk/domains/sms/models/Inbound.java | 160 ---- .../sdk/domains/sms/models/InboundBinary.java | 82 -- .../sdk/domains/sms/models/InboundText.java | 65 -- .../sdk/domains/sms/models/MediaBody.java | 65 -- .../sdk/domains/sms/models/Parameters.java | 61 -- .../sms/models/SMSCursorPageNavigator.java | 35 - .../sdk/domains/sms/models/package-info.java | 6 - .../BatchesListRequestParameters.java | 149 --- ...liveryReportBatchGetRequestParameters.java | 103 --- .../DeliveryReportListRequestParameters.java | 169 ---- ...oupAutoUpdateKeywordRequestParameters.java | 66 -- .../GroupAutoUpdateRequestParameters.java | 90 -- .../GroupCreateRequestParameters.java | 126 --- .../GroupReplaceRequestParameters.java | 80 -- .../GroupUpdateRequestParameters.java | 179 ---- .../requests/GroupsListRequestParameters.java | 72 -- .../InboundsListRequestParameters.java | 151 --- .../requests/SendSmsBatchBinaryRequest.java | 194 ---- .../requests/SendSmsBatchMediaRequest.java | 113 --- .../requests/SendSmsBatchTextRequest.java | 188 ---- .../requests/UpdateBaseBatchRequest.java | 222 ----- .../requests/UpdateSmsBatchBinaryRequest.java | 63 -- .../requests/UpdateSmsBatchMediaRequest.java | 100 -- .../requests/UpdateSmsBatchTextRequest.java | 72 -- .../sms/models/requests/package-info.java | 6 - .../models/responses/BatchesListResponse.java | 58 -- .../DeliveryReportsListResponse.java | 57 -- .../models/responses/GroupsListResponse.java | 56 -- .../responses/InboundsListResponse.java | 55 -- .../sms/models/responses/package-info.java | 6 - .../sms/models/webhooks/WebhooksEvent.java | 4 - .../sms/models/webhooks/package-info.java | 57 -- .../voice/models/webhooks/CallEvent.java | 1 - .../sms/adapters/BatchesServiceTest.java | 541 ----------- .../adapters/DeliveryReportsServiceTest.java | 245 ----- .../sms/adapters/GroupsServiceTest.java | 229 ----- .../sms/adapters/InboundsServiceTest.java | 159 ---- .../domains/sms/adapters/SMSServiceTest.java | 84 -- .../sms/adapters/WebHooksServiceTest.java | 141 --- .../converters/BatchDtoConverterTest.java | 209 ----- .../DeliveryReportBatchDtoConverterTest.java | 76 -- .../converters/DryRunDtoConverterTest.java | 37 - .../converters/GroupsDtoConverterTest.java | 145 --- .../sms/models/BatchBinaryBuilderTest.java | 143 --- .../domains/sms/models/BatchBinaryTest.java | 144 --- .../domains/sms/models/BatchBuilderTest.java | 118 --- .../sms/models/BatchMediaBuilderTest.java | 124 --- .../domains/sms/models/BatchMediaTest.java | 126 --- .../sdk/domains/sms/models/BatchTest.java | 117 --- .../sms/models/BatchTextBuilderTest.java | 143 --- .../sdk/domains/sms/models/BatchTextTest.java | 144 --- .../sdk/domains/sms/models/MediaBodyTest.java | 19 - .../domains/sms/models/ParametersTest.java | 43 - .../models/SMSCursorPageNavigatorTest.java | 25 - ...tchesListRequestParametersBuilderTest.java | 56 -- ...eportListRequestParametersBuilderTest.java | 68 -- ...oupCreateRequestParametersBuilderTest.java | 46 - .../sdk/e2e/domains/sms/v0/BatchesSteps.java | 367 -------- .../domains/sms/v0/DeliveryReportsSteps.java | 184 ---- .../sdk/e2e/domains/sms/v0/GroupsSteps.java | 227 ----- .../sdk/e2e/domains/sms/v0/InboundsSteps.java | 112 --- .../sinch/sdk/e2e/domains/sms/v0/SmsIT.java | 16 - .../sdk/e2e/domains/sms/v0/WebhooksSteps.java | 151 --- .../sms/adapters/api/v1/BatchesApi.java | 858 ------------------ .../adapters/api/v1/DeliveryReportsApi.java | 433 --------- .../sms/adapters/api/v1/GroupsApi.java | 644 ------------- .../sms/adapters/api/v1/InboundsApi.java | 298 ------ .../sms/models/dto/v1/AddKeywordDto.java | 138 --- .../dto/v1/ApiBatchListBatchesInnerDto.java | 382 -------- .../sms/models/dto/v1/ApiBatchListDto.java | 220 ----- .../models/dto/v1/ApiDeliveryFeedbackDto.java | 112 --- .../models/dto/v1/ApiGroupAutoUpdateDto.java | 173 ---- .../sms/models/dto/v1/ApiGroupDto.java | 298 ------ .../sms/models/dto/v1/ApiGroupListDto.java | 220 ----- .../sms/models/dto/v1/ApiInboundListDto.java | 220 ----- .../sms/models/dto/v1/ApiMoMessageDto.java | 423 --------- .../dto/v1/ApiUpdateBinaryMtMessageDto.java | 487 ---------- .../dto/v1/ApiUpdateMmsMtMessageDto.java | 536 ----------- .../models/dto/v1/ApiUpdateMtMessageDto.java | 379 -------- .../dto/v1/ApiUpdateTextMtMessageDto.java | 496 ---------- .../sms/models/dto/v1/BinaryRequestDto.java | 731 --------------- .../sms/models/dto/v1/BinaryResponseDto.java | 843 ----------------- .../models/dto/v1/CreateGroupResponseDto.java | 308 ------- .../sms/models/dto/v1/DeliveryReportDto.java | 288 ------ .../models/dto/v1/DeliveryReportListDto.java | 221 ----- .../models/dto/v1/DryRun200ResponseDto.java | 187 ---- ...DryRun200ResponsePerRecipientInnerDto.java | 210 ----- .../models/dto/v1/ErrorResponseObjDto.java | 134 --- .../sms/models/dto/v1/GroupAutoUpdateDto.java | 176 ---- .../dto/v1/GroupObjectAutoUpdateDto.java | 176 ---- .../v1/GroupObjectAutoUpdateRemoveDto.java | 140 --- .../sms/models/dto/v1/GroupObjectDto.java | 237 ----- .../domains/sms/models/dto/v1/InboundDto.java | 294 ------ .../sms/models/dto/v1/MOBinaryDto.java | 268 ------ .../domains/sms/models/dto/v1/MOTextDto.java | 229 ----- .../sms/models/dto/v1/MediaBodyDto.java | 134 --- .../sms/models/dto/v1/MediaRequestDto.java | 566 ------------ .../sms/models/dto/v1/MediaResponseDto.java | 670 -------------- .../dto/v1/MessageDeliveryStatusDto.java | 223 ----- .../sms/models/dto/v1/ParameterObjDto.java | 171 ---- .../dto/v1/ParameterObjParameterKeyDto.java | 149 --- .../dto/v1/RecipientDeliveryReportDto.java | 584 ------------ .../sms/models/dto/v1/RemoveKeywordDto.java | 138 --- .../models/dto/v1/ReplaceGroupRequestDto.java | 150 --- .../models/dto/v1/SendSMS201ResponseDto.java | 380 -------- .../sms/models/dto/v1/SendSMSRequestDto.java | 376 -------- .../sms/models/dto/v1/TextRequestDto.java | 724 --------------- .../sms/models/dto/v1/TextResponseDto.java | 825 ----------------- .../dto/v1/UpdateBatchMessageRequestDto.java | 395 -------- .../UpdateGroupRequestAutoUpdateAddDto.java | 144 --- .../v1/UpdateGroupRequestAutoUpdateDto.java | 177 ---- ...UpdateGroupRequestAutoUpdateRemoveDto.java | 141 --- .../models/dto/v1/UpdateGroupRequestDto.java | 308 ------- .../models/dto/v1/BinaryResponseDtoTest.java | 61 -- .../dto/v1/DeliveryReportBatchDtoTest.java | 58 -- .../v1/DeliveryReportRecipientDtoTest.java | 60 -- .../models/dto/v1/DryRunResponseDtoTest.java | 48 - .../models/dto/v1/GroupResponseDtoTest.java | 47 - .../sms/models/dto/v1/InboundDtoTest.java | 61 -- .../sms/models/dto/v1/MOBinaryDtoTest.java | 50 - .../sms/models/dto/v1/MOTextDtoTest.java | 49 - .../models/dto/v1/MediaResponseDtoTest.java | 70 -- .../models/dto/v1/SendSMSRequestDtoTest.java | 146 --- .../models/dto/v1/SendSMSResponseDtoTest.java | 138 --- .../models/dto/v1/TextResponseDtoTest.java | 87 -- .../dto/v1/UpdateSMSRequestDtoTest.java | 135 --- pom.xml | 6 - 168 files changed, 85 insertions(+), 29845 deletions(-) delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/BatchesService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/DeliveryReportsService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/GroupsService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/InboundsService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/WebHooksService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/adapters/BatchesService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/adapters/DeliveryReportsService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/adapters/GroupsService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/adapters/InboundsService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/adapters/WebHooksService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/adapters/converters/BatchDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/adapters/converters/DeliveryReportDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/adapters/converters/DryRunDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/adapters/converters/GroupsDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/adapters/converters/InboundsDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/adapters/converters/ParametersDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/BaseBatch.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/BaseDeliveryReport.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/Batch.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/BatchBinary.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/BatchMedia.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/BatchText.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportBatch.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportBatchMMS.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportBatchSMS.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportErrorCode.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportRecipient.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportRecipientEncoding.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportRecipientMMS.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportRecipientSMS.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportStatus.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportStatusDetails.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportType.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/DryRun.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/DryRunPerRecipientDetails.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/Group.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/GroupAutoUpdate.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/GroupAutoUpdateKeyword.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/Inbound.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/InboundBinary.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/InboundText.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/MediaBody.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/Parameters.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/SMSCursorPageNavigator.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/package-info.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/requests/BatchesListRequestParameters.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/requests/DeliveryReportBatchGetRequestParameters.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/requests/DeliveryReportListRequestParameters.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/requests/GroupAutoUpdateKeywordRequestParameters.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/requests/GroupAutoUpdateRequestParameters.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/requests/GroupCreateRequestParameters.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/requests/GroupReplaceRequestParameters.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/requests/GroupUpdateRequestParameters.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/requests/GroupsListRequestParameters.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/requests/InboundsListRequestParameters.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/requests/SendSmsBatchBinaryRequest.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/requests/SendSmsBatchMediaRequest.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/requests/SendSmsBatchTextRequest.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/requests/UpdateBaseBatchRequest.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/requests/UpdateSmsBatchBinaryRequest.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/requests/UpdateSmsBatchMediaRequest.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/requests/UpdateSmsBatchTextRequest.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/requests/package-info.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/responses/BatchesListResponse.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/responses/DeliveryReportsListResponse.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/responses/GroupsListResponse.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/responses/InboundsListResponse.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/responses/package-info.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/webhooks/WebhooksEvent.java delete mode 100644 client/src/main/com/sinch/sdk/domains/sms/models/webhooks/package-info.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/sms/adapters/BatchesServiceTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/sms/adapters/DeliveryReportsServiceTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/sms/adapters/GroupsServiceTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/sms/adapters/InboundsServiceTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/sms/adapters/SMSServiceTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/sms/adapters/WebHooksServiceTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/sms/adapters/converters/BatchDtoConverterTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/sms/adapters/converters/DeliveryReportBatchDtoConverterTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/sms/adapters/converters/DryRunDtoConverterTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/sms/adapters/converters/GroupsDtoConverterTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/sms/models/BatchBinaryBuilderTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/sms/models/BatchBinaryTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/sms/models/BatchBuilderTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/sms/models/BatchMediaBuilderTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/sms/models/BatchMediaTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/sms/models/BatchTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/sms/models/BatchTextBuilderTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/sms/models/BatchTextTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/sms/models/MediaBodyTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/sms/models/ParametersTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/sms/models/SMSCursorPageNavigatorTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/sms/models/requests/BatchesListRequestParametersBuilderTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/sms/models/requests/DeliveryReportListRequestParametersBuilderTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/sms/models/requests/GroupCreateRequestParametersBuilderTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/e2e/domains/sms/v0/BatchesSteps.java delete mode 100644 client/src/test/java/com/sinch/sdk/e2e/domains/sms/v0/DeliveryReportsSteps.java delete mode 100644 client/src/test/java/com/sinch/sdk/e2e/domains/sms/v0/GroupsSteps.java delete mode 100644 client/src/test/java/com/sinch/sdk/e2e/domains/sms/v0/InboundsSteps.java delete mode 100644 client/src/test/java/com/sinch/sdk/e2e/domains/sms/v0/SmsIT.java delete mode 100644 client/src/test/java/com/sinch/sdk/e2e/domains/sms/v0/WebhooksSteps.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/adapters/api/v1/BatchesApi.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/adapters/api/v1/DeliveryReportsApi.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/adapters/api/v1/GroupsApi.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/adapters/api/v1/InboundsApi.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/AddKeywordDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiBatchListBatchesInnerDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiBatchListDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiDeliveryFeedbackDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiGroupAutoUpdateDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiGroupDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiGroupListDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiInboundListDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiMoMessageDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiUpdateBinaryMtMessageDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiUpdateMmsMtMessageDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiUpdateMtMessageDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiUpdateTextMtMessageDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/BinaryRequestDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/BinaryResponseDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/CreateGroupResponseDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/DeliveryReportDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/DeliveryReportListDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/DryRun200ResponseDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/DryRun200ResponsePerRecipientInnerDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ErrorResponseObjDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/GroupAutoUpdateDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/GroupObjectAutoUpdateDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/GroupObjectAutoUpdateRemoveDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/GroupObjectDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/InboundDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/MOBinaryDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/MOTextDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/MediaBodyDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/MediaRequestDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/MediaResponseDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/MessageDeliveryStatusDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ParameterObjDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ParameterObjParameterKeyDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/RecipientDeliveryReportDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/RemoveKeywordDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ReplaceGroupRequestDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/SendSMS201ResponseDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/SendSMSRequestDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/TextRequestDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/TextResponseDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/UpdateBatchMessageRequestDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/UpdateGroupRequestAutoUpdateAddDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/UpdateGroupRequestAutoUpdateDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/UpdateGroupRequestAutoUpdateRemoveDto.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/UpdateGroupRequestDto.java delete mode 100644 openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/BinaryResponseDtoTest.java delete mode 100644 openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/DeliveryReportBatchDtoTest.java delete mode 100644 openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/DeliveryReportRecipientDtoTest.java delete mode 100644 openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/DryRunResponseDtoTest.java delete mode 100644 openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/GroupResponseDtoTest.java delete mode 100644 openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/InboundDtoTest.java delete mode 100644 openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/MOBinaryDtoTest.java delete mode 100644 openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/MOTextDtoTest.java delete mode 100644 openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/MediaResponseDtoTest.java delete mode 100644 openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/SendSMSRequestDtoTest.java delete mode 100644 openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/SendSMSResponseDtoTest.java delete mode 100644 openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/TextResponseDtoTest.java delete mode 100644 openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/UpdateSMSRequestDtoTest.java diff --git a/MIGRATION-GUIDE.md b/MIGRATION-GUIDE.md index 55920b943..3d236a9c4 100644 --- a/MIGRATION-GUIDE.md +++ b/MIGRATION-GUIDE.md @@ -81,3 +81,87 @@ Use the new versioned API under v1().numbers() to get access to [NumbersService] | callback() | [v1().callback()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/CallbackConfigurationService.html) | | webhook() | [v1().webhooks()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/WebHooksService.html) | +### [`SMS`](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/package-summary.html) + +#### Replacement models + +##### Batches +| Old class | New class | +|-----------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| models/Parameters | N/A. Part of `Create` and `Update` batch requests | +| models/MediaBody | [com.sinch.sdk.domains.sms.models.v1.batches.MediaBody](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/batches/MediaBody.html) | +| models/BaseBatch | [com.sinch.sdk.domains.sms.models.v1.batches.request.BatchRequest](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/batches/request/BatchRequest.html) | +| models/Batch | [com.sinch.sdk.domains.sms.models.v1.batches.response.BatchResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/batches/response/BatchResponse.html) | +| models/BatchBinary | [com.sinch.sdk.domains.sms.models.v1.batches.response.BinaryResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/batches/response/BinaryResponse.html) | +| models/BatchMedia | [com.sinch.sdk.domains.sms.models.v1.batches.response.MediaResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/batches/response/MediaResponse.html) | +| models/BatchText | [com.sinch.sdk.domains.sms.models.v1.batches.response.TextResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/batches/response/TextResponse.html) | +| models/DryRun | [com.sinch.sdk.domains.sms.models.v1.batches.response.DryRunResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/batches/response/DryRunResponse.html) | +| models/DryRunPerRecipientDetails | [com.sinch.sdk.domains.sms.models.v1.batches.response.DryRunPerRecipientDetails](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/batches/response/DryRunPerRecipientDetails.html) | +| models/requests/BatchesListRequestParameters | [com.sinch.sdk.domains.sms.models.v1.batches.request.ListBatchesQueryParameters](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/batches/request/ListBatchesQueryParameters.html) | +| models/requests/SendSmsBatchBinaryRequest | [com.sinch.sdk.domains.sms.models.v1.batches.request.BinaryRequest](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/batches/request/BinaryRequest.html) | +| models/requests/SendSmsBatchMediaRequest | [com.sinch.sdk.domains.sms.models.v1.batches.request.MediaRequest](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/batches/request/MediaRequest.html) | +| models/requests/SendSmsBatchTextRequest | [com.sinch.sdk.domains.sms.models.v1.batches.request.TextRequest](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/batches/request/TextRequest.html) | +| models/requests/UpdateBaseBatchRequest | [com.sinch.sdk.domains.sms.models.v1.batches.request.UpdateBatchRequest](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/batches/request/UpdateBatchRequest.html) | +| models/requests/UpdateSmsBatchBinaryRequest | [com.sinch.sdk.domains.sms.models.v1.batches.request.UpdateBinaryRequest](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/batches/request/UpdateBinaryRequest.html) | +| models/requests/UpdateSmsBatchMediaRequest | [com.sinch.sdk.domains.sms.models.v1.batches.request.UpdateMediaRequest](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/batches/request/UpdateMediaRequest.html) | +| models/requests/UpdateSmsBatchTextRequest | [com.sinch.sdk.domains.sms.models.v1.batches.request.UpdateTextRequest](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/batches/request/UpdateTextRequest.html) | +| models/responses/BatchesListResponse | [com.sinch.sdk.domains.sms.models.v1.batches.response.ListBatchesResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/batches/response/ListBatchesResponse.html) | + +##### Delivery Reports +| Old class | New class | +|---------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| models/BaseDeliveryReport | [com.sinch.sdk.domains.sms.models.v1.deliveryreports.DeliveryReport](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/deliveryreports/DeliveryReport.html) | +| models/DeliveryReportBatch | [com.sinch.sdk.domains.sms.models.v1.deliveryreports.BatchDeliveryReport](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/deliveryreports/BatchDeliveryReport.html) | +| models/DeliveryReportBatchMMS | [com.sinch.sdk.domains.sms.models.v1.deliveryreports.BatchDeliveryReportMMS](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/deliveryreports/BatchDeliveryReportMMS.html) | +| models/DeliveryReportBatchSMS | [com.sinch.sdk.domains.sms.models.v1.deliveryreports.BatchDeliveryReportSMS](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/deliveryreports/BatchDeliveryReportSMS.html) | +| models/DeliveryReportErrorCode | [com.sinch.sdk.domains.sms.models.v1.deliveryreports.DeliveryReceiptErrorCode](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/deliveryreports/DeliveryReceiptErrorCode.html) | +| models/DeliveryReportRecipient | [com.sinch.sdk.domains.sms.models.v1.deliveryreports.RecipientDeliveryReport](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/deliveryreports/RecipientDeliveryReport.html) | +| models/DeliveryReportRecipientEncoding | [com.sinch.sdk.domains.sms.models.v1.deliveryreports.EncodingType](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/deliveryreports/EncodingType.html) | +| models/DeliveryReportRecipientMMS | [com.sinch.sdk.domains.sms.models.v1.deliveryreports.RecipientDeliveryReportMMS](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/deliveryreports/RecipientDeliveryReportMMS.html) | +| models/DeliveryReportRecipientSMS | [com.sinch.sdk.domains.sms.models.v1.deliveryreports.RecipientDeliveryReportSMS](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/deliveryreports/RecipientDeliveryReportSMS.html) | +| models/DeliveryReportStatus | [com.sinch.sdk.domains.sms.models.v1.deliveryreports.DeliveryStatus](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/deliveryreports/DeliveryStatus.html) | +| models/DeliveryReportStatusDetails | [com.sinch.sdk.domains.sms.models.v1.deliveryreports.MessageDeliveryStatus](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/deliveryreports/MessageDeliveryStatus.html) | +| models/DeliveryReportType | [com.sinch.sdk.domains.sms.models.v1.deliveryreports.request.QueryReportType](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/deliveryreports/request/QueryReportType.html) | +| models/requests/DeliveryReportBatchGetRequestParameters | [com.sinch.sdk.domains.sms.models.v1.deliveryreports.request.BatchDeliveryReportQueryParameters](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/deliveryreports/request/BatchDeliveryReportQueryParameters.html) | +| models/requests/DeliveryReportListRequestParameters | [com.sinch.sdk.domains.sms.models.v1.deliveryreports.request.ListDeliveryReportsQueryParameters](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/deliveryreports/request/ListDeliveryReportsQueryParameters.html) | +| models/responses/DeliveryReportsListResponse | [com.sinch.sdk.domains.sms.models.v1.deliveryreports.response.ListDeliveryReportsResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/deliveryreports/response/ListDeliveryReportsResponse.html) | + +##### Groups +| Old class | New class | +|---------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| models/Group | [com.sinch.sdk.domains.sms.models.v1.groups.Group](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/groups/Group.html) | +| models/GroupAutoUpdate | [com.sinch.sdk.domains.sms.models.v1.groups.GroupAutoUpdate](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/groups/GroupAutoUpdate.html) | +| models/GroupAutoUpdateKeyword | [com.sinch.sdk.domains.sms.models.v1.groups.AddKeyword](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/groups/AddKeyword.html) and [com.sinch.sdk.domains.sms.models.v1.groups.RemoveKeyword](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/groups/RemoveKeyword.html) | +| models/requests/GroupAutoUpdateKeywordRequestParameters | [com.sinch.sdk.domains.sms.models.v1.groups.AddKeyword](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/groups/AddKeyword.html) and [com.sinch.sdk.domains.sms.models.v1.groups.RemoveKeyword](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/groups/RemoveKeyword.html) | +| models/requests/GroupAutoUpdateRequestParameters | [com.sinch.sdk.domains.sms.models.v1.groups.request.GroupUpdateRequest](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/request/GroupUpdateRequest.html) | +| models/requests/GroupCreateRequestParameters | [com.sinch.sdk.domains.sms.models.v1.groups.request.GroupRequest](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/request/GroupRequest.html) | +| models/requests/GroupReplaceRequestParameters | [com.sinch.sdk.domains.sms.models.v1.groups.request.GroupRequest](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/request/GroupRequest.html) | +| models/requests/GroupUpdateRequestParameters | [com.sinch.sdk.domains.sms.models.v1.groups.request.GroupUpdateRequest](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/request/GroupUpdateRequest.html) | +| models/requests/GroupsListRequestParameters | [com.sinch.sdk.domains.sms.models.v1.groups.request.ListGroupsQueryParameters](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/request/ListGroupsQueryParameters.html) | +| models/responses/GroupsListResponse | [com.sinch.sdk.domains.sms.models.v1.groups.response.ListGroupsResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/response/ListGroupsResponse.html) | + +##### Inbounds +| Old class | New class | +|-----------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| models/Inbound | [com.sinch.sdk.domains.sms.models.v1.inbounds.InboundMessage](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/inbounds/InboundMessage.html) | +| models/InboundBinary | [com.sinch.sdk.domains.sms.models.v1.inbounds.BinaryMessage](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/inbounds/BinaryMessage.html) | +| models/InboundText | [com.sinch.sdk.domains.sms.models.v1.inbounds.TextMessage](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/inbounds/TextMessage.html) | +| models/requests/InboundsListRequestParameters | [com.sinch.sdk.domains.sms.models.v1.inbounds.request.ListInboundMessagesQueryParameters](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/inbounds/request/ListInboundMessagesQueryParameters.html) | +| models/responses/InboundsListResponse | [com.sinch.sdk.domains.sms.models.v1.inbounds.response.ListInboundsResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/inbounds/response/ListInboundsResponse.html) | + +##### Webhooks +| Old class | New class | +|--------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| models/webhooks/WebhooksEvent | [com.sinch.sdk.domains.sms.models.v1.webhooks.SmsEvent](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/webhooks/SmsEvent.html) | + +#### Replacement APIs + +Use the new versioned API under `v1().sms()` to get access to [SMSService](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/api/v1/SMSService.html): [`sinchClient.sms.v1()`](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0./com/sinch/sdk/domains/sms/SMSService.html#v1()) + +| Old interface | New Equivalent in `sms().v1()` | +|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------| +| batches() | [v1().batches()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/api/v1/BatchesService.html) | +| deliveryReports() | [v1().deliveryReports()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/api/v1/DeliveryReportsService.html) | +| groups() | [v1().groups()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/api/v1/GroupsService.html) | +| inbounds() | [v1().inbounds()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/api/v1/InboundsService.html) | +| webHooks() | [v1().webhooks()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/api/v1/WebHooksService.html) | diff --git a/client/src/main/com/sinch/sdk/domains/sms/BatchesService.java b/client/src/main/com/sinch/sdk/domains/sms/BatchesService.java deleted file mode 100644 index 269dc9849..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/BatchesService.java +++ /dev/null @@ -1,192 +0,0 @@ -package com.sinch.sdk.domains.sms; - -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.domains.sms.models.BaseBatch; -import com.sinch.sdk.domains.sms.models.Batch; -import com.sinch.sdk.domains.sms.models.DryRun; -import com.sinch.sdk.domains.sms.models.requests.BatchesListRequestParameters; -import com.sinch.sdk.domains.sms.models.requests.UpdateBaseBatchRequest; -import com.sinch.sdk.domains.sms.models.responses.BatchesListResponse; -import com.sinch.sdk.domains.sms.models.v1.batches.request.BatchRequest; -import com.sinch.sdk.domains.sms.models.v1.batches.request.DryRunQueryParameters; -import com.sinch.sdk.domains.sms.models.v1.batches.request.ListBatchesQueryParameters; -import com.sinch.sdk.domains.sms.models.v1.batches.request.SendDeliveryFeedbackRequest; -import com.sinch.sdk.domains.sms.models.v1.batches.request.UpdateBatchRequest; -import java.util.Collection; - -/** - * Batches Service - * - * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Batches/ - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.sms.api.v1.BatchesService} instead. - */ -@Deprecated -public interface BatchesService { - - /** - * Get a batch message. - * - *

This operation returns a specific batch that matches the provided batch ID. - * - * @param batchId The batch ID you received from sending a message - * @param A type of Batch - * @return Batch information - * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Batches/#tag/Batches/operation/GetBatchMessage - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.sms.api.v1.BatchesService#get(String)} instead. - */ - @Deprecated - > T get(String batchId) throws ApiException; - - /** - * Send a message or a batch of messages. - * - *

Depending on the length of the body, one message might be split into multiple parts and - * charged accordingly.
- * Any groups targeted in a scheduled batch will be evaluated at the time of sending. If a group - * is deleted between batch creation and scheduled date, it will be considered empty.
- * Be sure to use the correct region in the server URL. - * - * @param batch The batch to be created - * @param A type of Batch - * @return Batch information - * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Batches/#tag/Batches/operation/SendSMS - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.sms.api.v1.BatchesService#send(BatchRequest)} - * instead. - */ - @Deprecated - > T send(BaseBatch batch) throws ApiException; - - /** - * Dry run. - * - *

This operation will perform a dry run of a batch which calculates the bodies and number of - * parts for all messages in the batch without actually sending any messages. - * - * @param perRecipient Whether to include per recipient details in the response - * @param numberOfRecipient Max number of recipients to include per recipient details for in the - * response - * @param batch The batch to be send - * @return Details about dryRun execution - * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Batches/#tag/Batches/operation/Dry_Run - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.sms.api.v1.BatchesService#dryRun(DryRunQueryParameters, - * BatchRequest)} instead. - */ - @Deprecated - DryRun dryRun(boolean perRecipient, int numberOfRecipient, BaseBatch batch) - throws ApiException; - - /** - * List Batches. - * - *

With the list operation you can list batch messages created in the last 14 days that you - * have created. This operation supports pagination. - * - * @param parameters Query parameters filtering returned batches - * @return Paginated list of Batches - * @since 1.0 - * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Batches/#tag/Batches/operation/ListBatches - * @deprecated use {@link - * com.sinch.sdk.domains.sms.api.v1.BatchesService#list(ListBatchesQueryParameters)} instead - */ - @Deprecated - BatchesListResponse list(BatchesListRequestParameters parameters) throws ApiException; - - /** - * Update a Batch message. - * - *

This operation updates all specified parameters of a batch that matches the provided batch - * ID. - * - * @param batchId The batch ID you received from sending a message - * @param batch Batch parameters to be updated - * @param A type of Batch - * @return Batch information - * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Batches/#tag/Batches/operation/UpdateBatchMessage - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.sms.api.v1.BatchesService#update(String, - * UpdateBatchRequest)} instead. - */ - @Deprecated - > T update(String batchId, UpdateBaseBatchRequest batch) - throws ApiException; - - /** - * Replace a batch . - * - *

This operation will replace all the parameters of a batch with the provided values. It is - * the same as cancelling a batch and sending a new one instead. - * - * @param batchId The batch ID you received from sending a message - * @param batch Batch parameters to be used - * @param A type of Batch - * @return Batch information - * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Batches/#tag/Batches/operation/ReplaceBatch - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.sms.api.v1.BatchesService#replace(String, - * BatchRequest)} instead. - */ - @Deprecated - > T replace(String batchId, BaseBatch batch) throws ApiException; - - /** - * Cancel a batch message. - * - *

A batch can be canceled at any point. If a batch is canceled while it's currently being - * delivered some messages currently being processed might still be delivered. The delivery report - * will indicate which messages were canceled and which weren't.
- * Canceling a batch scheduled in the future will result in an empty delivery report while - * canceling an already sent batch would result in no change to the completed delivery report. - * - * @param batchId The batch ID you received from sending a message - * @param A type of Batch - * @return Batch information - * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Batches/#tag/Batches/operation/CancelBatchMessage - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.sms.api.v1.BatchesService#cancel(String)} instead. - */ - @Deprecated - > T cancel(String batchId) throws ApiException; - - /** - * Send delivery feedback for a message. - * - *

Send feedback if your system can confirm successful message delivery. - * - *

Feedback can only be provided if feedback_enabled was set when batch was submitted. - * - *

Batches: It is possible to submit feedback multiple times for the same batch for - * different recipients. Feedback without specified recipients is treated as successful message - * delivery to all recipients referenced in the batch. Note that the recipients key is still - * required even if the value is empty. - * - *

Groups: If the batch message was creating using a group ID, at least one recipient - * is required. Excluding recipients (an empty recipient list) does not work and will result in a - * failed request. - * - * @param batchId The batch ID you received from sending a message - * @param recipients A list of phone numbers (MSISDNs) that have successfully received the - * message. The key is required, however, the value can be an empty array ([]) for a batch. If - * the feedback was enabled for a group, at least one phone number is required. - * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Batches/#tag/Batches/operation/deliveryFeedback - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.sms.api.v1.BatchesService#sendDeliveryFeedback(String, - * SendDeliveryFeedbackRequest)} instead. - */ - @Deprecated - void sendDeliveryFeedback(String batchId, Collection recipients) throws ApiException; -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/DeliveryReportsService.java b/client/src/main/com/sinch/sdk/domains/sms/DeliveryReportsService.java deleted file mode 100644 index 66dd30ac0..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/DeliveryReportsService.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.sinch.sdk.domains.sms; - -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.domains.sms.models.DeliveryReportBatch; -import com.sinch.sdk.domains.sms.models.DeliveryReportRecipient; -import com.sinch.sdk.domains.sms.models.requests.DeliveryReportBatchGetRequestParameters; -import com.sinch.sdk.domains.sms.models.requests.DeliveryReportListRequestParameters; -import com.sinch.sdk.domains.sms.models.responses.DeliveryReportsListResponse; -import com.sinch.sdk.domains.sms.models.v1.deliveryreports.request.BatchDeliveryReportQueryParameters; -import com.sinch.sdk.domains.sms.models.v1.deliveryreports.request.ListDeliveryReportsQueryParameters; - -/** - * Delivery reports Service. - * - *

The REST API uses message statuses and error codes in delivery reports, which refer to the - * state of the batch and can be present in either Retrieve - * a delivery report or sent as a callback. - * - * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Delivery-reports - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.sms.api.v1.DeliveryReportsService} instead. - */ -@Deprecated -public interface DeliveryReportsService { - - /** - * Retrieve a batch delivery report. - * - *

Delivery reports can be retrieved even if no callback was requested. The difference between - * a summary and a full report is only that the full report contains the phone numbers in E.164 format for each status - * code. - * - * @param batchId The batch ID you received from sending a message param type param status param - * code - * @param parameters Filtering parameters - * @return Delivery report related to batchId according to filters - * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Delivery-reports/#tag/Delivery-reports/operation/GetDeliveryReportByBatchId - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.sms.api.v1.DeliveryReportsService#get(String, - * BatchDeliveryReportQueryParameters)} instead. - */ - @Deprecated - DeliveryReportBatch get(String batchId, DeliveryReportBatchGetRequestParameters parameters) - throws ApiException; - - /** - * Retrieve a recipient delivery report. - * - *

A recipient delivery report contains the message status for a single recipient phone number. - * - * @param batchId The batch ID you received from sending a message param type param status param - * code - * @param recipient Phone number for which you to want to search - * @return Delivery report related to batchId according to filters - * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Delivery-reports/#tag/Delivery-reports/operation/GetDeliveryReportByPhoneNumber - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.sms.api.v1.DeliveryReportsService#getForNumber(String, String)} - * instead. - */ - @Deprecated - DeliveryReportRecipient getForNumber(String batchId, String recipient) throws ApiException; - - /** - * Get a list of finished delivery reports. - * - *

This operation supports pagination. - * - * @param parameters Filtering parameters - * @return Delivery report related to batchId according to filters - * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Delivery-reports/#tag/Delivery-reports/operation/getDeliveryReports - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.sms.api.v1.DeliveryReportsService#list(ListDeliveryReportsQueryParameters)} - * instead. - */ - @Deprecated - DeliveryReportsListResponse list(DeliveryReportListRequestParameters parameters) - throws ApiException; -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/GroupsService.java b/client/src/main/com/sinch/sdk/domains/sms/GroupsService.java deleted file mode 100644 index fdc15e41c..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/GroupsService.java +++ /dev/null @@ -1,164 +0,0 @@ -package com.sinch.sdk.domains.sms; - -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.domains.sms.models.Group; -import com.sinch.sdk.domains.sms.models.requests.GroupCreateRequestParameters; -import com.sinch.sdk.domains.sms.models.requests.GroupReplaceRequestParameters; -import com.sinch.sdk.domains.sms.models.requests.GroupUpdateRequestParameters; -import com.sinch.sdk.domains.sms.models.requests.GroupsListRequestParameters; -import com.sinch.sdk.domains.sms.models.responses.GroupsListResponse; -import com.sinch.sdk.domains.sms.models.v1.groups.request.GroupRequest; -import com.sinch.sdk.domains.sms.models.v1.groups.request.GroupUpdateRequest; -import com.sinch.sdk.domains.sms.models.v1.groups.request.ListGroupsQueryParameters; -import java.util.Collection; - -/** - * Groups Service - * - *

A group is a set of phone numbers (or MSISDNs) that can be used as a target when sending an - * SMS. An phone number (MSISDN) can only occur once in a group and any attempts to add a duplicate - * are ignored but not rejected. - * - * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Groups - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.sms.api.v1.GroupsService} instead. - */ -@Deprecated -public interface GroupsService { - - /** - * Retrieve a group. - * - *

This operation retrieves a specific group with the provided group ID. - * - * @param groupId The inbound ID found when listing inbound messages - * @return Group associated to groupId - * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Groups/#tag/Groups/operation/RetrieveGroup - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.sms.api.v1.GroupsService#get(String)} instead. - */ - @Deprecated - Group get(String groupId) throws ApiException; - - /** - * Create a group. - * - *

A group is a set of phone numbers (MSISDNs) that can be used as a target in the - * send_batch_msg operation. An MSISDN can only occur once in a group and any attempts to - * add a duplicate would be ignored but not rejected. - * - * @param parameters Parameters to be used to define group onto creation - * @return Created group - * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Groups/#tag/Groups/operation/CreateGroup - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.sms.api.v1.GroupsService#create(GroupRequest)} - * instead. - */ - @Deprecated - Group create(GroupCreateRequestParameters parameters) throws ApiException; - - /** - * Create an unnamed and empty group - * - * @return See {@link #create(GroupCreateRequestParameters)} - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.sms.api.v1.GroupsService#create(GroupRequest)} - * instead. - */ - @Deprecated - Group create() throws ApiException; - - /** - * List Groups - * - *

With the list operation you can list all groups that you have created. This operation - * supports pagination. - * - *

Groups are returned in reverse chronological order. - * - * @param parameters Filtering parameters - * @return group list - * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Groups/#tag/Groups/operation/ListGroups - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.sms.api.v1.GroupsService#list(ListGroupsQueryParameters)} instead. - */ - @Deprecated - GroupsListResponse list(GroupsListRequestParameters parameters) throws ApiException; - - /** - * List groups with default parameters - * - * @return See {@link #list(GroupsListRequestParameters)} - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.sms.api.v1.GroupsService#list()} instead. - */ - @Deprecated - GroupsListResponse list() throws ApiException; - - /** - * Replace a group - * - *

The replace operation will replace all parameters, including members, of an existing group - * with new values. - * - *

Replacing a group targeted by a batch message scheduled in the future is allowed and changes - * will be reflected when the batch is sent. - * - * @param groupId ID of a group that you are interested in getting. - * @param parameters Parameters to be replaced for group - * @return Group associated to groupId - * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Groups/#tag/Groups/operation/ReplaceGroup - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.sms.api.v1.GroupsService#replace(String, - * GroupRequest)} instead. - */ - @Deprecated - Group replace(String groupId, GroupReplaceRequestParameters parameters) throws ApiException; - - /** - * Update a group - * - * @param groupId ID of a group that you are interested in getting. - * @param parameters Parameters to be used to update group - * @return Modified group associated to groupId - * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Groups/#tag/Groups/operation/UpdateGroup - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.sms.api.v1.GroupsService#update(String, - * GroupUpdateRequest)} instead. - */ - @Deprecated - Group update(String groupId, GroupUpdateRequestParameters parameters) throws ApiException; - - /** - * Delete a group - * - * @param groupId ID of a group that you are interested in getting. - * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Groups/#tag/Groups/operation/deleteGroup - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.sms.api.v1.GroupsService#delete(String)} instead. - */ - @Deprecated - void delete(String groupId) throws ApiException; - - /** - * Get phone numbers for a group - * - * @param groupId ID of a group that you are interested in getting. - * @return A list of phone numbers in E.164 format. - * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Groups/#tag/Groups/operation/deleteGroup - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.sms.api.v1.GroupsService#listMembers(String)} - * instead. - */ - @Deprecated - Collection listMembers(String groupId) throws ApiException; -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/InboundsService.java b/client/src/main/com/sinch/sdk/domains/sms/InboundsService.java deleted file mode 100644 index e09029323..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/InboundsService.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.sinch.sdk.domains.sms; - -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.domains.sms.models.Inbound; -import com.sinch.sdk.domains.sms.models.requests.InboundsListRequestParameters; -import com.sinch.sdk.domains.sms.models.responses.InboundsListResponse; -import com.sinch.sdk.domains.sms.models.v1.inbounds.request.ListInboundMessagesQueryParameters; - -/** - * Inbounds Service - * - *

Inbounds, or Mobile Originated (MO) messages, are incoming messages. Inbound messages can be - * listed and retrieved like batch messages and they can also be delivered by callback requests like - * delivery reports. - * - * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Inbounds/ - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.sms.api.v1.InboundsService} instead. - */ -@Deprecated -public interface InboundsService { - - /** - * List incoming messages - * - *

With the list operation, you can list all inbound messages that you have received. This - * operation supports pagination. Inbounds are returned in reverse chronological order. - * - * @param parameters Filtering parameters - * @return Incoming messages - * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Delivery-reports/#tag/Delivery-reports/operation/getDeliveryReports - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.sms.api.v1.InboundsService#list(ListInboundMessagesQueryParameters)} - * instead. - */ - @Deprecated - InboundsListResponse list(InboundsListRequestParameters parameters) throws ApiException; - - /** - * Retrieve inbound message - * - *

This operation retrieves a specific inbound message with the provided inbound ID - * - * @param inboundId The inbound ID found when listing inbound messages - * @return Inbound messages- - * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Inbounds/#tag/Inbounds/operation/RetrieveInboundMessage - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.sms.api.v1.InboundsService#get(String)} instead. - */ - @Deprecated - Inbound get(String inboundId) throws ApiException; -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/SMSService.java b/client/src/main/com/sinch/sdk/domains/sms/SMSService.java index edbb8caeb..5b7dfd7b1 100644 --- a/client/src/main/com/sinch/sdk/domains/sms/SMSService.java +++ b/client/src/main/com/sinch/sdk/domains/sms/SMSService.java @@ -17,54 +17,4 @@ public interface SMSService { * @since 1.5 */ com.sinch.sdk.domains.sms.api.v1.SMSService v1(); - - /** - * Batches Service instance - * - * @return service instance for project - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.sms.api.v1.SMSService#batches()} instead. - */ - @Deprecated - BatchesService batches(); - - /** - * WebHooksService Service instance - * - * @return service instance for project - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.sms.api.v1.SMSService#webhooks()} instead. - */ - @Deprecated - WebHooksService webHooks(); - - /** - * Delivery Reports Service instance - * - * @return service instance for project - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.sms.api.v1.SMSService#deliveryReports()} instead. - */ - @Deprecated - DeliveryReportsService deliveryReports(); - - /** - * Inbounds Service instance - * - * @return service instance for project - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.sms.api.v1.SMSService#inbounds()} instead. - */ - @Deprecated - InboundsService inbounds(); - - /** - * Groups Service instance - * - * @return service instance for project - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.sms.api.v1.SMSService#groups()} instead. - */ - @Deprecated - GroupsService groups(); } diff --git a/client/src/main/com/sinch/sdk/domains/sms/WebHooksService.java b/client/src/main/com/sinch/sdk/domains/sms/WebHooksService.java deleted file mode 100644 index 211b5a308..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/WebHooksService.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.sinch.sdk.domains.sms; - -import com.sinch.sdk.core.exceptions.ApiMappingException; -import com.sinch.sdk.domains.sms.models.webhooks.WebhooksEvent; - -/** - * WebHooks - * - *

Callbacks - * - *

A callback is an HTTP POST request with a notification made by the Sinch SMS REST API to a URI - * of your choosing. - * - *

The REST API expects the receiving server to respond with a response code within the 2xx - * success range. For 5xx the callback will be retried. For 429 - * the callback will be retried and the throughput will be lowered. For other status codes in the - * 4xx range the callback will not be retried. The first initial retry will happen 5 - * seconds after the first try. The next attempt is after 10 seconds, then after 20 seconds, after - * 40 seconds, after 80 seconds, doubling on every attempt. The last retry will be at 81920 seconds - * (or 22 hours 45 minutes) after the initial failed attempt. - * - *

The SMS REST API offers the following callback options which can be configured for your - * account upon request to your account manager. - * - *

    - *
  • Callback with mutual authentication over TLS (HTTPS) connection by provisioning the - * callback URL with client keystore and password. - *
  • Callback with basic authentication by provisioning the callback URL with username and - * password. - *
  • Callback with OAuth 2.0 by provisioning the callback URL with username, password and the - * URL to fetch OAuth access token. - *
  • Callback using AWS SNS by provisioning the callback URL with an Access Key ID, Secret Key - * and Region. - *
- * - * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Webhooks/ - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.sms.api.v1.WebHooksService} instead. - */ -@Deprecated -public interface WebHooksService { - - /** - * Parse and un-serialize incoming webhooks payload - * - * @param jsonPayload The incoming payload received onto webhooks call - * @return Un serialized object instance (see inherited classes) and {@link - * com.sinch.sdk.domains.sms.models.webhooks package documentation} - * @deprecated use {@link com.sinch.sdk.domains.sms.api.v1.WebHooksService#parseEvent(String)} - * instead. - */ - @Deprecated - WebhooksEvent parse(String jsonPayload) throws ApiMappingException; -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/adapters/BatchesService.java b/client/src/main/com/sinch/sdk/domains/sms/adapters/BatchesService.java deleted file mode 100644 index 469b318ce..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/adapters/BatchesService.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.sinch.sdk.domains.sms.adapters; - -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.core.http.AuthManager; -import com.sinch.sdk.core.http.HttpClient; -import com.sinch.sdk.core.http.HttpMapper; -import com.sinch.sdk.core.models.pagination.Page; -import com.sinch.sdk.domains.sms.adapters.api.v1.BatchesApi; -import com.sinch.sdk.domains.sms.adapters.converters.BatchDtoConverter; -import com.sinch.sdk.domains.sms.adapters.converters.DryRunDtoConverter; -import com.sinch.sdk.domains.sms.models.BaseBatch; -import com.sinch.sdk.domains.sms.models.Batch; -import com.sinch.sdk.domains.sms.models.DryRun; -import com.sinch.sdk.domains.sms.models.SMSCursorPageNavigator; -import com.sinch.sdk.domains.sms.models.dto.v1.ApiBatchListDto; -import com.sinch.sdk.domains.sms.models.requests.BatchesListRequestParameters; -import com.sinch.sdk.domains.sms.models.requests.UpdateBaseBatchRequest; -import com.sinch.sdk.domains.sms.models.responses.BatchesListResponse; -import com.sinch.sdk.models.SmsContext; -import java.time.Instant; -import java.util.Collection; -import java.util.Map; - -public class BatchesService implements com.sinch.sdk.domains.sms.BatchesService { - - private final String uriUUID; - private final BatchesApi api; - - public BatchesService( - String uriUUID, - SmsContext context, - HttpClient httpClient, - Map authManagers) { - this.uriUUID = uriUUID; - this.api = - new BatchesApi(httpClient, context.getSmsServer(), authManagers, HttpMapper.getInstance()); - } - - protected BatchesApi getApi() { - return this.api; - } - - public > T get(String batchId) throws ApiException { - return BatchDtoConverter.convert(getApi().getBatchMessage(uriUUID, batchId)); - } - - public > T send(BaseBatch batch) throws ApiException { - return BatchDtoConverter.convert(getApi().sendSMS(uriUUID, BatchDtoConverter.convert(batch))); - } - - public DryRun dryRun(boolean perRecipient, int numberOfRecipient, BaseBatch batch) { - return DryRunDtoConverter.convert( - getApi() - .dryRun(uriUUID, perRecipient, numberOfRecipient, BatchDtoConverter.convert(batch))); - } - - public BatchesListResponse list() throws ApiException { - return this.list(null); - } - - public BatchesListResponse list(BatchesListRequestParameters parameters) throws ApiException { - - BatchesListRequestParameters guardParameters = - null != parameters ? parameters : BatchesListRequestParameters.builder().build(); - - ApiBatchListDto response = - getApi() - .listBatches( - uriUUID, - guardParameters.getPage().orElse(null), - guardParameters.getPageSize().orElse(null), - guardParameters.getFrom().orElse(null), - guardParameters.getStartDate().map(Instant::toString).orElse(null), - guardParameters.getEndDate().map(Instant::toString).orElse(null), - guardParameters.getClientReference().orElse(null)); - - Collection> content = BatchDtoConverter.convert(response); - SMSCursorPageNavigator navigator = - new SMSCursorPageNavigator(response.getPage(), response.getPageSize()); - - return new BatchesListResponse(this, new Page<>(guardParameters, content, navigator)); - } - - public > T update(String batchId, UpdateBaseBatchRequest batch) - throws ApiException { - return BatchDtoConverter.convert( - getApi().updateBatchMessage(uriUUID, batchId, BatchDtoConverter.convert(batch))); - } - - public > T replace(String batchId, BaseBatch batch) throws ApiException { - return BatchDtoConverter.convert( - getApi().replaceBatch(uriUUID, batchId, BatchDtoConverter.convert(batch))); - } - - public > T cancel(String batchId) throws ApiException { - return BatchDtoConverter.convert(getApi().cancelBatchMessage(uriUUID, batchId)); - } - - public void sendDeliveryFeedback(String batchId, Collection recipients) - throws ApiException { - getApi().deliveryFeedback(uriUUID, batchId, BatchDtoConverter.convert(recipients)); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/adapters/DeliveryReportsService.java b/client/src/main/com/sinch/sdk/domains/sms/adapters/DeliveryReportsService.java deleted file mode 100644 index 49ce48646..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/adapters/DeliveryReportsService.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.sinch.sdk.domains.sms.adapters; - -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.core.http.AuthManager; -import com.sinch.sdk.core.http.HttpClient; -import com.sinch.sdk.core.http.HttpMapper; -import com.sinch.sdk.core.models.pagination.Page; -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.domains.sms.adapters.api.v1.DeliveryReportsApi; -import com.sinch.sdk.domains.sms.adapters.converters.DeliveryReportDtoConverter; -import com.sinch.sdk.domains.sms.models.DeliveryReportBatch; -import com.sinch.sdk.domains.sms.models.DeliveryReportRecipient; -import com.sinch.sdk.domains.sms.models.DeliveryReportType; -import com.sinch.sdk.domains.sms.models.SMSCursorPageNavigator; -import com.sinch.sdk.domains.sms.models.dto.v1.DeliveryReportListDto; -import com.sinch.sdk.domains.sms.models.requests.DeliveryReportBatchGetRequestParameters; -import com.sinch.sdk.domains.sms.models.requests.DeliveryReportListRequestParameters; -import com.sinch.sdk.domains.sms.models.responses.DeliveryReportsListResponse; -import com.sinch.sdk.models.SmsContext; -import java.time.Instant; -import java.util.Collection; -import java.util.Map; -import java.util.stream.Collectors; - -/** - * Delivery reports Service - * - *

The REST API uses message statuses and error codes in delivery reports, which refer to the - * state of the batch and can be present in either Retrieve - * a delivery report or sent as a callback. - * - * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Delivery-reports - * @since 1.0 - */ -public class DeliveryReportsService implements com.sinch.sdk.domains.sms.DeliveryReportsService { - - private final String uriUUID; - private final DeliveryReportsApi api; - - protected DeliveryReportsApi getApi() { - return this.api; - } - - public DeliveryReportsService( - String uriUUID, - SmsContext context, - HttpClient httpClient, - Map authManagers) { - this.uriUUID = uriUUID; - this.api = - new DeliveryReportsApi( - httpClient, context.getSmsServer(), authManagers, HttpMapper.getInstance()); - } - - public DeliveryReportBatch get(String batchId, DeliveryReportBatchGetRequestParameters parameters) - throws ApiException { - - DeliveryReportBatchGetRequestParameters guardParameters = - null != parameters ? parameters : DeliveryReportBatchGetRequestParameters.builder().build(); - - return DeliveryReportDtoConverter.convert( - getApi() - .getDeliveryReportByBatchId( - uriUUID, - batchId, - guardParameters.getType().map(DeliveryReportType::value).orElse(null), - guardParameters - .geStatues() - .map(f -> f.stream().map(EnumDynamic::value).collect(Collectors.joining(","))) - .orElse(null), - guardParameters - .getCodes() - .map(f -> f.stream().map(Object::toString).collect(Collectors.joining(","))) - .orElse(null))); - } - - public DeliveryReportRecipient getForNumber(String batchId, String recipient) - throws ApiException { - return DeliveryReportDtoConverter.convert( - getApi().getDeliveryReportByPhoneNumber(uriUUID, batchId, recipient)); - } - - public DeliveryReportsListResponse list() throws ApiException { - return this.list(null); - } - - public DeliveryReportsListResponse list(DeliveryReportListRequestParameters parameters) - throws ApiException { - DeliveryReportListRequestParameters guardParameters = - null != parameters ? parameters : DeliveryReportListRequestParameters.builder().build(); - - DeliveryReportListDto response = - getApi() - .getDeliveryReports( - uriUUID, - guardParameters.getPage().orElse(null), - guardParameters.getPageSize().orElse(null), - guardParameters.getStartDate().map(Instant::toString).orElse(null), - guardParameters.getEndDate().map(Instant::toString).orElse(null), - guardParameters - .getStatuses() - .map(f -> f.stream().map(EnumDynamic::value).collect(Collectors.joining(","))) - .orElse(null), - guardParameters - .getCodes() - .map(f -> f.stream().map(Object::toString).collect(Collectors.joining(","))) - .orElse(null), - guardParameters.getClientReference().orElse(null)); - - Collection content = DeliveryReportDtoConverter.convert(response); - SMSCursorPageNavigator navigator = - new SMSCursorPageNavigator(response.getPage(), response.getPageSize()); - - return new DeliveryReportsListResponse(this, new Page<>(guardParameters, content, navigator)); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/adapters/GroupsService.java b/client/src/main/com/sinch/sdk/domains/sms/adapters/GroupsService.java deleted file mode 100644 index 9e71b0104..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/adapters/GroupsService.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.sinch.sdk.domains.sms.adapters; - -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.core.http.AuthManager; -import com.sinch.sdk.core.http.HttpClient; -import com.sinch.sdk.core.http.HttpMapper; -import com.sinch.sdk.core.models.pagination.Page; -import com.sinch.sdk.domains.sms.adapters.api.v1.GroupsApi; -import com.sinch.sdk.domains.sms.adapters.converters.GroupsDtoConverter; -import com.sinch.sdk.domains.sms.models.Group; -import com.sinch.sdk.domains.sms.models.SMSCursorPageNavigator; -import com.sinch.sdk.domains.sms.models.dto.v1.ApiGroupListDto; -import com.sinch.sdk.domains.sms.models.dto.v1.CreateGroupResponseDto; -import com.sinch.sdk.domains.sms.models.requests.GroupCreateRequestParameters; -import com.sinch.sdk.domains.sms.models.requests.GroupReplaceRequestParameters; -import com.sinch.sdk.domains.sms.models.requests.GroupUpdateRequestParameters; -import com.sinch.sdk.domains.sms.models.requests.GroupsListRequestParameters; -import com.sinch.sdk.domains.sms.models.responses.GroupsListResponse; -import com.sinch.sdk.models.SmsContext; -import java.util.Collection; -import java.util.Map; - -public class GroupsService implements com.sinch.sdk.domains.sms.GroupsService { - - private final String uriUUID; - private final GroupsApi api; - - protected GroupsApi getApi() { - return this.api; - } - - public GroupsService( - String uriUUID, - SmsContext context, - HttpClient httpClient, - Map authManagers) { - this.uriUUID = uriUUID; - this.api = - new GroupsApi(httpClient, context.getSmsServer(), authManagers, HttpMapper.getInstance()); - } - - public Group get(String groupId) throws ApiException { - - CreateGroupResponseDto response = getApi().retrieveGroup(uriUUID, groupId); - return GroupsDtoConverter.convert(response); - } - - public Group create() throws ApiException { - return this.create(null); - } - - public Group create(GroupCreateRequestParameters parameters) throws ApiException { - GroupCreateRequestParameters guardParameters = - null != parameters ? parameters : GroupCreateRequestParameters.builder().build(); - - CreateGroupResponseDto response = - getApi().createGroup(uriUUID, GroupsDtoConverter.convert(guardParameters)); - return GroupsDtoConverter.convert(response); - } - - public GroupsListResponse list() throws ApiException { - return this.list(null); - } - - public GroupsListResponse list(GroupsListRequestParameters parameters) throws ApiException { - GroupsListRequestParameters guardParameters = - null != parameters ? parameters : GroupsListRequestParameters.builder().build(); - - ApiGroupListDto response = - getApi() - .listGroups( - uriUUID, - guardParameters.getPage().orElse(null), - guardParameters.getPageSize().orElse(null)); - - Collection content = GroupsDtoConverter.convert(response); - SMSCursorPageNavigator navigator = - new SMSCursorPageNavigator(response.getPage(), response.getPageSize()); - - return new GroupsListResponse(this, new Page<>(guardParameters, content, navigator)); - } - - public Group replace(String groupId, GroupReplaceRequestParameters parameters) - throws ApiException { - GroupReplaceRequestParameters guardParameters = - null != parameters ? parameters : GroupReplaceRequestParameters.builder().build(); - - CreateGroupResponseDto response = - getApi().replaceGroup(uriUUID, groupId, GroupsDtoConverter.convert(guardParameters)); - return GroupsDtoConverter.convert(response); - } - - public Group update(String groupId, GroupUpdateRequestParameters parameters) throws ApiException { - GroupUpdateRequestParameters guardParameters = - null != parameters ? parameters : GroupUpdateRequestParameters.builder().build(); - - CreateGroupResponseDto response = - getApi().updateGroup(uriUUID, groupId, GroupsDtoConverter.convert(guardParameters)); - return GroupsDtoConverter.convert(response); - } - - public void delete(String groupId) throws ApiException { - getApi().deleteGroup(uriUUID, groupId); - } - - public Collection listMembers(String groupId) throws ApiException { - return getApi().getMembers(uriUUID, groupId); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/adapters/InboundsService.java b/client/src/main/com/sinch/sdk/domains/sms/adapters/InboundsService.java deleted file mode 100644 index 89a468f75..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/adapters/InboundsService.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.sinch.sdk.domains.sms.adapters; - -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.core.http.AuthManager; -import com.sinch.sdk.core.http.HttpClient; -import com.sinch.sdk.core.http.HttpMapper; -import com.sinch.sdk.core.models.pagination.Page; -import com.sinch.sdk.domains.sms.adapters.api.v1.InboundsApi; -import com.sinch.sdk.domains.sms.adapters.converters.InboundsDtoConverter; -import com.sinch.sdk.domains.sms.models.Inbound; -import com.sinch.sdk.domains.sms.models.SMSCursorPageNavigator; -import com.sinch.sdk.domains.sms.models.dto.v1.ApiInboundListDto; -import com.sinch.sdk.domains.sms.models.dto.v1.InboundDto; -import com.sinch.sdk.domains.sms.models.requests.InboundsListRequestParameters; -import com.sinch.sdk.domains.sms.models.responses.InboundsListResponse; -import com.sinch.sdk.models.SmsContext; -import java.time.Instant; -import java.util.Collection; -import java.util.Map; - -public class InboundsService implements com.sinch.sdk.domains.sms.InboundsService { - - private final String uriUUID; - private final InboundsApi api; - - protected InboundsApi getApi() { - return this.api; - } - - public InboundsService( - String uriUUID, - SmsContext context, - HttpClient httpClient, - Map authManagers) { - this.uriUUID = uriUUID; - this.api = - new InboundsApi(httpClient, context.getSmsServer(), authManagers, HttpMapper.getInstance()); - } - - public InboundsListResponse list() throws ApiException { - return this.list(null); - } - - public InboundsListResponse list(InboundsListRequestParameters parameters) throws ApiException { - InboundsListRequestParameters guardParameters = - null != parameters ? parameters : InboundsListRequestParameters.builder().build(); - - ApiInboundListDto response = - getApi() - .listInboundMessages( - uriUUID, - guardParameters.getPage().orElse(null), - guardParameters.getPageSize().orElse(null), - guardParameters.getTo().map(f -> String.join(",", f)).orElse(null), - guardParameters.getStartDate().map(Instant::toString).orElse(null), - guardParameters.getEndDate().map(Instant::toString).orElse(null), - guardParameters.getClientReference().orElse(null)); - - Collection> content = InboundsDtoConverter.convert(response); - SMSCursorPageNavigator navigator = - new SMSCursorPageNavigator(response.getPage(), response.getPageSize()); - - return new InboundsListResponse(this, new Page<>(guardParameters, content, navigator)); - } - - public Inbound get(String inboundId) throws ApiException { - - InboundDto response = getApi().retrieveInboundMessage(uriUUID, inboundId); - return InboundsDtoConverter.convert(response); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/adapters/SMSService.java b/client/src/main/com/sinch/sdk/domains/sms/adapters/SMSService.java index 654d9c66c..11503c42e 100644 --- a/client/src/main/com/sinch/sdk/domains/sms/adapters/SMSService.java +++ b/client/src/main/com/sinch/sdk/domains/sms/adapters/SMSService.java @@ -1,42 +1,15 @@ package com.sinch.sdk.domains.sms.adapters; -import com.sinch.sdk.auth.adapters.BearerAuthManager; -import com.sinch.sdk.auth.adapters.OAuthManager; -import com.sinch.sdk.core.http.AuthManager; import com.sinch.sdk.core.http.HttpClient; -import com.sinch.sdk.core.http.HttpMapper; import com.sinch.sdk.core.models.ServerConfiguration; -import com.sinch.sdk.core.utils.StringUtil; -import com.sinch.sdk.domains.sms.BatchesService; -import com.sinch.sdk.domains.sms.DeliveryReportsService; -import com.sinch.sdk.domains.sms.InboundsService; -import com.sinch.sdk.domains.sms.WebHooksService; import com.sinch.sdk.models.SmsContext; import com.sinch.sdk.models.SmsServicePlanCredentials; import com.sinch.sdk.models.UnifiedCredentials; -import java.util.AbstractMap; -import java.util.Map; -import java.util.Objects; import java.util.function.Supplier; -import java.util.logging.Logger; -import java.util.stream.Collectors; -import java.util.stream.Stream; public class SMSService implements com.sinch.sdk.domains.sms.SMSService { - private static final Logger LOGGER = Logger.getLogger(SMSService.class.getName()); - - private static final String SECURITY_SCHEME_KEYWORD_SMS = "BearerAuth"; - private final String uriUUID; - private final SmsContext context; - private final Map authManagers; - private final Supplier httpClientSupplier; - private volatile com.sinch.sdk.domains.sms.api.v1.SMSService v1; - private volatile BatchesService batches; - private volatile WebHooksService webHooks; - private volatile DeliveryReportsService deliveryReports; - private volatile InboundsService inbounds; - private volatile GroupsService groups; + private final com.sinch.sdk.domains.sms.api.v1.SMSService v1; public SMSService( UnifiedCredentials credentials, @@ -44,25 +17,6 @@ public SMSService( ServerConfiguration oAuthServer, Supplier httpClientSupplier) { - Objects.requireNonNull(credentials, "Credentials must be defined"); - Objects.requireNonNull(context, "Context must be defined"); - StringUtil.requireNonEmpty(credentials.getKeyId(), "'keyId' must be defined"); - StringUtil.requireNonEmpty(credentials.getKeySecret(), "'keySecret' must be defined"); - StringUtil.requireNonEmpty(credentials.getProjectId(), "'projectId' must be defined"); - StringUtil.requireNonEmpty(context.getSmsUrl(), "'smsUrl' must be defined"); - - LOGGER.fine("Activate SMS API with server='" + context.getSmsServer().getUrl() + "'"); - - OAuthManager oAuthManager = - new OAuthManager(credentials, oAuthServer, HttpMapper.getInstance(), httpClientSupplier); - - this.uriUUID = credentials.getProjectId(); - this.context = context; - this.httpClientSupplier = httpClientSupplier; - this.authManagers = - Stream.of(new AbstractMap.SimpleEntry<>(SECURITY_SCHEME_KEYWORD_SMS, oAuthManager)) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); - this.v1 = new com.sinch.sdk.domains.sms.api.v1.adapters.SMSService( credentials, context, oAuthServer, httpClientSupplier); @@ -73,25 +27,6 @@ public SMSService( SmsContext context, Supplier httpClientSupplier) { - Objects.requireNonNull(credentials, "Credentials must be defined"); - Objects.requireNonNull(context, "Context must be defined"); - StringUtil.requireNonEmpty(credentials.getServicePlanId(), "'servicePlanId' must be defined"); - StringUtil.requireNonEmpty(credentials.getApiToken(), "'apiToken' must be defined"); - - LOGGER.fine( - "Activate SMS API with service plan ID support and server='" - + context.getSmsServer().getUrl() - + "'"); - - BearerAuthManager authManager = new BearerAuthManager(credentials.getApiToken()); - - this.uriUUID = credentials.getServicePlanId(); - this.context = context; - this.httpClientSupplier = httpClientSupplier; - this.authManagers = - Stream.of(new AbstractMap.SimpleEntry<>(SECURITY_SCHEME_KEYWORD_SMS, authManager)) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); - this.v1 = new com.sinch.sdk.domains.sms.api.v1.adapters.SMSService( credentials, context, httpClientSupplier); @@ -101,52 +36,4 @@ public SMSService( public com.sinch.sdk.domains.sms.api.v1.SMSService v1() { return this.v1; } - - @Override - public BatchesService batches() { - if (null == this.batches) { - this.batches = - new com.sinch.sdk.domains.sms.adapters.BatchesService( - uriUUID, context, httpClientSupplier.get(), authManagers); - } - return this.batches; - } - - @Override - public WebHooksService webHooks() { - if (null == this.webHooks) { - this.webHooks = new com.sinch.sdk.domains.sms.adapters.WebHooksService(); - } - return this.webHooks; - } - - @Override - public DeliveryReportsService deliveryReports() { - if (null == this.deliveryReports) { - this.deliveryReports = - new com.sinch.sdk.domains.sms.adapters.DeliveryReportsService( - uriUUID, context, httpClientSupplier.get(), authManagers); - } - return this.deliveryReports; - } - - @Override - public InboundsService inbounds() { - if (null == this.inbounds) { - this.inbounds = - new com.sinch.sdk.domains.sms.adapters.InboundsService( - uriUUID, context, httpClientSupplier.get(), authManagers); - } - return this.inbounds; - } - - @Override - public GroupsService groups() { - if (null == this.groups) { - this.groups = - new com.sinch.sdk.domains.sms.adapters.GroupsService( - uriUUID, context, httpClientSupplier.get(), authManagers); - } - return this.groups; - } } diff --git a/client/src/main/com/sinch/sdk/domains/sms/adapters/WebHooksService.java b/client/src/main/com/sinch/sdk/domains/sms/adapters/WebHooksService.java deleted file mode 100644 index c5c64705d..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/adapters/WebHooksService.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.sinch.sdk.domains.sms.adapters; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.sinch.sdk.core.exceptions.ApiMappingException; -import com.sinch.sdk.core.utils.databind.Mapper; -import com.sinch.sdk.domains.sms.adapters.converters.DeliveryReportDtoConverter; -import com.sinch.sdk.domains.sms.adapters.converters.InboundsDtoConverter; -import com.sinch.sdk.domains.sms.models.BaseDeliveryReport; -import com.sinch.sdk.domains.sms.models.Inbound; -import com.sinch.sdk.domains.sms.models.dto.v1.DeliveryReportDto; -import com.sinch.sdk.domains.sms.models.dto.v1.DeliveryReportDto.TypeEnum; -import com.sinch.sdk.domains.sms.models.dto.v1.MOBinaryDto; -import com.sinch.sdk.domains.sms.models.dto.v1.MOTextDto; -import com.sinch.sdk.domains.sms.models.dto.v1.RecipientDeliveryReportDto; -import com.sinch.sdk.domains.sms.models.webhooks.WebhooksEvent; -import java.util.Objects; - -public class WebHooksService implements com.sinch.sdk.domains.sms.WebHooksService { - - public WebhooksEvent parse(String jsonPayload) throws ApiMappingException { - - WebhooksEvent event; - try { - event = incomingSMS(jsonPayload); - if (null == event) { - event = deliveryReport(jsonPayload); - } - if (null == event) { - throw new ApiMappingException(jsonPayload, null); - } - } catch (JsonProcessingException e) { - throw new ApiMappingException(jsonPayload, e); - } - return event; - } - - private Inbound incomingSMS(String jsonPayload) throws JsonProcessingException { - MOBinaryDto binary = Mapper.getInstance().readValue(jsonPayload, MOBinaryDto.class); - if (null != binary - && (Objects.equals(binary.getType(), MOBinaryDto.TypeEnum.MO_BINARY.getValue()))) { - return InboundsDtoConverter.convert(binary); - } - MOTextDto text = Mapper.getInstance().readValue(jsonPayload, MOTextDto.class); - if (null != text && (Objects.equals(text.getType(), MOTextDto.TypeEnum.MO_TEXT.getValue()))) { - return InboundsDtoConverter.convert(text); - } - return null; - } - - private BaseDeliveryReport deliveryReport(String jsonPayload) throws JsonProcessingException { - // Can we convert payload to Recipient DeliveryReport or Batch Delivery Report ? - RecipientDeliveryReportDto recipient = - Mapper.getInstance().readValue(jsonPayload, RecipientDeliveryReportDto.class); - if (null != recipient - && (Objects.equals(recipient.getType(), RecipientDeliveryReportDto.TypeEnum.MMS.getValue()) - || Objects.equals( - recipient.getType(), RecipientDeliveryReportDto.TypeEnum.SMS.getValue()))) { - return DeliveryReportDtoConverter.convert(recipient); - } - - DeliveryReportDto deliveryReport = - Mapper.getInstance().readValue(jsonPayload, DeliveryReportDto.class); - if (null != deliveryReport - && (Objects.equals(deliveryReport.getType(), TypeEnum.MMS.getValue()) - || Objects.equals(deliveryReport.getType(), TypeEnum.SMS.getValue()))) { - return DeliveryReportDtoConverter.convert(deliveryReport); - } - return null; - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/adapters/converters/BatchDtoConverter.java b/client/src/main/com/sinch/sdk/domains/sms/adapters/converters/BatchDtoConverter.java deleted file mode 100644 index 2044fd824..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/adapters/converters/BatchDtoConverter.java +++ /dev/null @@ -1,299 +0,0 @@ -package com.sinch.sdk.domains.sms.adapters.converters; - -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.core.models.AbstractOpenApiSchema; -import com.sinch.sdk.domains.common.adapters.converters.EnumDynamicConverter; -import com.sinch.sdk.domains.sms.models.BaseBatch; -import com.sinch.sdk.domains.sms.models.Batch; -import com.sinch.sdk.domains.sms.models.BatchBinary; -import com.sinch.sdk.domains.sms.models.BatchMedia; -import com.sinch.sdk.domains.sms.models.BatchText; -import com.sinch.sdk.domains.sms.models.DeliveryReportType; -import com.sinch.sdk.domains.sms.models.MediaBody; -import com.sinch.sdk.domains.sms.models.dto.v1.ApiBatchListBatchesInnerDto; -import com.sinch.sdk.domains.sms.models.dto.v1.ApiBatchListDto; -import com.sinch.sdk.domains.sms.models.dto.v1.ApiDeliveryFeedbackDto; -import com.sinch.sdk.domains.sms.models.dto.v1.ApiUpdateBinaryMtMessageDto; -import com.sinch.sdk.domains.sms.models.dto.v1.ApiUpdateMmsMtMessageDto; -import com.sinch.sdk.domains.sms.models.dto.v1.ApiUpdateTextMtMessageDto; -import com.sinch.sdk.domains.sms.models.dto.v1.BinaryRequestDto; -import com.sinch.sdk.domains.sms.models.dto.v1.BinaryResponseDto; -import com.sinch.sdk.domains.sms.models.dto.v1.MediaBodyDto; -import com.sinch.sdk.domains.sms.models.dto.v1.MediaRequestDto; -import com.sinch.sdk.domains.sms.models.dto.v1.MediaResponseDto; -import com.sinch.sdk.domains.sms.models.dto.v1.SendSMSRequestDto; -import com.sinch.sdk.domains.sms.models.dto.v1.TextRequestDto; -import com.sinch.sdk.domains.sms.models.dto.v1.TextResponseDto; -import com.sinch.sdk.domains.sms.models.dto.v1.UpdateBatchMessageRequestDto; -import com.sinch.sdk.domains.sms.models.requests.SendSmsBatchBinaryRequest; -import com.sinch.sdk.domains.sms.models.requests.SendSmsBatchMediaRequest; -import com.sinch.sdk.domains.sms.models.requests.SendSmsBatchTextRequest; -import com.sinch.sdk.domains.sms.models.requests.UpdateBaseBatchRequest; -import com.sinch.sdk.domains.sms.models.requests.UpdateSmsBatchBinaryRequest; -import com.sinch.sdk.domains.sms.models.requests.UpdateSmsBatchMediaRequest; -import com.sinch.sdk.domains.sms.models.requests.UpdateSmsBatchTextRequest; -import java.time.ZoneOffset; -import java.util.ArrayList; -import java.util.Collection; - -public class BatchDtoConverter { - - public static > T convert(AbstractOpenApiSchema dto) { - Object obj = dto.getActualInstance(); - if (obj instanceof BinaryResponseDto) { - @SuppressWarnings("unchecked") - T t = (T) convertBinary((BinaryResponseDto) obj); - return t; - } else if (obj instanceof MediaResponseDto) { - @SuppressWarnings("unchecked") - T t = (T) convertMedia((MediaResponseDto) obj); - return t; - } else if (obj instanceof TextResponseDto) { - @SuppressWarnings("unchecked") - T t = (T) convertText((TextResponseDto) obj); - return t; - } else { - throw new ApiException("Unexpected class:" + obj.getClass().getName()); - } - } - - private static BatchBinary convertBinary(BinaryResponseDto dto) { - return BatchBinary.builder() - .setId(dto.getId()) - .setTo(dto.getTo()) - .setFrom(dto.getFrom()) - .setCanceled(dto.getCanceled()) - .setBody(dto.getBody()) - .setUdh(dto.getUdh()) - .setCreatedAt(null != dto.getCreatedAt() ? dto.getCreatedAt().toInstant() : null) - .setModifiedAt(null != dto.getModifiedAt() ? dto.getModifiedAt().toInstant() : null) - .setDeliveryReport(DeliveryReportType.from(dto.getDeliveryReport())) - .setSendAt(null != dto.getSendAt() ? dto.getSendAt().toInstant() : null) - .setExpireAt(null != dto.getExpireAt() ? dto.getExpireAt().toInstant() : null) - .setCallbackUrl(dto.getCallbackUrl()) - .setClientReference(dto.getClientReference()) - .setFeedbackEnabled(dto.getFeedbackEnabled()) - .setFlashMessage(dto.getFlashMessage()) - .setTruncateConcat(dto.getTruncateConcat()) - .setMaxNumberOfMessageParts(dto.getMaxNumberOfMessageParts()) - .setFromTon(dto.getFromTon()) - .setFromNpi(dto.getFromNpi()) - .build(); - } - - private static BatchMedia convertMedia(MediaResponseDto dto) { - return BatchMedia.builder() - .setId(dto.getId()) - .setTo(dto.getTo()) - .setFrom(dto.getFrom()) - .setCanceled(dto.getCanceled()) - .setBody( - null != dto.getBody() - ? MediaBody.builder() - .setMessage(dto.getBody().getMessage()) - .setUrl(dto.getBody().getUrl()) - .build() - : null) - .setCreatedAt(null != dto.getCreatedAt() ? dto.getCreatedAt().toInstant() : null) - .setModifiedAt(null != dto.getModifiedAt() ? dto.getModifiedAt().toInstant() : null) - .setDeliveryReport(DeliveryReportType.from(dto.getDeliveryReport())) - .setSendAt(null != dto.getSendAt() ? dto.getSendAt().toInstant() : null) - .setExpireAt(null != dto.getExpireAt() ? dto.getExpireAt().toInstant() : null) - .setCallbackUrl(dto.getCallbackUrl()) - .setClientReference(dto.getClientReference()) - .setFeedbackEnabled(dto.getFeedbackEnabled()) - .setParameters(ParametersDtoConverter.convert(dto.getParameters())) - .build(); - } - - private static BatchText convertText(TextResponseDto dto) { - return BatchText.builder() - .setId(dto.getId()) - .setTo(dto.getTo()) - .setFrom(dto.getFrom()) - .setCanceled(dto.getCanceled()) - .setBody(dto.getBody()) - .setCreatedAt(null != dto.getCreatedAt() ? dto.getCreatedAt().toInstant() : null) - .setModifiedAt(null != dto.getModifiedAt() ? dto.getModifiedAt().toInstant() : null) - .setDeliveryReport(DeliveryReportType.from(dto.getDeliveryReport())) - .setSendAt(null != dto.getSendAt() ? dto.getSendAt().toInstant() : null) - .setExpireAt(null != dto.getExpireAt() ? dto.getExpireAt().toInstant() : null) - .setCallbackUrl(dto.getCallbackUrl()) - .setClientReference(dto.getClientReference()) - .setFeedbackEnabled(dto.getFeedbackEnabled()) - .setFlashMessage(dto.getFlashMessage()) - .setTruncateConcat(dto.getTruncateConcat()) - .setMaxNumberOfMessageParts(dto.getMaxNumberOfMessageParts()) - .setFromTon(dto.getFromTon()) - .setFromNpi(dto.getFromNpi()) - .setParameters(ParametersDtoConverter.convert(dto.getParameters())) - .build(); - } - - public static SendSMSRequestDto convert(BaseBatch value) { - if (value instanceof SendSmsBatchBinaryRequest) { - return convert((SendSmsBatchBinaryRequest) value); - } else if (value instanceof SendSmsBatchMediaRequest) { - return convert((SendSmsBatchMediaRequest) value); - } else if (value instanceof SendSmsBatchTextRequest) { - return convert((SendSmsBatchTextRequest) value); - } else { - throw new ApiException("Unexpected class:" + value.getClass().getName()); - } - } - - public static UpdateBatchMessageRequestDto convert(UpdateBaseBatchRequest value) { - if (value instanceof UpdateSmsBatchBinaryRequest) { - return convert((UpdateSmsBatchBinaryRequest) value); - } else if (value instanceof UpdateSmsBatchMediaRequest) { - return convert((UpdateSmsBatchMediaRequest) value); - } else if (value instanceof UpdateSmsBatchTextRequest) { - return convert((UpdateSmsBatchTextRequest) value); - } else { - throw new ApiException("Unexpected class:" + value.getClass().getName()); - } - } - - private static SendSMSRequestDto convert(SendSmsBatchBinaryRequest value) { - BinaryRequestDto dto = - new BinaryRequestDto() - .type(BinaryRequestDto.TypeEnum.MT_BINARY.getValue()) - .to(new ArrayList<>(value.getTo())) - .body(value.getBody()); - value.getFrom().ifPresent(dto::from); - value - .getDeliveryReport() - .ifPresent(f -> dto.setDeliveryReport(EnumDynamicConverter.convert(f))); - value.getSendAt().ifPresent(f -> dto.setSendAt(f.atOffset(ZoneOffset.UTC))); - value.getExpireAt().ifPresent(f -> dto.setExpireAt(f.atOffset(ZoneOffset.UTC))); - value.getCallbackUrl().ifPresent(dto::callbackUrl); - value.getClientReference().ifPresent(dto::clientReference); - value.isFeedbackEnabled().ifPresent(dto::feedbackEnabled); - value.isFlashMessage().ifPresent(dto::flashMessage); - value.isTruncateConcat().ifPresent(dto::truncateConcat); - value.getMaxNumberOfMessageParts().ifPresent(dto::maxNumberOfMessageParts); - value.getFromTon().ifPresent(dto::fromTon); - value.getFromNpi().ifPresent(dto::fromNpi); - value.getUdh().ifPresent(dto::udh); - return new SendSMSRequestDto(dto); - } - - private static SendSMSRequestDto convert(SendSmsBatchMediaRequest value) { - MediaRequestDto dto = - new MediaRequestDto(MediaRequestDto.TypeEnum.MT_MEDIA.getValue()) - .to(new ArrayList<>(value.getTo())) - .body(convert(value.getBody())); - value.getFrom().ifPresent(dto::from); - value - .getDeliveryReport() - .ifPresent(f -> dto.setDeliveryReport(EnumDynamicConverter.convert(f))); - value.getSendAt().ifPresent(f -> dto.setSendAt(f.atOffset(ZoneOffset.UTC))); - value.getExpireAt().ifPresent(f -> dto.setExpireAt(f.atOffset(ZoneOffset.UTC))); - value.getCallbackUrl().ifPresent(dto::callbackUrl); - value.getClientReference().ifPresent(dto::clientReference); - value.isFeedbackEnabled().ifPresent(dto::feedbackEnabled); - value.isStrictValidation().ifPresent(dto::strictValidation); - value.getParameters().ifPresent(f -> dto.setParameters(ParametersDtoConverter.convert(f))); - return new SendSMSRequestDto(dto); - } - - private static SendSMSRequestDto convert(SendSmsBatchTextRequest value) { - TextRequestDto dto = - new TextRequestDto() - .type(TextRequestDto.TypeEnum.MT_TEXT.getValue()) - .to(new ArrayList<>(value.getTo())) - .body(value.getBody()); - value.getFrom().ifPresent(dto::from); - value - .getDeliveryReport() - .ifPresent(f -> dto.setDeliveryReport(EnumDynamicConverter.convert(f))); - value.getSendAt().ifPresent(f -> dto.setSendAt(f.atOffset(ZoneOffset.UTC))); - value.getExpireAt().ifPresent(f -> dto.setExpireAt(f.atOffset(ZoneOffset.UTC))); - value.getCallbackUrl().ifPresent(dto::callbackUrl); - value.getClientReference().ifPresent(dto::clientReference); - value.isFeedbackEnabled().ifPresent(dto::feedbackEnabled); - value.isFlashMessage().ifPresent(dto::flashMessage); - value.isTruncateConcat().ifPresent(dto::truncateConcat); - value.getMaxNumberOfMessageParts().ifPresent(dto::maxNumberOfMessageParts); - value.getFromTon().ifPresent(dto::fromTon); - value.getFromNpi().ifPresent(dto::fromNpi); - value.getParameters().ifPresent(f -> dto.setParameters(ParametersDtoConverter.convert(f))); - return new SendSMSRequestDto(dto); - } - - private static UpdateBatchMessageRequestDto convert(UpdateSmsBatchTextRequest value) { - ApiUpdateTextMtMessageDto dto = - new ApiUpdateTextMtMessageDto().type(ApiUpdateTextMtMessageDto.TypeEnum.MT_TEXT.getValue()); - - value.getToAdd().ifPresent(f -> dto.toAdd(new ArrayList<>(f))); - value.getToRemove().ifPresent(f -> dto.toRemove(new ArrayList<>(f))); - value.getFrom().ifPresent(dto::from); - value.getBody().ifPresent(dto::body); - value - .getDeliveryReport() - .ifPresent(f -> dto.setDeliveryReport(EnumDynamicConverter.convert(f))); - value.getSendAt().ifPresent(f -> dto.setSendAt(f.atOffset(ZoneOffset.UTC))); - value.getExpireAt().ifPresent(f -> dto.setExpireAt(f.atOffset(ZoneOffset.UTC))); - value.getCallbackUrl().ifPresent(dto::callbackUrl); - value.getParameters().ifPresent(f -> dto.setParameters(ParametersDtoConverter.convert(f))); - return new UpdateBatchMessageRequestDto(dto); - } - - private static UpdateBatchMessageRequestDto convert(UpdateSmsBatchMediaRequest value) { - ApiUpdateMmsMtMessageDto dto = - new ApiUpdateMmsMtMessageDto().type(ApiUpdateMmsMtMessageDto.TypeEnum.MT_MEDIA.getValue()); - - value.getToAdd().ifPresent(f -> dto.toAdd(new ArrayList<>(f))); - value.getToRemove().ifPresent(f -> dto.toRemove(new ArrayList<>(f))); - value.getFrom().ifPresent(dto::from); - value.getBody().ifPresent(f -> dto.setBody(convert(f))); - value - .getDeliveryReport() - .ifPresent(f -> dto.setDeliveryReport(EnumDynamicConverter.convert(f))); - value.getSendAt().ifPresent(f -> dto.setSendAt(f.atOffset(ZoneOffset.UTC))); - value.getExpireAt().ifPresent(f -> dto.setExpireAt(f.atOffset(ZoneOffset.UTC))); - value.getCallbackUrl().ifPresent(dto::callbackUrl); - value.getParameters().ifPresent(f -> dto.setParameters(ParametersDtoConverter.convert(f))); - value.isStrictValidation().ifPresent(dto::strictValidation); - return new UpdateBatchMessageRequestDto(dto); - } - - private static UpdateBatchMessageRequestDto convert(UpdateSmsBatchBinaryRequest value) { - ApiUpdateBinaryMtMessageDto dto = - new ApiUpdateBinaryMtMessageDto() - .type(ApiUpdateBinaryMtMessageDto.TypeEnum.MT_BINARY.getValue()); - value.getToAdd().ifPresent(f -> dto.toAdd(new ArrayList<>(f))); - value.getToRemove().ifPresent(f -> dto.toRemove(new ArrayList<>(f))); - value.getFrom().ifPresent(dto::from); - value.getBody().ifPresent(dto::setBody); - value - .getDeliveryReport() - .ifPresent(f -> dto.setDeliveryReport(EnumDynamicConverter.convert(f))); - value.getSendAt().ifPresent(f -> dto.setSendAt(f.atOffset(ZoneOffset.UTC))); - value.getExpireAt().ifPresent(f -> dto.setExpireAt(f.atOffset(ZoneOffset.UTC))); - value.getCallbackUrl().ifPresent(dto::callbackUrl); - value.getUdh().ifPresent(dto::udh); - return new UpdateBatchMessageRequestDto(dto); - } - - private static MediaBodyDto convert(MediaBody value) { - return new MediaBodyDto().url(value.getUrl()).message(value.getMessage().orElse(null)); - } - - public static > Collection convert(ApiBatchListDto dto) { - - Collection collection = dto.getBatches(); - Collection pageContent = new ArrayList<>(); - if (null != collection) { - for (ApiBatchListBatchesInnerDto apiBatchListBatchesInnerDto : collection) { - T convert = convert(apiBatchListBatchesInnerDto); - pageContent.add(convert); - } - } - return pageContent; - } - - public static ApiDeliveryFeedbackDto convert(Collection recipients) { - return new ApiDeliveryFeedbackDto().recipients(new ArrayList<>(recipients)); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/adapters/converters/DeliveryReportDtoConverter.java b/client/src/main/com/sinch/sdk/domains/sms/adapters/converters/DeliveryReportDtoConverter.java deleted file mode 100644 index a5c35b29b..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/adapters/converters/DeliveryReportDtoConverter.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.sinch.sdk.domains.sms.adapters.converters; - -import com.sinch.sdk.domains.sms.models.DeliveryReportBatch; -import com.sinch.sdk.domains.sms.models.DeliveryReportBatchMMS; -import com.sinch.sdk.domains.sms.models.DeliveryReportBatchSMS; -import com.sinch.sdk.domains.sms.models.DeliveryReportErrorCode; -import com.sinch.sdk.domains.sms.models.DeliveryReportRecipient; -import com.sinch.sdk.domains.sms.models.DeliveryReportRecipientEncoding; -import com.sinch.sdk.domains.sms.models.DeliveryReportRecipientMMS; -import com.sinch.sdk.domains.sms.models.DeliveryReportRecipientSMS; -import com.sinch.sdk.domains.sms.models.DeliveryReportStatus; -import com.sinch.sdk.domains.sms.models.DeliveryReportStatusDetails; -import com.sinch.sdk.domains.sms.models.dto.v1.DeliveryReportDto; -import com.sinch.sdk.domains.sms.models.dto.v1.DeliveryReportListDto; -import com.sinch.sdk.domains.sms.models.dto.v1.MessageDeliveryStatusDto; -import com.sinch.sdk.domains.sms.models.dto.v1.RecipientDeliveryReportDto; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Objects; -import java.util.stream.Collectors; - -public class DeliveryReportDtoConverter { - - public static DeliveryReportBatch convert(DeliveryReportDto dto) { - DeliveryReportBatch.Builder builder; - - if (Objects.equals(dto.getType(), DeliveryReportDto.TypeEnum.MMS.getValue())) { - builder = DeliveryReportBatchMMS.builder(); - } else if (Objects.equals(dto.getType(), DeliveryReportDto.TypeEnum.SMS.getValue())) { - builder = DeliveryReportBatchSMS.builder(); - } else { - return null; - } - - return builder - .setBatchId(dto.getBatchId()) - .setClientReference(dto.getClientReference()) - .setStatuses( - null != dto.getStatuses() - ? dto.getStatuses().stream() - .map(DeliveryReportDtoConverter::convert) - .collect(Collectors.toList()) - : null) - .setTotalMessageCount(dto.getTotalMessageCount()) - .build(); - } - - public static DeliveryReportRecipient convert(RecipientDeliveryReportDto dto) { - DeliveryReportRecipient.Builder builder; - - if (Objects.equals(dto.getType(), RecipientDeliveryReportDto.TypeEnum.MMS.getValue())) { - builder = DeliveryReportRecipientMMS.builder(); - } else if (Objects.equals(dto.getType(), RecipientDeliveryReportDto.TypeEnum.SMS.getValue())) { - builder = DeliveryReportRecipientSMS.builder(); - } else { - return null; - } - - return builder - .setBatchId(dto.getBatchId()) - .setClientReference(dto.getClientReference()) - .setAt(null != dto.getAt() ? dto.getAt().toInstant() : null) - .setCode(DeliveryReportErrorCode.from(dto.getCode())) - .setRecipient(dto.getRecipient()) - .setStatus(DeliveryReportStatus.from(dto.getStatus())) - .setAppliedOriginator(dto.getAppliedOriginator()) - .setEncoding(DeliveryReportRecipientEncoding.from(dto.getEncoding())) - .setNumberOfMessageParts(dto.getNumberOfMessageParts()) - .setOperator(dto.getOperator()) - .setOperatorStatusAt( - null != dto.getOperatorStatusAt() ? dto.getOperatorStatusAt().toInstant() : null) - .build(); - } - - public static Collection convert(DeliveryReportListDto dto) { - Collection collection = dto.getDeliveryReports(); - Collection pageContent = new ArrayList<>(); - if (null != collection) { - for (RecipientDeliveryReportDto innerDto : collection) { - DeliveryReportRecipient convert = convert(innerDto); - pageContent.add(convert); - } - } - return pageContent; - } - - private static DeliveryReportStatusDetails convert(MessageDeliveryStatusDto dto) { - return DeliveryReportStatusDetails.builder() - .setCode(dto.getCode()) - .setCount(dto.getCount()) - .setStatus(DeliveryReportStatus.from(dto.getStatus())) - .setRecipients(dto.getRecipients()) - .build(); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/adapters/converters/DryRunDtoConverter.java b/client/src/main/com/sinch/sdk/domains/sms/adapters/converters/DryRunDtoConverter.java deleted file mode 100644 index 1b7669049..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/adapters/converters/DryRunDtoConverter.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.sinch.sdk.domains.sms.adapters.converters; - -import com.sinch.sdk.domains.sms.models.DryRun; -import com.sinch.sdk.domains.sms.models.DryRunPerRecipientDetails; -import com.sinch.sdk.domains.sms.models.dto.v1.DryRun200ResponseDto; -import com.sinch.sdk.domains.sms.models.dto.v1.DryRun200ResponsePerRecipientInnerDto; -import java.util.stream.Collectors; - -public class DryRunDtoConverter { - - public static DryRun convert(DryRun200ResponseDto dto) { - return DryRun.builder() - .setNumberOfRecipients(dto.getNumberOfRecipients()) - .setNumberOfMessages(dto.getNumberOfMessages()) - .setPerRecipient( - dto.getPerRecipient().stream() - .map(DryRunDtoConverter::convert) - .collect(Collectors.toList())) - .build(); - } - - private static DryRunPerRecipientDetails convert(DryRun200ResponsePerRecipientInnerDto dto) { - return DryRunPerRecipientDetails.builder() - .setRecipient(dto.getRecipient()) - .setNumberOfParts(dto.getNumberOfParts()) - .setBody(dto.getBody()) - .setEncoding(dto.getEncoding()) - .build(); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/adapters/converters/GroupsDtoConverter.java b/client/src/main/com/sinch/sdk/domains/sms/adapters/converters/GroupsDtoConverter.java deleted file mode 100644 index 2ad137d63..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/adapters/converters/GroupsDtoConverter.java +++ /dev/null @@ -1,215 +0,0 @@ -package com.sinch.sdk.domains.sms.adapters.converters; - -import com.sinch.sdk.core.utils.DateUtil; -import com.sinch.sdk.domains.sms.models.Group; -import com.sinch.sdk.domains.sms.models.GroupAutoUpdate; -import com.sinch.sdk.domains.sms.models.GroupAutoUpdateKeyword; -import com.sinch.sdk.domains.sms.models.dto.v1.AddKeywordDto; -import com.sinch.sdk.domains.sms.models.dto.v1.ApiGroupAutoUpdateDto; -import com.sinch.sdk.domains.sms.models.dto.v1.ApiGroupDto; -import com.sinch.sdk.domains.sms.models.dto.v1.ApiGroupListDto; -import com.sinch.sdk.domains.sms.models.dto.v1.CreateGroupResponseDto; -import com.sinch.sdk.domains.sms.models.dto.v1.GroupAutoUpdateDto; -import com.sinch.sdk.domains.sms.models.dto.v1.GroupObjectAutoUpdateDto; -import com.sinch.sdk.domains.sms.models.dto.v1.GroupObjectAutoUpdateRemoveDto; -import com.sinch.sdk.domains.sms.models.dto.v1.GroupObjectDto; -import com.sinch.sdk.domains.sms.models.dto.v1.RemoveKeywordDto; -import com.sinch.sdk.domains.sms.models.dto.v1.ReplaceGroupRequestDto; -import com.sinch.sdk.domains.sms.models.dto.v1.UpdateGroupRequestAutoUpdateAddDto; -import com.sinch.sdk.domains.sms.models.dto.v1.UpdateGroupRequestAutoUpdateDto; -import com.sinch.sdk.domains.sms.models.dto.v1.UpdateGroupRequestAutoUpdateRemoveDto; -import com.sinch.sdk.domains.sms.models.dto.v1.UpdateGroupRequestDto; -import com.sinch.sdk.domains.sms.models.requests.GroupAutoUpdateKeywordRequestParameters; -import com.sinch.sdk.domains.sms.models.requests.GroupAutoUpdateRequestParameters; -import com.sinch.sdk.domains.sms.models.requests.GroupCreateRequestParameters; -import com.sinch.sdk.domains.sms.models.requests.GroupReplaceRequestParameters; -import com.sinch.sdk.domains.sms.models.requests.GroupUpdateRequestParameters; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Set; -import java.util.stream.Collectors; - -public class GroupsDtoConverter { - - public static Group convert(CreateGroupResponseDto dto) { - return Group.builder() - .setId(dto.getId()) - .setName(dto.getName()) - .setSize(dto.getSize()) - .setCreatedAt(DateUtil.toInstant(dto.getCreatedAt())) - .setModifiedAt(DateUtil.toInstant(dto.getModifiedAt())) - .setChildGroupIds(convertChildGroups(dto.getChildGroups())) - .setAutoUpdate(convert(dto.getAutoUpdate())) - .build(); - } - - public static GroupObjectDto convert(GroupCreateRequestParameters client) { - GroupObjectDto dto = new GroupObjectDto(); - client.getName().ifPresent(dto::name); - client.getMembers().ifPresent(f -> dto.members(new ArrayList<>(f))); - client.getChildGroupIds().ifPresent(f -> dto.childGroups(new ArrayList<>(f))); - client.getAutoUpdate().ifPresent(f -> dto.autoUpdate(GroupsDtoConverter.convert(f))); - return dto; - } - - public static Collection convert(ApiGroupListDto dto) { - - Collection collection = dto.getGroups(); - Collection pageContent = new ArrayList<>(); - if (null != collection) { - for (ApiGroupDto innerDto : collection) { - Group convert = convert(innerDto); - pageContent.add(convert); - } - } - return pageContent; - } - - public static ReplaceGroupRequestDto convert(GroupReplaceRequestParameters client) { - ReplaceGroupRequestDto dto = new ReplaceGroupRequestDto(); - client.getName().ifPresent(dto::name); - client.getMembers().ifPresent(f -> dto.members(new ArrayList<>(f))); - return dto; - } - - public static UpdateGroupRequestDto convert(GroupUpdateRequestParameters client) { - UpdateGroupRequestDto dto = new UpdateGroupRequestDto(); - client.getName().ifPresent(dto::name); - client.getAdd().ifPresent(f -> dto.add(new ArrayList<>(f))); - client.getRemove().ifPresent(f -> dto.remove(new ArrayList<>(f))); - client.getAddFromGroup().ifPresent(dto::addFromGroup); - client.getRemoveFromGroup().ifPresent(dto::removeFromGroup); - client.getAutoUpdate().ifPresent(f -> dto.autoUpdate(GroupsDtoConverter.convertForUpdate(f))); - return dto; - } - - private static Group convert(ApiGroupDto dto) { - return Group.builder() - .setId(dto.getId()) - .setName(dto.getName()) - .setSize(dto.getSize()) - .setCreatedAt(DateUtil.toInstant(dto.getCreatedAt())) - .setModifiedAt(DateUtil.toInstant(dto.getModifiedAt())) - .setChildGroupIds(convertChildGroups(dto.getChildGroups())) - .setAutoUpdate(convert(dto.getAutoUpdate())) - .build(); - } - - private static Collection convertChildGroups(Set dto) { - if (null == dto) { - return null; - } - return dto.stream().map(f -> (String) f).collect(Collectors.toList()); - } - - private static GroupAutoUpdate convert(GroupAutoUpdateDto dto) { - if (null == dto) { - return null; - } - return GroupAutoUpdate.builder() - .setTo(dto.getTo()) - .setAdd(convert(dto.getAdd())) - .setRemove(convert(dto.getRemove())) - .build(); - } - - private static GroupAutoUpdate convert(ApiGroupAutoUpdateDto dto) { - if (null == dto) { - return null; - } - return GroupAutoUpdate.builder() - .setTo(dto.getTo()) - .setAdd(convert(dto.getAdd())) - .setRemove(convert(dto.getRemove())) - .build(); - } - - private static GroupObjectAutoUpdateDto convert(GroupAutoUpdateRequestParameters client) { - if (null == client) { - return null; - } - GroupObjectAutoUpdateDto dto = new GroupObjectAutoUpdateDto(); - client.getTo().ifPresent(dto::to); - client.getAdd().ifPresent(f -> dto.add(convertAdd(f))); - client.getRemove().ifPresent(f -> dto.remove(convertRemove(f))); - return dto; - } - - private static UpdateGroupRequestAutoUpdateDto convertForUpdate( - GroupAutoUpdateRequestParameters client) { - if (null == client) { - return null; - } - UpdateGroupRequestAutoUpdateDto dto = new UpdateGroupRequestAutoUpdateDto(); - - client.getTo().ifPresent(dto::to); - client.getAdd().ifPresent(f -> dto.add(convertAdd(f))); - client.getRemove().ifPresent(f -> dto.remove(convertRemoveForUpdate(f))); - return dto; - } - - private static GroupAutoUpdateKeyword convert(AddKeywordDto dto) { - if (null == dto) { - return null; - } - - GroupAutoUpdateKeyword.Builder builder = GroupAutoUpdateKeyword.builder(); - if (dto.getFirstWordDefined()) { - builder.setFirstWord(dto.getFirstWord()); - } - if (dto.getSecondWordDefined()) { - builder.setSecondWord(dto.getSecondWord()); - } - return builder.build(); - } - - private static UpdateGroupRequestAutoUpdateAddDto convertAdd( - GroupAutoUpdateKeywordRequestParameters client) { - if (null == client) { - return null; - } - - UpdateGroupRequestAutoUpdateAddDto dto = new UpdateGroupRequestAutoUpdateAddDto(); - client.getFirstWord().ifPresent(dto::firstWord); - client.getSecondWord().ifPresent(dto::secondWord); - return dto; - } - - private static GroupAutoUpdateKeyword convert(RemoveKeywordDto dto) { - if (null == dto) { - return null; - } - GroupAutoUpdateKeyword.Builder builder = GroupAutoUpdateKeyword.builder(); - if (dto.getFirstWordDefined()) { - builder.setFirstWord(dto.getFirstWord()); - } - if (dto.getSecondWordDefined()) { - builder.setSecondWord(dto.getSecondWord()); - } - return builder.build(); - } - - private static GroupObjectAutoUpdateRemoveDto convertRemove( - GroupAutoUpdateKeywordRequestParameters client) { - if (null == client) { - return null; - } - - GroupObjectAutoUpdateRemoveDto dto = new GroupObjectAutoUpdateRemoveDto(); - client.getFirstWord().ifPresent(dto::firstWord); - client.getSecondWord().ifPresent(dto::secondWord); - return dto; - } - - private static UpdateGroupRequestAutoUpdateRemoveDto convertRemoveForUpdate( - GroupAutoUpdateKeywordRequestParameters client) { - if (null == client) { - return null; - } - - UpdateGroupRequestAutoUpdateRemoveDto dto = new UpdateGroupRequestAutoUpdateRemoveDto(); - client.getFirstWord().ifPresent(dto::firstWord); - client.getSecondWord().ifPresent(dto::secondWord); - return dto; - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/adapters/converters/InboundsDtoConverter.java b/client/src/main/com/sinch/sdk/domains/sms/adapters/converters/InboundsDtoConverter.java deleted file mode 100644 index c8cd25d9a..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/adapters/converters/InboundsDtoConverter.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.sinch.sdk.domains.sms.adapters.converters; - -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.core.models.AbstractOpenApiSchema; -import com.sinch.sdk.domains.sms.models.Inbound; -import com.sinch.sdk.domains.sms.models.InboundBinary; -import com.sinch.sdk.domains.sms.models.InboundText; -import com.sinch.sdk.domains.sms.models.dto.v1.ApiInboundListDto; -import com.sinch.sdk.domains.sms.models.dto.v1.InboundDto; -import com.sinch.sdk.domains.sms.models.dto.v1.MOBinaryDto; -import com.sinch.sdk.domains.sms.models.dto.v1.MOTextDto; -import java.util.ArrayList; -import java.util.Collection; - -public class InboundsDtoConverter { - - public static Inbound convert(AbstractOpenApiSchema dto) { - Object obj = dto.getActualInstance(); - if (obj instanceof MOBinaryDto) { - return convert((MOBinaryDto) obj); - } else if (obj instanceof MOTextDto) { - return convert((MOTextDto) obj); - } else { - throw new ApiException("Unexpected class:" + obj.getClass().getName()); - } - } - - public static Collection> convert(ApiInboundListDto dto) { - - Collection collection = dto.getInbounds(); - Collection> pageContent = new ArrayList<>(); - if (null != collection) { - for (InboundDto innerDto : collection) { - Inbound convert = convert(innerDto); - pageContent.add(convert); - } - } - return pageContent; - } - - public static InboundBinary convert(MOBinaryDto dto) { - return InboundBinary.builder() - .setBody(dto.getBody()) - .setFrom(dto.getFrom()) - .setId(dto.getId()) - .setReceivedAt(null != dto.getReceivedAt() ? dto.getReceivedAt().toInstant() : null) - .setTo(dto.getTo()) - .setClientReference(dto.getClientReference()) - .setOperatorId(dto.getOperatorId()) - .setSentAt(null != dto.getSentAt() ? dto.getSentAt().toInstant() : null) - .setUdh(dto.getUdh()) - .build(); - } - - public static InboundText convert(MOTextDto dto) { - return InboundText.builder() - .setBody(dto.getBody()) - .setFrom(dto.getFrom()) - .setId(dto.getId()) - .setReceivedAt(null != dto.getReceivedAt() ? dto.getReceivedAt().toInstant() : null) - .setTo(dto.getTo()) - .setClientReference(dto.getClientReference()) - .setOperatorId(dto.getOperatorId()) - .setSentAt(null != dto.getSentAt() ? dto.getSentAt().toInstant() : null) - .build(); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/adapters/converters/ParametersDtoConverter.java b/client/src/main/com/sinch/sdk/domains/sms/adapters/converters/ParametersDtoConverter.java deleted file mode 100644 index 95350fc2a..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/adapters/converters/ParametersDtoConverter.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.sinch.sdk.domains.sms.adapters.converters; - -import com.sinch.sdk.core.utils.Pair; -import com.sinch.sdk.domains.sms.models.Parameters; -import com.sinch.sdk.domains.sms.models.Parameters.Entry; -import com.sinch.sdk.domains.sms.models.dto.v1.ParameterObjDto; -import com.sinch.sdk.domains.sms.models.dto.v1.ParameterObjParameterKeyDto; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; -import java.util.Optional; -import java.util.concurrent.atomic.AtomicReference; - -public class ParametersDtoConverter { - - public static Parameters convert(ParameterObjDto dto) { - if (null == dto) { - return null; - } - - ArrayList client = new ArrayList<>(); - dto.forEach((key, value) -> client.addAll(convertParameters(key, value))); - - return new Parameters(client); - } - - public static ParameterObjDto convert(Parameters parameters) { - ParameterObjDto dto = new ParameterObjDto(); - - parameters - .entrySet() - .iterator() - .forEachRemaining(entries -> dto.put(entries.getKey(), convert(entries.getValue()))); - return dto; - } - - public static HashMap convert(Collection client) { - if (null == client) { - return null; - } - HashMap dto = new HashMap<>(); - - client.forEach( - entry -> { - dto.put(entry.getValue().getLeft(), entry.getValue().getRight()); - entry - .getDefaultValue() - .ifPresent(def -> dto.put(ParameterObjParameterKeyDto.JSON_PROPERTY_DEFAULT, def)); - }); - return dto; - } - - public static Collection convertParameters(String parameterName, Object _dto) { - if (!(_dto instanceof Map)) { - return null; - } - ArrayList client = new ArrayList<>(); - - @SuppressWarnings("unchecked") - Map dto = (Map) _dto; - - AtomicReference> defValue = - new AtomicReference<>( - dto.entrySet().stream() - .filter( - entry -> - entry.getKey().equals(ParameterObjParameterKeyDto.JSON_PROPERTY_DEFAULT)) - .map(Map.Entry::getValue) - .findFirst()); - - dto.forEach( - (key, value) -> { - if (!key.equals(ParameterObjParameterKeyDto.JSON_PROPERTY_DEFAULT)) { - client.add( - new Entry(parameterName, new Pair<>(key, value), defValue.get().orElse(null))); - defValue.set(Optional.empty()); - } - }); - return client; - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/BaseBatch.java b/client/src/main/com/sinch/sdk/domains/sms/models/BaseBatch.java deleted file mode 100644 index 9fe049854..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/BaseBatch.java +++ /dev/null @@ -1,251 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import com.sinch.sdk.core.models.OptionalValue; -import java.time.Instant; -import java.util.Collection; -import java.util.Objects; - -/** - * Base class for Batch types - * - * @param Type of batch - * @since 1.0 - */ -public class BaseBatch { - - private final T body; - - private final Collection to; - - private final OptionalValue from; - - private final OptionalValue deliveryReport; - - private final OptionalValue sendAt; - - private final OptionalValue expireAt; - - private final OptionalValue callbackUrl; - - private final OptionalValue clientReference; - - private final OptionalValue feedbackEnabled; - - protected BaseBatch( - Collection to, - OptionalValue from, - T body, - OptionalValue deliveryReport, - OptionalValue sendAt, - OptionalValue expireAt, - OptionalValue callbackUrl, - OptionalValue clientReference, - OptionalValue feedbackEnabled) { - Objects.requireNonNull(to); - Objects.requireNonNull(body); - this.to = to; - this.from = from; - this.body = body; - this.deliveryReport = deliveryReport; - this.sendAt = sendAt; - this.expireAt = expireAt; - this.callbackUrl = callbackUrl; - this.clientReference = clientReference; - this.feedbackEnabled = feedbackEnabled; - } - - public Collection getTo() { - return to; - } - - public T getBody() { - return body; - } - - public OptionalValue getFrom() { - return from; - } - - public OptionalValue getDeliveryReport() { - return deliveryReport; - } - - public OptionalValue getSendAt() { - return sendAt; - } - - public OptionalValue getExpireAt() { - return expireAt; - } - - public OptionalValue getCallbackUrl() { - return callbackUrl; - } - - public OptionalValue getClientReference() { - return clientReference; - } - - public OptionalValue isFeedbackEnabled() { - return feedbackEnabled; - } - - @Override - public String toString() { - return "BaseBatch{" - + "body=" - + body - + ", to=" - + to - + ", from='" - + from - + '\'' - + ", deliveryReportType=" - + deliveryReport - + ", sendAt=" - + sendAt - + ", expireAt=" - + expireAt - + ", callbackUrl='" - + callbackUrl - + '\'' - + ", clientReference='" - + clientReference - + '\'' - + ", feedbackEnabled=" - + feedbackEnabled - + '}'; - } - - protected static class Builder> { - - public Collection to; - - public OptionalValue from = OptionalValue.empty(); - - public T body; - - public OptionalValue deliveryReport = OptionalValue.empty(); - - public OptionalValue sendAt = OptionalValue.empty(); - - public OptionalValue expireAt = OptionalValue.empty(); - - public OptionalValue callbackUrl = OptionalValue.empty(); - - public OptionalValue clientReference = OptionalValue.empty(); - - public OptionalValue feedbackEnabled = OptionalValue.empty(); - - /** - * @param to List of Phone numbers and group IDs that will receive the batch - * @return current builder - */ - public B setTo(Collection to) { - this.to = to; - return self(); - } - - /** - * @param from Sender number. Must be valid phone number, short code or alphanumeric. Required - * if Automatic Default Originator not configured. - * @return current builder - */ - public B setFrom(String from) { - this.from = OptionalValue.of(from); - return self(); - } - - /** - * @param body The message content - * @return current builder - */ - public B setBody(T body) { - this.body = body; - return self(); - } - - /** - * @param deliveryReport Request delivery report callback. Note that delivery reports can be - * fetched from the API regardless of this setting - * @return current builder - */ - public B setDeliveryReport(DeliveryReportType deliveryReport) { - this.deliveryReport = OptionalValue.of(deliveryReport); - return self(); - } - - /** - * @param sendAt If set in the future, the message will be delayed until send_at occurs. Must be - * before expire_at. If set in the past, messages will be sent immediately - * @return current builder - */ - public B setSendAt(Instant sendAt) { - this.sendAt = OptionalValue.of(sendAt); - return self(); - } - - /** - * @param expireAt If set, the system will stop trying to deliver the message at this point. - * Must be after send_at. Default and max is 3 days after send_at - * @return current builder - */ - public B setExpireAt(Instant expireAt) { - this.expireAt = OptionalValue.of(expireAt); - return self(); - } - - /** - * @param callbackUrl Override the default callback URL for this batch. Must be valid URL. - * @return current builder - */ - public B setCallbackUrl(String callbackUrl) { - this.callbackUrl = OptionalValue.of(callbackUrl); - return self(); - } - - /** - * @param clientReference The client identifier of a batch message. If set, the identifier will - * be added in the delivery report/callback of this batch - * @return current builder - */ - public B setClientReference(String clientReference) { - this.clientReference = OptionalValue.of(clientReference); - return self(); - } - - /** - * @param feedbackEnabled If set to true, then feedback is expected after successful delivery. - * @return current builder - */ - public B setFeedbackEnabled(Boolean feedbackEnabled) { - this.feedbackEnabled = OptionalValue.of(feedbackEnabled); - return self(); - } - - public BaseBatch build() { - return new BaseBatch<>( - to, - from, - body, - deliveryReport, - sendAt, - expireAt, - callbackUrl, - clientReference, - feedbackEnabled); - } - - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - } - - public static class BatchBuilder extends BaseBatch.Builder> { - @Override - protected BatchBuilder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/BaseDeliveryReport.java b/client/src/main/com/sinch/sdk/domains/sms/models/BaseDeliveryReport.java deleted file mode 100644 index f78640d05..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/BaseDeliveryReport.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import com.sinch.sdk.domains.sms.models.webhooks.WebhooksEvent; -import java.util.Objects; -import java.util.Optional; - -/** - * Base class for Delivery Report WebHook - * - * @since 1.0 - */ -public abstract class BaseDeliveryReport implements WebhooksEvent { - - private final String batchId; - private final String clientReference; - - /** - * @param batchId Required. The ID of the batch this delivery report belongs to. - * @param clientReference The client identifier of the batch this delivery report belongs to, if - * set when submitting batch. - */ - public BaseDeliveryReport(String batchId, String clientReference) { - Objects.requireNonNull(batchId); - this.batchId = batchId; - this.clientReference = clientReference; - } - - public String getBatchId() { - return batchId; - } - - public Optional getClientReference() { - return Optional.ofNullable(clientReference); - } - - @Override - public String toString() { - return "BaseDeliveryReport{" - + "batchId='" - + batchId - + '\'' - + ", clientReference='" - + clientReference - + '\'' - + '}'; - } - - public abstract static class Builder> { - protected String batchId; - protected String clientReference; - - public B setBatchId(String batchId) { - this.batchId = batchId; - return self(); - } - - public B setClientReference(String clientReference) { - this.clientReference = clientReference; - return self(); - } - - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/Batch.java b/client/src/main/com/sinch/sdk/domains/sms/models/Batch.java deleted file mode 100644 index 5d3d31651..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/Batch.java +++ /dev/null @@ -1,303 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import java.time.Instant; -import java.util.Collection; - -/** - * Base class for Batch types - * - * @param Type of batch - * @since 1.0 - */ -public class Batch { - - private final String id; - - private final Collection to; - - private final String from; - - private final Boolean canceled; - - private final T body; - - private final Instant createdAt; - - private final Instant modifiedAt; - - private final DeliveryReportType deliveryReport; - - private final Instant sendAt; - - private final Instant expireAt; - - private final String callbackUrl; - - private final String clientReference; - - private final Boolean feedbackEnabled; - - /** - * @param id Unique identifier for batch - * @param to List of Phone numbers and group IDs that will receive the batch - * @param from Sender number. Must be valid phone number, short code or alphanumeric. Required if - * Automatic Default Originator not configured. - * @param canceled Indicates if the batch has been canceled or not. - * @param body The message content - * @param createdAt when batch was created - * @param modifiedAt when batch was last updated - * @param deliveryReport Request delivery report callback. Note that delivery reports can be - * fetched from the API regardless of this setting - * @param sendAt If set in the future, the message will be delayed until send_at occurs. Must be - * before expire_at. If set in the past, messages will be sent immediately - * @param expireAt If set, the system will stop trying to deliver the message at this point. Must - * be after send_at. Default and max is 3 days after send_at - * @param callbackUrl Override the default callback URL for this batch. Must be valid URL. - * @param clientReference The client identifier of a batch message. If set, the identifier will be - * added in the delivery report/callback of this batch - * @param feedbackEnabled If set to true, then feedback is expected after successful delivery. - */ - public Batch( - String id, - Collection to, - String from, - Boolean canceled, - T body, - Instant createdAt, - Instant modifiedAt, - DeliveryReportType deliveryReport, - Instant sendAt, - Instant expireAt, - String callbackUrl, - String clientReference, - Boolean feedbackEnabled) { - this.id = id; - this.to = to; - this.from = from; - this.canceled = canceled; - this.body = body; - this.createdAt = createdAt; - this.modifiedAt = modifiedAt; - this.deliveryReport = deliveryReport; - this.sendAt = sendAt; - this.expireAt = expireAt; - this.callbackUrl = callbackUrl; - this.clientReference = clientReference; - this.feedbackEnabled = feedbackEnabled; - } - - public static BatchBuilder batchBuilder() { - return new BatchBuilder<>(); - } - - public String getId() { - return id; - } - - public Collection getTo() { - return to; - } - - public String getFrom() { - return from; - } - - public Boolean isCanceled() { - return canceled; - } - - public T getBody() { - return body; - } - - public Instant getCreatedAt() { - return createdAt; - } - - public Instant getModifiedAt() { - return modifiedAt; - } - - public DeliveryReportType getDeliveryReport() { - return deliveryReport; - } - - public Instant getSendAt() { - return sendAt; - } - - public Instant getExpireAt() { - return expireAt; - } - - public String getCallbackUrl() { - return callbackUrl; - } - - public String getClientReference() { - return clientReference; - } - - public Boolean isFeedbackEnabled() { - return feedbackEnabled; - } - - @Override - public String toString() { - return "Batch{" - + "id='" - + id - + '\'' - + ", to=" - + to - + ", from='" - + from - + '\'' - + ", canceled=" - + canceled - + ", body=" - + body - + ", createdAt=" - + createdAt - + ", modifiedAt=" - + modifiedAt - + ", deliveryReportType=" - + deliveryReport - + ", sendAt=" - + sendAt - + ", expireAt=" - + expireAt - + ", callbackUrl='" - + callbackUrl - + '\'' - + ", clientReference='" - + clientReference - + '\'' - + ", feedbackEnabled=" - + feedbackEnabled - + '}'; - } - - protected static class Builder> { - - String id; - - Collection to; - - String from; - - Boolean canceled; - - T body; - - Instant createdAt; - - Instant modifiedAt; - - DeliveryReportType deliveryReport; - - Instant sendAt; - - Instant expireAt; - - String callbackUrl; - - String clientReference; - - Boolean feedbackEnabled; - - public B setId(String id) { - this.id = id; - return self(); - } - - public B setTo(Collection to) { - this.to = to; - return self(); - } - - public B setFrom(String from) { - this.from = from; - return self(); - } - - public B setCanceled(Boolean canceled) { - this.canceled = canceled; - return self(); - } - - public B setBody(T body) { - this.body = body; - return self(); - } - - public B setCreatedAt(Instant createdAt) { - this.createdAt = createdAt; - return self(); - } - - public B setModifiedAt(Instant modifiedAt) { - this.modifiedAt = modifiedAt; - return self(); - } - - public B setDeliveryReport(DeliveryReportType deliveryReport) { - this.deliveryReport = deliveryReport; - return self(); - } - - public B setSendAt(Instant sendAt) { - this.sendAt = sendAt; - return self(); - } - - public B setExpireAt(Instant expireAt) { - this.expireAt = expireAt; - return self(); - } - - public B setCallbackUrl(String callbackUrl) { - this.callbackUrl = callbackUrl; - return self(); - } - - public B setClientReference(String clientReference) { - this.clientReference = clientReference; - return self(); - } - - public B setFeedbackEnabled(Boolean feedbackEnabled) { - this.feedbackEnabled = feedbackEnabled; - return self(); - } - - public Batch build() { - return new Batch<>( - id, - to, - from, - canceled, - body, - createdAt, - modifiedAt, - deliveryReport, - sendAt, - expireAt, - callbackUrl, - clientReference, - feedbackEnabled); - } - - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - } - - public static class BatchBuilder extends Batch.Builder> { - @Override - protected BatchBuilder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/BatchBinary.java b/client/src/main/com/sinch/sdk/domains/sms/models/BatchBinary.java deleted file mode 100644 index 5d9a989e0..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/BatchBinary.java +++ /dev/null @@ -1,204 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import java.time.Instant; -import java.util.Collection; - -/** - * BatchBinary type - * - * @since 1.0 - */ -public class BatchBinary extends Batch { - private final Boolean flashMessage; - private final Boolean truncateConcat; - private final Integer maxNumberOfMessageParts; - private final Integer fromTon; - private final Integer fromNpi; - private final String udh; - - /** - * @param id Unique identifier for batch - * @param to List of Phone numbers and group IDs that will receive the batch - * @param from Sender number. Must be valid phone number, short code or alphanumeric. Required if - * Automatic Default Originator not configured. - * @param canceled Indicates if the batch has been canceled or not. - * @param body The message content - * @param createdAt when batch was created - * @param modifiedAt when batch was last updated - * @param deliveryReport Request delivery report callback. Note that delivery reports can be - * fetched from the API regardless of this setting - * @param sendAt If set in the future, the message will be delayed until send_at occurs. Must be - * before expire_at. If set in the past, messages will be sent immediately - * @param expireAt If set, the system will stop trying to deliver the message at this point. Must - * be after send_at. Default and max is 3 days after send_at - * @param callbackUrl Override the default callback URL for this batch. Must be valid URL. - * @param clientReference The client identifier of a batch message. If set, the identifier will be - * added in the delivery report/callback of this batch - * @param feedbackEnabled If set to true, then feedback is expected after successful delivery. * - * @param flashMessage If sent as a flash message, displays true. - * @param truncateConcat If set to true, the message was shortened when exceeding one part. - * @param maxNumberOfMessageParts Displays the number of message parts set in the request. - * @param fromTon The type of number for the sender number. - * @param fromNpi Number Plan Indicator for the sender number. - * @param udh The UDH header of a binary message HEX encoded. Max 140 bytes including the body. - */ - public BatchBinary( - String id, - Collection to, - String from, - Boolean canceled, - String body, - Instant createdAt, - Instant modifiedAt, - DeliveryReportType deliveryReport, - Instant sendAt, - Instant expireAt, - String callbackUrl, - String clientReference, - Boolean feedbackEnabled, - Boolean flashMessage, - Boolean truncateConcat, - Integer maxNumberOfMessageParts, - Integer fromTon, - Integer fromNpi, - String udh) { - super( - id, - to, - from, - canceled, - body, - createdAt, - modifiedAt, - deliveryReport, - sendAt, - expireAt, - callbackUrl, - clientReference, - feedbackEnabled); - this.flashMessage = flashMessage; - this.truncateConcat = truncateConcat; - this.maxNumberOfMessageParts = maxNumberOfMessageParts; - this.fromTon = fromTon; - this.fromNpi = fromNpi; - this.udh = udh; - } - - public Boolean isFlashMessage() { - return flashMessage; - } - - public Boolean isTruncateConcat() { - return truncateConcat; - } - - public Integer getMaxNumberOfMessageParts() { - return maxNumberOfMessageParts; - } - - public Integer getFromTon() { - return fromTon; - } - - public Integer getFromNpi() { - return fromNpi; - } - - public String getUdh() { - return udh; - } - - public static Builder builder() { - return new Builder(); - } - - @Override - public String toString() { - return "BatchBinary{" - + "flashMessage=" - + flashMessage - + ", truncateConcat=" - + truncateConcat - + ", maxNumberOfMessageParts=" - + maxNumberOfMessageParts - + ", fromTon=" - + fromTon - + ", fromNpi=" - + fromNpi - + ", udh='" - + udh - + '\'' - + "} " - + super.toString(); - } - - public static class Builder extends Batch.Builder { - - private Boolean flashMessage; - private Boolean truncateConcat; - private Integer maxNumberOfMessageParts; - private Integer fromTon; - private Integer fromNpi; - private String udh; - - private Builder() {} - - public Builder setFlashMessage(Boolean flashMessage) { - this.flashMessage = flashMessage; - return this; - } - - public Builder setTruncateConcat(Boolean truncateConcat) { - this.truncateConcat = truncateConcat; - return this; - } - - public Builder setMaxNumberOfMessageParts(Integer maxNumberOfMessageParts) { - this.maxNumberOfMessageParts = maxNumberOfMessageParts; - return this; - } - - public Builder setFromTon(Integer fromTon) { - this.fromTon = fromTon; - return this; - } - - public Builder setFromNpi(Integer fromNpi) { - this.fromNpi = fromNpi; - return this; - } - - public Builder setUdh(String udh) { - this.udh = udh; - return this; - } - - public BatchBinary build() { - return new BatchBinary( - id, - to, - from, - canceled, - body, - createdAt, - modifiedAt, - deliveryReport, - sendAt, - expireAt, - callbackUrl, - clientReference, - feedbackEnabled, - flashMessage, - truncateConcat, - maxNumberOfMessageParts, - fromTon, - fromNpi, - udh); - } - - @Override - protected Builder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/BatchMedia.java b/client/src/main/com/sinch/sdk/domains/sms/models/BatchMedia.java deleted file mode 100644 index f893963eb..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/BatchMedia.java +++ /dev/null @@ -1,138 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import java.time.Instant; -import java.util.Collection; - -/** - * BatchMedia type - * - * @since 1.0 - */ -public class BatchMedia extends Batch { - private final Parameters parameters; - private final Boolean strictValidation; - - /** - * @param id Unique identifier for batch - * @param to List of Phone numbers and group IDs that will receive the batch - * @param from Sender number. Must be valid phone number, short code or alphanumeric. Required if - * Automatic Default Originator not configured. - * @param canceled Indicates if the batch has been canceled or not. - * @param body The message content - * @param createdAt when batch was created - * @param modifiedAt when batch was last updated - * @param deliveryReport Request delivery report callback. Note that delivery reports can be - * fetched from the API regardless of this setting - * @param sendAt If set in the future, the message will be delayed until send_at occurs. Must be - * before expire_at. If set in the past, messages will be sent immediately - * @param expireAt If set, the system will stop trying to deliver the message at this point. Must - * be after send_at. Default and max is 3 days after send_at - * @param callbackUrl Override the default callback URL for this batch. Must be valid URL. - * @param clientReference The client identifier of a batch message. If set, the identifier will be - * added in the delivery report/callback of this batch - * @param feedbackEnabled If set to true, then feedback is expected after successful delivery. * - * @param parameters Contains the parameters that will be used for customizing the message for - * each recipient. - * @param strictValidation Whether or not you want the media included in your message to be - * checked against Sinch MMS channel best practices. If set to true, your message will be - * rejected if it doesn't conform to the listed recommendations, otherwise no validation will - * be performed. - */ - public BatchMedia( - String id, - Collection to, - String from, - Boolean canceled, - MediaBody body, - Instant createdAt, - Instant modifiedAt, - DeliveryReportType deliveryReport, - Instant sendAt, - Instant expireAt, - String callbackUrl, - String clientReference, - Boolean feedbackEnabled, - Parameters parameters, - Boolean strictValidation) { - super( - id, - to, - from, - canceled, - body, - createdAt, - modifiedAt, - deliveryReport, - sendAt, - expireAt, - callbackUrl, - clientReference, - feedbackEnabled); - this.parameters = parameters; - this.strictValidation = strictValidation; - } - - public Parameters getParameters() { - return parameters; - } - - public Boolean isStrictValidation() { - return strictValidation; - } - - public static Builder builder() { - return new Builder(); - } - - @Override - public String toString() { - return "BatchMedia{" - + "parameters=" - + parameters - + ", strictValidation=" - + strictValidation - + "} " - + super.toString(); - } - - public static class Builder extends Batch.Builder { - private Parameters parameters; - private Boolean strictValidation; - - private Builder() {} - - public Builder setParameters(Parameters parameters) { - this.parameters = parameters; - return this; - } - - public Builder setStrictValidation(Boolean strictValidation) { - this.strictValidation = strictValidation; - return this; - } - - public BatchMedia build() { - return new BatchMedia( - id, - to, - from, - canceled, - body, - createdAt, - modifiedAt, - deliveryReport, - sendAt, - expireAt, - callbackUrl, - clientReference, - feedbackEnabled, - parameters, - strictValidation); - } - - @Override - protected Builder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/BatchText.java b/client/src/main/com/sinch/sdk/domains/sms/models/BatchText.java deleted file mode 100644 index f79c8b089..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/BatchText.java +++ /dev/null @@ -1,203 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import java.time.Instant; -import java.util.Collection; - -/** - * BatchText type - * - * @since 1.0 - */ -public class BatchText extends Batch { - private final Boolean flashMessage; - private final Parameters parameters; - private final Boolean truncateConcat; - private final Integer maxNumberOfMessageParts; - private final Integer fromTon; - private final Integer fromNpi; - - /** - * @param id Unique identifier for batch - * @param to List of Phone numbers and group IDs that will receive the batch - * @param from Sender number. Must be valid phone number, short code or alphanumeric. Required if - * Automatic Default Originator not configured. - * @param canceled Indicates if the batch has been canceled or not. - * @param body The message content - * @param createdAt when batch was created - * @param modifiedAt when batch was last updated - * @param deliveryReport Request delivery report callback. Note that delivery reports can be - * fetched from the API regardless of this setting - * @param sendAt If set in the future, the message will be delayed until send_at occurs. Must be - * before expire_at. If set in the past, messages will be sent immediately - * @param expireAt If set, the system will stop trying to deliver the message at this point. Must - * be after send_at. Default and max is 3 days after send_at - * @param callbackUrl Override the default callback URL for this batch. Must be valid URL. - * @param clientReference The client identifier of a batch message. If set, the identifier will be - * added in the delivery report/callback of this batch - * @param feedbackEnabled If set to true, then feedback is expected after successful delivery. - * @param parameters Contains the parameters that will be used for customizing the message for - * each recipient. - * @param flashMessage If sent as a flash message, displays true. - * @param truncateConcat If set to true, the message was shortened when exceeding one part. - * @param maxNumberOfMessageParts Displays the number of message parts set in the request. - * @param fromTon The type of number for the sender number. - * @param fromNpi Number Plan Indicator for the sender number. - */ - public BatchText( - String id, - Collection to, - String from, - Boolean canceled, - String body, - Instant createdAt, - Instant modifiedAt, - DeliveryReportType deliveryReport, - Instant sendAt, - Instant expireAt, - String callbackUrl, - String clientReference, - Boolean flashMessage, - Boolean feedbackEnabled, - Parameters parameters, - Boolean truncateConcat, - Integer maxNumberOfMessageParts, - Integer fromTon, - Integer fromNpi) { - super( - id, - to, - from, - canceled, - body, - createdAt, - modifiedAt, - deliveryReport, - sendAt, - expireAt, - callbackUrl, - clientReference, - feedbackEnabled); - this.flashMessage = flashMessage; - this.parameters = parameters; - this.truncateConcat = truncateConcat; - this.maxNumberOfMessageParts = maxNumberOfMessageParts; - this.fromTon = fromTon; - this.fromNpi = fromNpi; - } - - public Parameters getParameters() { - return parameters; - } - - public Boolean isFlashMessage() { - return flashMessage; - } - - public Boolean isTruncateConcat() { - return truncateConcat; - } - - public Integer getMaxNumberOfMessageParts() { - return maxNumberOfMessageParts; - } - - public Integer getFromTon() { - return fromTon; - } - - public Integer getFromNpi() { - return fromNpi; - } - - @Override - public String toString() { - return "BatchText{" - + "flashMessage=" - + flashMessage - + ", parameters=" - + parameters - + ", truncateConcat=" - + truncateConcat - + ", maxNumberOfMessageParts=" - + maxNumberOfMessageParts - + ", fromTon=" - + fromTon - + ", fromNpi=" - + fromNpi - + "} " - + super.toString(); - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder extends Batch.Builder { - private Boolean flashMessage; - private Parameters parameters; - private Boolean truncateConcat; - private Integer maxNumberOfMessageParts; - private Integer fromTon; - private Integer fromNpi; - - private Builder() {} - - public Builder setFlashMessage(Boolean flashMessage) { - this.flashMessage = flashMessage; - return this; - } - - public Builder setParameters(Parameters parameters) { - this.parameters = parameters; - return this; - } - - public Builder setTruncateConcat(Boolean truncateConcat) { - this.truncateConcat = truncateConcat; - return this; - } - - public Builder setMaxNumberOfMessageParts(Integer maxNumberOfMessageParts) { - this.maxNumberOfMessageParts = maxNumberOfMessageParts; - return this; - } - - public Builder setFromTon(Integer fromTon) { - this.fromTon = fromTon; - return this; - } - - public Builder setFromNpi(Integer fromNpi) { - this.fromNpi = fromNpi; - return this; - } - - public BatchText build() { - return new BatchText( - id, - to, - from, - canceled, - body, - createdAt, - modifiedAt, - deliveryReport, - sendAt, - expireAt, - callbackUrl, - clientReference, - flashMessage, - feedbackEnabled, - parameters, - truncateConcat, - maxNumberOfMessageParts, - fromTon, - fromNpi); - } - - @Override - protected Builder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportBatch.java b/client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportBatch.java deleted file mode 100644 index 8496c3c8f..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportBatch.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import java.util.Collection; -import java.util.Objects; - -/** - * Common Definition to Delivery Report - * - * @since 1.0 - */ -public abstract class DeliveryReportBatch extends BaseDeliveryReport { - - private final Collection statuses; - private final Integer totalMessageCount; - - /** - * @param batchId Required. The ID of the batch this delivery report belongs to. - * @param clientReference The client identifier of the batch this delivery report belongs to, if - * set when submitting batch. - * @param statuses Required. Array with status objects. Only status codes with at - * least one recipient will be listed. - * @param totalMessageCount Required. The total number of messages in the batch. - */ - public DeliveryReportBatch( - String batchId, - String clientReference, - Collection statuses, - Integer totalMessageCount) { - super(batchId, clientReference); - Objects.requireNonNull(statuses); - Objects.requireNonNull(totalMessageCount); - this.statuses = statuses; - this.totalMessageCount = totalMessageCount; - } - - public Collection getStatuses() { - return statuses; - } - - public Integer getTotalMessageCount() { - return totalMessageCount; - } - - @Override - public String toString() { - return "DeliveryReportBatch{" - + "statuses=" - + statuses - + ", totalMessageCount=" - + totalMessageCount - + "} " - + super.toString(); - } - - public abstract static class Builder> extends BaseDeliveryReport.Builder { - protected Collection statuses; - protected Integer totalMessageCount; - - public B setStatuses(Collection statuses) { - this.statuses = statuses; - return self(); - } - - public B setTotalMessageCount(Integer totalMessageCount) { - this.totalMessageCount = totalMessageCount; - return self(); - } - - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - - public abstract DeliveryReportBatch build(); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportBatchMMS.java b/client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportBatchMMS.java deleted file mode 100644 index 291c0b57e..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportBatchMMS.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import java.util.Collection; - -/** - * MMS delivery Report - * - * @since 1.0 - */ -public class DeliveryReportBatchMMS extends DeliveryReportBatch { - - /** - * @param batchId Required. The ID of the batch this delivery report belongs to. - * @param clientReference The client identifier of the batch this delivery report belongs to, if - * set when submitting batch. - * @param statuses Required. Array with status objects. Only status codes with at - * least one recipient will be listed. - * @param totalMessageCount Required. The total number of messages in the batch. - */ - public DeliveryReportBatchMMS( - String batchId, - String clientReference, - Collection statuses, - Integer totalMessageCount) { - super(batchId, clientReference, statuses, totalMessageCount); - } - - @Override - public String toString() { - return "DeliveryReportBatchMMS{} " + super.toString(); - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder extends DeliveryReportBatch.Builder { - - protected Builder() { - super(); - } - - public DeliveryReportBatchMMS build() { - return new DeliveryReportBatchMMS(batchId, clientReference, statuses, totalMessageCount); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportBatchSMS.java b/client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportBatchSMS.java deleted file mode 100644 index 2c78e7792..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportBatchSMS.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import java.util.Collection; - -/** - * SMS delivery Report - * - * @since 1.0 - */ -public class DeliveryReportBatchSMS extends DeliveryReportBatch { - - /** - * @param batchId Required. The ID of the batch this delivery report belongs to. - * @param clientReference The client identifier of the batch this delivery report belongs to, if - * set when submitting batch. - * @param statuses Required. Array with status objects. Only status codes with at - * least one recipient will be listed. - * @param totalMessageCount Required. The total number of messages in the batch. - */ - public DeliveryReportBatchSMS( - String batchId, - String clientReference, - Collection statuses, - Integer totalMessageCount) { - super(batchId, clientReference, statuses, totalMessageCount); - } - - @Override - public String toString() { - return "DeliveryReportBatchSMS{} " + super.toString(); - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder extends DeliveryReportBatch.Builder { - - private Builder() { - super(); - } - - public DeliveryReportBatchSMS build() { - return new DeliveryReportBatchSMS(batchId, clientReference, statuses, totalMessageCount); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportErrorCode.java b/client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportErrorCode.java deleted file mode 100644 index 72a5e50a9..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportErrorCode.java +++ /dev/null @@ -1,142 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -/** - * Applied encoding for message. - * - * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Delivery-reports/#tag/Delivery-reports/operation/deliveryReport!path=1/encoding&t=request - * @since 1.0 - */ -public class DeliveryReportErrorCode extends EnumDynamic { - - /** - * Message is queued within REST API system and will be dispatched according to the rate of the - * account. - */ - public static final DeliveryReportErrorCode QUEUED = new DeliveryReportErrorCode(400); - - /** Message has been dispatched to SMSC. */ - public static final DeliveryReportErrorCode DISPATCHED = new DeliveryReportErrorCode(401); - - /** SMSC rejected message. Retrying is likely to cause the same error. */ - public static final DeliveryReportErrorCode MESSAGE_UNROUTABLE = new DeliveryReportErrorCode(402); - - /** An unexpected error caused the message to fail. */ - public static final DeliveryReportErrorCode INTERNAL_ERROR = new DeliveryReportErrorCode(403); - - /** Message failed because of temporary delivery failure. Message can be retried. */ - public static final DeliveryReportErrorCode TEMPORARY_DELIVERY_FAILURE = - new DeliveryReportErrorCode(404); - - /** - * One or more parameters in the message body has no mapping for this recipient. See Message - * Parameterization - */ - public static final DeliveryReportErrorCode UNMATCHED_PARAMETER = - new DeliveryReportErrorCode(405); - - /** - * Message was expired before reaching SMSC. This may happen if the expiry time for the message - * was very short. - */ - public static final DeliveryReportErrorCode INTERNAL_EXPIRY = new DeliveryReportErrorCode(406); - - /** Message was cancelled by user before reaching SMSC. */ - public static final DeliveryReportErrorCode CANCELLED = new DeliveryReportErrorCode(407); - - /** SMSC rejected the message. Retrying is likely to cause the same error. */ - public static final DeliveryReportErrorCode INTERNAL_REJECT = new DeliveryReportErrorCode(408); - - /** - * No default originator exists/configured for this recipient when sending message without - * originator. - */ - public static final DeliveryReportErrorCode UNMATCHED_DEFAULT_ORIGINATOR = - new DeliveryReportErrorCode(410); - - /** - * Message failed as the number of message parts exceeds the defined max number of message parts. - */ - public static final DeliveryReportErrorCode EXCEEDED_PARTS_LIMIT = - new DeliveryReportErrorCode(411); - - /** SMSC rejected the message. The account hasn't been provisioned for this region. */ - public static final DeliveryReportErrorCode UNPROVISIONED_REGION = - new DeliveryReportErrorCode(412); - - /** The account is blocked. Reach out to support for help. Potentially out of credits. */ - public static final DeliveryReportErrorCode BLOCKED = new DeliveryReportErrorCode(413); - - /** - * MMS only, the request failed due to a bad media URL. It is possible that the URL was - * unreachable, or sent a bad response. - */ - public static final DeliveryReportErrorCode BAD_MEDIA = new DeliveryReportErrorCode(414); - - /** MMS only, message reached MMSC but was rejected by MMS gateway or mobile network. */ - public static final DeliveryReportErrorCode DELIVERY_REPORT_REJECTED = - new DeliveryReportErrorCode(415); - - /** MMS only, message reached MMSC but it is not supported. */ - public static final DeliveryReportErrorCode DELIVERY_REPORT_NOT_SUPPORTED = - new DeliveryReportErrorCode(416); - - /** - * MMS only, message reached MMSC but the destination network or the mobile subscriber cannot be - * reached. - */ - public static final DeliveryReportErrorCode DELIVERY_REPORT_UNREACHABLE = - new DeliveryReportErrorCode(417); - - /** - * MMS only, message reached MMSC but the handset of the mobile subscriber does not recognize the - * message content. - */ - public static final DeliveryReportErrorCode DELIVERY_REPORT_UNRECOGNIZED = - new DeliveryReportErrorCode(418); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - DeliveryReportErrorCode.class, - DeliveryReportErrorCode::new, - Arrays.asList( - QUEUED, - DISPATCHED, - MESSAGE_UNROUTABLE, - INTERNAL_ERROR, - TEMPORARY_DELIVERY_FAILURE, - UNMATCHED_PARAMETER, - INTERNAL_EXPIRY, - CANCELLED, - INTERNAL_REJECT, - UNMATCHED_DEFAULT_ORIGINATOR, - EXCEEDED_PARTS_LIMIT, - UNPROVISIONED_REGION, - BLOCKED, - BAD_MEDIA, - DELIVERY_REPORT_REJECTED, - DELIVERY_REPORT_NOT_SUPPORTED, - DELIVERY_REPORT_UNREACHABLE, - DELIVERY_REPORT_UNRECOGNIZED)); - - private DeliveryReportErrorCode(Integer value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static DeliveryReportErrorCode from(Integer value) { - return ENUM_SUPPORT.from(value); - } - - public static Integer valueOf(DeliveryReportErrorCode e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportRecipient.java b/client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportRecipient.java deleted file mode 100644 index 16cd51993..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportRecipient.java +++ /dev/null @@ -1,197 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import java.time.Instant; -import java.util.Optional; - -/** - * Common Definition to Delivery Report - * - * @since 1.0 - */ -public abstract class DeliveryReportRecipient extends BaseDeliveryReport { - - private final Instant at; - private final DeliveryReportErrorCode code; - private final String recipient; - private final DeliveryReportStatus status; - private final String appliedOriginator; - private final DeliveryReportRecipientEncoding encoding; - private final Integer numberOfMessageParts; - private final String operator; - private final Instant operatorStatusAt; - - /** - * Recipient Delivery Report Recipient - * - * @param batchId Required. The ID of the batch this delivery report belongs to. - * @param clientReference The client identifier of the batch this delivery report belongs to, if - * set when submitting batch. - * @param at Required. A timestamp of when the Delivery Report was created in the - * Sinch service - * @param code Required. The detailed status - * code. - * @param recipient Required. Phone number that was queried. - * @param status Required. The simplified status as described in Delivery Report - * Statuses - * @param appliedOriginator The default originator used for the recipient this delivery report - * belongs to, if default originator pool configured and no originator set when submitting - * batch. - * @param encoding Applied encoding for message. Present only if smart encoding is enabled. - * @param numberOfMessageParts The number of parts the message was split into. Present only if - * max_number_of_message_parts parameter was set. - * @param operator The operator that was used for delivering the message to this recipient, if - * enabled on the account by Sinch. - * @param operatorStatusAt A timestamp extracted from the Delivery Receipt from the originating - * SMSC - */ - public DeliveryReportRecipient( - String batchId, - String clientReference, - Instant at, - DeliveryReportErrorCode code, - String recipient, - DeliveryReportStatus status, - String appliedOriginator, - DeliveryReportRecipientEncoding encoding, - Integer numberOfMessageParts, - String operator, - Instant operatorStatusAt) { - super(batchId, clientReference); - this.at = at; - this.code = code; - this.recipient = recipient; - this.status = status; - this.appliedOriginator = appliedOriginator; - this.encoding = encoding; - this.numberOfMessageParts = numberOfMessageParts; - this.operator = operator; - this.operatorStatusAt = operatorStatusAt; - } - - public Instant getAt() { - return at; - } - - public DeliveryReportErrorCode getCode() { - return code; - } - - public String getRecipient() { - return recipient; - } - - public DeliveryReportStatus getStatus() { - return status; - } - - public Optional getAppliedOriginator() { - return Optional.ofNullable(appliedOriginator); - } - - public Optional getEncoding() { - return Optional.ofNullable(encoding); - } - - public Optional getNumberOfMessageParts() { - return Optional.ofNullable(numberOfMessageParts); - } - - public Optional getOperator() { - return Optional.ofNullable(operator); - } - - public Optional getOperatorStatusAt() { - return Optional.ofNullable(operatorStatusAt); - } - - @Override - public String toString() { - return "DeliveryReportRecipient{" - + "at=" - + at - + ", code='" - + code - + '\'' - + ", recipient='" - + recipient - + '\'' - + ", status=" - + status - + ", appliedOriginator='" - + appliedOriginator - + '\'' - + ", encoding='" - + encoding - + '\'' - + ", numberOfMessageParts=" - + numberOfMessageParts - + ", operator='" - + operator - + '\'' - + ", operatorStatusAt=" - + operatorStatusAt - + "} " - + super.toString(); - } - - public abstract static class Builder> extends BaseDeliveryReport.Builder { - - protected Instant at; - protected DeliveryReportErrorCode code; - protected String recipient; - protected DeliveryReportStatus status; - protected String appliedOriginator; - protected DeliveryReportRecipientEncoding encoding; - protected Integer numberOfMessageParts; - protected String operator; - protected Instant operatorStatusAt; - - public Builder setAt(Instant at) { - this.at = at; - return this; - } - - public Builder setCode(DeliveryReportErrorCode code) { - this.code = code; - return this; - } - - public Builder setRecipient(String recipient) { - this.recipient = recipient; - return this; - } - - public Builder setStatus(DeliveryReportStatus status) { - this.status = status; - return this; - } - - public Builder setAppliedOriginator(String appliedOriginator) { - this.appliedOriginator = appliedOriginator; - return this; - } - - public Builder setEncoding(DeliveryReportRecipientEncoding encoding) { - this.encoding = encoding; - return this; - } - - public Builder setNumberOfMessageParts(Integer numberOfMessageParts) { - this.numberOfMessageParts = numberOfMessageParts; - return this; - } - - public Builder setOperator(String operator) { - this.operator = operator; - return this; - } - - public Builder setOperatorStatusAt(Instant operatorStatusAt) { - this.operatorStatusAt = operatorStatusAt; - return this; - } - - public abstract DeliveryReportRecipient build(); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportRecipientEncoding.java b/client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportRecipientEncoding.java deleted file mode 100644 index 2726159b7..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportRecipientEncoding.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -/** - * Applied encoding for message. - * - * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Delivery-reports/#tag/Delivery-reports/operation/deliveryReport!path=1/encoding&t=request - * @since 1.0 - */ -public class DeliveryReportRecipientEncoding - extends EnumDynamic { - - public static final DeliveryReportRecipientEncoding GSM = - new DeliveryReportRecipientEncoding("GSM"); - public static final DeliveryReportRecipientEncoding UNICODE = - new DeliveryReportRecipientEncoding("UNICODE"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - DeliveryReportRecipientEncoding.class, - DeliveryReportRecipientEncoding::new, - Arrays.asList(GSM, UNICODE)); - - private DeliveryReportRecipientEncoding(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static DeliveryReportRecipientEncoding from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(DeliveryReportRecipientEncoding e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportRecipientMMS.java b/client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportRecipientMMS.java deleted file mode 100644 index dc80daa78..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportRecipientMMS.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import java.time.Instant; - -/** - * SMS Delivery Report Recipient for MMS - * - * @since 1.0 - */ -public class DeliveryReportRecipientMMS extends DeliveryReportRecipient { - - /** - * Recipient Delivery Report for MMS - * - * @param batchId Required. The ID of the batch this delivery report belongs to. - * @param clientReference The client identifier of the batch this delivery report belongs to, if - * set when submitting batch. - * @param at Required. A timestamp of when the Delivery Report was created in the - * Sinch service - * @param code Required. The detailed status - * code. - * @param recipient Required. Phone number that was queried. - * @param status Required. The simplified status as described in Delivery Report - * Statuses - * @param appliedOriginator The default originator used for the recipient this delivery report - * belongs to, if default originator pool configured and no originator set when submitting - * batch. - * @param encoding Applied encoding for message. Present only if smart encoding is enabled. - * @param numberOfMessageParts The number of parts the message was split into. Present only if - * max_number_of_message_parts parameter was set. - * @param operator The operator that was used for delivering the message to this recipient, if - * enabled on the account by Sinch. - * @param operatorStatusAt A timestamp extracted from the Delivery Receipt from the originating - * SMSC - */ - public DeliveryReportRecipientMMS( - String batchId, - String clientReference, - Instant at, - DeliveryReportErrorCode code, - String recipient, - DeliveryReportStatus status, - String appliedOriginator, - DeliveryReportRecipientEncoding encoding, - Integer numberOfMessageParts, - String operator, - Instant operatorStatusAt) { - super( - batchId, - clientReference, - at, - code, - recipient, - status, - appliedOriginator, - encoding, - numberOfMessageParts, - operator, - operatorStatusAt); - } - - @Override - public String toString() { - return "DeliveryReportRecipientMMS{} " + super.toString(); - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder extends DeliveryReportRecipient.Builder { - - protected Builder() { - super(); - } - - public DeliveryReportRecipientMMS build() { - return new DeliveryReportRecipientMMS( - batchId, - clientReference, - at, - code, - recipient, - status, - appliedOriginator, - encoding, - numberOfMessageParts, - operator, - operatorStatusAt); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportRecipientSMS.java b/client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportRecipientSMS.java deleted file mode 100644 index e32a1fd45..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportRecipientSMS.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import java.time.Instant; - -/** - * SMS Delivery Report Recipient for SMS - * - * @since 1.0 - */ -public class DeliveryReportRecipientSMS extends DeliveryReportRecipient { - - /** - * Recipient Delivery Report for SMS - * - * @param batchId Required. The ID of the batch this delivery report belongs to. - * @param clientReference The client identifier of the batch this delivery report belongs to, if - * set when submitting batch. - * @param at Required. A timestamp of when the Delivery Report was created in the - * Sinch service - * @param code Required. The detailed status - * code. - * @param recipient Required. Phone number that was queried. - * @param status Required. The simplified status as described in Delivery Report - * Statuses - * @param appliedOriginator The default originator used for the recipient this delivery report - * belongs to, if default originator pool configured and no originator set when submitting - * batch. - * @param encoding Applied encoding for message. Present only if smart encoding is enabled. - * @param numberOfMessageParts The number of parts the message was split into. Present only if - * max_number_of_message_parts parameter was set. - * @param operator The operator that was used for delivering the message to this recipient, if - * enabled on the account by Sinch. - * @param operatorStatusAt A timestamp extracted from the Delivery Receipt from the originating - * SMSC - */ - public DeliveryReportRecipientSMS( - String batchId, - String clientReference, - Instant at, - DeliveryReportErrorCode code, - String recipient, - DeliveryReportStatus status, - String appliedOriginator, - DeliveryReportRecipientEncoding encoding, - Integer numberOfMessageParts, - String operator, - Instant operatorStatusAt) { - super( - batchId, - clientReference, - at, - code, - recipient, - status, - appliedOriginator, - encoding, - numberOfMessageParts, - operator, - operatorStatusAt); - } - - @Override - public String toString() { - return "DeliveryReportRecipientSMS{} " + super.toString(); - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder extends DeliveryReportRecipient.Builder { - - protected Builder() { - super(); - } - - public DeliveryReportRecipientSMS build() { - return new DeliveryReportRecipientSMS( - batchId, - clientReference, - at, - code, - recipient, - status, - appliedOriginator, - encoding, - numberOfMessageParts, - operator, - operatorStatusAt); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportStatus.java b/client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportStatus.java deleted file mode 100644 index 738eb970b..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportStatus.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -/** - * The status field describes which state a particular message is in. Note that statuses of type - * Intermediate will only be reported if you request a status per_recipient or - * per_recipient_final ( @see Retrieve - * a recipient delivery report). - * - * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Delivery-reports/#tag/Delivery-reports/section/Delivery-report-statuses - * @since 1.0 - */ -public class DeliveryReportStatus extends EnumDynamic { - - /** - * Message is queued within REST API system and will be dispatched according to the rate of the - * account. - */ - public static final DeliveryReportStatus QUEUED = new DeliveryReportStatus("Queued"); - - /** Message has been dispatched and accepted for delivery by the SMSC. */ - public static final DeliveryReportStatus DISPATCHED = new DeliveryReportStatus("Dispatched"); - - /** Message was aborted before reaching the SMSC. */ - public static final DeliveryReportStatus ABORTED = new DeliveryReportStatus("Aborted"); - - /** Message was cancelled by user before reaching SMSC. */ - public static final DeliveryReportStatus CANCELLED = new DeliveryReportStatus("Cancelled"); - - /** Message was rejected by the SMSC. */ - public static final DeliveryReportStatus REJECTED = new DeliveryReportStatus("Rejected"); - - /** - * Message has been deleted. Message was deleted by a remote SMSC. This may happen if the - * destination is an invalid MSISDN or opted out subscriber. - */ - public static final DeliveryReportStatus DELETED = new DeliveryReportStatus("Deleted"); - - /** Message has been delivered. */ - public static final DeliveryReportStatus DELIVERED = new DeliveryReportStatus("Delivered"); - - /** Message failed to be delivered. */ - public static final DeliveryReportStatus FAILED = new DeliveryReportStatus("Failed"); - - /** - * Message expired before delivery to the SMSC. This may happen if the expiry time for the message - * was very short. - */ - public static final DeliveryReportStatus EXPIRED = new DeliveryReportStatus("Expired"); - - /** - * Message was delivered to the SMSC but no Delivery Receipt has been received or a Delivery - * Receipt that couldn't be interpreted was received. - */ - public static final DeliveryReportStatus UNKNOWN = new DeliveryReportStatus("Unknown"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - DeliveryReportStatus.class, - DeliveryReportStatus::new, - Arrays.asList( - QUEUED, - DISPATCHED, - ABORTED, - CANCELLED, - REJECTED, - DELETED, - DELIVERED, - FAILED, - EXPIRED, - UNKNOWN)); - - private DeliveryReportStatus(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static DeliveryReportStatus from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(DeliveryReportStatus e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportStatusDetails.java b/client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportStatusDetails.java deleted file mode 100644 index 1a7ae1d4e..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportStatusDetails.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import java.util.Collection; - -/** - * Details related to a delivery report status - * - * @since 1.0 - */ -public class DeliveryReportStatusDetails { - - private final Integer code; - private final Integer count; - private final Collection recipients; - private final DeliveryReportStatus status; - - /** - * @param code Required. The detailed status - * code. - * @param count Required. The number of messages that currently has this code - * @param recipients Required. Only for full report. A list of the phone number - * recipients which messages has this status code - * @param status Required. The simplified status as described in Delivery Report - * Statuses - */ - public DeliveryReportStatusDetails( - Integer code, Integer count, Collection recipients, String status) { - this.code = code; - this.count = count; - this.recipients = recipients; - this.status = DeliveryReportStatus.from(status); - } - - public Integer getCode() { - return code; - } - - public Integer getCount() { - return count; - } - - public Collection getRecipients() { - return recipients; - } - - public DeliveryReportStatus getStatus() { - return status; - } - - @Override - public String toString() { - return "DeliveryReportStatusDetails{" - + "code=" - + code - + ", count=" - + count - + ", recipients=" - + recipients - + ", status=" - + status - + '}'; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - private Integer code; - private Integer count; - private Collection recipients; - private DeliveryReportStatus status; - - private Builder() {} - - public Builder setCode(Integer code) { - this.code = code; - return this; - } - - public Builder setCount(Integer count) { - this.count = count; - return this; - } - - public Builder setRecipients(Collection recipients) { - this.recipients = recipients; - return this; - } - - public Builder setStatus(DeliveryReportStatus status) { - this.status = status; - return this; - } - - public DeliveryReportStatusDetails build() { - return new DeliveryReportStatusDetails(code, count, recipients, status.value()); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportType.java b/client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportType.java deleted file mode 100644 index ee2dc6cfd..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/DeliveryReportType.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -/** - * DeliveryReportType authorized values - * - * @since 1.0 - */ -public class DeliveryReportType extends EnumDynamic { - - /** No delivery report callback will be sent. */ - public static final DeliveryReportType NONE = new DeliveryReportType("none"); - - /** A single delivery report callback will be sent. */ - public static final DeliveryReportType SUMMARY = new DeliveryReportType("summary"); - - /** - * A single delivery report callback will be sent which includes a list of recipients per delivery - * status. - */ - public static final DeliveryReportType FULL = new DeliveryReportType("full"); - - /** - * A delivery report callback will be sent for each status change of a message. This could result - * in a lot of callbacks and should be used with caution for larger batches. These delivery - * reports also include a timestamp of when the Delivery Report originated from the SMSC. - */ - public static final DeliveryReportType PER_RECIPIENT = new DeliveryReportType("per_recipient"); - - /** - * A delivery report callback representing the final status of a message will be sent for each - * recipient. This will send only one callback per recipient, compared to the multiple callbacks - * sent when using per_recipient. The delivery report will also include a timestamp of when it - * originated from the SMSC. - */ - public static final DeliveryReportType PER_RECIPIENT_FINAl = - new DeliveryReportType("per_recipient_final"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - DeliveryReportType.class, - DeliveryReportType::new, - Arrays.asList(NONE, SUMMARY, FULL, PER_RECIPIENT, PER_RECIPIENT_FINAl)); - - private DeliveryReportType(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static DeliveryReportType from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(DeliveryReportType e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/DryRun.java b/client/src/main/com/sinch/sdk/domains/sms/models/DryRun.java deleted file mode 100644 index e80d2c984..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/DryRun.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import java.util.Collection; - -/** - * Information related to a dryRun request - * - * @since 1.0 - */ -public class DryRun { - - private final Integer numberOfRecipients; - private final Integer numberOfMessages; - private final Collection perRecipient; - - /** - * @param numberOfRecipients The number of recipients in the batch - * @param numberOfMessages The total number of SMS message parts to be sent in the batch - * @param perRecipient The recipient, the number of message parts to this recipient, the body of - * the message, and the encoding type of each message - */ - public DryRun( - Integer numberOfRecipients, - Integer numberOfMessages, - Collection perRecipient) { - this.numberOfRecipients = numberOfRecipients; - this.numberOfMessages = numberOfMessages; - this.perRecipient = perRecipient; - } - - public Integer getNumberOfRecipients() { - return numberOfRecipients; - } - - public Integer getNumberOfMessages() { - return numberOfMessages; - } - - public Collection getPerRecipient() { - return perRecipient; - } - - public static Builder builder() { - return new Builder(); - } - - @Override - public String toString() { - return "DryRun{" - + "numberOfRecipients=" - + numberOfRecipients - + ", numberOfMessages=" - + numberOfMessages - + ", perRecipient=" - + perRecipient - + '}'; - } - - public static class Builder { - - private Integer numberOfRecipients; - private Integer numberOfMessages; - private Collection perRecipient; - - public Builder setNumberOfRecipients(Integer numberOfRecipients) { - this.numberOfRecipients = numberOfRecipients; - return this; - } - - public Builder setNumberOfMessages(Integer numberOfMessages) { - this.numberOfMessages = numberOfMessages; - return this; - } - - public Builder setPerRecipient(Collection perRecipient) { - this.perRecipient = perRecipient; - return this; - } - - public DryRun build() { - return new DryRun(numberOfRecipients, numberOfMessages, perRecipient); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/DryRunPerRecipientDetails.java b/client/src/main/com/sinch/sdk/domains/sms/models/DryRunPerRecipientDetails.java deleted file mode 100644 index 895f7ca8a..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/DryRunPerRecipientDetails.java +++ /dev/null @@ -1,157 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -/** - * Details related to a dryRun recipient - * - * @since 1.0 - */ -public class DryRunPerRecipientDetails { - - private final String recipient; - private final Integer numberOfParts; - private final String body; - private final String encoding; - - /** - * Due to unused messagePart field, prefer the numberOfParts version - * usage. - * - *

This constructor will be removed in a next major release - * - * @deprecated - */ - @Deprecated - public DryRunPerRecipientDetails( - String recipient, String messagePart, String body, String encoding) { - this.recipient = recipient; - this.numberOfParts = null; - this.body = body; - this.encoding = encoding; - } - - public DryRunPerRecipientDetails( - String recipient, Integer numberOfParts, String body, String encoding) { - this.recipient = recipient; - this.numberOfParts = numberOfParts; - this.body = body; - this.encoding = encoding; - } - - /** - * Get recipient - * - * @return recipient - */ - public String getRecipient() { - return recipient; - } - - /** - * Due to unused messagePart field, prefer the {@link #getNumberOfParts()} usage. - * - *

This function will be removed in a next major release - * - * @deprecated - */ - @Deprecated - public String getMessagePart() { - return null; - } - - /** - * Get number of parts - * - * @return number of parts - */ - public Integer getNumberOfParts() { - return numberOfParts; - } - - /** - * Get body - * - * @return body - */ - public String getBody() { - return body; - } - - /** - * Get encoding - * - * @return encoding - */ - public String getEncoding() { - return encoding; - } - - @Override - public String toString() { - return "DryRunPerRecipientDetails{" - + "recipient='" - + recipient - + '\'' - + ", numberOfParts='" - + numberOfParts - + '\'' - + ", body='" - + body - + '\'' - + ", encoding='" - + encoding - + '\'' - + '}'; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - private String recipient; - private Integer numberOfParts; - private String body; - private String encoding; - - public Builder setRecipient(String recipient) { - this.recipient = recipient; - return this; - } - - /** - * Due to unused messagePart field, prefer the {@link #setNumberOfParts(Integer)} - * usage. - * - *

This function will be removed in a next major release - * - * @deprecated - */ - @Deprecated - public Builder setMessagePart(String messageParts) { - // Do nothing - return this; - } - - public Builder setNumberOfParts(Integer numberOfParts) { - this.numberOfParts = numberOfParts; - return this; - } - - public Builder setBody(String body) { - this.body = body; - return this; - } - - public Builder setEncoding(String encoding) { - this.encoding = encoding; - return this; - } - - private Builder() {} - - public DryRunPerRecipientDetails build() { - return new DryRunPerRecipientDetails(recipient, numberOfParts, body, encoding); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/Group.java b/client/src/main/com/sinch/sdk/domains/sms/models/Group.java deleted file mode 100644 index aa40e6e04..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/Group.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import java.time.Instant; -import java.util.Collection; - -public class Group { - - private final String id; - private final String name; - private final Integer size; - private final Instant createdAt; - private final Instant modifiedAt; - private final Collection childGroupIds; - private final GroupAutoUpdate autoUpdate; - - /** - * @param id Unique identifier for the group - * @param name Name of group if set - * @param size The number of members currently in the group - * @param createdAt Timestamp for when the group was created - * @param modifiedAt Timestamp for when the group was created - * @param childGroupIds MSISDNs of child group will be included in this group. If present then - * this group will be auto populated. Constraints: Elements must be group IDs - * @param autoUpdate Describes how this group is auto updated through user interaction. Is - * null if the group is not auto updated. - */ - public Group( - String id, - String name, - Integer size, - Instant createdAt, - Instant modifiedAt, - Collection childGroupIds, - GroupAutoUpdate autoUpdate) { - this.id = id; - this.name = name; - this.size = size; - this.createdAt = createdAt; - this.modifiedAt = modifiedAt; - this.childGroupIds = childGroupIds; - this.autoUpdate = autoUpdate; - } - - public String getId() { - return id; - } - - public String getName() { - return name; - } - - public Integer getSize() { - return size; - } - - public Instant getCreatedAt() { - return createdAt; - } - - public Instant getModifiedAt() { - return modifiedAt; - } - - public Collection getChildGroupIds() { - return childGroupIds; - } - - public GroupAutoUpdate getAutoUpdate() { - return autoUpdate; - } - - public static Builder builder() { - return new Builder(); - } - - @Override - public String toString() { - return "Group{" - + "id='" - + id - + '\'' - + ", name='" - + name - + '\'' - + ", size=" - + size - + ", createdAt=" - + createdAt - + ", modifiedAt=" - + modifiedAt - + ", childGroupIds=" - + childGroupIds - + ", autoUpdate=" - + autoUpdate - + '}'; - } - - public static class Builder { - - String id; - String name; - Integer size; - Instant createdAt; - Instant modifiedAt; - Collection childGroupIds; - GroupAutoUpdate autoUpdate; - - private Builder() {} - - public Builder setId(String id) { - this.id = id; - return this; - } - - public Builder setName(String name) { - this.name = name; - return this; - } - - public Builder setSize(Integer size) { - this.size = size; - return this; - } - - public Builder setCreatedAt(Instant createdAt) { - this.createdAt = createdAt; - return this; - } - - public Builder setModifiedAt(Instant modifiedAt) { - this.modifiedAt = modifiedAt; - return this; - } - - public Builder setChildGroupIds(Collection childGroupIds) { - this.childGroupIds = childGroupIds; - return this; - } - - public Builder setAutoUpdate(GroupAutoUpdate autoUpdate) { - this.autoUpdate = autoUpdate; - return this; - } - - public Group build() { - return new Group(id, name, size, createdAt, modifiedAt, childGroupIds, autoUpdate); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/GroupAutoUpdate.java b/client/src/main/com/sinch/sdk/domains/sms/models/GroupAutoUpdate.java deleted file mode 100644 index 988e63b3b..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/GroupAutoUpdate.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -public class GroupAutoUpdate { - private final String to; - private final GroupAutoUpdateKeyword add; - private final GroupAutoUpdateKeyword remove; - - /** - * @param to Short code or long number addressed in MO.
- * Constraints: Must be valid MSISDN or short code. - * @param add Keyword to be sent in MO to add MSISDN to a group - * @param remove Keyword to be sent in MO to remove MSISDN to a group - */ - public GroupAutoUpdate(String to, GroupAutoUpdateKeyword add, GroupAutoUpdateKeyword remove) { - this.to = to; - this.add = add; - this.remove = remove; - } - - public String getTo() { - return to; - } - - public GroupAutoUpdateKeyword getAdd() { - return add; - } - - public GroupAutoUpdateKeyword getRemove() { - return remove; - } - - public static Builder builder() { - return new Builder(); - } - - @Override - public String toString() { - return "GroupAutoUpdate{" + "to='" + to + '\'' + ", add=" + add + ", remove=" + remove + '}'; - } - - public static class Builder { - - String to; - GroupAutoUpdateKeyword add; - GroupAutoUpdateKeyword remove; - - private Builder() {} - - public Builder setTo(String to) { - this.to = to; - return this; - } - - public Builder setAdd(GroupAutoUpdateKeyword add) { - this.add = add; - return this; - } - - public Builder setRemove(GroupAutoUpdateKeyword remove) { - this.remove = remove; - return this; - } - - public GroupAutoUpdate build() { - return new GroupAutoUpdate(to, add, remove); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/GroupAutoUpdateKeyword.java b/client/src/main/com/sinch/sdk/domains/sms/models/GroupAutoUpdateKeyword.java deleted file mode 100644 index 8b88a5903..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/GroupAutoUpdateKeyword.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import com.sinch.sdk.core.models.OptionalValue; - -public class GroupAutoUpdateKeyword { - - private final OptionalValue firstWord; - private final OptionalValue secondWord; - - /** - * @param firstWord Opt-in keyword like "JOIN" if _auto_update.to_ is dedicated long/short number - * or unique brand keyword like "Sinch" if it is a shared short code. - * @param secondWord Opt-in keyword like "JOIN" if _auto_update.to_ is shared short code. - */ - private GroupAutoUpdateKeyword( - OptionalValue firstWord, OptionalValue secondWord) { - this.firstWord = firstWord; - this.secondWord = secondWord; - } - - public OptionalValue getFirstWord() { - return firstWord; - } - - public OptionalValue getSecondWord() { - return secondWord; - } - - @Override - public String toString() { - return "GroupAutoUpdateKeyword{" - + "firstWord='" - + firstWord - + '\'' - + ", secondWord='" - + secondWord - + '\'' - + '}'; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - OptionalValue firstWord = OptionalValue.empty(); - OptionalValue secondWord = OptionalValue.empty(); - - private Builder() {} - - public Builder setFirstWord(String firstWord) { - this.firstWord = OptionalValue.of(firstWord); - return this; - } - - public Builder setSecondWord(String secondWord) { - this.secondWord = OptionalValue.of(secondWord); - return this; - } - - public GroupAutoUpdateKeyword build() { - return new GroupAutoUpdateKeyword(firstWord, secondWord); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/Inbound.java b/client/src/main/com/sinch/sdk/domains/sms/models/Inbound.java deleted file mode 100644 index c32a37d9a..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/Inbound.java +++ /dev/null @@ -1,160 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import com.sinch.sdk.domains.sms.models.webhooks.WebhooksEvent; -import java.time.Instant; -import java.util.Optional; - -/** - * Base class for Incoming message - * - * @param Type of body - * @since 1.0 - */ -public abstract class Inbound implements WebhooksEvent { - - private final T body; - private final String from; - private final String id; - private final Instant receivedAt; - private final String to; - private final String clientReference; - private final String operatorId; - private final Instant sentAt; - - public Inbound( - T body, - String from, - String id, - Instant receivedAt, - String to, - String clientReference, - String operatorId, - Instant sentAt) { - this.body = body; - this.from = from; - this.id = id; - this.receivedAt = receivedAt; - this.to = to; - this.clientReference = clientReference; - this.operatorId = operatorId; - this.sentAt = sentAt; - } - - public T getBody() { - return body; - } - - public String getFrom() { - return from; - } - - public String getId() { - return id; - } - - public Instant getReceivedAt() { - return receivedAt; - } - - public String getTo() { - return to; - } - - public Optional getClientReference() { - return Optional.ofNullable(clientReference); - } - - public Optional getOperatorId() { - return Optional.ofNullable(operatorId); - } - - public Optional getSentAt() { - return Optional.ofNullable(sentAt); - } - - @Override - public String toString() { - return "Inbound{" - + "body=" - + body - + ", from='" - + from - + '\'' - + ", id='" - + id - + '\'' - + ", receivedAt=" - + receivedAt - + ", to='" - + to - + '\'' - + ", clientReference='" - + clientReference - + '\'' - + ", operatorId='" - + operatorId - + '\'' - + ", sentAt=" - + sentAt - + '}'; - } - - public abstract static class Builder> { - - T body; - String from; - String id; - Instant receivedAt; - String to; - String clientReference; - String operatorId; - Instant sentAt; - - public B setBody(T body) { - this.body = body; - return self(); - } - - public B setFrom(String from) { - this.from = from; - return self(); - } - - public B setId(String id) { - this.id = id; - return self(); - } - - public B setReceivedAt(Instant receivedAt) { - this.receivedAt = receivedAt; - return self(); - } - - public B setTo(String to) { - this.to = to; - return self(); - } - - public B setClientReference(String clientReference) { - this.clientReference = clientReference; - return self(); - } - - public B setOperatorId(String operatorId) { - this.operatorId = operatorId; - return self(); - } - - public B setSentAt(Instant sentAt) { - this.sentAt = sentAt; - return self(); - } - - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - - public abstract Inbound build(); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/InboundBinary.java b/client/src/main/com/sinch/sdk/domains/sms/models/InboundBinary.java deleted file mode 100644 index 70081c01e..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/InboundBinary.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import java.time.Instant; - -/** - * Incoming SMS Binary - * - * @since 1.0 - */ -public class InboundBinary extends Inbound { - - private final String udh; - - /** - * Binary MO class - * - * @param body The message content Base64 encoded. Max 140 bytes together with udh. - * @param from The phone number that sent the message. @see https://community.sinch.com/t5/Glossary/MSISDN/ta-p/7628 - * @param id The ID of this inbound message. - * @param receivedAt When the system received the message. - * @param to The Sinch phone number or short code to which the message was sent. - * @param clientReference If this inbound message is in response to a previously sent message that - * contained a client reference, then this field contains that client reference. Utilizing - * this feature requires additional setup on your account. Contact your account manager to - * enable this feature. - * @param operatorId The MCC/MNC of the sender's operator if known. - * @param sendAt When the message left the originating device. Only available if provided by - * operator. - * @param udh The UDH header of a binary message HEX encoded. Max 140 bytes together with body. - */ - public InboundBinary( - String body, - String from, - String id, - Instant receivedAt, - String to, - String clientReference, - String operatorId, - Instant sendAt, - String udh) { - super(body, from, id, receivedAt, to, clientReference, operatorId, sendAt); - this.udh = udh; - } - - public String getUdh() { - return udh; - } - - @Override - public String toString() { - return "InboundBinary{" + "udh='" + udh + '\'' + "} " + super.toString(); - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder extends Inbound.Builder { - - String udh; - - protected Builder() { - super(); - } - - public Builder setUdh(String udh) { - this.udh = udh; - return this; - } - - public InboundBinary build() { - return new InboundBinary( - body, from, id, receivedAt, to, clientReference, operatorId, sentAt, udh); - } - - @Override - protected Builder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/InboundText.java b/client/src/main/com/sinch/sdk/domains/sms/models/InboundText.java deleted file mode 100644 index 9d68027fd..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/InboundText.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import java.time.Instant; - -/** - * Incoming SMS Text - * - * @since 1.0 - */ -public class InboundText extends Inbound { - - /** - * Text MO class - * - * @param body The message content Base64 encoded. Max 140 bytes together with udh. - * @param from The phone number that sent the message. @see https://community.sinch.com/t5/Glossary/MSISDN/ta-p/7628 - * @param id The ID of this inbound message. - * @param receivedAt When the system received the message. - * @param to The Sinch phone number or short code to which the message was sent. - * @param clientReference If this inbound message is in response to a previously sent message that - * contained a client reference, then this field contains that client reference. Utilizing - * this feature requires additional setup on your account. Contact your account manager to - * enable this feature. - * @param operatorId The MCC/MNC of the sender's operator if known. - * @param sentAt When the message left the originating device. Only available if provided by - * operator. - */ - public InboundText( - String body, - String from, - String id, - Instant receivedAt, - String to, - String clientReference, - String operatorId, - Instant sentAt) { - super(body, from, id, receivedAt, to, clientReference, operatorId, sentAt); - } - - @Override - public String toString() { - return "InboundText{} " + super.toString(); - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder extends Inbound.Builder { - - protected Builder() { - super(); - } - - public InboundText build() { - return new InboundText(body, from, id, receivedAt, to, clientReference, operatorId, sentAt); - } - - @Override - protected InboundText.Builder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/MediaBody.java b/client/src/main/com/sinch/sdk/domains/sms/models/MediaBody.java deleted file mode 100644 index f12056cfd..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/MediaBody.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import java.util.Optional; - -/** - * MediaBody object - * - * @since 1.0 - */ -public class MediaBody { - private final String message; - private final String url; - - /** - * @param url URL to the media file - * @param message The message text. Text only media messages will be rejected, please use SMS - * instead. - */ - public MediaBody(String url, String message) { - this.message = message; - this.url = url; - } - - public MediaBody(String url) { - this(url, null); - } - - public String getUrl() { - return url; - } - - public Optional getMessage() { - return Optional.ofNullable(message); - } - - @Override - public String toString() { - return "MediaBody{" + "message='" + message + '\'' + ", url='" + url + '\'' + '}'; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String message; - private String url; - - private Builder() {} - - public Builder setMessage(String message) { - this.message = message; - return this; - } - - public Builder setUrl(String url) { - this.url = url; - return this; - } - - public MediaBody build() { - return new MediaBody(url, message); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/Parameters.java b/client/src/main/com/sinch/sdk/domains/sms/models/Parameters.java deleted file mode 100644 index c8e6b90a2..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/Parameters.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import com.sinch.sdk.core.utils.Pair; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Optional; -import java.util.stream.Collectors; - -public class Parameters extends HashMap> { - - private static final long serialVersionUID = 1L; - - /** - * @throws NullPointerException – if the specified map is null - */ - public Parameters(Collection list) throws NullPointerException { - super(list.stream().collect(Collectors.groupingBy(Parameters.Entry::getKey))); - } - - public static class Entry { - private final String key; - private final Pair value; - private final String defaultValue; - - public Entry(String key, Pair value, String defaultValue) { - this.key = key; - this.value = value; - this.defaultValue = defaultValue; - } - - public Entry(String key, Pair value) { - this(key, value, null); - } - - public String getKey() { - return key; - } - - public Pair getValue() { - return value; - } - - public Optional getDefaultValue() { - return Optional.ofNullable(defaultValue); - } - - @Override - public String toString() { - return "Entry{" - + "key='" - + key - + '\'' - + ", value=" - + value - + ", defaultValue=" - + defaultValue - + '}'; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/SMSCursorPageNavigator.java b/client/src/main/com/sinch/sdk/domains/sms/models/SMSCursorPageNavigator.java deleted file mode 100644 index 29a988cd1..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/SMSCursorPageNavigator.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import com.sinch.sdk.core.models.pagination.PageNavigator; - -public class SMSCursorPageNavigator extends PageNavigator { - - private final Integer currentPage; - private final Integer pageSize; - - public SMSCursorPageNavigator(Integer currentPage, Integer pageSize) { - super(null); - this.currentPage = currentPage; - this.pageSize = pageSize; - } - - private Integer computeNextPageCursor() { - return null == pageSize || pageSize == 0 ? null : currentPage + 1; - } - - @Override - public Integer getToken() { - return computeNextPageCursor(); - } - - @Override - public String toString() { - return "SMSCursorPageNavigator{" - + "currentPage=" - + currentPage - + ", pageSize=" - + pageSize - + "} " - + super.toString(); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/package-info.java b/client/src/main/com/sinch/sdk/domains/sms/models/package-info.java deleted file mode 100644 index bc49635cc..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/package-info.java +++ /dev/null @@ -1,6 +0,0 @@ -/** - * SMS API related models - * - * @since 1.0 - */ -package com.sinch.sdk.domains.sms.models; diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/requests/BatchesListRequestParameters.java b/client/src/main/com/sinch/sdk/domains/sms/models/requests/BatchesListRequestParameters.java deleted file mode 100644 index c68d77bd5..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/requests/BatchesListRequestParameters.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.sinch.sdk.domains.sms.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import java.time.Instant; - -/** - * Parameters request to list batches for a project - * - * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Batches/#tag/Batches/operation/ListBatches/ - * @since 1.0 - */ -public class BatchesListRequestParameters { - - private final OptionalValue from; - private final OptionalValue startDate; - private final OptionalValue endDate; - private final OptionalValue clientReference; - private final OptionalValue page; - private final OptionalValue pageSize; - - private BatchesListRequestParameters( - OptionalValue from, - OptionalValue startDate, - OptionalValue endDate, - OptionalValue clientReference, - OptionalValue page, - OptionalValue pageSize) { - this.from = from; - this.startDate = startDate; - this.endDate = endDate; - this.clientReference = clientReference; - this.page = page; - this.pageSize = pageSize; - } - - public OptionalValue getFrom() { - return from; - } - - public OptionalValue getStartDate() { - return startDate; - } - - public OptionalValue getEndDate() { - return endDate; - } - - public OptionalValue getClientReference() { - return clientReference; - } - - public OptionalValue getPage() { - return page; - } - - public OptionalValue getPageSize() { - return pageSize; - } - - public static Builder builder() { - return new Builder(); - } - - public static Builder builder(BatchesListRequestParameters parameters) { - return new Builder(parameters); - } - - public static class Builder { - - OptionalValue from = OptionalValue.empty(); - OptionalValue startDate = OptionalValue.empty(); - OptionalValue endDate = OptionalValue.empty(); - OptionalValue clientReference = OptionalValue.empty(); - OptionalValue page = OptionalValue.empty(); - OptionalValue pageSize = OptionalValue.empty(); - - private Builder() {} - - private Builder(BatchesListRequestParameters parameters) { - this.from = parameters.from; - this.startDate = parameters.startDate; - this.endDate = parameters.endDate; - this.clientReference = parameters.clientReference; - this.page = parameters.page; - this.pageSize = parameters.pageSize; - } - - /** - * @param from Only list messages sent from this sender number. Multiple originating numbers can - * be comma separated. Must be phone numbers or short code. - * @return current builder - */ - public Builder setFrom(String from) { - this.from = OptionalValue.of(from); - return this; - } - - /** - * @param startDate Only list messages received at or after this date/time. - * @return current builder - */ - public Builder setStartDate(Instant startDate) { - this.startDate = OptionalValue.of(startDate); - return this; - } - - /** - * @param endDate Only list messages received before this date/time - * @return current builder - */ - public Builder setEndDate(Instant endDate) { - this.endDate = OptionalValue.of(endDate); - return this; - } - - /** - * @param clientReference Client reference to include - * @return current builder - */ - public Builder setClientReference(String clientReference) { - this.clientReference = OptionalValue.of(clientReference); - return this; - } - - /** - * @param page The page number starting from 0 - * @return current builder - */ - public Builder setPage(Integer page) { - this.page = OptionalValue.of(page); - return this; - } - - /** - * @param pageSize Determines the size of a page - * @return current builder - */ - public Builder setPageSize(Integer pageSize) { - this.pageSize = OptionalValue.of(pageSize); - return this; - } - - public BatchesListRequestParameters build() { - return new BatchesListRequestParameters( - from, startDate, endDate, clientReference, page, pageSize); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/requests/DeliveryReportBatchGetRequestParameters.java b/client/src/main/com/sinch/sdk/domains/sms/models/requests/DeliveryReportBatchGetRequestParameters.java deleted file mode 100644 index a76d07768..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/requests/DeliveryReportBatchGetRequestParameters.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.sinch.sdk.domains.sms.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.sms.models.DeliveryReportStatus; -import com.sinch.sdk.domains.sms.models.DeliveryReportType; -import java.util.Collection; - -/** - * Parameters request to get a Batch Delivery Report - * - * @since 1.0 - */ -public class DeliveryReportBatchGetRequestParameters { - - private final OptionalValue type; - private final OptionalValue> statuses; - private final OptionalValue> codes; - - private DeliveryReportBatchGetRequestParameters( - OptionalValue type, - OptionalValue> statuses, - OptionalValue> codes) { - this.type = type; - this.statuses = statuses; - this.codes = codes; - } - - public OptionalValue getType() { - return type; - } - - public OptionalValue> geStatues() { - return statuses; - } - - public OptionalValue> getCodes() { - return codes; - } - - public static Builder builder() { - return new Builder(); - } - - public static Builder builder(DeliveryReportBatchGetRequestParameters parameters) { - return new Builder(parameters); - } - - public static class Builder { - - OptionalValue type = OptionalValue.empty(); - OptionalValue> statuses = OptionalValue.empty(); - OptionalValue> codes = OptionalValue.empty(); - - private Builder() {} - - private Builder(DeliveryReportBatchGetRequestParameters parameters) { - this.type = parameters.type; - this.statuses = parameters.statuses; - this.codes = parameters.codes; - } - - /** - * @param type Filter by type of delivery report. - *

    - *
  • A summary will count the number of messages sent per status. - *
  • A full report give that of a summary report but in addition, lists - * phone numbers. - *
- * - * @return current builder - */ - public Builder setType(DeliveryReportType type) { - this.type = OptionalValue.of(type); - return this; - } - - /** - * @param statuses Filter by list of statuses - * to include - * @return current builder - */ - public Builder setStatuses(Collection statuses) { - this.statuses = OptionalValue.of(statuses); - return this; - } - - /** - * @param codes Filter by list of codes - * to include - * @return current builder - */ - public Builder setCodes(Collection codes) { - this.codes = OptionalValue.of(codes); - return this; - } - - public DeliveryReportBatchGetRequestParameters build() { - return new DeliveryReportBatchGetRequestParameters(type, statuses, codes); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/requests/DeliveryReportListRequestParameters.java b/client/src/main/com/sinch/sdk/domains/sms/models/requests/DeliveryReportListRequestParameters.java deleted file mode 100644 index 54cc1d502..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/requests/DeliveryReportListRequestParameters.java +++ /dev/null @@ -1,169 +0,0 @@ -package com.sinch.sdk.domains.sms.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.sms.models.DeliveryReportErrorCode; -import com.sinch.sdk.domains.sms.models.DeliveryReportStatus; -import java.time.Instant; -import java.util.Collection; - -/** - * Parameters request to list delivery reports for a project - * - * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Delivery-reports/#tag/Delivery-reports/operation/getDeliveryReports - * @since 1.0 - */ -public class DeliveryReportListRequestParameters { - - private final OptionalValue startDate; - private final OptionalValue endDate; - private final OptionalValue clientReference; - private final OptionalValue page; - private final OptionalValue pageSize; - private final OptionalValue> statuses; - private final OptionalValue> codes; - - private DeliveryReportListRequestParameters( - OptionalValue startDate, - OptionalValue endDate, - OptionalValue clientReference, - OptionalValue page, - OptionalValue pageSize, - OptionalValue> statuses, - OptionalValue> codes) { - this.startDate = startDate; - this.endDate = endDate; - this.clientReference = clientReference; - this.page = page; - this.pageSize = pageSize; - this.statuses = statuses; - this.codes = codes; - } - - public OptionalValue getStartDate() { - return startDate; - } - - public OptionalValue getEndDate() { - return endDate; - } - - public OptionalValue getClientReference() { - return clientReference; - } - - public OptionalValue getPage() { - return page; - } - - public OptionalValue getPageSize() { - return pageSize; - } - - public OptionalValue> getStatuses() { - return statuses; - } - - public OptionalValue> getCodes() { - return codes; - } - - public static Builder builder() { - return new Builder(); - } - - public static Builder builder(DeliveryReportListRequestParameters parameters) { - return new Builder(parameters); - } - - public static class Builder { - - OptionalValue startDate = OptionalValue.empty(); - OptionalValue endDate = OptionalValue.empty(); - OptionalValue clientReference = OptionalValue.empty(); - OptionalValue page = OptionalValue.empty(); - OptionalValue pageSize = OptionalValue.empty(); - OptionalValue> statuses = OptionalValue.empty(); - OptionalValue> codes = OptionalValue.empty(); - - private Builder() {} - - private Builder(DeliveryReportListRequestParameters parameters) { - this.startDate = parameters.startDate; - this.endDate = parameters.endDate; - this.clientReference = parameters.clientReference; - this.page = parameters.page; - this.pageSize = parameters.pageSize; - this.statuses = parameters.statuses; - this.codes = parameters.codes; - } - - /** - * @param startDate Only list messages received at or after this date/time. Default: 24h ago - * @return current builder - */ - public Builder setStartDate(Instant startDate) { - this.startDate = OptionalValue.of(startDate); - return this; - } - - /** - * @param endDate Only list messages received before this date/time. - * @return current builder - */ - public Builder setEndDate(Instant endDate) { - this.endDate = OptionalValue.of(endDate); - return this; - } - - /** - * @param clientReference Client reference to include - * @return current builder - */ - public Builder setClientReference(String clientReference) { - this.clientReference = OptionalValue.of(clientReference); - return this; - } - - /** - * @param page The page number starting from 0. - * @return current builder - */ - public Builder setPage(Integer page) { - this.page = OptionalValue.of(page); - return this; - } - - /** - * @param pageSize Determines the size of a page. - * @return current builder - */ - public Builder setPageSize(Integer pageSize) { - this.pageSize = OptionalValue.of(pageSize); - return this; - } - - /** - * @param statuses List of delivery report statuses to include - * @return current builder - */ - public Builder setStatuses(Collection statuses) { - this.statuses = OptionalValue.of(statuses); - return this; - } - - /** - * @param codes List of delivery receipt error codes to include - * @return current builder - */ - public Builder setCodes(Collection codes) { - this.codes = OptionalValue.of(codes); - return this; - } - - public DeliveryReportListRequestParameters build() { - return new DeliveryReportListRequestParameters( - startDate, endDate, clientReference, page, pageSize, statuses, codes); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/requests/GroupAutoUpdateKeywordRequestParameters.java b/client/src/main/com/sinch/sdk/domains/sms/models/requests/GroupAutoUpdateKeywordRequestParameters.java deleted file mode 100644 index ec9581db4..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/requests/GroupAutoUpdateKeywordRequestParameters.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.sinch.sdk.domains.sms.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; - -public class GroupAutoUpdateKeywordRequestParameters { - - private final OptionalValue firstWord; - private final OptionalValue secondWord; - - /** - * @param firstWord Opt-in keyword like "JOIN" if _auto_update.to_ is dedicated long/short number - * or unique brand keyword like "Sinch" if it is a shared short code. - * @param secondWord Opt-in keyword like "JOIN" if _auto_update.to_ is shared short code. - */ - private GroupAutoUpdateKeywordRequestParameters( - OptionalValue firstWord, OptionalValue secondWord) { - this.firstWord = firstWord; - this.secondWord = secondWord; - } - - public OptionalValue getFirstWord() { - return firstWord; - } - - public OptionalValue getSecondWord() { - return secondWord; - } - - @Override - public String toString() { - return "GroupAutoUpdateKeywordRequestParameters{" - + "firstWord='" - + firstWord - + '\'' - + ", secondWord='" - + secondWord - + '\'' - + '}'; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - OptionalValue firstWord = OptionalValue.empty(); - OptionalValue secondWord = OptionalValue.empty(); - - private Builder() {} - - public Builder setFirstWord(String firstWord) { - this.firstWord = OptionalValue.of(firstWord); - return this; - } - - public Builder setSecondWord(String secondWord) { - this.secondWord = OptionalValue.of(secondWord); - return this; - } - - public GroupAutoUpdateKeywordRequestParameters build() { - return new GroupAutoUpdateKeywordRequestParameters(firstWord, secondWord); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/requests/GroupAutoUpdateRequestParameters.java b/client/src/main/com/sinch/sdk/domains/sms/models/requests/GroupAutoUpdateRequestParameters.java deleted file mode 100644 index e1a41ffcb..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/requests/GroupAutoUpdateRequestParameters.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.sinch.sdk.domains.sms.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.sms.models.GroupAutoUpdate.Builder; - -public class GroupAutoUpdateRequestParameters { - private final OptionalValue to; - private final OptionalValue add; - private final OptionalValue remove; - - private GroupAutoUpdateRequestParameters( - OptionalValue to, - OptionalValue add, - OptionalValue remove) { - this.to = to; - this.add = add; - this.remove = remove; - } - - public OptionalValue getTo() { - return to; - } - - public OptionalValue getAdd() { - return add; - } - - public OptionalValue getRemove() { - return remove; - } - - public static Builder builder() { - return new Builder(); - } - - @Override - public String toString() { - return "GroupAutoUpdateRequestParameters{" - + "to='" - + to - + '\'' - + ", add=" - + add - + ", remove=" - + remove - + '}'; - } - - public static class Builder { - - OptionalValue to = OptionalValue.empty(); - OptionalValue add = OptionalValue.empty(); - OptionalValue remove = OptionalValue.empty(); - - private Builder() {} - - /** - * @param to Short code or long number addressed in MO.
- * Constraints: Must be valid MSISDN or short code. - * @return current builder - */ - public Builder setTo(String to) { - this.to = OptionalValue.of(to); - return this; - } - - /*** - * - * @param add Keyword to be sent in MO to add MSISDN to a group - * @return current builder - */ - public Builder setAdd(GroupAutoUpdateKeywordRequestParameters add) { - this.add = OptionalValue.of(add); - return this; - } - - /** - * @param remove Keyword to be sent in MO to remove MSISDN to a group - * @return current builder - */ - public Builder setRemove(GroupAutoUpdateKeywordRequestParameters remove) { - this.remove = OptionalValue.of(remove); - return this; - } - - public GroupAutoUpdateRequestParameters build() { - return new GroupAutoUpdateRequestParameters(to, add, remove); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/requests/GroupCreateRequestParameters.java b/client/src/main/com/sinch/sdk/domains/sms/models/requests/GroupCreateRequestParameters.java deleted file mode 100644 index 7fc87d229..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/requests/GroupCreateRequestParameters.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.sinch.sdk.domains.sms.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import java.util.Collection; - -/** - * Parameters request to create a group - * - * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Groups/#tag/Groups/operation/CreateGroup - * @since 1.0 - */ -public class GroupCreateRequestParameters { - - private final OptionalValue name; - private final OptionalValue> members; - private final OptionalValue> childGroupIds; - private final OptionalValue autoUpdate; - - private GroupCreateRequestParameters( - OptionalValue name, - OptionalValue> members, - OptionalValue> childGroupIds, - OptionalValue autoUpdate) { - this.name = name; - this.members = members; - this.childGroupIds = childGroupIds; - this.autoUpdate = autoUpdate; - } - - public OptionalValue getName() { - return name; - } - - public OptionalValue> getMembers() { - return members; - } - - public OptionalValue> getChildGroupIds() { - return childGroupIds; - } - - public OptionalValue getAutoUpdate() { - return autoUpdate; - } - - @Override - public String toString() { - return "GroupCreateRequestParameters{" - + "name='" - + name - + '\'' - + ", members=" - + members - + ", childGroupIds=" - + childGroupIds - + ", autoUpdate=" - + autoUpdate - + '}'; - } - - public static Builder builder() { - return new Builder(); - } - - public static Builder builder(GroupCreateRequestParameters parameters) { - return new Builder(parameters); - } - - public static class Builder { - - OptionalValue name = OptionalValue.empty(); - OptionalValue> members = OptionalValue.empty(); - OptionalValue> childGroupIds = OptionalValue.empty(); - OptionalValue autoUpdate = OptionalValue.empty(); - - private Builder() {} - - private Builder(GroupCreateRequestParameters parameters) { - this.name = parameters.getName(); - this.members = parameters.getMembers(); - this.childGroupIds = parameters.getChildGroupIds(); - this.autoUpdate = parameters.getAutoUpdate(); - } - - /** - * @param name Name of the group - * @return current builder - */ - public Builder setName(String name) { - this.name = OptionalValue.of(name); - return this; - } - - /** - * @param members Initial list of phone numbers in E.164 format MSISDNs for the group - * @return current builder - */ - public Builder setMembers(Collection members) { - this.members = OptionalValue.of(members); - return this; - } - - /** - * @param childGroupIds Child group IDs - * @return current builder - */ - public Builder setChildGroupIds(Collection childGroupIds) { - this.childGroupIds = OptionalValue.of(childGroupIds); - return this; - } - - /** - * @param autoUpdate Auto update settings - * @return current builder - */ - public Builder setAutoUpdate(GroupAutoUpdateRequestParameters autoUpdate) { - this.autoUpdate = OptionalValue.of(autoUpdate); - return this; - } - - public GroupCreateRequestParameters build() { - return new GroupCreateRequestParameters(name, members, childGroupIds, autoUpdate); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/requests/GroupReplaceRequestParameters.java b/client/src/main/com/sinch/sdk/domains/sms/models/requests/GroupReplaceRequestParameters.java deleted file mode 100644 index b51982475..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/requests/GroupReplaceRequestParameters.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.sinch.sdk.domains.sms.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import java.util.Collection; - -/** - * Parameters request to replace a group - * - * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Groups/#tag/Groups/operation/ReplaceGroup - * @since 1.0 - */ -public class GroupReplaceRequestParameters { - - private final OptionalValue name; - private final OptionalValue> members; - - private GroupReplaceRequestParameters( - OptionalValue name, OptionalValue> members) { - this.name = name; - this.members = members; - } - - public OptionalValue getName() { - return name; - } - - public OptionalValue> getMembers() { - return members; - } - - @Override - public String toString() { - return "GroupCreateRequestParameters{" + "name='" + name + '\'' + ", members=" + members + '}'; - } - - public static Builder builder() { - return new Builder(); - } - - public static Builder builder(GroupReplaceRequestParameters parameters) { - return new Builder(parameters); - } - - public static class Builder { - - OptionalValue name = OptionalValue.empty(); - OptionalValue> members = OptionalValue.empty(); - - private Builder() {} - - private Builder(GroupReplaceRequestParameters parameters) { - this.name = parameters.getName(); - this.members = parameters.getMembers(); - } - - /** - * @param name Name of the group - * @return current builder - */ - public Builder setName(String name) { - this.name = OptionalValue.of(name); - return this; - } - - /** - * @param members The initial members of the group. - *

Constraints: Elements must be phone numbers in E.164 format MSISDNs. - * @return current builder - */ - public Builder setMembers(Collection members) { - this.members = OptionalValue.of(members); - return this; - } - - public GroupReplaceRequestParameters build() { - return new GroupReplaceRequestParameters(name, members); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/requests/GroupUpdateRequestParameters.java b/client/src/main/com/sinch/sdk/domains/sms/models/requests/GroupUpdateRequestParameters.java deleted file mode 100644 index 1a9b17c10..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/requests/GroupUpdateRequestParameters.java +++ /dev/null @@ -1,179 +0,0 @@ -package com.sinch.sdk.domains.sms.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import java.util.Collection; - -/** - * Parameters request to update" a group - * - * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Groups/#tag/Groups/operation/UpdateGroup - * @since 1.0 - */ -public class GroupUpdateRequestParameters { - - private final OptionalValue name; - private final OptionalValue> add; - private final OptionalValue> remove; - private final OptionalValue addFromGroup; - private final OptionalValue removeFromGroup; - private final OptionalValue autoUpdate; - - private GroupUpdateRequestParameters( - OptionalValue name, - OptionalValue> add, - OptionalValue> remove, - OptionalValue addFromGroup, - OptionalValue removeFromGroup, - OptionalValue autoUpdate) { - this.name = name; - this.add = add; - this.remove = remove; - this.addFromGroup = addFromGroup; - this.removeFromGroup = removeFromGroup; - this.autoUpdate = autoUpdate; - } - - public OptionalValue getName() { - return name; - } - - public OptionalValue> getAdd() { - return add; - } - - public OptionalValue> getRemove() { - return remove; - } - - public OptionalValue getAddFromGroup() { - return addFromGroup; - } - - public OptionalValue getRemoveFromGroup() { - return removeFromGroup; - } - - public OptionalValue getAutoUpdate() { - return autoUpdate; - } - - @Override - public String toString() { - return "GroupUpdateRequestParameters{" - + "name='" - + name - + '\'' - + ", add=" - + add - + ", remove=" - + remove - + ", addFromGroup='" - + addFromGroup - + '\'' - + ", removeFromGroup='" - + removeFromGroup - + '\'' - + ", autoUpdate=" - + autoUpdate - + '}'; - } - - public static Builder builder() { - return new Builder(); - } - - public static Builder builder(GroupUpdateRequestParameters parameters) { - return new Builder(parameters); - } - - public static class Builder { - - OptionalValue name = OptionalValue.empty(); - - OptionalValue> add = OptionalValue.empty(); - - OptionalValue> remove = OptionalValue.empty(); - - OptionalValue addFromGroup = OptionalValue.empty(); - - OptionalValue removeFromGroup = OptionalValue.empty(); - - OptionalValue autoUpdate = OptionalValue.empty(); - - private Builder() {} - - private Builder(GroupUpdateRequestParameters parameters) { - this.name = parameters.getName(); - this.add = parameters.getAdd(); - this.remove = parameters.getRemove(); - this.addFromGroup = parameters.getAddFromGroup(); - this.removeFromGroup = parameters.getRemoveFromGroup(); - this.autoUpdate = parameters.getAutoUpdate(); - } - - /** - * @param name The name of the group. Omitting name from the JSON body will leave the name - * unchanged. To remove an existing name set, name explicitly to the JSON value null. - * @return current builder - */ - public Builder setName(String name) { - this.name = OptionalValue.of(name); - return this; - } - - /** - * @param add Add a list of phone numbers (MSISDNs) to this group. The phone numbers are a - * strings within an array and must be in E.164 format. - * @return current builder - */ - public Builder setAdd(Collection add) { - this.add = OptionalValue.of(add); - return this; - } - - /** - * @param remove Remove a list of phone numbers (MSISDNs) to this group.The phone numbers are a - * strings within an array and must be in E.164 format. - * @return current builder - */ - public Builder setRemove(Collection remove) { - this.remove = OptionalValue.of(remove); - return this; - } - - /** - * @param addFromGroup Copy the members from the another group into this group. Constraints: - * Must be valid group ID - * @return current builder - */ - public Builder setAddFromGroup(String addFromGroup) { - this.addFromGroup = OptionalValue.of(addFromGroup); - return this; - } - - /** - * @param removeFromGroup Remove the members in a specified group from this group. - *

Constraints: Must be valid group ID - * @return current builder - */ - public Builder setRemoveFromGroup(String removeFromGroup) { - this.removeFromGroup = OptionalValue.of(removeFromGroup); - return this; - } - - /** - * @param autoUpdate auto update settings - * @return current builder - */ - public Builder setAutoUpdate(GroupAutoUpdateRequestParameters autoUpdate) { - this.autoUpdate = OptionalValue.of(autoUpdate); - return this; - } - - public GroupUpdateRequestParameters build() { - return new GroupUpdateRequestParameters( - name, add, remove, addFromGroup, removeFromGroup, autoUpdate); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/requests/GroupsListRequestParameters.java b/client/src/main/com/sinch/sdk/domains/sms/models/requests/GroupsListRequestParameters.java deleted file mode 100644 index 5e72eed06..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/requests/GroupsListRequestParameters.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.sinch.sdk.domains.sms.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; - -/** - * Parameters request to list groups - * - * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Groups/#tag/Groups/operation/ListGroups - * @since 1.0 - */ -public class GroupsListRequestParameters { - - private final OptionalValue page; - private final OptionalValue pageSize; - - public GroupsListRequestParameters(OptionalValue page, OptionalValue pageSize) { - this.page = page; - this.pageSize = pageSize; - } - - public OptionalValue getPage() { - return page; - } - - public OptionalValue getPageSize() { - return pageSize; - } - - public static Builder builder() { - return new Builder(); - } - - public static Builder builder(GroupsListRequestParameters parameters) { - return new Builder(parameters); - } - - public static class Builder { - - OptionalValue page = OptionalValue.empty(); - OptionalValue pageSize = OptionalValue.empty(); - - private Builder() {} - - private Builder(GroupsListRequestParameters parameters) { - this.page = parameters.page; - this.pageSize = parameters.pageSize; - } - - /** - * @param page The page number starting from 0. - * @return current builder - */ - public Builder setPage(Integer page) { - this.page = OptionalValue.of(page); - return this; - } - - /** - * @param pageSize Determines the size of a page. - * @return current builder - */ - public Builder setPageSize(Integer pageSize) { - this.pageSize = OptionalValue.of(pageSize); - return this; - } - - public GroupsListRequestParameters build() { - return new GroupsListRequestParameters(page, pageSize); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/requests/InboundsListRequestParameters.java b/client/src/main/com/sinch/sdk/domains/sms/models/requests/InboundsListRequestParameters.java deleted file mode 100644 index d72abcfef..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/requests/InboundsListRequestParameters.java +++ /dev/null @@ -1,151 +0,0 @@ -package com.sinch.sdk.domains.sms.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import java.time.Instant; -import java.util.Collection; - -/** - * Parameters request to list delivery reports for a project - * - * @see https://developers.sinch.com/docs/sms/api-reference/sms/tag/Delivery-reports/#tag/Delivery-reports/operation/getDeliveryReports - * @since 1.0 - */ -public class InboundsListRequestParameters { - - private final OptionalValue startDate; - private final OptionalValue endDate; - private final OptionalValue clientReference; - private final OptionalValue page; - private final OptionalValue pageSize; - private final OptionalValue> to; - - private InboundsListRequestParameters( - OptionalValue startDate, - OptionalValue endDate, - OptionalValue clientReference, - OptionalValue page, - OptionalValue pageSize, - OptionalValue> to) { - this.startDate = startDate; - this.endDate = endDate; - this.clientReference = clientReference; - this.page = page; - this.pageSize = pageSize; - this.to = to; - } - - public OptionalValue getStartDate() { - return startDate; - } - - public OptionalValue getEndDate() { - return endDate; - } - - public OptionalValue getClientReference() { - return clientReference; - } - - public OptionalValue getPage() { - return page; - } - - public OptionalValue getPageSize() { - return pageSize; - } - - public OptionalValue> getTo() { - return to; - } - - public static Builder builder() { - return new Builder(); - } - - public static Builder builder(InboundsListRequestParameters parameters) { - return new Builder(parameters); - } - - public static class Builder { - - OptionalValue startDate = OptionalValue.empty(); - OptionalValue endDate = OptionalValue.empty(); - OptionalValue clientReference = OptionalValue.empty(); - OptionalValue page = OptionalValue.empty(); - OptionalValue pageSize = OptionalValue.empty(); - OptionalValue> to = OptionalValue.empty(); - - private Builder() {} - - private Builder(InboundsListRequestParameters parameters) { - this.startDate = parameters.startDate; - this.endDate = parameters.endDate; - this.clientReference = parameters.clientReference; - this.page = parameters.page; - this.pageSize = parameters.pageSize; - this.to = parameters.to; - } - - /** - * @param startDate Only list messages received at or after this date/time - * @return current builder - */ - public Builder setStartDate(Instant startDate) { - this.startDate = OptionalValue.of(startDate); - return this; - } - - /** - * @param endDate Only list messages received before this date/time - * @return current builder - */ - public Builder setEndDate(Instant endDate) { - this.endDate = OptionalValue.of(endDate); - return this; - } - - /** - * @param clientReference Using a client reference in inbound messages requires additional setup - * on your account. Contact your account manager to enable this feature. Only list inbound - * messages that are in response to messages with a previously provided client reference. - * @return current builder - */ - public Builder setClientReference(String clientReference) { - this.clientReference = OptionalValue.of(clientReference); - return this; - } - - /** - * @param page The page number starting from 0. - * @return current builder - */ - public Builder setPage(Integer page) { - this.page = OptionalValue.of(page); - return this; - } - - /** - * @param pageSize Determines the size of a page. - * @return current builder - */ - public Builder setPageSize(Integer pageSize) { - this.pageSize = OptionalValue.of(pageSize); - return this; - } - - /** - * @param to Only list messages sent to these destinations - * @return current builder - */ - public Builder setTo(Collection to) { - this.to = OptionalValue.of(to); - return this; - } - - public InboundsListRequestParameters build() { - return new InboundsListRequestParameters( - startDate, endDate, clientReference, page, pageSize, to); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/requests/SendSmsBatchBinaryRequest.java b/client/src/main/com/sinch/sdk/domains/sms/models/requests/SendSmsBatchBinaryRequest.java deleted file mode 100644 index a3b2ce2f6..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/requests/SendSmsBatchBinaryRequest.java +++ /dev/null @@ -1,194 +0,0 @@ -package com.sinch.sdk.domains.sms.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.sms.models.BaseBatch; -import com.sinch.sdk.domains.sms.models.DeliveryReportType; -import java.time.Instant; -import java.util.Collection; - -public class SendSmsBatchBinaryRequest extends BaseBatch { - private final OptionalValue flashMessage; - private final OptionalValue truncateConcat; - private final OptionalValue maxNumberOfMessageParts; - private final OptionalValue fromTon; - private final OptionalValue fromNpi; - private final OptionalValue udh; - - private SendSmsBatchBinaryRequest( - Collection to, - OptionalValue from, - String body, - OptionalValue deliveryReport, - OptionalValue sendAt, - OptionalValue expireAt, - OptionalValue callbackUrl, - OptionalValue clientReference, - OptionalValue flashMessage, - OptionalValue feedbackEnabled, - OptionalValue truncateConcat, - OptionalValue maxNumberOfMessageParts, - OptionalValue fromTon, - OptionalValue fromNpi, - OptionalValue udh) { - super( - to, - from, - body, - deliveryReport, - sendAt, - expireAt, - callbackUrl, - clientReference, - feedbackEnabled); - this.flashMessage = flashMessage; - this.truncateConcat = truncateConcat; - this.maxNumberOfMessageParts = maxNumberOfMessageParts; - this.fromTon = fromTon; - this.fromNpi = fromNpi; - this.udh = udh; - } - - public OptionalValue isFlashMessage() { - return flashMessage; - } - - public OptionalValue isTruncateConcat() { - return truncateConcat; - } - - public OptionalValue getMaxNumberOfMessageParts() { - return maxNumberOfMessageParts; - } - - public OptionalValue getFromTon() { - return fromTon; - } - - public OptionalValue getFromNpi() { - return fromNpi; - } - - public OptionalValue getUdh() { - return udh; - } - - @Override - public String toString() { - return "SendSmsBatchBinaryRequest{" - + "flashMessage=" - + flashMessage - + ", truncateConcat=" - + truncateConcat - + ", maxNumberOfMessageParts=" - + maxNumberOfMessageParts - + ", fromTon=" - + fromTon - + ", fromNpi=" - + fromNpi - + ", udh='" - + udh - + '\'' - + ", base='" - + "} " - + super.toString(); - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder extends BaseBatch.Builder { - private OptionalValue flashMessage = OptionalValue.empty(); - private OptionalValue truncateConcat = OptionalValue.empty(); - private OptionalValue maxNumberOfMessageParts = OptionalValue.empty(); - private OptionalValue fromTon = OptionalValue.empty(); - private OptionalValue fromNpi = OptionalValue.empty(); - private OptionalValue udh = OptionalValue.empty(); - - private Builder() { - super(); - } - - /** - * @param flashMessage If sent as a flash message, displays true. - * @return current builder - * @deprecated - */ - public Builder setFlashMessage(boolean flashMessage) { - this.flashMessage = OptionalValue.of(flashMessage); - return this; - } - - /** - * @param truncateConcat If set to true, the message was shortened when exceeding one part. - * @return current builder - * @deprecated - */ - public Builder setTruncateConcat(boolean truncateConcat) { - this.truncateConcat = OptionalValue.of(truncateConcat); - return this; - } - - /** - * @param maxNumberOfMessageParts Displays the number of message parts set in the request. - * @return current builder - * @deprecated - */ - public Builder setMaxNumberOfMessageParts(int maxNumberOfMessageParts) { - this.maxNumberOfMessageParts = OptionalValue.of(maxNumberOfMessageParts); - return this; - } - - /** - * @param fromTon The type of number for the sender number. - * @return current builder - */ - public Builder setFromTon(int fromTon) { - this.fromTon = OptionalValue.of(fromTon); - return this; - } - - /** - * @param fromNpi Number Plan Indicator for the sender number. - * @return current builder - */ - public Builder setFromNpi(int fromNpi) { - this.fromNpi = OptionalValue.of(fromNpi); - return this; - } - - /** - * @param udh The UDH header of a binary message HEX encoded. Max 140 bytes including the body. - * @return current builder - */ - public Builder setUdh(String udh) { - this.udh = OptionalValue.of(udh); - return this; - } - - @Override - public SendSmsBatchBinaryRequest build() { - return new SendSmsBatchBinaryRequest( - to, - from, - body, - deliveryReport, - sendAt, - expireAt, - callbackUrl, - clientReference, - flashMessage, - feedbackEnabled, - truncateConcat, - maxNumberOfMessageParts, - fromTon, - fromNpi, - udh); - } - - @Override - protected Builder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/requests/SendSmsBatchMediaRequest.java b/client/src/main/com/sinch/sdk/domains/sms/models/requests/SendSmsBatchMediaRequest.java deleted file mode 100644 index 44fb01ff5..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/requests/SendSmsBatchMediaRequest.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.sinch.sdk.domains.sms.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.sms.models.BaseBatch; -import com.sinch.sdk.domains.sms.models.DeliveryReportType; -import com.sinch.sdk.domains.sms.models.MediaBody; -import com.sinch.sdk.domains.sms.models.Parameters; -import java.time.Instant; -import java.util.Collection; - -public class SendSmsBatchMediaRequest extends BaseBatch { - private final OptionalValue parameters; - private final OptionalValue strictValidation; - - private SendSmsBatchMediaRequest( - Collection to, - OptionalValue from, - MediaBody body, - OptionalValue deliveryReport, - OptionalValue sendAt, - OptionalValue expireAt, - OptionalValue callbackUrl, - OptionalValue clientReference, - OptionalValue feedbackEnabled, - OptionalValue parameters, - OptionalValue strictValidation) { - super( - to, - from, - body, - deliveryReport, - sendAt, - expireAt, - callbackUrl, - clientReference, - feedbackEnabled); - this.parameters = parameters; - this.strictValidation = strictValidation; - } - - public OptionalValue getParameters() { - return parameters; - } - - public OptionalValue isStrictValidation() { - return strictValidation; - } - - @Override - public String toString() { - return "SendSmsBatchMediaRequest{" - + "parameters=" - + parameters - + ", strictValidation=" - + strictValidation - + ", base='" - + "} " - + super.toString(); - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder extends BaseBatch.Builder { - private OptionalValue parameters = OptionalValue.empty(); - private OptionalValue strictValidation = OptionalValue.empty(); - - private Builder() {} - - /** - * @param parameters Contains the parameters that will be used for customizing the message for - * each recipient. - * @return current builder - */ - public Builder setParameters(Parameters parameters) { - this.parameters = OptionalValue.of(parameters); - return this; - } - - /** - * @param strictValidation Whether or not you want the media included in your message to be - * checked against Sinch MMS channel best practices. If set to true, your message will be - * rejected if it doesn't conform to the listed recommendations, otherwise no validation - * will be performed. - * @return current builder - */ - public Builder setStrictValidation(Boolean strictValidation) { - this.strictValidation = OptionalValue.of(strictValidation); - return this; - } - - public SendSmsBatchMediaRequest build() { - return new SendSmsBatchMediaRequest( - to, - from, - body, - deliveryReport, - sendAt, - expireAt, - callbackUrl, - clientReference, - feedbackEnabled, - parameters, - strictValidation); - } - - @Override - protected Builder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/requests/SendSmsBatchTextRequest.java b/client/src/main/com/sinch/sdk/domains/sms/models/requests/SendSmsBatchTextRequest.java deleted file mode 100644 index 6abb4497b..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/requests/SendSmsBatchTextRequest.java +++ /dev/null @@ -1,188 +0,0 @@ -package com.sinch.sdk.domains.sms.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.sms.models.BaseBatch; -import com.sinch.sdk.domains.sms.models.DeliveryReportType; -import com.sinch.sdk.domains.sms.models.Parameters; -import java.time.Instant; -import java.util.Collection; - -public class SendSmsBatchTextRequest extends BaseBatch { - private final OptionalValue flashMessage; - private final OptionalValue parameters; - private final OptionalValue truncateConcat; - private final OptionalValue maxNumberOfMessageParts; - private final OptionalValue fromTon; - private final OptionalValue fromNpi; - - private SendSmsBatchTextRequest( - Collection to, - OptionalValue from, - String body, - OptionalValue deliveryReport, - OptionalValue sendAt, - OptionalValue expireAt, - OptionalValue callbackUrl, - OptionalValue clientReference, - OptionalValue flashMessage, - OptionalValue feedbackEnabled, - OptionalValue parameters, - OptionalValue truncateConcat, - OptionalValue maxNumberOfMessageParts, - OptionalValue fromTon, - OptionalValue fromNpi) { - super( - to, - from, - body, - deliveryReport, - sendAt, - expireAt, - callbackUrl, - clientReference, - feedbackEnabled); - this.flashMessage = flashMessage; - this.parameters = parameters; - this.truncateConcat = truncateConcat; - this.maxNumberOfMessageParts = maxNumberOfMessageParts; - this.fromTon = fromTon; - this.fromNpi = fromNpi; - } - - public OptionalValue getParameters() { - return parameters; - } - - public OptionalValue isFlashMessage() { - return flashMessage; - } - - public OptionalValue isTruncateConcat() { - return truncateConcat; - } - - public OptionalValue getMaxNumberOfMessageParts() { - return maxNumberOfMessageParts; - } - - public OptionalValue getFromTon() { - return fromTon; - } - - public OptionalValue getFromNpi() { - return fromNpi; - } - - @Override - public String toString() { - return "SendSmsBatchTextRequest{" - + "flashMessage=" - + flashMessage - + ", parameters=" - + parameters - + ", truncateConcat=" - + truncateConcat - + ", maxNumberOfMessageParts=" - + maxNumberOfMessageParts - + ", fromTon=" - + fromTon - + ", fromNpi=" - + fromNpi - + "} " - + super.toString(); - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder extends BaseBatch.Builder { - private OptionalValue flashMessage = OptionalValue.empty(); - private OptionalValue parameters = OptionalValue.empty(); - private OptionalValue truncateConcat = OptionalValue.empty(); - private OptionalValue maxNumberOfMessageParts = OptionalValue.empty(); - private OptionalValue fromTon = OptionalValue.empty(); - private OptionalValue fromNpi = OptionalValue.empty(); - - private Builder() {} - - /** - * @param flashMessage If sent as a flash message, displays true. - * @return current builder - */ - public Builder setFlashMessage(boolean flashMessage) { - this.flashMessage = OptionalValue.of(flashMessage); - return this; - } - - /** - * @param parameters Contains the parameters that will be used for customizing the message for - * each recipient. - * @return current builder - */ - public Builder setParameters(Parameters parameters) { - this.parameters = OptionalValue.of(parameters); - return this; - } - - /** - * @param truncateConcat If set to true, the message was shortened when exceeding one part. - * @return current builder - */ - public Builder setTruncateConcat(Boolean truncateConcat) { - this.truncateConcat = OptionalValue.of(truncateConcat); - return this; - } - - /** - * @param maxNumberOfMessageParts Displays the number of message parts set in the request. - * @return current builder - */ - public Builder setMaxNumberOfMessageParts(Integer maxNumberOfMessageParts) { - this.maxNumberOfMessageParts = OptionalValue.of(maxNumberOfMessageParts); - return this; - } - - /** - * @param fromTon The type of number for the sender number. - * @return current builder - */ - public Builder setFromTon(Integer fromTon) { - this.fromTon = OptionalValue.of(fromTon); - return this; - } - - /** - * @param fromNpi Number Plan Indicator for the sender number. - * @return current builder - */ - public Builder setFromNpi(Integer fromNpi) { - this.fromNpi = OptionalValue.of(fromNpi); - return this; - } - - public SendSmsBatchTextRequest build() { - return new SendSmsBatchTextRequest( - to, - from, - body, - deliveryReport, - sendAt, - expireAt, - callbackUrl, - clientReference, - flashMessage, - feedbackEnabled, - parameters, - truncateConcat, - maxNumberOfMessageParts, - fromTon, - fromNpi); - } - - @Override - protected Builder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/requests/UpdateBaseBatchRequest.java b/client/src/main/com/sinch/sdk/domains/sms/models/requests/UpdateBaseBatchRequest.java deleted file mode 100644 index 2901171ff..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/requests/UpdateBaseBatchRequest.java +++ /dev/null @@ -1,222 +0,0 @@ -package com.sinch.sdk.domains.sms.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.sms.models.DeliveryReportType; -import java.time.Instant; -import java.util.Collection; - -/** - * Base class for Batch types - * - * @param Type of batch - * @since 1.0 - */ -public class UpdateBaseBatchRequest { - - private final OptionalValue from; - - private final OptionalValue body; - - private final OptionalValue> toAdd; - - private final OptionalValue> toRemove; - - private final OptionalValue deliveryReport; - - private final OptionalValue sendAt; - - private final OptionalValue expireAt; - - private final OptionalValue callbackUrl; - - protected UpdateBaseBatchRequest( - OptionalValue> toAdd, - OptionalValue> toRemove, - OptionalValue from, - OptionalValue body, - OptionalValue deliveryReport, - OptionalValue sendAt, - OptionalValue expireAt, - OptionalValue callbackUrl) { - this.toAdd = toAdd; - this.toRemove = toRemove; - this.from = from; - this.body = body; - this.deliveryReport = deliveryReport; - this.sendAt = sendAt; - this.expireAt = expireAt; - this.callbackUrl = callbackUrl; - } - - public static BatchBuilder batchBuilder() { - return new BatchBuilder<>(); - } - - public OptionalValue> getToAdd() { - return toAdd; - } - - public OptionalValue> getToRemove() { - return toRemove; - } - - public OptionalValue getBody() { - return body; - } - - public OptionalValue getFrom() { - return from; - } - - public OptionalValue getDeliveryReport() { - return deliveryReport; - } - - public OptionalValue getSendAt() { - return sendAt; - } - - public OptionalValue getExpireAt() { - return expireAt; - } - - public OptionalValue getCallbackUrl() { - return callbackUrl; - } - - @Override - public String toString() { - return "UpdateBaseBatchRequest{" - + "from='" - + from - + '\'' - + ", body=" - + body - + ", toAdd=" - + toAdd - + ", toRemove=" - + toRemove - + ", deliveryReportType=" - + deliveryReport - + ", sendAt=" - + sendAt - + ", expireAt=" - + expireAt - + ", callbackUrl='" - + callbackUrl - + '\'' - + '}'; - } - - protected static class Builder> { - - public OptionalValue> toAdd = OptionalValue.empty(); - - public OptionalValue> toRemove = OptionalValue.empty(); - - public OptionalValue from = OptionalValue.empty(); - - public OptionalValue body = OptionalValue.empty(); - - public OptionalValue deliveryReportType = OptionalValue.empty(); - - public OptionalValue sendAt = OptionalValue.empty(); - - public OptionalValue expireAt = OptionalValue.empty(); - - public OptionalValue callbackUrl = OptionalValue.empty(); - - /** - * @param toAdd List of phone numbers and group IDs to add to the batch. - * @return current builder - */ - public B setToAdd(Collection toAdd) { - this.toAdd = OptionalValue.of(toAdd); - return self(); - } - - /** - * @param toRemove List of phone numbers and group IDs to remove from the batch. - * @return current builder - */ - public B setToRemove(Collection toRemove) { - this.toRemove = OptionalValue.of(toRemove); - return self(); - } - - /** - * @param from Sender number. Must be valid phone number, short code or alphanumeric. Required - * if Automatic Default Originator not configured. - * @return current builder - */ - public B setFrom(String from) { - this.from = OptionalValue.of(from); - return self(); - } - - /** - * @param body The message content - * @return current builder - */ - public B setBody(T body) { - this.body = OptionalValue.of(body); - return self(); - } - - /** - * @param deliveryReportType Request delivery report callback. Note that delivery reports can be - * fetched from the API regardless of this setting - * @return current builder - */ - public B setDeliveryReport(DeliveryReportType deliveryReportType) { - this.deliveryReportType = OptionalValue.of(deliveryReportType); - return self(); - } - - /** - * @param sendAt If set in the future, the message will be delayed until send_at occurs. Must be - * before expire_at. If set in the past, messages will be sent immediately - * @return current builder - */ - public B setSendAt(Instant sendAt) { - this.sendAt = OptionalValue.of(sendAt); - return self(); - } - - /** - * @param expireAt If set, the system will stop trying to deliver the message at this point. - * Must be after send_at. Default and max is 3 days after send_at - * @return current builder - */ - public B setExpireAt(Instant expireAt) { - this.expireAt = OptionalValue.of(expireAt); - return self(); - } - - /** - * @param callbackUrl Override the default callback URL for this batch. Must be valid URL. - * @return current builder - */ - public B setCallbackUrl(String callbackUrl) { - this.callbackUrl = OptionalValue.of(callbackUrl); - return self(); - } - - public UpdateBaseBatchRequest build() { - return new UpdateBaseBatchRequest<>( - toAdd, toRemove, from, body, deliveryReportType, sendAt, expireAt, callbackUrl); - } - - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - } - - public static class BatchBuilder extends UpdateBaseBatchRequest.Builder> { - @Override - protected BatchBuilder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/requests/UpdateSmsBatchBinaryRequest.java b/client/src/main/com/sinch/sdk/domains/sms/models/requests/UpdateSmsBatchBinaryRequest.java deleted file mode 100644 index 14417f512..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/requests/UpdateSmsBatchBinaryRequest.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.sinch.sdk.domains.sms.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.sms.models.DeliveryReportType; -import java.time.Instant; -import java.util.Collection; - -public class UpdateSmsBatchBinaryRequest extends UpdateBaseBatchRequest { - private final OptionalValue udh; - - private UpdateSmsBatchBinaryRequest( - OptionalValue> toAdd, - OptionalValue> toRemove, - OptionalValue from, - OptionalValue body, - OptionalValue deliveryReport, - OptionalValue sendAt, - OptionalValue expireAt, - OptionalValue callbackUrl, - OptionalValue udh) { - super(toAdd, toRemove, from, body, deliveryReport, sendAt, expireAt, callbackUrl); - this.udh = udh; - } - - public OptionalValue getUdh() { - return udh; - } - - @Override - public String toString() { - return "UpdateSmsBatchBinaryRequest{" + "udh='" + udh + '\'' + "} " + super.toString(); - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder extends UpdateBaseBatchRequest.Builder { - - private OptionalValue udh; - - private Builder() {} - - /** - * @param udh The UDH header of a binary message HEX encoded. Max 140 bytes including the body. - * @return current builder - */ - public Builder setUdh(String udh) { - this.udh = OptionalValue.of(udh); - return this; - } - - public UpdateSmsBatchBinaryRequest build() { - return new UpdateSmsBatchBinaryRequest( - toAdd, toRemove, from, body, deliveryReportType, sendAt, expireAt, callbackUrl, udh); - } - - @Override - protected Builder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/requests/UpdateSmsBatchMediaRequest.java b/client/src/main/com/sinch/sdk/domains/sms/models/requests/UpdateSmsBatchMediaRequest.java deleted file mode 100644 index b0bfc78f9..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/requests/UpdateSmsBatchMediaRequest.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.sinch.sdk.domains.sms.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.sms.models.DeliveryReportType; -import com.sinch.sdk.domains.sms.models.MediaBody; -import com.sinch.sdk.domains.sms.models.Parameters; -import java.time.Instant; -import java.util.Collection; - -public class UpdateSmsBatchMediaRequest extends UpdateBaseBatchRequest { - private final OptionalValue parameters; - private final OptionalValue strictValidation; - - public UpdateSmsBatchMediaRequest( - OptionalValue> toAdd, - OptionalValue> toRemove, - OptionalValue from, - OptionalValue body, - OptionalValue deliveryReport, - OptionalValue sendAt, - OptionalValue expireAt, - OptionalValue callbackUrl, - OptionalValue parameters, - OptionalValue strictValidation) { - super(toAdd, toRemove, from, body, deliveryReport, sendAt, expireAt, callbackUrl); - this.parameters = parameters; - this.strictValidation = strictValidation; - } - - public OptionalValue getParameters() { - return parameters; - } - - public OptionalValue isStrictValidation() { - return strictValidation; - } - - @Override - public String toString() { - return "UpdateSmsBatchMediaRequest{" - + "parameters=" - + parameters - + ", strictValidation=" - + strictValidation - + "} " - + super.toString(); - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder extends UpdateBaseBatchRequest.Builder { - private OptionalValue parameters = OptionalValue.empty(); - private OptionalValue strictValidation = OptionalValue.empty(); - - private Builder() {} - - /** - * @param parameters Contains the parameters that will be used for customizing the message for - * each recipient. - * @return current builder - */ - public Builder setParameters(Parameters parameters) { - this.parameters = OptionalValue.of(parameters); - return this; - } - - /** - * @param strictValidation Whether or not you want the media included in your message to be - * checked against Sinch MMS channel best practices. If set to true, your message will be - * rejected if it doesn't conform to the listed recommendations, otherwise no validation - * will be performed - * @return current builder - */ - public Builder setStrictValidation(Boolean strictValidation) { - this.strictValidation = OptionalValue.of(strictValidation); - return this; - } - - public UpdateSmsBatchMediaRequest build() { - return new UpdateSmsBatchMediaRequest( - toAdd, - toRemove, - from, - body, - deliveryReportType, - sendAt, - expireAt, - callbackUrl, - parameters, - strictValidation); - } - - @Override - protected Builder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/requests/UpdateSmsBatchTextRequest.java b/client/src/main/com/sinch/sdk/domains/sms/models/requests/UpdateSmsBatchTextRequest.java deleted file mode 100644 index 7a63004bf..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/requests/UpdateSmsBatchTextRequest.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.sinch.sdk.domains.sms.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.sms.models.DeliveryReportType; -import com.sinch.sdk.domains.sms.models.Parameters; -import java.time.Instant; -import java.util.Collection; - -public class UpdateSmsBatchTextRequest extends UpdateBaseBatchRequest { - private final OptionalValue parameters; - - public UpdateSmsBatchTextRequest( - OptionalValue> toAdd, - OptionalValue> toRemove, - OptionalValue from, - OptionalValue body, - OptionalValue deliveryReport, - OptionalValue sendAt, - OptionalValue expireAt, - OptionalValue callbackUrl, - OptionalValue parameters) { - super(toAdd, toRemove, from, body, deliveryReport, sendAt, expireAt, callbackUrl); - this.parameters = parameters; - } - - public OptionalValue getParameters() { - return parameters; - } - - @Override - public String toString() { - return "UpdateSmsBatchTextRequest{" + "parameters=" + parameters + "} " + super.toString(); - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder extends UpdateBaseBatchRequest.Builder { - private OptionalValue parameters = OptionalValue.empty(); - - private Builder() {} - - /** - * @param parameters Contains the parameters that will be used for customizing the message for - * each recipient. - * @return current builder - */ - public Builder setParameters(Parameters parameters) { - this.parameters = OptionalValue.of(parameters); - return this; - } - - public UpdateSmsBatchTextRequest build() { - return new UpdateSmsBatchTextRequest( - toAdd, - toRemove, - from, - body, - deliveryReportType, - sendAt, - expireAt, - callbackUrl, - parameters); - } - - @Override - protected Builder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/requests/package-info.java b/client/src/main/com/sinch/sdk/domains/sms/models/requests/package-info.java deleted file mode 100644 index 853a20313..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/requests/package-info.java +++ /dev/null @@ -1,6 +0,0 @@ -/** - * SMS API requests related models - * - * @since 1.0 - */ -package com.sinch.sdk.domains.sms.models.requests; diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/responses/BatchesListResponse.java b/client/src/main/com/sinch/sdk/domains/sms/models/responses/BatchesListResponse.java deleted file mode 100644 index b8da8575f..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/responses/BatchesListResponse.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.sinch.sdk.domains.sms.models.responses; - -import com.sinch.sdk.core.models.pagination.ListResponse; -import com.sinch.sdk.core.models.pagination.Page; -import com.sinch.sdk.domains.sms.BatchesService; -import com.sinch.sdk.domains.sms.models.Batch; -import com.sinch.sdk.domains.sms.models.requests.BatchesListRequestParameters; -import java.util.Collection; -import java.util.NoSuchElementException; - -/** - * Lists batches response - * - * @since 1.0 - */ -public class BatchesListResponse extends ListResponse> { - - private final Page, Integer> page; - private final BatchesService service; - private BatchesListResponse nextPage; - - public BatchesListResponse( - BatchesService service, Page, Integer> page) { - this.service = service; - this.page = page; - } - - public boolean hasNextPage() { - - if (null == nextPage) { - BatchesListRequestParameters.Builder newParameters = - BatchesListRequestParameters.builder(page.getParameters()); - newParameters.setPage(page.getNextPageToken()); - nextPage = service.list(newParameters.build()); - } - return (null != nextPage.getContent() && !nextPage.getContent().isEmpty()); - } - - public BatchesListResponse nextPage() { - - if (!hasNextPage()) { - throw new NoSuchElementException("Reached the last page of the API response"); - } - - BatchesListResponse response = nextPage; - nextPage = null; - return response; - } - - public Collection> getContent() { - return page.getEntities(); - } - - @Override - public String toString() { - return "BatchesListResponse{" + "page=" + page + '}'; - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/responses/DeliveryReportsListResponse.java b/client/src/main/com/sinch/sdk/domains/sms/models/responses/DeliveryReportsListResponse.java deleted file mode 100644 index a726156ab..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/responses/DeliveryReportsListResponse.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.sinch.sdk.domains.sms.models.responses; - -import com.sinch.sdk.core.models.pagination.ListResponse; -import com.sinch.sdk.core.models.pagination.Page; -import com.sinch.sdk.domains.sms.DeliveryReportsService; -import com.sinch.sdk.domains.sms.models.DeliveryReportRecipient; -import com.sinch.sdk.domains.sms.models.requests.DeliveryReportListRequestParameters; -import java.util.Collection; -import java.util.NoSuchElementException; - -/** - * Lists batches response - * - * @since 1.0 - */ -public class DeliveryReportsListResponse extends ListResponse { - - private final Page page; - private final DeliveryReportsService service; - private DeliveryReportsListResponse nextPage; - - public DeliveryReportsListResponse( - DeliveryReportsService service, - Page page) { - this.service = service; - this.page = page; - } - - public boolean hasNextPage() { - - if (null == nextPage) { - DeliveryReportListRequestParameters.Builder newParameters = - DeliveryReportListRequestParameters.builder(page.getParameters()); - newParameters.setPage(page.getNextPageToken()); - nextPage = service.list(newParameters.build()); - } - return (null != nextPage.getContent() && !nextPage.getContent().isEmpty()); - } - - public DeliveryReportsListResponse nextPage() { - if (!hasNextPage()) { - throw new NoSuchElementException("Reached the last page of the API response"); - } - DeliveryReportsListResponse response = nextPage; - nextPage = null; - return response; - } - - public Collection getContent() { - return page.getEntities(); - } - - @Override - public String toString() { - return "DeliveryReportsListResponse{" + "page=" + page + '}'; - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/responses/GroupsListResponse.java b/client/src/main/com/sinch/sdk/domains/sms/models/responses/GroupsListResponse.java deleted file mode 100644 index c01217576..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/responses/GroupsListResponse.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.sinch.sdk.domains.sms.models.responses; - -import com.sinch.sdk.core.models.pagination.ListResponse; -import com.sinch.sdk.core.models.pagination.Page; -import com.sinch.sdk.domains.sms.GroupsService; -import com.sinch.sdk.domains.sms.models.Group; -import com.sinch.sdk.domains.sms.models.requests.GroupsListRequestParameters; -import java.util.Collection; -import java.util.NoSuchElementException; - -/** - * Groups List response - * - * @since 1.0 - */ -public class GroupsListResponse extends ListResponse { - - private final Page page; - private final GroupsService service; - private GroupsListResponse nextPage; - - public GroupsListResponse( - GroupsService service, Page page) { - this.service = service; - this.page = page; - } - - public boolean hasNextPage() { - - if (null == nextPage) { - GroupsListRequestParameters.Builder newParameters = - GroupsListRequestParameters.builder(page.getParameters()); - newParameters.setPage(page.getNextPageToken()); - nextPage = service.list(newParameters.build()); - } - return (null != nextPage.getContent() && !nextPage.getContent().isEmpty()); - } - - public GroupsListResponse nextPage() { - if (!hasNextPage()) { - throw new NoSuchElementException("Reached the last page of the API response"); - } - GroupsListResponse response = nextPage; - nextPage = null; - return response; - } - - public Collection getContent() { - return page.getEntities(); - } - - @Override - public String toString() { - return "GroupsListResponse{" + "page=" + page + '}'; - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/responses/InboundsListResponse.java b/client/src/main/com/sinch/sdk/domains/sms/models/responses/InboundsListResponse.java deleted file mode 100644 index e582fe54d..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/responses/InboundsListResponse.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.sinch.sdk.domains.sms.models.responses; - -import com.sinch.sdk.core.models.pagination.ListResponse; -import com.sinch.sdk.core.models.pagination.Page; -import com.sinch.sdk.domains.sms.InboundsService; -import com.sinch.sdk.domains.sms.models.Inbound; -import com.sinch.sdk.domains.sms.models.requests.InboundsListRequestParameters; -import java.util.Collection; -import java.util.NoSuchElementException; - -/** - * List Incoming Messages response - * - * @since 1.0 - */ -public class InboundsListResponse extends ListResponse> { - - private final Page, Integer> page; - private final InboundsService service; - private InboundsListResponse nextPage; - - public InboundsListResponse( - InboundsService service, Page, Integer> page) { - this.service = service; - this.page = page; - } - - public boolean hasNextPage() { - if (null == nextPage) { - InboundsListRequestParameters.Builder newParameters = - InboundsListRequestParameters.builder(page.getParameters()); - newParameters.setPage(page.getNextPageToken()); - nextPage = service.list(newParameters.build()); - } - return (null != nextPage.getContent() && !nextPage.getContent().isEmpty()); - } - - public InboundsListResponse nextPage() { - if (!hasNextPage()) { - throw new NoSuchElementException("Reached the last page of the API response"); - } - InboundsListResponse response = nextPage; - nextPage = null; - return response; - } - - public Collection> getContent() { - return page.getEntities(); - } - - @Override - public String toString() { - return "InboundsListResponse{" + "page=" + page + '}'; - } -} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/responses/package-info.java b/client/src/main/com/sinch/sdk/domains/sms/models/responses/package-info.java deleted file mode 100644 index d1d64f4d4..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/responses/package-info.java +++ /dev/null @@ -1,6 +0,0 @@ -/** - * SMS API responses related models - * - * @since 1.0 - */ -package com.sinch.sdk.domains.sms.models.responses; diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/webhooks/WebhooksEvent.java b/client/src/main/com/sinch/sdk/domains/sms/models/webhooks/WebhooksEvent.java deleted file mode 100644 index 0c0630124..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/webhooks/WebhooksEvent.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.sinch.sdk.domains.sms.models.webhooks; - -/** Interface defining a WebHook event */ -public interface WebhooksEvent {} diff --git a/client/src/main/com/sinch/sdk/domains/sms/models/webhooks/package-info.java b/client/src/main/com/sinch/sdk/domains/sms/models/webhooks/package-info.java deleted file mode 100644 index 225045d4b..000000000 --- a/client/src/main/com/sinch/sdk/domains/sms/models/webhooks/package-info.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * SMS API webhooks related models - * - *

Incoming SMS WebHook

- * - *

An inbound message is a message sent to one of your short codes or long numbers from a mobile - * phone. To receive inbound message callbacks, a URL needs to be added to your REST API. - * - *

This URL can be specified in your Dashboard. - * - *

See https://developers.sinch.com/docs/sms/api-reference/sms/tag/Webhooks/#tag/Webhooks/operation/incomingSMS - * - *

Delivery Report WebHook

- * - *

A delivery report contains the status and status code for each recipient of a batch. To get a - * delivery report callback for a message or batch of messages, set the delivery_report - * field accordingly when creating a batch. - * - *

The following is provided so you can better understand our webhooks/callbacks. Configuration - * of both webhooks and the type of delivery report requested happens when sending a batch. - * - *

Callback URL - * - *

The callback URL can either be provided for each batch or provisioned globally for your - * account in your Sinch Customer Dashboard. - * Learn how to configure a webhook/callback here - * - *

Type - * - *

The type is the type of delivery report webhook. The response will vary depending - * on the webhook delivery report you selected when the batch was sent, so choose the appropriate - * selection under "One of". - * - *

    - *
  • The delivery_report_sms and delivery_report_mms types are - * documented under Delivery report. - *

    These are reports containing either - * a full report or summary report, depending on your selection at the time the batch was - * sent. - *

  • The recipient_delivery_report_sms and recipient_delivery_report_mms - * delivery report types are documented under Recipient delivery report. - *

    These are delivery reports for recipient phone numbers. If you set per_recipient - * for the delivery_report parameter when sending the batch, a recipient - * report gets sent to you for each status change for each recipient in your batch. If you set - * per_recipient_final, a recipient report gets sent to you for the final status - * of each recipient in your batch. - *

- * - * See https://developers.sinch.com/docs/sms/api-reference/sms/tag/Webhooks/#tag/Webhooks/operation/deliveryReport - * - * @since 1.0 - */ -package com.sinch.sdk.domains.sms.models.webhooks; diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/CallEvent.java b/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/CallEvent.java index 9f741bb7b..644f42ed9 100644 --- a/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/CallEvent.java +++ b/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/CallEvent.java @@ -1,6 +1,5 @@ package com.sinch.sdk.domains.voice.models.webhooks; -import com.sinch.sdk.domains.sms.models.DeliveryReportBatch.Builder; import java.time.Instant; /** Base class for webhooks call event */ diff --git a/client/src/test/java/com/sinch/sdk/domains/sms/adapters/BatchesServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/sms/adapters/BatchesServiceTest.java deleted file mode 100644 index e2b2b1ad2..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/sms/adapters/BatchesServiceTest.java +++ /dev/null @@ -1,541 +0,0 @@ -package com.sinch.sdk.domains.sms.adapters; - -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import com.adelean.inject.resources.junit.jupiter.GivenJsonResource; -import com.adelean.inject.resources.junit.jupiter.TestWithResources; -import com.sinch.sdk.BaseTest; -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.core.http.AuthManager; -import com.sinch.sdk.core.http.HttpClient; -import com.sinch.sdk.core.utils.Pair; -import com.sinch.sdk.domains.sms.adapters.api.v1.BatchesApi; -import com.sinch.sdk.domains.sms.adapters.converters.BatchDtoConverter; -import com.sinch.sdk.domains.sms.adapters.converters.DryRunDtoConverterTest; -import com.sinch.sdk.domains.sms.models.Batch; -import com.sinch.sdk.domains.sms.models.BatchBinary; -import com.sinch.sdk.domains.sms.models.BatchMedia; -import com.sinch.sdk.domains.sms.models.BatchText; -import com.sinch.sdk.domains.sms.models.DeliveryReportType; -import com.sinch.sdk.domains.sms.models.DryRun; -import com.sinch.sdk.domains.sms.models.MediaBody; -import com.sinch.sdk.domains.sms.models.Parameters; -import com.sinch.sdk.domains.sms.models.dto.v1.ApiBatchListDto; -import com.sinch.sdk.domains.sms.models.dto.v1.ApiDeliveryFeedbackDto; -import com.sinch.sdk.domains.sms.models.dto.v1.DryRun200ResponseDto; -import com.sinch.sdk.domains.sms.models.dto.v1.SendSMS201ResponseDto; -import com.sinch.sdk.domains.sms.models.requests.SendSmsBatchBinaryRequest; -import com.sinch.sdk.domains.sms.models.requests.SendSmsBatchMediaRequest; -import com.sinch.sdk.domains.sms.models.requests.SendSmsBatchTextRequest; -import com.sinch.sdk.domains.sms.models.requests.UpdateSmsBatchBinaryRequest; -import com.sinch.sdk.domains.sms.models.requests.UpdateSmsBatchMediaRequest; -import com.sinch.sdk.domains.sms.models.requests.UpdateSmsBatchTextRequest; -import com.sinch.sdk.domains.sms.models.responses.BatchesListResponse; -import com.sinch.sdk.models.SmsContext; -import java.time.Instant; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.Mock; - -@TestWithResources -public class BatchesServiceTest extends BaseTest { - - static final String id = "01FC66621XXXXX119Z8PMV1QPQ"; - static final Collection to = Arrays.asList("+15551231234", "+15551256344"); - static final String from = "+15551231234"; - static final boolean canceled = false; - static final Instant createdAt = Instant.parse("2019-08-24T14:15:22Z"); - static final Instant modifiedAt = Instant.parse("2019-08-24T14:17:22Z"); - static final DeliveryReportType deliveryReport = DeliveryReportType.NONE; - static final Instant sendAt = Instant.parse("2019-08-24T14:19:22Z"); - static final Instant expireAt = Instant.parse("2019-08-24T14:21:22Z"); - static final String callbackUrl = "callback url"; - static final String clientReference = "myReference"; - static final boolean flashMessage = true; - static final boolean feedbackEnabled = false; - static final boolean truncateConcat = true; - static final int maxNumberOfMessageParts = 1; - static final int fromTon = 6; - static final int fromNpi = 18; - static final String udh = "foo udh"; - static final String body = "Hi ${name} ({an identifier}) ! How are you?"; - public static final BatchBinary batchBinary = - BatchBinary.builder() - .setId(id) - .setTo(to) - .setFrom(from) - .setCanceled(canceled) - .setBody(body) - .setCreatedAt(createdAt) - .setModifiedAt(modifiedAt) - .setDeliveryReport(deliveryReport) - .setSendAt(sendAt) - .setExpireAt(expireAt) - .setCallbackUrl(callbackUrl) - .setClientReference(clientReference) - .setFlashMessage(flashMessage) - .setFeedbackEnabled(feedbackEnabled) - .setTruncateConcat(truncateConcat) - .setMaxNumberOfMessageParts(maxNumberOfMessageParts) - .setFromTon(fromTon) - .setFromNpi(fromNpi) - .setUdh(udh) - .build(); - static final Parameters parameters = - new Parameters( - Arrays.asList( - new Parameters.Entry( - "name", new Pair<>("15551231234", "name value for 15551231234"), "default value"), - new Parameters.Entry("name", new Pair<>("15551256344", "name value for 15551256344")), - new Parameters.Entry( - "an identifier", - new Pair<>("15551231234", "an identifier value for 15551231234")), - new Parameters.Entry( - "an identifier", - new Pair<>("15551256344", "an identifier value for 15551256344")))); - - public static final BatchMedia batchMedia = - BatchMedia.builder() - .setId(id) - .setTo(to) - .setFrom(from) - .setCanceled(canceled) - .setBody( - new MediaBody( - "https://en.wikipedia.org/wiki/Sinch_(company)#/media/File:Sinch_LockUp_RGB.png", - "Hi ${name} ({an identifier}) ! How are you?")) - .setCreatedAt(Instant.parse("2019-08-24T14:14:22Z")) - .setModifiedAt(Instant.parse("2019-08-24T14:15:22Z")) - .setDeliveryReport(DeliveryReportType.SUMMARY) - .setSendAt(Instant.parse("2019-08-24T14:16:22Z")) - .setExpireAt(Instant.parse("2019-08-24T14:17:22Z")) - .setCallbackUrl(callbackUrl) - .setClientReference("client reference") - .setFeedbackEnabled(feedbackEnabled) - .setParameters(parameters) - .build(); - public static final BatchText batchText = - BatchText.builder() - .setId(id) - .setTo(to) - .setFrom(from) - .setCanceled(canceled) - .setBody(body) - .setCreatedAt(createdAt) - .setModifiedAt(modifiedAt) - .setDeliveryReport(deliveryReport) - .setSendAt(sendAt) - .setExpireAt(expireAt) - .setCallbackUrl(callbackUrl) - .setClientReference(clientReference) - .setFlashMessage(flashMessage) - .setFeedbackEnabled(feedbackEnabled) - .setTruncateConcat(truncateConcat) - .setMaxNumberOfMessageParts(maxNumberOfMessageParts) - .setFromTon(fromTon) - .setFromNpi(fromNpi) - .setParameters(parameters) - .build(); - - public static final SendSmsBatchBinaryRequest sendSmsBatchBinaryRequest = - SendSmsBatchBinaryRequest.builder() - .setTo(to) - .setFrom(from) - .setBody(body) - .setDeliveryReport(deliveryReport) - .setSendAt(sendAt) - .setExpireAt(expireAt) - .setCallbackUrl(callbackUrl) - .setClientReference(clientReference) - .setFlashMessage(flashMessage) - .setFeedbackEnabled(feedbackEnabled) - .setTruncateConcat(truncateConcat) - .setMaxNumberOfMessageParts(maxNumberOfMessageParts) - .setFromTon(fromTon) - .setFromNpi(fromNpi) - .setUdh(udh) - .build(); - - public static final SendSmsBatchMediaRequest sendSmsBatchMediaRequest = - SendSmsBatchMediaRequest.builder() - .setTo(to) - .setFrom(from) - .setBody( - new MediaBody( - "https://en.wikipedia.org/wiki/Sinch_(company)#/media/File:Sinch_LockUp_RGB.png", - "Hi ${name} ({an identifier}) ! How are you?")) - .setDeliveryReport(DeliveryReportType.SUMMARY) - .setSendAt(Instant.parse("2019-08-24T14:16:22Z")) - .setExpireAt(Instant.parse("2019-08-24T14:17:22Z")) - .setCallbackUrl(callbackUrl) - .setClientReference("client reference") - .setFeedbackEnabled(feedbackEnabled) - .setStrictValidation(true) - .setParameters(parameters) - .build(); - public static final SendSmsBatchTextRequest sendSmsBatchTextRequest = - SendSmsBatchTextRequest.builder() - .setTo(to) - .setFrom(from) - .setBody(body) - .setDeliveryReport(deliveryReport) - .setSendAt(sendAt) - .setExpireAt(expireAt) - .setCallbackUrl(callbackUrl) - .setClientReference(clientReference) - .setFlashMessage(flashMessage) - .setFeedbackEnabled(feedbackEnabled) - .setTruncateConcat(truncateConcat) - .setMaxNumberOfMessageParts(maxNumberOfMessageParts) - .setFromTon(fromTon) - .setFromNpi(fromNpi) - .setParameters(parameters) - .build(); - - public static final UpdateSmsBatchTextRequest updateSmsBatchTextRequest = - UpdateSmsBatchTextRequest.builder() - .setToAdd(to) - .setFrom(from) - .setBody(body) - .setDeliveryReport(deliveryReport) - .setSendAt(sendAt) - .setExpireAt(expireAt) - .setCallbackUrl(callbackUrl) - .setParameters(parameters) - .build(); - - public static final UpdateSmsBatchMediaRequest updateSmsBatchMediaRequest = - UpdateSmsBatchMediaRequest.builder() - .setToRemove(to) - .setFrom(from) - .setBody( - new MediaBody( - "https://en.wikipedia.org/wiki/Sinch_(company)#/media/File:Sinch_LockUp_RGB.png", - body)) - .setDeliveryReport(DeliveryReportType.SUMMARY) - .setSendAt(Instant.parse("2019-08-24T14:16:22Z")) - .setExpireAt(Instant.parse("2019-08-24T14:17:22Z")) - .setCallbackUrl(callbackUrl) - .setStrictValidation(true) - .setParameters(parameters) - .build(); - - public static final UpdateSmsBatchBinaryRequest updateSmsBatchBinaryRequest = - UpdateSmsBatchBinaryRequest.builder() - .setToAdd(Arrays.asList("+15551231234", "+15987365412")) - .setToRemove(Arrays.asList("+0123456789", "+9876543210")) - .setFrom(from) - .setBody(body) - .setDeliveryReport(DeliveryReportType.FULL) - .setSendAt(sendAt) - .setExpireAt(expireAt) - .setCallbackUrl(callbackUrl) - .setUdh(udh) - .build(); - - @GivenJsonResource("/domains/sms/v1/batches/response/BinaryResponseDto.json") - public SendSMS201ResponseDto binaryResponseDto; - - @GivenJsonResource("/domains/sms/v1/batches/response/MediaResponseDto.json") - SendSMS201ResponseDto mediaResponseDto; - - @GivenJsonResource("/domains/sms/v1/batches/response/TextResponseDto.json") - SendSMS201ResponseDto textResponseDto; - - @GivenJsonResource("/domains/sms/v1/batches/response/DryRunResponseDto.json") - DryRun200ResponseDto dryRunResponseDto; - - @GivenJsonResource("/domains/sms/v1/batches/response/ListBatchesResponseDtoPage0.json") - ApiBatchListDto listBatchesResponseDtoPage0; - - @GivenJsonResource("/domains/sms/v1/batches/response/ListBatchesResponseDtoPage1.json") - ApiBatchListDto listBatchesResponseDtoPage1; - - @GivenJsonResource("/domains/sms/v1/batches/response/ListBatchesResponseDtoPage2.json") - ApiBatchListDto listBatchesResponseDtoPage2; - - @Mock SmsContext context; - @Mock HttpClient httpClient; - @Mock Map authManagers; - @Mock BatchesApi api; - BatchesService service; - String uriPartID = "foovalue"; - - @Captor ArgumentCaptor recipientsCaptor; - - @BeforeEach - public void initMocks() { - service = spy(new BatchesService(uriPartID, context, httpClient, authManagers)); - doReturn(api).when(service).getApi(); - } - - @Test - void getBinary() throws ApiException { - - when(api.getBatchMessage(eq(uriPartID), eq("foo binary batch id"))) - .thenReturn(binaryResponseDto); - - Batch response = service.get("foo binary batch id"); - - Assertions.assertThat(response).usingRecursiveComparison().isEqualTo(batchBinary); - } - - @Test - void getMedia() throws ApiException { - - when(api.getBatchMessage(eq(uriPartID), eq("foo media batch id"))).thenReturn(mediaResponseDto); - - Batch response = service.get("foo media batch id"); - - Assertions.assertThat(response).usingRecursiveComparison().isEqualTo(batchMedia); - } - - @Test - void getText() throws ApiException { - - when(api.getBatchMessage(eq(uriPartID), eq("foo text batch id"))).thenReturn(textResponseDto); - - Batch response = service.get("foo text batch id"); - - Assertions.assertThat(response).usingRecursiveComparison().isEqualTo(batchText); - } - - @Test - void sendBinary() throws ApiException { - - when(api.sendSMS(eq(uriPartID), eq(BatchDtoConverter.convert(sendSmsBatchBinaryRequest)))) - .thenReturn(binaryResponseDto); - - Batch response = service.send(sendSmsBatchBinaryRequest); - - Assertions.assertThat(response).usingRecursiveComparison().isEqualTo(batchBinary); - } - - @Test - void sendMedia() throws ApiException { - - when(api.sendSMS(eq(uriPartID), eq(BatchDtoConverter.convert(sendSmsBatchMediaRequest)))) - .thenReturn(mediaResponseDto); - - Batch response = service.send(sendSmsBatchMediaRequest); - - Assertions.assertThat(response).usingRecursiveComparison().isEqualTo(batchMedia); - } - - @Test - void sendText() throws ApiException { - - when(api.sendSMS(eq(uriPartID), eq(BatchDtoConverter.convert(sendSmsBatchTextRequest)))) - .thenReturn(textResponseDto); - - Batch response = service.send(sendSmsBatchTextRequest); - - Assertions.assertThat(response).usingRecursiveComparison().isEqualTo(batchText); - } - - @Test - void dryRun() throws ApiException { - - when(api.dryRun( - eq(uriPartID), - eq(true), - eq(456), - eq(BatchDtoConverter.convert(sendSmsBatchTextRequest)))) - .thenReturn(dryRunResponseDto); - - DryRun response = service.dryRun(true, 456, sendSmsBatchTextRequest); - - Assertions.assertThat(response) - .usingRecursiveComparison() - .isEqualTo(DryRunDtoConverterTest.dryRunClient); - } - - @Test - void list() throws ApiException { - - when(api.listBatches(eq(uriPartID), eq(null), eq(null), eq(null), eq(null), eq(null), eq(null))) - .thenReturn(listBatchesResponseDtoPage0); - when(api.listBatches(eq(uriPartID), eq(1), eq(null), eq(null), eq(null), eq(null), eq(null))) - .thenReturn(listBatchesResponseDtoPage1); - when(api.listBatches(eq(uriPartID), eq(2), eq(null), eq(null), eq(null), eq(null), eq(null))) - .thenReturn(listBatchesResponseDtoPage2); - BatchesListResponse response = service.list(null); - - Iterator> iterator = response.iterator(); - Batch batch = iterator.next(); - Assertions.assertThat(iterator.hasNext()).isEqualTo(true); - Assertions.assertThat(batch) - .usingRecursiveComparison() - .isEqualTo( - BatchBinary.builder() - .setId("01HEAWCHESCXG8SDG5R10VF8E1") - .setTo(Collections.singletonList("339876543213")) - .setFrom("33123456789") - .setCanceled(false) - .setBody("the body") - .setCreatedAt(Instant.parse("2023-11-03T15:21:21.113Z")) - .setModifiedAt(Instant.parse("2023-11-03T15:21:21.568Z")) - .setDeliveryReport(DeliveryReportType.NONE) - .setExpireAt(Instant.parse("2023-11-06T15:21:21.973Z")) - .setClientReference("a client reference") - .setFeedbackEnabled(false) - .setFlashMessage(false) - .build()); - - batch = iterator.next(); - Assertions.assertThat(iterator.hasNext()).isEqualTo(true); - Assertions.assertThat(batch) - .usingRecursiveComparison() - .isEqualTo( - BatchText.builder() - .setId("01HEAC0AG69SVYYQ675VPYT28Q") - .setTo(Collections.singletonList("3300000000")) - .setCanceled(false) - .setBody("the body") - .setCreatedAt(Instant.parse("2023-11-03T10:35:03.558Z")) - .setModifiedAt(Instant.parse("2023-11-03T10:35:03.666Z")) - .setDeliveryReport(DeliveryReportType.NONE) - .setExpireAt(Instant.parse("2023-11-03T10:35:03.558Z")) - .setFeedbackEnabled(true) - .setFlashMessage(false) - .build()); - - batch = iterator.next(); - Assertions.assertThat(iterator.hasNext()).isEqualTo(false); - Assertions.assertThat(batch) - .usingRecursiveComparison() - .isEqualTo( - BatchMedia.builder() - .setId("01HEABZ9S80D4ENE3X6CPMATZR") - .setTo(Collections.singletonList("331111111")) - .setCanceled(false) - .setBody(MediaBody.builder().setUrl("an URL").build()) - .setCreatedAt(Instant.parse("2023-11-03T10:34:30.056Z")) - .setModifiedAt(Instant.parse("2023-11-03T10:34:30.156Z")) - .setDeliveryReport(DeliveryReportType.SUMMARY) - .setExpireAt(Instant.parse("2023-11-06T10:34:30.256Z")) - .setFeedbackEnabled(false) - .build()); - } - - @Test - void updateText() throws ApiException { - - when(api.updateBatchMessage( - eq(uriPartID), - eq("foo text batch id"), - eq(BatchDtoConverter.convert(updateSmsBatchTextRequest)))) - .thenReturn(textResponseDto); - - Batch response = service.update("foo text batch id", updateSmsBatchTextRequest); - - Assertions.assertThat(response).usingRecursiveComparison().isEqualTo(batchText); - } - - @Test - void updateMedia() throws ApiException { - - when(api.updateBatchMessage( - eq(uriPartID), - eq("foo text batch id"), - eq(BatchDtoConverter.convert(updateSmsBatchMediaRequest)))) - .thenReturn(mediaResponseDto); - - Batch response = service.update("foo text batch id", updateSmsBatchMediaRequest); - - Assertions.assertThat(response).usingRecursiveComparison().isEqualTo(batchMedia); - } - - @Test - void updateBinary() throws ApiException { - - when(api.updateBatchMessage( - eq(uriPartID), - eq("foo text batch id"), - eq(BatchDtoConverter.convert(updateSmsBatchBinaryRequest)))) - .thenReturn(binaryResponseDto); - - Batch response = service.update("foo text batch id", updateSmsBatchBinaryRequest); - - Assertions.assertThat(response).usingRecursiveComparison().isEqualTo(batchBinary); - } - - @Test - void replaceBinary() throws ApiException { - - when(api.replaceBatch( - eq(uriPartID), - eq("foo text batch id"), - eq(BatchDtoConverter.convert(sendSmsBatchBinaryRequest)))) - .thenReturn(binaryResponseDto); - - Batch response = service.replace("foo text batch id", sendSmsBatchBinaryRequest); - - Assertions.assertThat(response).usingRecursiveComparison().isEqualTo(batchBinary); - } - - @Test - void replaceMedia() throws ApiException { - - when(api.replaceBatch( - eq(uriPartID), - eq("foo text batch id"), - eq(BatchDtoConverter.convert(sendSmsBatchMediaRequest)))) - .thenReturn(mediaResponseDto); - - Batch response = service.replace("foo text batch id", sendSmsBatchMediaRequest); - - Assertions.assertThat(response).usingRecursiveComparison().isEqualTo(batchMedia); - } - - @Test - void replaceText() throws ApiException { - - when(api.replaceBatch( - eq(uriPartID), - eq("foo text batch id"), - eq(BatchDtoConverter.convert(sendSmsBatchTextRequest)))) - .thenReturn(textResponseDto); - - Batch response = service.replace("foo text batch id", sendSmsBatchTextRequest); - - Assertions.assertThat(response).usingRecursiveComparison().isEqualTo(batchText); - } - - @Test - void cancelBatch() throws ApiException { - - when(api.cancelBatchMessage(eq(uriPartID), eq("foo text batch id"))) - .thenReturn(textResponseDto); - - Batch response = service.cancel("foo text batch id"); - - Assertions.assertThat(response).usingRecursiveComparison().isEqualTo(batchText); - } - - @Test - void sendDeliveryFeedback() throws ApiException { - List recipients = Arrays.asList("foo", "foo2"); - - service.sendDeliveryFeedback("foo text batch id", recipients); - - verify(api) - .deliveryFeedback(eq(uriPartID), eq("foo text batch id"), recipientsCaptor.capture()); - - ApiDeliveryFeedbackDto dto = recipientsCaptor.getValue(); - Assertions.assertThat(dto.getRecipients()).usingRecursiveComparison().isEqualTo(recipients); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/sms/adapters/DeliveryReportsServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/sms/adapters/DeliveryReportsServiceTest.java deleted file mode 100644 index b82028ca0..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/sms/adapters/DeliveryReportsServiceTest.java +++ /dev/null @@ -1,245 +0,0 @@ -package com.sinch.sdk.domains.sms.adapters; - -import static org.junit.jupiter.api.Assertions.assertInstanceOf; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - -import com.adelean.inject.resources.junit.jupiter.GivenJsonResource; -import com.adelean.inject.resources.junit.jupiter.TestWithResources; -import com.sinch.sdk.BaseTest; -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.core.http.AuthManager; -import com.sinch.sdk.core.http.HttpClient; -import com.sinch.sdk.domains.sms.adapters.api.v1.DeliveryReportsApi; -import com.sinch.sdk.domains.sms.adapters.converters.DeliveryReportDtoConverter; -import com.sinch.sdk.domains.sms.models.DeliveryReportBatch; -import com.sinch.sdk.domains.sms.models.DeliveryReportBatchMMS; -import com.sinch.sdk.domains.sms.models.DeliveryReportBatchSMS; -import com.sinch.sdk.domains.sms.models.DeliveryReportErrorCode; -import com.sinch.sdk.domains.sms.models.DeliveryReportRecipient; -import com.sinch.sdk.domains.sms.models.DeliveryReportRecipientEncoding; -import com.sinch.sdk.domains.sms.models.DeliveryReportRecipientMMS; -import com.sinch.sdk.domains.sms.models.DeliveryReportRecipientSMS; -import com.sinch.sdk.domains.sms.models.DeliveryReportStatus; -import com.sinch.sdk.domains.sms.models.DeliveryReportType; -import com.sinch.sdk.domains.sms.models.dto.v1.DeliveryReportDto; -import com.sinch.sdk.domains.sms.models.dto.v1.DeliveryReportListDto; -import com.sinch.sdk.domains.sms.models.dto.v1.RecipientDeliveryReportDto; -import com.sinch.sdk.domains.sms.models.requests.DeliveryReportBatchGetRequestParameters; -import com.sinch.sdk.domains.sms.models.responses.DeliveryReportsListResponse; -import com.sinch.sdk.models.SmsContext; -import java.time.Instant; -import java.util.Arrays; -import java.util.Iterator; -import java.util.Map; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.mockito.Mock; - -@TestWithResources -class DeliveryReportsServiceTest extends BaseTest { - - @Mock SmsContext context; - @Mock HttpClient httpClient; - @Mock Map authManagers; - - @Mock DeliveryReportsApi api; - DeliveryReportsService service; - String uriPartID = "foovalue"; - - @GivenJsonResource("/domains/sms/v1/deliveryreports/BatchDeliveryReportSMSDto.json") - DeliveryReportDto deliveryReportBatchSMSDto; - - @GivenJsonResource("/domains/sms/v1/deliveryreports/BatchDeliveryReportMMSDto.json") - DeliveryReportDto deliveryReportBatchMMSDto; - - @GivenJsonResource("/domains/sms/v1/deliveryreports/RecipientDeliveryReportSMSDto.json") - RecipientDeliveryReportDto deliveryReportRecipientSMSDto; - - @GivenJsonResource("/domains/sms/v1/deliveryreports/RecipientDeliveryReportMMSDto.json") - RecipientDeliveryReportDto deliveryReportRecipientMMSDto; - - @GivenJsonResource( - "/domains/sms/v1/deliveryreports/response/ListDeliveryReportResponseDtoPage0.json") - DeliveryReportListDto listDeliveryReportResponseDtoPage0; - - @GivenJsonResource( - "/domains/sms/v1/deliveryreports/response/ListDeliveryReportResponseDtoPage1.json") - DeliveryReportListDto listDeliveryReportResponseDtoPage1; - - @GivenJsonResource( - "/domains/sms/v1/deliveryreports/response/ListDeliveryReportResponseDtoPage2.json") - DeliveryReportListDto listDeliveryReportResponseDtoPage2; - - @BeforeEach - public void initMocks() { - service = spy(new DeliveryReportsService(uriPartID, context, httpClient, authManagers)); - doReturn(api).when(service).getApi(); - } - - @Test - void getDeliveryReportBatchSMS() throws ApiException { - - when(api.getDeliveryReportByBatchId( - eq(uriPartID), - eq("foo binary batch id"), - eq("foo type"), - eq("foo status1,Cancelled"), - eq("456,789"))) - .thenReturn(deliveryReportBatchSMSDto); - - DeliveryReportBatch response = - service.get( - "foo binary batch id", - DeliveryReportBatchGetRequestParameters.builder() - .setType(DeliveryReportType.from("foo type")) - .setStatuses( - Arrays.asList( - DeliveryReportStatus.from("foo status1"), DeliveryReportStatus.CANCELLED)) - .setCodes(Arrays.asList(456, 789)) - .build()); - - assertInstanceOf(DeliveryReportBatchSMS.class, response); - Assertions.assertThat(response) - .usingRecursiveComparison() - .isEqualTo(DeliveryReportDtoConverter.convert(deliveryReportBatchSMSDto)); - } - - @Test - void getDeliveryReportBatchMMS() throws ApiException { - - when(api.getDeliveryReportByBatchId( - eq(uriPartID), - eq("foo binary batch id"), - eq("foo type"), - eq("foo status1,Cancelled"), - eq("456,789"))) - .thenReturn(deliveryReportBatchMMSDto); - - DeliveryReportBatch response = - service.get( - "foo binary batch id", - DeliveryReportBatchGetRequestParameters.builder() - .setType(DeliveryReportType.from("foo type")) - .setStatuses( - Arrays.asList( - DeliveryReportStatus.from("foo status1"), DeliveryReportStatus.CANCELLED)) - .setCodes(Arrays.asList(456, 789)) - .build()); - - assertInstanceOf(DeliveryReportBatchMMS.class, response); - Assertions.assertThat(response) - .usingRecursiveComparison() - .isEqualTo(DeliveryReportDtoConverter.convert(deliveryReportBatchMMSDto)); - } - - @Test - void getDeliveryReportRecipientSMS() throws ApiException { - - when(api.getDeliveryReportByPhoneNumber( - eq(uriPartID), eq("foo binary batch id"), eq("foo number"))) - .thenReturn(deliveryReportRecipientSMSDto); - - DeliveryReportRecipient response = service.getForNumber("foo binary batch id", "foo number"); - - assertInstanceOf(DeliveryReportRecipientSMS.class, response); - Assertions.assertThat(response) - .usingRecursiveComparison() - .isEqualTo(DeliveryReportDtoConverter.convert(deliveryReportRecipientSMSDto)); - } - - @Test - void getDeliveryReportRecipientMMS() throws ApiException { - - when(api.getDeliveryReportByPhoneNumber( - eq(uriPartID), eq("foo binary batch id"), eq("foo number"))) - .thenReturn(deliveryReportRecipientMMSDto); - - DeliveryReportRecipient response = service.getForNumber("foo binary batch id", "foo number"); - - assertInstanceOf(DeliveryReportRecipientMMS.class, response); - Assertions.assertThat(response) - .usingRecursiveComparison() - .isEqualTo(DeliveryReportDtoConverter.convert(deliveryReportRecipientMMSDto)); - } - - @Test - void list() throws ApiException { - - when(api.getDeliveryReports( - eq(uriPartID), eq(null), eq(null), eq(null), eq(null), eq(null), eq(null), eq(null))) - .thenReturn(listDeliveryReportResponseDtoPage0); - when(api.getDeliveryReports( - eq(uriPartID), eq(1), eq(null), eq(null), eq(null), eq(null), eq(null), eq(null))) - .thenReturn(listDeliveryReportResponseDtoPage1); - when(api.getDeliveryReports( - eq(uriPartID), eq(2), eq(null), eq(null), eq(null), eq(null), eq(null), eq(null))) - .thenReturn(listDeliveryReportResponseDtoPage2); - DeliveryReportsListResponse response = service.list(null); - - Iterator iterator = response.iterator(); - DeliveryReportRecipient item = iterator.next(); - Assertions.assertThat(iterator.hasNext()).isEqualTo(true); - - assertInstanceOf(DeliveryReportRecipientSMS.class, item); - Assertions.assertThat(item) - .usingRecursiveComparison() - .isEqualTo( - DeliveryReportRecipientSMS.builder() - .setBatchId("01FC66621XXXXX119Z8PMV1QPQ") - .setRecipient("+44231235674") - .setCode(DeliveryReportErrorCode.from(401)) - .setStatus(DeliveryReportStatus.DISPATCHED) - .setAt(Instant.parse("2022-08-30T08:16:08.930Z")) - .setOperator("operator") - .setAppliedOriginator("applied originator") - .setClientReference("client reference") - .setEncoding(DeliveryReportRecipientEncoding.from("encoding")) - .setNumberOfMessageParts(123) - .setOperatorStatusAt(Instant.parse("2022-08-30T08:16:08.150Z")) - .build()); - - item = iterator.next(); - Assertions.assertThat(iterator.hasNext()).isEqualTo(true); - assertInstanceOf(DeliveryReportRecipientMMS.class, item); - Assertions.assertThat(item) - .usingRecursiveComparison() - .isEqualTo( - DeliveryReportRecipientMMS.builder() - .setBatchId("01FC66621XXXXX119Z8PMV1QPQ") - .setRecipient("+44231235674") - .setCode(DeliveryReportErrorCode.DISPATCHED) - .setStatus(DeliveryReportStatus.DISPATCHED) - .setAt(Instant.parse("2022-08-30T08:16:08.930Z")) - .setOperator("operator") - .setAppliedOriginator("applied originator") - .setClientReference("client reference") - .setEncoding(DeliveryReportRecipientEncoding.from("encoding")) - .setNumberOfMessageParts(123) - .setOperatorStatusAt(Instant.parse("2022-08-30T08:16:08.150Z")) - .build()); - - item = iterator.next(); - Assertions.assertThat(iterator.hasNext()).isEqualTo(false); - assertInstanceOf(DeliveryReportRecipientSMS.class, item); - Assertions.assertThat(item) - .usingRecursiveComparison() - .isEqualTo( - DeliveryReportRecipientSMS.builder() - .setBatchId("01FC66621XXXXX119Z8PMV1QPQ") - .setRecipient("+44231235674") - .setCode(DeliveryReportErrorCode.from(401)) - .setStatus(DeliveryReportStatus.DISPATCHED) - .setAt(Instant.parse("2022-08-30T08:16:08.930Z")) - .setOperator("operator") - .setAppliedOriginator("applied originator") - .setClientReference("client reference") - .setEncoding(DeliveryReportRecipientEncoding.from("encoding")) - .setNumberOfMessageParts(123) - .setOperatorStatusAt(Instant.parse("2022-08-30T08:16:08.150Z")) - .build()); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/sms/adapters/GroupsServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/sms/adapters/GroupsServiceTest.java deleted file mode 100644 index 41ed9aac2..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/sms/adapters/GroupsServiceTest.java +++ /dev/null @@ -1,229 +0,0 @@ -package com.sinch.sdk.domains.sms.adapters; - -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import com.adelean.inject.resources.junit.jupiter.GivenJsonResource; -import com.adelean.inject.resources.junit.jupiter.TestWithResources; -import com.sinch.sdk.BaseTest; -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.core.http.AuthManager; -import com.sinch.sdk.core.http.HttpClient; -import com.sinch.sdk.domains.sms.adapters.api.v1.GroupsApi; -import com.sinch.sdk.domains.sms.adapters.converters.GroupsDtoConverter; -import com.sinch.sdk.domains.sms.models.Group; -import com.sinch.sdk.domains.sms.models.GroupAutoUpdate; -import com.sinch.sdk.domains.sms.models.GroupAutoUpdateKeyword; -import com.sinch.sdk.domains.sms.models.dto.v1.ApiGroupListDto; -import com.sinch.sdk.domains.sms.models.dto.v1.CreateGroupResponseDto; -import com.sinch.sdk.domains.sms.models.dto.v1.GroupObjectDto; -import com.sinch.sdk.domains.sms.models.dto.v1.ReplaceGroupRequestDto; -import com.sinch.sdk.domains.sms.models.dto.v1.UpdateGroupRequestDto; -import com.sinch.sdk.domains.sms.models.requests.GroupReplaceRequestParameters; -import com.sinch.sdk.domains.sms.models.requests.GroupUpdateRequestParameters; -import com.sinch.sdk.domains.sms.models.responses.GroupsListResponse; -import com.sinch.sdk.models.SmsContext; -import java.time.Instant; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Iterator; -import java.util.Map; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.Mock; - -@TestWithResources -class GroupsServiceTest extends BaseTest { - - @Mock SmsContext context; - @Mock HttpClient httpClient; - @Mock Map authManagers; - @Mock GroupsApi api; - GroupsService service; - String uriPartID = "foovalue"; - - @Captor ArgumentCaptor groupIdCaptor; - - @GivenJsonResource("/domains/sms/v1/groups/GroupDto.json") - CreateGroupResponseDto createGroupResponseDto; - - @GivenJsonResource("/domains/sms/v1/groups/response/ListGroupsResponseDtoPage0.json") - ApiGroupListDto groupsListResponseDtoPage0; - - @GivenJsonResource("/domains/sms/v1/groups/response/ListGroupsResponseDtoPage1.json") - ApiGroupListDto groupsListResponseDtoPage1; - - @GivenJsonResource("/domains/sms/v1/groups/response/ListGroupsResponseDtoPage2.json") - ApiGroupListDto groupsListResponseDtoPage2; - - @BeforeEach - public void initMocks() { - service = spy(new GroupsService(uriPartID, context, httpClient, authManagers)); - doReturn(api).when(service).getApi(); - } - - @Test - void get() throws ApiException { - - when(api.retrieveGroup(eq(uriPartID), eq("foo group ID"))).thenReturn(createGroupResponseDto); - - Group response = service.get("foo group ID"); - - Assertions.assertThat(response) - .usingRecursiveComparison() - .isEqualTo(GroupsDtoConverter.convert(createGroupResponseDto)); - } - - @Test - void create() throws ApiException { - - when(api.createGroup(eq(uriPartID), eq(new GroupObjectDto()))) - .thenReturn(createGroupResponseDto); - - Group response = service.create(null); - - Assertions.assertThat(response) - .usingRecursiveComparison() - .isEqualTo(GroupsDtoConverter.convert(createGroupResponseDto)); - } - - @Test - void list() throws ApiException { - - when(api.listGroups(eq(uriPartID), eq(null), eq(null))).thenReturn(groupsListResponseDtoPage0); - when(api.listGroups(eq(uriPartID), eq(1), eq(null))).thenReturn(groupsListResponseDtoPage1); - when(api.listGroups(eq(uriPartID), eq(2), eq(null))).thenReturn(groupsListResponseDtoPage2); - - GroupsListResponse response = service.list(null); - - Iterator iterator = response.iterator(); - Group item = iterator.next(); - Assertions.assertThat(iterator.hasNext()).isEqualTo(true); - - Assertions.assertThat(item) - .usingRecursiveComparison() - .isEqualTo( - Group.builder() - .setId("01FC66621XXXXX119Z8PMV1QPU") - .setName("My new customers") - .setSize(2) - .setCreatedAt(Instant.parse("2019-08-24T14:15:22Z")) - .setModifiedAt(Instant.parse("2019-08-24T14:15:44Z")) - .setChildGroupIds( - Arrays.asList("01FC66621XXXXX119Z8PMV1AHY", "01FC66621XXXXX119Z8PMV1A00")) - .setAutoUpdate( - GroupAutoUpdate.builder() - .setTo("15551231234") - .setAdd(GroupAutoUpdateKeyword.builder().setFirstWord("1stKeyword").build()) - .setRemove( - GroupAutoUpdateKeyword.builder() - .setFirstWord("1stKeyword") - .setSecondWord("2ndKeyword") - .build()) - .build()) - .build()); - - item = iterator.next(); - Assertions.assertThat(iterator.hasNext()).isEqualTo(true); - Assertions.assertThat(item) - .usingRecursiveComparison() - .isEqualTo(Group.builder().setId("foo id").build()); - - item = iterator.next(); - Assertions.assertThat(iterator.hasNext()).isEqualTo(false); - Assertions.assertThat(item) - .usingRecursiveComparison() - .isEqualTo( - Group.builder() - .setId("01FC66621XXXXX119Z8PMV1QPU") - .setName("My new customers") - .setSize(2) - .setCreatedAt(Instant.parse("2019-08-24T14:15:22Z")) - .setModifiedAt(Instant.parse("2019-08-24T14:15:44Z")) - .setChildGroupIds( - Arrays.asList("01FC66621XXXXX119Z8PMV1AHY", "01FC66621XXXXX119Z8PMV1A00")) - .setAutoUpdate( - GroupAutoUpdate.builder() - .setTo("15551231234") - .setAdd(GroupAutoUpdateKeyword.builder().setFirstWord("1stKeyword").build()) - .setRemove( - GroupAutoUpdateKeyword.builder() - .setFirstWord("1stKeyword") - .setSecondWord("2ndKeyword") - .build()) - .build()) - .build()); - } - - @Test - void replace() throws ApiException { - - when(api.replaceGroup( - eq(uriPartID), - eq("group id"), - eq( - new ReplaceGroupRequestDto() - .name("foo name") - .members(Collections.singletonList("foo member"))))) - .thenReturn(createGroupResponseDto); - - Group response = - service.replace( - "group id", - GroupReplaceRequestParameters.builder() - .setName("foo name") - .setMembers(Collections.singletonList("foo member")) - .build()); - - Assertions.assertThat(response) - .usingRecursiveComparison() - .isEqualTo(GroupsDtoConverter.convert(createGroupResponseDto)); - } - - @Test - void update() throws ApiException { - - when(api.updateGroup( - eq(uriPartID), eq("group id"), eq(new UpdateGroupRequestDto().name("foo name")))) - .thenReturn(createGroupResponseDto); - - Group response = - service.update( - "group id", GroupUpdateRequestParameters.builder().setName("foo name").build()); - - Assertions.assertThat(response) - .usingRecursiveComparison() - .isEqualTo(GroupsDtoConverter.convert(createGroupResponseDto)); - } - - @Test - void delete() throws ApiException { - - service.delete("foo group id"); - - verify(api).deleteGroup(eq(uriPartID), groupIdCaptor.capture()); - - String parameter = groupIdCaptor.getValue(); - Assertions.assertThat(parameter).isEqualTo("foo group id"); - } - - @Test - void listMembers() throws ApiException { - - when(api.getMembers(eq(uriPartID), eq("group id"))) - .thenReturn(Arrays.asList("entry 1", "entry 2")); - - Collection response = service.listMembers("group id"); - - Assertions.assertThat(response) - .usingRecursiveComparison() - .isEqualTo(Arrays.asList("entry 1", "entry 2")); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/sms/adapters/InboundsServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/sms/adapters/InboundsServiceTest.java deleted file mode 100644 index bc3816cd3..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/sms/adapters/InboundsServiceTest.java +++ /dev/null @@ -1,159 +0,0 @@ -package com.sinch.sdk.domains.sms.adapters; - -import static org.junit.jupiter.api.Assertions.assertInstanceOf; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - -import com.adelean.inject.resources.junit.jupiter.GivenJsonResource; -import com.adelean.inject.resources.junit.jupiter.TestWithResources; -import com.sinch.sdk.BaseTest; -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.core.http.AuthManager; -import com.sinch.sdk.core.http.HttpClient; -import com.sinch.sdk.domains.sms.adapters.api.v1.InboundsApi; -import com.sinch.sdk.domains.sms.adapters.converters.InboundsDtoConverter; -import com.sinch.sdk.domains.sms.models.Inbound; -import com.sinch.sdk.domains.sms.models.InboundBinary; -import com.sinch.sdk.domains.sms.models.InboundText; -import com.sinch.sdk.domains.sms.models.dto.v1.ApiInboundListDto; -import com.sinch.sdk.domains.sms.models.dto.v1.InboundDto; -import com.sinch.sdk.domains.sms.models.responses.InboundsListResponse; -import com.sinch.sdk.models.SmsContext; -import java.time.Instant; -import java.util.Iterator; -import java.util.Map; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.mockito.Mock; - -@TestWithResources -class InboundsServiceTest extends BaseTest { - - @Mock SmsContext context; - @Mock HttpClient httpClient; - @Mock Map authManagers; - @Mock InboundsApi api; - InboundsService service; - - String uriPartID = "foovalue"; - - @GivenJsonResource("/domains/sms/v1/inbounds/InboundBinaryDto.json") - InboundDto binary; - - @GivenJsonResource("/domains/sms/v1/inbounds/InboundTextDto.json") - InboundDto text; - - @GivenJsonResource("/domains/sms/v1/inbounds/response/internal/InboundsListResponseDtoPage0.json") - ApiInboundListDto inboundsLisResponseDtoPage0; - - @GivenJsonResource("/domains/sms/v1/inbounds/response/internal/InboundsListResponseDtoPage1.json") - ApiInboundListDto inboundsLisResponseDtoPage1; - - @GivenJsonResource("/domains/sms/v1/inbounds/response/internal/InboundsListResponseDtoPage2.json") - ApiInboundListDto inboundsLisResponseDtoPage2; - - @BeforeEach - public void initMocks() { - service = spy(new InboundsService(uriPartID, context, httpClient, authManagers)); - doReturn(api).when(service).getApi(); - } - - @Test - void getBinary() throws ApiException { - - when(api.retrieveInboundMessage(eq(uriPartID), eq("foo inbound ID"))).thenReturn(binary); - - Inbound response = service.get("foo inbound ID"); - - assertInstanceOf(InboundBinary.class, response); - Assertions.assertThat(response) - .usingRecursiveComparison() - .isEqualTo(InboundsDtoConverter.convert(binary)); - } - - @Test - void getText() throws ApiException { - - when(api.retrieveInboundMessage(eq(uriPartID), eq("foo inbound ID"))).thenReturn(text); - - Inbound response = service.get("foo inbound ID"); - - assertInstanceOf(InboundText.class, response); - Assertions.assertThat(response) - .usingRecursiveComparison() - .isEqualTo(InboundsDtoConverter.convert(text)); - } - - @Test - void list() throws ApiException { - - when(api.listInboundMessages( - eq(uriPartID), eq(null), eq(null), eq(null), eq(null), eq(null), eq(null))) - .thenReturn(inboundsLisResponseDtoPage0); - when(api.listInboundMessages( - eq(uriPartID), eq(1), eq(null), eq(null), eq(null), eq(null), eq(null))) - .thenReturn(inboundsLisResponseDtoPage1); - when(api.listInboundMessages( - eq(uriPartID), eq(2), eq(null), eq(null), eq(null), eq(null), eq(null))) - .thenReturn(inboundsLisResponseDtoPage2); - InboundsListResponse response = service.list(null); - - Iterator> iterator = response.iterator(); - Inbound item = iterator.next(); - Assertions.assertThat(iterator.hasNext()).isEqualTo(true); - - assertInstanceOf(InboundBinary.class, item); - Assertions.assertThat(item) - .usingRecursiveComparison() - .isEqualTo( - InboundBinary.builder() - .setBody("a body") - .setClientReference("a client reference") - .setFrom("+11203494390") - .setId("01FC66621XXXXX119Z8PMV1QPA") - .setOperatorId("35000") - .setReceivedAt(Instant.parse("2019-08-24T14:17:22Z")) - .setSentAt(Instant.parse("2019-08-24T14:15:22Z")) - .setTo("11203453453") - .setUdh("foo udh") - .build()); - - item = iterator.next(); - Assertions.assertThat(iterator.hasNext()).isEqualTo(true); - assertInstanceOf(InboundText.class, item); - Assertions.assertThat(item) - .usingRecursiveComparison() - .isEqualTo( - InboundText.builder() - .setBody("a body") - .setClientReference("a client reference") - .setFrom("+11203494390") - .setId("01FC66621XXXXX119Z8PMV1QPA") - .setOperatorId("35000") - .setReceivedAt(Instant.parse("2019-08-24T14:17:22Z")) - .setSentAt(Instant.parse("2019-08-24T14:15:22Z")) - .setTo("11203453453") - .build()); - - item = iterator.next(); - Assertions.assertThat(iterator.hasNext()).isEqualTo(false); - assertInstanceOf(InboundBinary.class, item); - Assertions.assertThat(item) - .usingRecursiveComparison() - .isEqualTo( - InboundBinary.builder() - .setBody("a body") - .setClientReference("a client reference") - .setFrom("+11203494390") - .setId("01FC66621XXXXX119Z8PMV1QPA") - .setOperatorId("35000") - .setReceivedAt(Instant.parse("2019-08-24T14:17:22Z")) - .setSentAt(Instant.parse("2019-08-24T14:15:22Z")) - .setTo("11203453453") - .setUdh("foo udh") - .build()); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/sms/adapters/SMSServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/sms/adapters/SMSServiceTest.java deleted file mode 100644 index 0ab100db0..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/sms/adapters/SMSServiceTest.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.sinch.sdk.domains.sms.adapters; - -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import com.sinch.sdk.core.http.HttpClient; -import com.sinch.sdk.core.models.ServerConfiguration; -import com.sinch.sdk.models.SmsContext; -import com.sinch.sdk.models.UnifiedCredentials; -import org.junit.jupiter.api.Test; -import org.mockito.Mock; - -class SMSServiceTest { - - @Mock HttpClient httpClient; - - @Test - void doNotAcceptNullKey() { - UnifiedCredentials credentials = - UnifiedCredentials.builder().setKeyId(null).setKeySecret("foo").setProjectId("foo").build(); - SmsContext context = SmsContext.builder().build(); - ServerConfiguration server = new ServerConfiguration(""); - Exception exception = - assertThrows( - IllegalArgumentException.class, - () -> new SMSService(credentials, context, server, () -> httpClient)); - assertTrue(exception.getMessage().contains("keyId")); - } - - @Test - void doNotAcceptNullKeySecret() { - UnifiedCredentials credentials = - UnifiedCredentials.builder().setKeyId("foo").setKeySecret(null).setProjectId("foo").build(); - SmsContext context = SmsContext.builder().build(); - ServerConfiguration server = new ServerConfiguration(""); - Exception exception = - assertThrows( - IllegalArgumentException.class, - () -> new SMSService(credentials, context, server, () -> httpClient)); - assertTrue(exception.getMessage().contains("keySecret")); - } - - @Test - void doNotAcceptNullProject() { - UnifiedCredentials credentials = - UnifiedCredentials.builder().setKeyId("foo").setKeySecret("foo").setProjectId(null).build(); - SmsContext context = SmsContext.builder().build(); - ServerConfiguration server = new ServerConfiguration(""); - - Exception exception = - assertThrows( - IllegalArgumentException.class, - () -> new SMSService(credentials, context, server, () -> httpClient)); - assertTrue(exception.getMessage().contains("projectId")); - } - - @Test - void doNotAcceptNullCredentials() { - - SmsContext context = SmsContext.builder().build(); - ServerConfiguration server = new ServerConfiguration(""); - Exception exception = - assertThrows( - NullPointerException.class, - () -> new SMSService(null, context, server, () -> httpClient)); - assertTrue(exception.getMessage().contains("Credentials must be defined")); - } - - @Test - void doNotAcceptNullContext() { - UnifiedCredentials credentials = - UnifiedCredentials.builder() - .setKeyId("foo") - .setKeySecret("foo") - .setProjectId("foo") - .build(); - ServerConfiguration server = new ServerConfiguration(""); - Exception exception = - assertThrows( - NullPointerException.class, - () -> new SMSService(credentials, null, server, () -> httpClient)); - assertTrue(exception.getMessage().contains("Context must be defined")); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/sms/adapters/WebHooksServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/sms/adapters/WebHooksServiceTest.java deleted file mode 100644 index 5a3fbcb0f..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/sms/adapters/WebHooksServiceTest.java +++ /dev/null @@ -1,141 +0,0 @@ -package com.sinch.sdk.domains.sms.adapters; - -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import com.adelean.inject.resources.junit.jupiter.GivenTextResource; -import com.adelean.inject.resources.junit.jupiter.TestWithResources; -import com.sinch.sdk.BaseTest; -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.core.exceptions.ApiMappingException; -import com.sinch.sdk.domains.sms.adapters.converters.DeliveryReportDtoConverter; -import com.sinch.sdk.domains.sms.adapters.converters.InboundsDtoConverter; -import com.sinch.sdk.domains.sms.models.DeliveryReportBatchMMS; -import com.sinch.sdk.domains.sms.models.DeliveryReportBatchSMS; -import com.sinch.sdk.domains.sms.models.DeliveryReportRecipientMMS; -import com.sinch.sdk.domains.sms.models.DeliveryReportRecipientSMS; -import com.sinch.sdk.domains.sms.models.InboundBinary; -import com.sinch.sdk.domains.sms.models.InboundText; -import com.sinch.sdk.domains.sms.models.dto.v1.DeliveryReportBatchDtoTest; -import com.sinch.sdk.domains.sms.models.dto.v1.DeliveryReportRecipientDtoTest; -import com.sinch.sdk.domains.sms.models.dto.v1.MOBinaryDtoTest; -import com.sinch.sdk.domains.sms.models.dto.v1.MOTextDtoTest; -import com.sinch.sdk.domains.sms.models.webhooks.WebhooksEvent; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.InjectMocks; - -@TestWithResources -public class WebHooksServiceTest extends BaseTest { - - @GivenTextResource("/domains/sms/v1/inbounds/InboundBinaryDto.json") - String incomingSMSBinaryJsonString; - - @GivenTextResource("/domains/sms/v1/inbounds/InboundTextDto.json") - String incomingSMSTextJsonString; - - @GivenTextResource("/domains/sms/v1/deliveryreports/RecipientDeliveryReportSMSDto.json") - String deliveryReportRecipientSMSJsonString; - - @GivenTextResource("/domains/sms/v1/deliveryreports/RecipientDeliveryReportMMSDto.json") - String deliveryReportRecipientMMSJsonString; - - @GivenTextResource("/domains/sms/v1/deliveryreports/BatchDeliveryReportSMSDto.json") - String deliveryReportBatchSMSJsonString; - - @GivenTextResource("/domains/sms/v1/deliveryreports/BatchDeliveryReportMMSDto.json") - String deliveryReportBatchMMSJsonString; - - @InjectMocks WebHooksService service; - - @Test - void incomingSMSBinary() throws ApiException { - - WebhooksEvent response = service.parse(incomingSMSBinaryJsonString); - - Assertions.assertThat(response).isInstanceOf(InboundBinary.class); - Assertions.assertThat(response) - .usingRecursiveComparison() - .isEqualTo(InboundsDtoConverter.convert(MOBinaryDtoTest.dto)); - } - - @Test - void incomingSMSText() throws ApiException { - - WebhooksEvent response = service.parse(incomingSMSTextJsonString); - - Assertions.assertThat(response).isInstanceOf(InboundText.class); - Assertions.assertThat(response) - .usingRecursiveComparison() - .isEqualTo(InboundsDtoConverter.convert(MOTextDtoTest.dto)); - } - - @Test - void handleExceptionIncomingSMS() throws ApiException { - - String jsonPayload = incomingSMSBinaryJsonString.replace("mo_binary", "foo type"); - ApiMappingException thrown = - assertThrows(ApiMappingException.class, () -> service.parse(jsonPayload)); - assertTrue(thrown.getMessage().contains(jsonPayload)); - } - - @Test - void deliveryReportRecipientDeliveryReportSms() throws ApiException { - - WebhooksEvent response = service.parse(deliveryReportRecipientSMSJsonString); - - Assertions.assertThat(response).isInstanceOf(DeliveryReportRecipientSMS.class); - Assertions.assertThat(response) - .usingRecursiveComparison() - .isEqualTo( - DeliveryReportDtoConverter.convert( - DeliveryReportRecipientDtoTest.deliveryReportRecipientSMS)); - } - - @Test - void deliveryReportRecipientDeliveryReportMms() throws ApiException { - - WebhooksEvent response = service.parse(deliveryReportRecipientMMSJsonString); - - Assertions.assertThat(response).isInstanceOf(DeliveryReportRecipientMMS.class); - Assertions.assertThat(response) - .usingRecursiveComparison() - .isEqualTo( - DeliveryReportDtoConverter.convert( - DeliveryReportRecipientDtoTest.deliveryReportRecipientMMS)); - } - - @Test - void deliveryReportBatchDeliveryReportSms() throws ApiException { - - WebhooksEvent response = service.parse(deliveryReportBatchSMSJsonString); - - Assertions.assertThat(response).isInstanceOf(DeliveryReportBatchSMS.class); - Assertions.assertThat(response) - .usingRecursiveComparison() - .isEqualTo( - DeliveryReportDtoConverter.convert(DeliveryReportBatchDtoTest.deliveryReportBatchSMS)); - } - - @Test - void deliveryReportBatchDeliveryReportMms() throws ApiException { - - WebhooksEvent response = service.parse(deliveryReportBatchMMSJsonString); - - Assertions.assertThat(response).isInstanceOf(DeliveryReportBatchMMS.class); - Assertions.assertThat(response) - .usingRecursiveComparison() - .isEqualTo( - DeliveryReportDtoConverter.convert(DeliveryReportBatchDtoTest.deliveryReportBatchMMS)); - } - - @Test - void handleExceptionDeliveryReport() throws ApiException { - - String jsonPayload = - deliveryReportRecipientMMSJsonString.replace("recipient_delivery_report_mms", "foo type"); - ApiMappingException thrown = - assertThrows(ApiMappingException.class, () -> service.parse(jsonPayload)); - assertTrue(thrown.getMessage().contains(jsonPayload)); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/sms/adapters/converters/BatchDtoConverterTest.java b/client/src/test/java/com/sinch/sdk/domains/sms/adapters/converters/BatchDtoConverterTest.java deleted file mode 100644 index 22ea01b7e..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/sms/adapters/converters/BatchDtoConverterTest.java +++ /dev/null @@ -1,209 +0,0 @@ -package com.sinch.sdk.domains.sms.adapters.converters; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertInstanceOf; -import static org.junit.jupiter.api.Assertions.fail; - -import com.adelean.inject.resources.junit.jupiter.GivenJsonResource; -import com.adelean.inject.resources.junit.jupiter.TestWithResources; -import com.sinch.sdk.BaseTest; -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.domains.sms.adapters.BatchesServiceTest; -import com.sinch.sdk.domains.sms.models.Batch; -import com.sinch.sdk.domains.sms.models.BatchBinary; -import com.sinch.sdk.domains.sms.models.BatchMedia; -import com.sinch.sdk.domains.sms.models.BatchText; -import com.sinch.sdk.domains.sms.models.dto.v1.BinaryResponseDto; -import com.sinch.sdk.domains.sms.models.dto.v1.MediaResponseDto; -import com.sinch.sdk.domains.sms.models.dto.v1.SendSMS201ResponseDto; -import com.sinch.sdk.domains.sms.models.dto.v1.SendSMSRequestDto; -import com.sinch.sdk.domains.sms.models.dto.v1.TextResponseDto; -import com.sinch.sdk.domains.sms.models.dto.v1.UpdateBatchMessageRequestDto; -import java.util.Arrays; -import java.util.Collection; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -@TestWithResources -class BatchDtoConverterTest extends BaseTest { - - @GivenJsonResource("/domains/sms/v1/batches/response/BinaryResponseDto.json") - public SendSMS201ResponseDto binaryResponseDto; - - @GivenJsonResource("/domains/sms/v1/batches/response/TextResponseDto.json") - public SendSMS201ResponseDto textResponseDto; - - @GivenJsonResource("/domains/sms/v1/batches/response/MediaResponseDto.json") - public SendSMS201ResponseDto mediaResponseDto; - - @GivenJsonResource("/domains/sms/v1/BinaryRequestDto.json") - public SendSMSRequestDto sendBinaryRequestDto; - - @GivenJsonResource("/domains/sms/v1/batches/request/TextRequestDto.json") - public SendSMSRequestDto sendTextRequestDto; - - @GivenJsonResource("/domains/sms/v1/batches/request/MediaRequestDto.json") - public SendSMSRequestDto sendMediaRequestDto; - - @GivenJsonResource("/domains/sms/v1/UpdateSMSTextRequestDto.json") - public UpdateBatchMessageRequestDto updateTextRequestDto; - - @GivenJsonResource("/domains/sms/v1/UpdateSMSMediaRequestDto.json") - public UpdateBatchMessageRequestDto updateMediaRequestDto; - - @GivenJsonResource("/domains/sms/v1/UpdateSMSBinaryRequestDto.json") - public UpdateBatchMessageRequestDto updateBinaryRequestDto; - - public static void compareWithDto(Batch client, SendSMS201ResponseDto dto) { - Object obj = dto.getActualInstance(); - if (obj instanceof BinaryResponseDto) { - assertInstanceOf(BatchBinary.class, client); - compareBinary((BatchBinary) client, dto.getBinaryResponseDto()); - } else if (obj instanceof MediaResponseDto) { - assertInstanceOf(BatchMedia.class, client); - compareMedia((BatchMedia) client, dto.getMediaResponseDto()); - } else if (obj instanceof TextResponseDto) { - assertInstanceOf(BatchText.class, client); - compareText((BatchText) client, dto.getTextResponseDto()); - } else { - fail("Unexpected class:" + obj.getClass().getName()); - } - } - - private static void compareBinary(BatchBinary client, BinaryResponseDto dto) { - assertEquals(dto.getId(), client.getId()); - assertEquals(dto.getTo(), client.getTo()); - assertEquals(dto.getFrom(), client.getFrom()); - assertEquals(dto.getCanceled(), client.isCanceled()); - assertEquals(dto.getBody(), client.getBody()); - assertEquals(dto.getUdh(), client.getUdh()); - assertEquals(dto.getType(), BinaryResponseDto.TypeEnum.MT_BINARY.getValue()); - assertEquals(dto.getCreatedAt().toInstant(), client.getCreatedAt()); - assertEquals(dto.getModifiedAt().toInstant(), client.getModifiedAt()); - Assertions.assertEquals(dto.getDeliveryReport(), client.getDeliveryReport().value()); - assertEquals(dto.getSendAt().toInstant(), client.getSendAt()); - assertEquals(dto.getExpireAt().toInstant(), client.getExpireAt()); - assertEquals(dto.getCallbackUrl(), client.getCallbackUrl()); - assertEquals(dto.getClientReference(), client.getClientReference()); - assertEquals(dto.getFeedbackEnabled(), client.isFeedbackEnabled()); - assertEquals(dto.getFlashMessage(), client.isFlashMessage()); - assertEquals(dto.getTruncateConcat(), client.isTruncateConcat()); - assertEquals(dto.getMaxNumberOfMessageParts(), client.getMaxNumberOfMessageParts()); - assertEquals(dto.getFromTon(), client.getFromTon()); - assertEquals(dto.getFromNpi(), client.getFromNpi()); - } - - private static void compareMedia(BatchMedia client, MediaResponseDto dto) { - assertEquals(dto.getId(), client.getId()); - assertEquals(dto.getTo(), client.getTo()); - assertEquals(dto.getFrom(), client.getFrom()); - assertEquals(dto.getCanceled(), client.isCanceled()); - assertEquals(dto.getBody().getUrl(), client.getBody().getUrl()); - assertEquals(dto.getBody().getMessage(), client.getBody().getMessage().get()); - assertEquals(dto.getType(), MediaResponseDto.TypeEnum.MT_MEDIA.getValue()); - assertEquals(dto.getCreatedAt().toInstant(), client.getCreatedAt()); - assertEquals(dto.getModifiedAt().toInstant(), client.getModifiedAt()); - Assertions.assertEquals(dto.getDeliveryReport(), client.getDeliveryReport().value()); - assertEquals(dto.getSendAt().toInstant(), client.getSendAt()); - assertEquals(dto.getExpireAt().toInstant(), client.getExpireAt()); - TestHelpers.recursiveEquals(client.getParameters(), dto.getParameters()); - assertEquals(dto.getCallbackUrl(), client.getCallbackUrl()); - assertEquals(dto.getClientReference(), client.getClientReference()); - assertEquals(dto.getFeedbackEnabled(), client.isFeedbackEnabled()); - } - - private static void compareText(BatchText client, TextResponseDto dto) { - assertEquals(dto.getId(), client.getId()); - assertEquals(dto.getTo(), client.getTo()); - assertEquals(dto.getFrom(), client.getFrom()); - assertEquals(dto.getCanceled(), client.isCanceled()); - assertEquals(dto.getBody(), client.getBody()); - assertEquals(dto.getType(), TextResponseDto.TypeEnum.MT_TEXT.getValue()); - assertEquals(dto.getCreatedAt().toInstant(), client.getCreatedAt()); - assertEquals(dto.getModifiedAt().toInstant(), client.getModifiedAt()); - Assertions.assertEquals(dto.getDeliveryReport(), client.getDeliveryReport().value()); - assertEquals(dto.getSendAt().toInstant(), client.getSendAt()); - assertEquals(dto.getExpireAt().toInstant(), client.getExpireAt()); - assertEquals(dto.getCallbackUrl(), client.getCallbackUrl()); - assertEquals(dto.getClientReference(), client.getClientReference()); - assertEquals(dto.getFeedbackEnabled(), client.isFeedbackEnabled()); - assertEquals(dto.getFlashMessage(), client.isFlashMessage()); - assertEquals(dto.getTruncateConcat(), client.isTruncateConcat()); - TestHelpers.recursiveEquals(client.getParameters(), dto.getParameters()); - assertEquals(dto.getMaxNumberOfMessageParts(), client.getMaxNumberOfMessageParts()); - assertEquals(dto.getFromTon(), client.getFromTon()); - assertEquals(dto.getFromNpi(), client.getFromNpi()); - } - - @Test - void convertBinaryResponse() { - TestHelpers.recursiveEquals( - BatchDtoConverter.convert(binaryResponseDto), BatchesServiceTest.batchBinary); - } - - @Test - void convertMediaResponse() { - TestHelpers.recursiveEquals( - BatchDtoConverter.convert(mediaResponseDto), BatchesServiceTest.batchMedia); - } - - @Test - void convertTextResponse() { - TestHelpers.recursiveEquals( - BatchDtoConverter.convert(textResponseDto), BatchesServiceTest.batchText); - } - - @Test - void convertSendBinaryRequest() { - org.assertj.core.api.Assertions.assertThat( - BatchDtoConverter.convert(BatchesServiceTest.sendSmsBatchBinaryRequest)) - .usingRecursiveComparison() - .isEqualTo(sendBinaryRequestDto); - } - - @Test - void convertSendMediaRequest() { - org.assertj.core.api.Assertions.assertThat( - BatchDtoConverter.convert(BatchesServiceTest.sendSmsBatchMediaRequest)) - .usingRecursiveComparison() - .isEqualTo(sendMediaRequestDto); - } - - @Test - void convertSendTextRequest() { - org.assertj.core.api.Assertions.assertThat( - BatchDtoConverter.convert(BatchesServiceTest.sendSmsBatchTextRequest)) - .usingRecursiveComparison() - .isEqualTo(sendTextRequestDto); - } - - @Test - void convertUpdateTextRequest() { - TestHelpers.recursiveEquals( - BatchDtoConverter.convert(BatchesServiceTest.updateSmsBatchTextRequest), - updateTextRequestDto); - } - - @Test - void convertUpdateMediaRequest() { - TestHelpers.recursiveEquals( - BatchDtoConverter.convert(BatchesServiceTest.updateSmsBatchMediaRequest), - updateMediaRequestDto); - } - - @Test - void convertUpdateBinaryRequest() { - TestHelpers.recursiveEquals( - BatchDtoConverter.convert(BatchesServiceTest.updateSmsBatchBinaryRequest), - updateBinaryRequestDto); - } - - @Test - void convertDeliveryFeedbackRecipients() { - Collection recipients = Arrays.asList("foo1", "foo2"); - org.assertj.core.api.Assertions.assertThat( - BatchDtoConverter.convert(recipients).getRecipients()) - .usingRecursiveComparison() - .isEqualTo(recipients); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/sms/adapters/converters/DeliveryReportBatchDtoConverterTest.java b/client/src/test/java/com/sinch/sdk/domains/sms/adapters/converters/DeliveryReportBatchDtoConverterTest.java deleted file mode 100644 index cbfd8a515..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/sms/adapters/converters/DeliveryReportBatchDtoConverterTest.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.sinch.sdk.domains.sms.adapters.converters; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertInstanceOf; - -import com.adelean.inject.resources.junit.jupiter.GivenJsonResource; -import com.adelean.inject.resources.junit.jupiter.TestWithResources; -import com.sinch.sdk.BaseTest; -import com.sinch.sdk.domains.sms.models.DeliveryReportBatch; -import com.sinch.sdk.domains.sms.models.DeliveryReportBatchMMS; -import com.sinch.sdk.domains.sms.models.DeliveryReportBatchSMS; -import com.sinch.sdk.domains.sms.models.DeliveryReportStatusDetails; -import com.sinch.sdk.domains.sms.models.dto.v1.DeliveryReportDto; -import com.sinch.sdk.domains.sms.models.dto.v1.DeliveryReportDto.TypeEnum; -import com.sinch.sdk.domains.sms.models.dto.v1.MessageDeliveryStatusDto; -import java.rmi.UnexpectedException; -import java.util.Collection; -import java.util.Iterator; -import java.util.Objects; -import org.junit.jupiter.api.Test; - -@TestWithResources -class DeliveryReportBatchDtoConverterTest extends BaseTest { - - @GivenJsonResource("/domains/sms/v1/deliveryreports/BatchDeliveryReportSMSDto.json") - DeliveryReportDto deliveryReportSMSClientDto; - - @GivenJsonResource("/domains/sms/v1/deliveryreports/BatchDeliveryReportMMSDto.json") - DeliveryReportDto deliveryReportMMSClientDto; - - public static void compareWithDto( - DeliveryReportStatusDetails client, MessageDeliveryStatusDto dto) { - assertEquals(dto.getCode(), client.getCode()); - assertEquals(dto.getCount(), client.getCount()); - assertEquals(dto.getRecipients(), client.getRecipients()); - assertEquals(dto.getStatus(), client.getStatus().value()); - } - - public static void compareWithDto( - Collection client, Collection dto) { - assertEquals(dto.size(), client.size()); - Iterator dtoIterator = dto.iterator(); - Iterator clientIterator = client.iterator(); - - dtoIterator.forEachRemaining(dtoItem -> compareWithDto(clientIterator.next(), dtoItem)); - } - - public static void compareWithDto(DeliveryReportBatch client, DeliveryReportDto dto) - throws UnexpectedException { - String type = dto.getType(); - if (Objects.equals(type, TypeEnum.MMS.getValue())) { - assertInstanceOf(DeliveryReportBatchMMS.class, client); - } else if (Objects.equals(type, TypeEnum.SMS.getValue())) { - assertInstanceOf(DeliveryReportBatchSMS.class, client); - } else { - throw new UnexpectedException("Unexpected type " + type); - } - - assertEquals(dto.getBatchId(), client.getBatchId()); - compareWithDto(client.getStatuses(), dto.getStatuses()); - assertEquals(dto.getTotalMessageCount(), client.getTotalMessageCount()); - assertEquals(dto.getClientReference(), client.getClientReference().orElse(null)); - } - - @Test - void convertSMS() throws UnexpectedException { - compareWithDto( - DeliveryReportDtoConverter.convert(deliveryReportSMSClientDto), deliveryReportSMSClientDto); - } - - @Test - void convertMMS() throws UnexpectedException { - compareWithDto( - DeliveryReportDtoConverter.convert(deliveryReportMMSClientDto), deliveryReportMMSClientDto); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/sms/adapters/converters/DryRunDtoConverterTest.java b/client/src/test/java/com/sinch/sdk/domains/sms/adapters/converters/DryRunDtoConverterTest.java deleted file mode 100644 index 7b262f973..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/sms/adapters/converters/DryRunDtoConverterTest.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.sinch.sdk.domains.sms.adapters.converters; - -import com.adelean.inject.resources.junit.jupiter.GivenJsonResource; -import com.adelean.inject.resources.junit.jupiter.TestWithResources; -import com.sinch.sdk.BaseTest; -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.domains.sms.models.DryRun; -import com.sinch.sdk.domains.sms.models.DryRunPerRecipientDetails; -import com.sinch.sdk.domains.sms.models.dto.v1.DryRun200ResponseDto; -import java.util.Collections; -import org.junit.jupiter.api.Test; - -@TestWithResources -public class DryRunDtoConverterTest extends BaseTest { - - @GivenJsonResource("/domains/sms/v1/batches/response/DryRunResponseDto.json") - DryRun200ResponseDto loadedDto; - - public static DryRun dryRunClient = - DryRun.builder() - .setNumberOfRecipients(123) - .setNumberOfMessages(456) - .setPerRecipient( - Collections.singletonList( - DryRunPerRecipientDetails.builder() - .setRecipient("recipient string") - .setNumberOfParts(1) - .setBody("body string") - .setEncoding("encoding string") - .build())) - .build(); - - @Test - void testConvertDryRun() { - TestHelpers.recursiveEquals(DryRunDtoConverter.convert(loadedDto), dryRunClient); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/sms/adapters/converters/GroupsDtoConverterTest.java b/client/src/test/java/com/sinch/sdk/domains/sms/adapters/converters/GroupsDtoConverterTest.java deleted file mode 100644 index 047c233f6..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/sms/adapters/converters/GroupsDtoConverterTest.java +++ /dev/null @@ -1,145 +0,0 @@ -package com.sinch.sdk.domains.sms.adapters.converters; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -import com.adelean.inject.resources.junit.jupiter.GivenJsonResource; -import com.adelean.inject.resources.junit.jupiter.TestWithResources; -import com.sinch.sdk.BaseTest; -import com.sinch.sdk.domains.sms.models.Group; -import com.sinch.sdk.domains.sms.models.GroupAutoUpdate; -import com.sinch.sdk.domains.sms.models.dto.v1.CreateGroupResponseDto; -import com.sinch.sdk.domains.sms.models.dto.v1.GroupAutoUpdateDto; -import com.sinch.sdk.domains.sms.models.dto.v1.GroupObjectDto; -import com.sinch.sdk.domains.sms.models.dto.v1.ReplaceGroupRequestDto; -import com.sinch.sdk.domains.sms.models.dto.v1.UpdateGroupRequestDto; -import com.sinch.sdk.domains.sms.models.requests.GroupAutoUpdateKeywordRequestParameters; -import com.sinch.sdk.domains.sms.models.requests.GroupAutoUpdateRequestParameters; -import com.sinch.sdk.domains.sms.models.requests.GroupCreateRequestParameters; -import com.sinch.sdk.domains.sms.models.requests.GroupReplaceRequestParameters; -import com.sinch.sdk.domains.sms.models.requests.GroupUpdateRequestParameters; -import java.rmi.UnexpectedException; -import java.util.Arrays; -import java.util.Collections; -import java.util.Iterator; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -@TestWithResources -class GroupsDtoConverterTest extends BaseTest { - - @GivenJsonResource("/domains/sms/v1/groups/GroupDto.json") - CreateGroupResponseDto createGroupResponseDto; - - @GivenJsonResource("/domains/sms/v1/CreateGroupRequestDto.json") - GroupObjectDto createGroupRequestParametersDto; - - @GivenJsonResource("/domains/sms/v1/groups/request/GroupUpdateRequestDto.json") - UpdateGroupRequestDto groupUpdateRequestParametersDto; - - @GivenJsonResource("/domains/sms/v1/ReplaceGroupRequestDto.json") - ReplaceGroupRequestDto groupReplaceRequestParametersDto; - - static void compareWithDto(Group client, CreateGroupResponseDto dto) { - assertEquals(dto.getSize(), client.getSize()); - assertEquals(dto.getCreatedAt().toInstant(), client.getCreatedAt()); - assertEquals(dto.getModifiedAt().toInstant(), client.getModifiedAt()); - assertEquals(dto.getId(), client.getId()); - assertEquals(dto.getName(), client.getName()); - Iterator dtoIterator = dto.getChildGroups().iterator(); - Iterator clientIterator = client.getChildGroupIds().iterator(); - dtoIterator.forEachRemaining(dtoItem -> assertEquals(clientIterator.next(), dtoItem)); - compareWithDto(client.getAutoUpdate(), dto.getAutoUpdate()); - } - - static void compareWithDto(GroupAutoUpdate client, GroupAutoUpdateDto dto) { - assertEquals(dto.getTo(), client.getTo()); - - assertEquals(dto.getAdd().getFirstWordDefined(), client.getAdd().getFirstWord().isPresent()); - assertEquals(dto.getAdd().getFirstWord(), client.getAdd().getFirstWord().orElse(null)); - assertEquals(dto.getAdd().getSecondWordDefined(), client.getAdd().getSecondWord().isPresent()); - assertEquals(dto.getAdd().getSecondWord(), client.getAdd().getSecondWord().orElse(null)); - - assertEquals( - dto.getRemove().getFirstWordDefined(), client.getRemove().getFirstWord().isPresent()); - assertEquals(dto.getRemove().getFirstWord(), client.getRemove().getFirstWord().orElse(null)); - assertEquals( - dto.getRemove().getSecondWordDefined(), client.getRemove().getSecondWord().isPresent()); - assertEquals(dto.getRemove().getSecondWord(), client.getRemove().getSecondWord().orElse(null)); - } - - @Test - void convertCreateGroupResponse() throws UnexpectedException { - compareWithDto(GroupsDtoConverter.convert(createGroupResponseDto), createGroupResponseDto); - } - - @Test - void convertCreateRequestParameters() throws UnexpectedException { - GroupCreateRequestParameters client = - GroupCreateRequestParameters.builder() - .setName("My new customers") - .setMembers(Collections.singletonList("foo")) - .setChildGroupIds( - Arrays.asList("01FC66621XXXXX119Z8PMV1AHY", "01FC66621XXXXX119Z8PMV1A00")) - .setAutoUpdate( - GroupAutoUpdateRequestParameters.builder() - .setTo("15551231234") - .setAdd( - GroupAutoUpdateKeywordRequestParameters.builder() - .setFirstWord("Add 1st keyword") - .build()) - .setRemove( - GroupAutoUpdateKeywordRequestParameters.builder() - .setFirstWord("remove 1st keyword") - .setSecondWord("remove 2nd keyword") - .build()) - .build()) - .build(); - - Assertions.assertThat(createGroupRequestParametersDto) - .usingRecursiveComparison() - .isEqualTo(GroupsDtoConverter.convert(client)); - } - - @Test - void convertUpdateRequestParameters() throws UnexpectedException { - GroupUpdateRequestParameters client = - GroupUpdateRequestParameters.builder() - .setName("My new customers") - .setAdd(Collections.singletonList("+12345674890")) - .setRemove(Arrays.asList("+0987654321", "+3456789123")) - .setAddFromGroup("01FC66621XXXXX119Z8PMV1AHY") - .setRemoveFromGroup("01FC66621XXXXX119Z8PMV1A00") - .setAutoUpdate( - GroupAutoUpdateRequestParameters.builder() - .setTo("15551231234") - .setAdd( - GroupAutoUpdateKeywordRequestParameters.builder() - .setFirstWord("Add 1st keyword") - .setSecondWord("Add 2nd keyword") - .build()) - .setRemove( - GroupAutoUpdateKeywordRequestParameters.builder() - .setFirstWord("remove 1st keyword") - .setSecondWord("remove 2nd keyword") - .build()) - .build()) - .build(); - - Assertions.assertThat(groupUpdateRequestParametersDto) - .usingRecursiveComparison() - .isEqualTo(GroupsDtoConverter.convert(client)); - } - - @Test - void convertReplaceRequestParameters() throws UnexpectedException { - GroupReplaceRequestParameters client = - GroupReplaceRequestParameters.builder() - .setName("My new customers") - .setMembers(Collections.singletonList("foo")) - .build(); - - Assertions.assertThat(groupReplaceRequestParametersDto) - .usingRecursiveComparison() - .isEqualTo(GroupsDtoConverter.convert(client)); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/sms/models/BatchBinaryBuilderTest.java b/client/src/test/java/com/sinch/sdk/domains/sms/models/BatchBinaryBuilderTest.java deleted file mode 100644 index af8202164..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/sms/models/BatchBinaryBuilderTest.java +++ /dev/null @@ -1,143 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import java.time.Instant; -import java.util.Arrays; -import java.util.Collection; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class BatchBinaryBuilderTest { - - final String id = "an id"; - - final Collection to = Arrays.asList("to1", "to2"); - - final String from = "from value"; - - final boolean canceled = true; - final Instant createdAt = Instant.now(); - final Instant modifiedAt = Instant.now(); - final DeliveryReportType deliveryReport = DeliveryReportType.FULL; - final Instant sendAt = Instant.now(); - final Instant expireAt = Instant.now(); - final String callbackUrl = "callback value"; - final String clientReference = " client reference"; - final boolean feedbackEnabled = false; - final boolean truncateConcat = true; - final int maxNumberOfMessageParts = 23; - final int fromTon = 1234; - final int fromNpi = 567; - final String udh = "udh value"; - final String body = "body content"; - final BatchBinary value = - BatchBinary.builder() - .setId(id) - .setTo(to) - .setFrom(from) - .setCanceled(canceled) - .setBody(body) - .setCreatedAt(createdAt) - .setModifiedAt(modifiedAt) - .setDeliveryReport(deliveryReport) - .setSendAt(sendAt) - .setExpireAt(expireAt) - .setCallbackUrl(callbackUrl) - .setClientReference(clientReference) - .setFeedbackEnabled(feedbackEnabled) - .setTruncateConcat(truncateConcat) - .setMaxNumberOfMessageParts(maxNumberOfMessageParts) - .setFromTon(fromTon) - .setFromNpi(fromNpi) - .setUdh(udh) - .build(); - - @Test - void getId() { - Assertions.assertThat(value.getId()).isEqualTo(id); - } - - @Test - void getTo() { - Assertions.assertThat(value.getTo()).usingRecursiveComparison().isEqualTo(to); - } - - @Test - void getFrom() { - Assertions.assertThat(value.getFrom()).isEqualTo(from); - } - - @Test - void isCanceled() { - Assertions.assertThat(value.isCanceled()).isEqualTo(canceled); - } - - @Test - void getBody() { - Assertions.assertThat(value.getBody()).isEqualTo(body); - } - - @Test - void getExpireAt() { - Assertions.assertThat(value.getExpireAt()).isEqualTo(expireAt); - } - - @Test - void getCreatedAt() { - Assertions.assertThat(value.getCreatedAt()).isEqualTo(createdAt); - } - - @Test - void getModifiedAt() { - Assertions.assertThat(value.getModifiedAt()).isEqualTo(modifiedAt); - } - - @Test - void getDeliveryReport() { - Assertions.assertThat(value.getDeliveryReport()).isEqualTo(deliveryReport); - } - - @Test - void getSendAt() { - Assertions.assertThat(value.getSendAt()).isEqualTo(sendAt); - } - - @Test - void getCallbackUrl() { - Assertions.assertThat(value.getCallbackUrl()).isEqualTo(callbackUrl); - } - - @Test - void getClientReference() { - Assertions.assertThat(value.getClientReference()).isEqualTo(clientReference); - } - - @Test - void isFeedbackEnabled() { - Assertions.assertThat(value.isFeedbackEnabled()).isEqualTo(feedbackEnabled); - } - - @Test - void isTruncateConcat() { - Assertions.assertThat(value.isTruncateConcat()).isEqualTo(truncateConcat); - } - - @Test - void getMaxNumberOfMessageParts() { - Assertions.assertThat(value.getMaxNumberOfMessageParts()).isEqualTo(maxNumberOfMessageParts); - } - - @Test - void getFromTon() { - Assertions.assertThat(value.getFromTon()).isEqualTo(fromTon); - } - - @Test - void getFromNpi() { - Assertions.assertThat(value.getFromNpi()).isEqualTo(fromNpi); - } - - @Test - void getUdh() { - Assertions.assertThat(value.getUdh()).isEqualTo(udh); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/sms/models/BatchBinaryTest.java b/client/src/test/java/com/sinch/sdk/domains/sms/models/BatchBinaryTest.java deleted file mode 100644 index 721ce174e..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/sms/models/BatchBinaryTest.java +++ /dev/null @@ -1,144 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import java.time.Instant; -import java.util.Arrays; -import java.util.Collection; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class BatchBinaryTest { - - final String id = "an id"; - - final Collection to = Arrays.asList("to1", "to2"); - - final String from = "from value"; - - final boolean canceled = true; - final Instant createdAt = Instant.now(); - final Instant modifiedAt = Instant.now(); - final DeliveryReportType deliveryReport = DeliveryReportType.FULL; - final Instant sendAt = Instant.now(); - final Instant expireAt = Instant.now(); - final String callbackUrl = "callback value"; - final String clientReference = " client reference"; - final boolean flashMessage = true; - final boolean feedbackEnabled = false; - final boolean truncateConcat = true; - final int maxNumberOfMessageParts = 23; - final int fromTon = 1234; - final int fromNpi = 567; - final String udh = "udh value"; - final String body = "body content"; - final BatchBinary value = - new BatchBinary( - id, - to, - from, - canceled, - body, - createdAt, - modifiedAt, - deliveryReport, - sendAt, - expireAt, - callbackUrl, - clientReference, - feedbackEnabled, - flashMessage, - truncateConcat, - maxNumberOfMessageParts, - fromTon, - fromNpi, - udh); - - @Test - void getId() { - Assertions.assertThat(value.getId()).isEqualTo(id); - } - - @Test - void getTo() { - Assertions.assertThat(value.getTo()).usingRecursiveComparison().isEqualTo(to); - } - - @Test - void getFrom() { - Assertions.assertThat(value.getFrom()).isEqualTo(from); - } - - @Test - void isCanceled() { - Assertions.assertThat(value.isCanceled()).isEqualTo(canceled); - } - - @Test - void getBody() { - Assertions.assertThat(value.getBody()).isEqualTo(body); - } - - @Test - void getExpireAt() { - Assertions.assertThat(value.getExpireAt()).isEqualTo(expireAt); - } - - @Test - void getCreatedAt() { - Assertions.assertThat(value.getCreatedAt()).isEqualTo(createdAt); - } - - @Test - void getModifiedAt() { - Assertions.assertThat(value.getModifiedAt()).isEqualTo(modifiedAt); - } - - @Test - void getDeliveryReport() { - Assertions.assertThat(value.getDeliveryReport()).isEqualTo(deliveryReport); - } - - @Test - void getSendAt() { - Assertions.assertThat(value.getSendAt()).isEqualTo(sendAt); - } - - @Test - void getCallbackUrl() { - Assertions.assertThat(value.getCallbackUrl()).isEqualTo(callbackUrl); - } - - @Test - void getClientReference() { - Assertions.assertThat(value.getClientReference()).isEqualTo(clientReference); - } - - @Test - void isFeedbackEnabled() { - Assertions.assertThat(value.isFeedbackEnabled()).isEqualTo(feedbackEnabled); - } - - @Test - void isTruncateConcat() { - Assertions.assertThat(value.isTruncateConcat()).isEqualTo(truncateConcat); - } - - @Test - void getMaxNumberOfMessageParts() { - Assertions.assertThat(value.getMaxNumberOfMessageParts()).isEqualTo(maxNumberOfMessageParts); - } - - @Test - void getFromTon() { - Assertions.assertThat(value.getFromTon()).isEqualTo(fromTon); - } - - @Test - void getFromNpi() { - Assertions.assertThat(value.getFromNpi()).isEqualTo(fromNpi); - } - - @Test - void getUdh() { - Assertions.assertThat(value.getUdh()).isEqualTo(udh); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/sms/models/BatchBuilderTest.java b/client/src/test/java/com/sinch/sdk/domains/sms/models/BatchBuilderTest.java deleted file mode 100644 index 8855fb581..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/sms/models/BatchBuilderTest.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import java.time.Instant; -import java.util.Arrays; -import java.util.Collection; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class BatchBuilderTest { - - final String id = "an id"; - - final Collection to = Arrays.asList("to1", "to2"); - - final String from = "from value"; - - final boolean canceled = true; - - final Integer body = -45; - - final Instant createdAt = Instant.now(); - - final Instant modifiedAt = Instant.now(); - - final DeliveryReportType deliveryReport = DeliveryReportType.FULL; - - final Instant sendAt = Instant.now(); - - final Instant expireAt = Instant.now(); - - final String callbackUrl = "callback value"; - - final String clientReference = " client reference"; - - final boolean feedbackEnabled = false; - - final Batch value = - Batch.batchBuilder() - .setId(id) - .setTo(to) - .setFrom(from) - .setCanceled(canceled) - .setBody(body) - .setCreatedAt(createdAt) - .setModifiedAt(modifiedAt) - .setDeliveryReport(deliveryReport) - .setSendAt(sendAt) - .setExpireAt(expireAt) - .setCallbackUrl(callbackUrl) - .setClientReference(clientReference) - .setFeedbackEnabled(feedbackEnabled) - .build(); - - @Test - void getId() { - Assertions.assertThat(value.getId()).isEqualTo(id); - } - - @Test - void getTo() { - Assertions.assertThat(value.getTo()).usingRecursiveComparison().isEqualTo(to); - } - - @Test - void getFrom() { - Assertions.assertThat(value.getFrom()).isEqualTo(from); - } - - @Test - void isCanceled() { - Assertions.assertThat(value.isCanceled()).isEqualTo(canceled); - } - - @Test - void getBody() { - Assertions.assertThat(value.getBody()).isEqualTo(body); - } - - @Test - void getExpireAt() { - Assertions.assertThat(value.getExpireAt()).isEqualTo(expireAt); - } - - @Test - void getCreatedAt() { - Assertions.assertThat(value.getCreatedAt()).isEqualTo(createdAt); - } - - @Test - void getModifiedAt() { - Assertions.assertThat(value.getModifiedAt()).isEqualTo(modifiedAt); - } - - @Test - void getDeliveryReport() { - Assertions.assertThat(value.getDeliveryReport()).isEqualTo(deliveryReport); - } - - @Test - void getSendAt() { - Assertions.assertThat(value.getSendAt()).isEqualTo(sendAt); - } - - @Test - void getCallbackUrl() { - Assertions.assertThat(value.getCallbackUrl()).isEqualTo(callbackUrl); - } - - @Test - void getClientReference() { - Assertions.assertThat(value.getClientReference()).isEqualTo(clientReference); - } - - @Test - void isFeedbackEnabled() { - Assertions.assertThat(value.isFeedbackEnabled()).isEqualTo(feedbackEnabled); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/sms/models/BatchMediaBuilderTest.java b/client/src/test/java/com/sinch/sdk/domains/sms/models/BatchMediaBuilderTest.java deleted file mode 100644 index b7da2e2a4..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/sms/models/BatchMediaBuilderTest.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import java.time.Instant; -import java.util.Arrays; -import java.util.Collection; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class BatchMediaBuilderTest { - - final String id = "an id"; - - final Collection to = Arrays.asList("to1", "to2"); - - final String from = "from value"; - - final boolean canceled = true; - final Parameters parameters = null; - final Instant createdAt = Instant.now(); - final Instant modifiedAt = Instant.now(); - final DeliveryReportType deliveryReport = DeliveryReportType.FULL; - final Instant sendAt = Instant.now(); - final Instant expireAt = Instant.now(); - final String callbackUrl = "callback value"; - final String clientReference = " client reference"; - final boolean feedbackEnabled = false; - - final MediaBody body = new MediaBody("body message", "url value"); - final boolean strictValidation = true; - - final BatchMedia value = - BatchMedia.builder() - .setId(id) - .setTo(to) - .setFrom(from) - .setCanceled(canceled) - .setBody(body) - .setParameters(parameters) - .setCreatedAt(createdAt) - .setModifiedAt(modifiedAt) - .setDeliveryReport(deliveryReport) - .setSendAt(sendAt) - .setExpireAt(expireAt) - .setCallbackUrl(callbackUrl) - .setClientReference(clientReference) - .setFeedbackEnabled(feedbackEnabled) - .setStrictValidation(strictValidation) - .build(); - - @Test - void getId() { - Assertions.assertThat(value.getId()).isEqualTo(id); - } - - @Test - void getTo() { - Assertions.assertThat(value.getTo()).usingRecursiveComparison().isEqualTo(to); - } - - @Test - void getFrom() { - Assertions.assertThat(value.getFrom()).isEqualTo(from); - } - - @Test - void isCanceled() { - Assertions.assertThat(value.isCanceled()).isEqualTo(canceled); - } - - @Test - void getBody() { - Assertions.assertThat(value.getBody()).isEqualTo(body); - } - - @Test - void getParameters() { - Assertions.assertThat(value.getParameters()).isEqualTo(parameters); - } - - @Test - void getExpireAt() { - Assertions.assertThat(value.getExpireAt()).isEqualTo(expireAt); - } - - @Test - void getCreatedAt() { - Assertions.assertThat(value.getCreatedAt()).isEqualTo(createdAt); - } - - @Test - void getModifiedAt() { - Assertions.assertThat(value.getModifiedAt()).isEqualTo(modifiedAt); - } - - @Test - void getDeliveryReport() { - Assertions.assertThat(value.getDeliveryReport()).isEqualTo(deliveryReport); - } - - @Test - void getSendAt() { - Assertions.assertThat(value.getSendAt()).isEqualTo(sendAt); - } - - @Test - void getCallbackUrl() { - Assertions.assertThat(value.getCallbackUrl()).isEqualTo(callbackUrl); - } - - @Test - void getClientReference() { - Assertions.assertThat(value.getClientReference()).isEqualTo(clientReference); - } - - @Test - void isFeedbackEnabled() { - Assertions.assertThat(value.isFeedbackEnabled()).isEqualTo(feedbackEnabled); - } - - @Test - void isStrictValidation() { - Assertions.assertThat(value.isStrictValidation()).isEqualTo(strictValidation); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/sms/models/BatchMediaTest.java b/client/src/test/java/com/sinch/sdk/domains/sms/models/BatchMediaTest.java deleted file mode 100644 index 95ac1cbb5..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/sms/models/BatchMediaTest.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import com.sinch.sdk.core.utils.Pair; -import java.time.Instant; -import java.util.Arrays; -import java.util.Collection; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class BatchMediaTest { - final String id = "an id"; - - final Collection to = Arrays.asList("to1", "to2"); - - final String from = "from value"; - - final boolean canceled = true; - final Parameters parameters = - new Parameters( - Arrays.asList( - new Parameters.Entry("key 1", new Pair<>("value identifier1", "value 1")), - new Parameters.Entry( - "key 2", new Pair<>("value identifier2", "value 2"), "default value for "))); - final Instant createdAt = Instant.now(); - final Instant modifiedAt = Instant.now(); - final DeliveryReportType deliveryReport = DeliveryReportType.FULL; - final Instant sendAt = Instant.now(); - final Instant expireAt = Instant.now(); - final String callbackUrl = "callback value"; - final String clientReference = " client reference"; - final boolean feedbackEnabled = false; - final MediaBody body = new MediaBody("url value", "body message"); - final boolean strictValidation = true; - final BatchMedia value = - new BatchMedia( - id, - to, - from, - canceled, - body, - createdAt, - modifiedAt, - deliveryReport, - sendAt, - expireAt, - callbackUrl, - clientReference, - feedbackEnabled, - parameters, - strictValidation); - - @Test - void getId() { - Assertions.assertThat(value.getId()).isEqualTo(id); - } - - @Test - void getTo() { - Assertions.assertThat(value.getTo()).usingRecursiveComparison().isEqualTo(to); - } - - @Test - void getFrom() { - Assertions.assertThat(value.getFrom()).isEqualTo(from); - } - - @Test - void isCanceled() { - Assertions.assertThat(value.isCanceled()).isEqualTo(canceled); - } - - @Test - void getBody() { - Assertions.assertThat(value.getBody()).isEqualTo(body); - } - - @Test - void getParameters() { - Assertions.assertThat(value.getParameters()).usingRecursiveComparison().isEqualTo(parameters); - } - - @Test - void getExpireAt() { - Assertions.assertThat(value.getExpireAt()).isEqualTo(expireAt); - } - - @Test - void getCreatedAt() { - Assertions.assertThat(value.getCreatedAt()).isEqualTo(createdAt); - } - - @Test - void getModifiedAt() { - Assertions.assertThat(value.getModifiedAt()).isEqualTo(modifiedAt); - } - - @Test - void getDeliveryReport() { - Assertions.assertThat(value.getDeliveryReport()).isEqualTo(deliveryReport); - } - - @Test - void getSendAt() { - Assertions.assertThat(value.getSendAt()).isEqualTo(sendAt); - } - - @Test - void getCallbackUrl() { - Assertions.assertThat(value.getCallbackUrl()).isEqualTo(callbackUrl); - } - - @Test - void getClientReference() { - Assertions.assertThat(value.getClientReference()).isEqualTo(clientReference); - } - - @Test - void isFeedbackEnabled() { - Assertions.assertThat(value.isFeedbackEnabled()).isEqualTo(feedbackEnabled); - } - - @Test - void isStrictValidation() { - Assertions.assertThat(value.isStrictValidation()).isEqualTo(strictValidation); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/sms/models/BatchTest.java b/client/src/test/java/com/sinch/sdk/domains/sms/models/BatchTest.java deleted file mode 100644 index 7da9d943f..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/sms/models/BatchTest.java +++ /dev/null @@ -1,117 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import java.time.Instant; -import java.util.Arrays; -import java.util.Collection; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class BatchTest { - - final String id = "an id"; - - final Collection to = Arrays.asList("to1", "to2"); - - final String from = "from value"; - - final boolean canceled = true; - - final Integer body = -45; - - final Instant createdAt = Instant.now(); - - final Instant modifiedAt = Instant.now(); - - final DeliveryReportType deliveryReport = DeliveryReportType.FULL; - - final Instant sendAt = Instant.now(); - - final Instant expireAt = Instant.now(); - - final String callbackUrl = "callback value"; - - final String clientReference = " client reference"; - - final boolean feedbackEnabled = false; - - final Batch value = - new Batch<>( - id, - to, - from, - canceled, - body, - createdAt, - modifiedAt, - deliveryReport, - sendAt, - expireAt, - callbackUrl, - clientReference, - feedbackEnabled); - - @Test - void getId() { - Assertions.assertThat(value.getId()).isEqualTo(id); - } - - @Test - void getTo() { - Assertions.assertThat(value.getTo()).usingRecursiveComparison().isEqualTo(to); - } - - @Test - void getFrom() { - Assertions.assertThat(value.getFrom()).isEqualTo(from); - } - - @Test - void isCanceled() { - Assertions.assertThat(value.isCanceled()).isEqualTo(canceled); - } - - @Test - void getBody() { - Assertions.assertThat(value.getBody()).isEqualTo(body); - } - - @Test - void getExpireAt() { - Assertions.assertThat(value.getExpireAt()).isEqualTo(expireAt); - } - - @Test - void getCreatedAt() { - Assertions.assertThat(value.getCreatedAt()).isEqualTo(createdAt); - } - - @Test - void getModifiedAt() { - Assertions.assertThat(value.getModifiedAt()).isEqualTo(modifiedAt); - } - - @Test - void getDeliveryReport() { - Assertions.assertThat(value.getDeliveryReport()).isEqualTo(deliveryReport); - } - - @Test - void getSendAt() { - Assertions.assertThat(value.getSendAt()).isEqualTo(sendAt); - } - - @Test - void getCallbackUrl() { - Assertions.assertThat(value.getCallbackUrl()).isEqualTo(callbackUrl); - } - - @Test - void getClientReference() { - Assertions.assertThat(value.getClientReference()).isEqualTo(clientReference); - } - - @Test - void isFeedbackEnabled() { - Assertions.assertThat(value.isFeedbackEnabled()).isEqualTo(feedbackEnabled); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/sms/models/BatchTextBuilderTest.java b/client/src/test/java/com/sinch/sdk/domains/sms/models/BatchTextBuilderTest.java deleted file mode 100644 index 1054c47f2..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/sms/models/BatchTextBuilderTest.java +++ /dev/null @@ -1,143 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import java.time.Instant; -import java.util.Arrays; -import java.util.Collection; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class BatchTextBuilderTest { - - final String id = "an id"; - - final Collection to = Arrays.asList("to1", "to2"); - - final String from = "from value"; - - final boolean canceled = true; - final Parameters parameters = null; - final Instant createdAt = Instant.now(); - final Instant modifiedAt = Instant.now(); - final DeliveryReportType deliveryReport = DeliveryReportType.FULL; - final Instant sendAt = Instant.now(); - final Instant expireAt = Instant.now(); - final String callbackUrl = "callback value"; - final String clientReference = " client reference"; - final boolean feedbackEnabled = false; - final boolean truncateConcat = true; - final int maxNumberOfMessageParts = 23; - final int fromTon = 1234; - final int fromNpi = 567; - final String body = "body content"; - final BatchText value = - BatchText.builder() - .setId(id) - .setTo(to) - .setFrom(from) - .setCanceled(canceled) - .setBody(body) - .setCreatedAt(createdAt) - .setModifiedAt(modifiedAt) - .setDeliveryReport(deliveryReport) - .setSendAt(sendAt) - .setExpireAt(expireAt) - .setCallbackUrl(callbackUrl) - .setClientReference(clientReference) - .setFeedbackEnabled(feedbackEnabled) - .setTruncateConcat(truncateConcat) - .setMaxNumberOfMessageParts(maxNumberOfMessageParts) - .setFromTon(fromTon) - .setFromNpi(fromNpi) - .setParameters(parameters) - .build(); - - @Test - void getId() { - Assertions.assertThat(value.getId()).isEqualTo(id); - } - - @Test - void getTo() { - Assertions.assertThat(value.getTo()).usingRecursiveComparison().isEqualTo(to); - } - - @Test - void getFrom() { - Assertions.assertThat(value.getFrom()).isEqualTo(from); - } - - @Test - void isCanceled() { - Assertions.assertThat(value.isCanceled()).isEqualTo(canceled); - } - - @Test - void getBody() { - Assertions.assertThat(value.getBody()).isEqualTo(body); - } - - @Test - void getParameters() { - Assertions.assertThat(value.getParameters()).isEqualTo(parameters); - } - - @Test - void getExpireAt() { - Assertions.assertThat(value.getExpireAt()).isEqualTo(expireAt); - } - - @Test - void getCreatedAt() { - Assertions.assertThat(value.getCreatedAt()).isEqualTo(createdAt); - } - - @Test - void getModifiedAt() { - Assertions.assertThat(value.getModifiedAt()).isEqualTo(modifiedAt); - } - - @Test - void getDeliveryReport() { - Assertions.assertThat(value.getDeliveryReport()).isEqualTo(deliveryReport); - } - - @Test - void getSendAt() { - Assertions.assertThat(value.getSendAt()).isEqualTo(sendAt); - } - - @Test - void getCallbackUrl() { - Assertions.assertThat(value.getCallbackUrl()).isEqualTo(callbackUrl); - } - - @Test - void getClientReference() { - Assertions.assertThat(value.getClientReference()).isEqualTo(clientReference); - } - - @Test - void isFeedbackEnabled() { - Assertions.assertThat(value.isFeedbackEnabled()).isEqualTo(feedbackEnabled); - } - - @Test - void isTruncateConcat() { - Assertions.assertThat(value.isTruncateConcat()).isEqualTo(truncateConcat); - } - - @Test - void getMaxNumberOfMessageParts() { - Assertions.assertThat(value.getMaxNumberOfMessageParts()).isEqualTo(maxNumberOfMessageParts); - } - - @Test - void getFromTon() { - Assertions.assertThat(value.getFromTon()).isEqualTo(fromTon); - } - - @Test - void getFromNpi() { - Assertions.assertThat(value.getFromNpi()).isEqualTo(fromNpi); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/sms/models/BatchTextTest.java b/client/src/test/java/com/sinch/sdk/domains/sms/models/BatchTextTest.java deleted file mode 100644 index 604882a67..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/sms/models/BatchTextTest.java +++ /dev/null @@ -1,144 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import java.time.Instant; -import java.util.Arrays; -import java.util.Collection; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class BatchTextTest { - - final String id = "an id"; - - final Collection to = Arrays.asList("to1", "to2"); - - final String from = "from value"; - - final boolean canceled = true; - final Parameters parameters = null; - final Instant createdAt = Instant.now(); - final Instant modifiedAt = Instant.now(); - final DeliveryReportType deliveryReport = DeliveryReportType.FULL; - final Instant sendAt = Instant.now(); - final Instant expireAt = Instant.now(); - final String callbackUrl = "callback value"; - final String clientReference = " client reference"; - final boolean flashMessage = true; - final boolean feedbackEnabled = false; - final boolean truncateConcat = true; - final int maxNumberOfMessageParts = 23; - final int fromTon = 1234; - final int fromNpi = 567; - final String body = "body content"; - final BatchText value = - new BatchText( - id, - to, - from, - canceled, - body, - createdAt, - modifiedAt, - deliveryReport, - sendAt, - expireAt, - callbackUrl, - clientReference, - flashMessage, - feedbackEnabled, - parameters, - truncateConcat, - maxNumberOfMessageParts, - fromTon, - fromNpi); - - @Test - void getId() { - Assertions.assertThat(value.getId()).isEqualTo(id); - } - - @Test - void getTo() { - Assertions.assertThat(value.getTo()).usingRecursiveComparison().isEqualTo(to); - } - - @Test - void getFrom() { - Assertions.assertThat(value.getFrom()).isEqualTo(from); - } - - @Test - void isCanceled() { - Assertions.assertThat(value.isCanceled()).isEqualTo(canceled); - } - - @Test - void getBody() { - Assertions.assertThat(value.getBody()).isEqualTo(body); - } - - @Test - void getParameters() { - Assertions.assertThat(value.getParameters()).isEqualTo(parameters); - } - - @Test - void getExpireAt() { - Assertions.assertThat(value.getExpireAt()).isEqualTo(expireAt); - } - - @Test - void getCreatedAt() { - Assertions.assertThat(value.getCreatedAt()).isEqualTo(createdAt); - } - - @Test - void getModifiedAt() { - Assertions.assertThat(value.getModifiedAt()).isEqualTo(modifiedAt); - } - - @Test - void getDeliveryReport() { - Assertions.assertThat(value.getDeliveryReport()).isEqualTo(deliveryReport); - } - - @Test - void getSendAt() { - Assertions.assertThat(value.getSendAt()).isEqualTo(sendAt); - } - - @Test - void getCallbackUrl() { - Assertions.assertThat(value.getCallbackUrl()).isEqualTo(callbackUrl); - } - - @Test - void getClientReference() { - Assertions.assertThat(value.getClientReference()).isEqualTo(clientReference); - } - - @Test - void isFeedbackEnabled() { - Assertions.assertThat(value.isFeedbackEnabled()).isEqualTo(feedbackEnabled); - } - - @Test - void isTruncateConcat() { - Assertions.assertThat(value.isTruncateConcat()).isEqualTo(truncateConcat); - } - - @Test - void getMaxNumberOfMessageParts() { - Assertions.assertThat(value.getMaxNumberOfMessageParts()).isEqualTo(maxNumberOfMessageParts); - } - - @Test - void getFromTon() { - Assertions.assertThat(value.getFromTon()).isEqualTo(fromTon); - } - - @Test - void getFromNpi() { - Assertions.assertThat(value.getFromNpi()).isEqualTo(fromNpi); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/sms/models/MediaBodyTest.java b/client/src/test/java/com/sinch/sdk/domains/sms/models/MediaBodyTest.java deleted file mode 100644 index 1579b7ea6..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/sms/models/MediaBodyTest.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class MediaBodyTest { - - final MediaBody value = new MediaBody("the url", "the message"); - - @Test - void getMessage() { - Assertions.assertThat(value.getMessage().get()).isEqualTo("the message"); - } - - @Test - void getUrl() { - Assertions.assertThat(value.getUrl()).isEqualTo("the url"); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/sms/models/ParametersTest.java b/client/src/test/java/com/sinch/sdk/domains/sms/models/ParametersTest.java deleted file mode 100644 index 0e193f93d..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/sms/models/ParametersTest.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.core.utils.Pair; -import java.util.ArrayList; -import java.util.Arrays; -import org.junit.jupiter.api.Test; - -class ParametersTest { - final Parameters parameters = - new Parameters( - Arrays.asList( - new Parameters.Entry("key 1", new Pair<>("value identifier1", "value 1")), - new Parameters.Entry( - "key 1", - new Pair<>("value identifier1 duplicated key", "value 1 duplicated key")), - new Parameters.Entry( - "key 2", new Pair<>("value identifier2", "value 2"), "default value for "))); - - @Test - void getParameters() { - - TestHelpers.recursiveEquals( - parameters.get("key 2"), - new ArrayList( - Arrays.asList( - new Parameters.Entry( - "key 2", new Pair<>("value identifier2", "value 2"), "default value for ")))); - } - - @Test - void duplicatedKey() { - - TestHelpers.recursiveEquals( - parameters.get("key 1"), - new ArrayList( - Arrays.asList( - new Parameters.Entry("key 1", new Pair<>("value identifier1", "value 1")), - new Parameters.Entry( - "key 1", - new Pair<>("value identifier1 duplicated key", "value 1 duplicated key"))))); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/sms/models/SMSCursorPageNavigatorTest.java b/client/src/test/java/com/sinch/sdk/domains/sms/models/SMSCursorPageNavigatorTest.java deleted file mode 100644 index b734ee127..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/sms/models/SMSCursorPageNavigatorTest.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.sinch.sdk.domains.sms.models; - -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class SMSCursorPageNavigatorTest { - - @Test - void getTokenNullPageSize() { - SMSCursorPageNavigator cursorNavigator = new SMSCursorPageNavigator(45, null); - Assertions.assertThat(cursorNavigator.getToken()).isEqualTo(null); - } - - @Test - void getTokenZeroPageSize() { - SMSCursorPageNavigator cursorNavigator = new SMSCursorPageNavigator(45, 0); - Assertions.assertThat(cursorNavigator.getToken()).isEqualTo(null); - } - - @Test - void getToken() { - SMSCursorPageNavigator cursorNavigator = new SMSCursorPageNavigator(0, 15); - Assertions.assertThat(cursorNavigator.getToken()).isEqualTo(1); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/sms/models/requests/BatchesListRequestParametersBuilderTest.java b/client/src/test/java/com/sinch/sdk/domains/sms/models/requests/BatchesListRequestParametersBuilderTest.java deleted file mode 100644 index 3dfe21753..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/sms/models/requests/BatchesListRequestParametersBuilderTest.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.sinch.sdk.domains.sms.models.requests; - -import java.time.Instant; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class BatchesListRequestParametersBuilderTest { - - static final String from = "foo from"; - - static Instant startDate = Instant.now(); - static Instant endDate = Instant.now(); - static String clientReference = "a client reference"; - static Integer page = 1; - static Integer pageSize = 3; - - public static final BatchesListRequestParameters value = - BatchesListRequestParameters.builder() - .setFrom(from) - .setStartDate(startDate) - .setEndDate(endDate) - .setClientReference(clientReference) - .setPage(page) - .setPageSize(pageSize) - .build(); - - @Test - void getFrom() { - Assertions.assertThat(value.getFrom().get()).isEqualTo(from); - } - - @Test - void getStartDate() { - Assertions.assertThat(value.getStartDate().get()).isEqualTo(startDate); - } - - @Test - void getEndDate() { - Assertions.assertThat(value.getEndDate().get()).isEqualTo(endDate); - } - - @Test - void getClientReference() { - Assertions.assertThat(value.getClientReference().get()).isEqualTo(clientReference); - } - - @Test - void getPage() { - Assertions.assertThat(value.getPage().get()).isEqualTo(page); - } - - @Test - void getPageSize() { - Assertions.assertThat(value.getPageSize().get()).isEqualTo(pageSize); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/sms/models/requests/DeliveryReportListRequestParametersBuilderTest.java b/client/src/test/java/com/sinch/sdk/domains/sms/models/requests/DeliveryReportListRequestParametersBuilderTest.java deleted file mode 100644 index 74ea6ccdd..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/sms/models/requests/DeliveryReportListRequestParametersBuilderTest.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.sinch.sdk.domains.sms.models.requests; - -import com.sinch.sdk.domains.sms.models.DeliveryReportErrorCode; -import com.sinch.sdk.domains.sms.models.DeliveryReportStatus; -import java.time.Instant; -import java.util.Arrays; -import java.util.Collection; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class DeliveryReportListRequestParametersBuilderTest { - - final Instant startDate = Instant.now().plusSeconds(10); - final Instant endDate = Instant.now().plusSeconds(15); - final String clientReference = " client reference"; - final Integer page = 12; - final Integer pageSize = 3; - final Collection statuses = - Arrays.asList(DeliveryReportStatus.CANCELLED, DeliveryReportStatus.DELETED); - final Collection codes = - Arrays.asList( - DeliveryReportErrorCode.from(123), DeliveryReportErrorCode.DELIVERY_REPORT_UNREACHABLE); - final DeliveryReportListRequestParameters value = - DeliveryReportListRequestParameters.builder() - .setStartDate(startDate) - .setEndDate(endDate) - .setClientReference(clientReference) - .setPage(page) - .setPageSize(pageSize) - .setStatuses(statuses) - .setCodes(codes) - .build(); - - @Test - void getStartDate() { - Assertions.assertThat(value.getStartDate().get()).isEqualTo(startDate); - } - - @Test - void getEndDate() { - Assertions.assertThat(value.getEndDate().get()).isEqualTo(endDate); - } - - @Test - void getClientReference() { - Assertions.assertThat(value.getClientReference().get()).isEqualTo(clientReference); - } - - @Test - void getPage() { - Assertions.assertThat(value.getPage().get()).isEqualTo(page); - } - - @Test - void getPageSize() { - Assertions.assertThat(value.getPageSize().get()).isEqualTo(pageSize); - } - - @Test - void getStatuses() { - Assertions.assertThat(value.getStatuses().get()).usingRecursiveComparison().isEqualTo(statuses); - } - - @Test - void getCodes() { - Assertions.assertThat(value.getCodes().get()).usingRecursiveComparison().isEqualTo(codes); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/sms/models/requests/GroupCreateRequestParametersBuilderTest.java b/client/src/test/java/com/sinch/sdk/domains/sms/models/requests/GroupCreateRequestParametersBuilderTest.java deleted file mode 100644 index 528b324a8..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/sms/models/requests/GroupCreateRequestParametersBuilderTest.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.sinch.sdk.domains.sms.models.requests; - -import static org.junit.jupiter.api.Assertions.*; - -import java.util.Collection; -import java.util.Collections; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class GroupCreateRequestParametersBuilderTest { - - final String name = "my name"; - final String member = "a member"; - final String childGroupId = "a group id"; - - Collection members = Collections.singletonList(member); - Collection childGroupIds = Collections.singletonList(childGroupId); - GroupAutoUpdateRequestParameters autoUpdate = GroupAutoUpdateRequestParameters.builder().build(); - final GroupCreateRequestParameters value = - GroupCreateRequestParameters.builder() - .setName(name) - .setMembers(members) - .setChildGroupIds(childGroupIds) - .setAutoUpdate(autoUpdate) - .build(); - - @Test - void getName() { - Assertions.assertThat(value.getName().get()).isEqualTo(name); - } - - @Test - void getMembers() { - Assertions.assertThat(value.getMembers().get()).isEqualTo(members); - } - - @Test - void getChildGroupIds() { - Assertions.assertThat(value.getChildGroupIds().get()).isEqualTo(childGroupIds); - } - - @Test - void getAutoUpdate() { - Assertions.assertThat(value.getAutoUpdate().get()).isEqualTo(autoUpdate); - } -} diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v0/BatchesSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v0/BatchesSteps.java deleted file mode 100644 index ca7d7053b..000000000 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v0/BatchesSteps.java +++ /dev/null @@ -1,367 +0,0 @@ -package com.sinch.sdk.e2e.domains.sms.v0; - -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.core.utils.Pair; -import com.sinch.sdk.domains.sms.BatchesService; -import com.sinch.sdk.domains.sms.models.BatchText; -import com.sinch.sdk.domains.sms.models.DeliveryReportType; -import com.sinch.sdk.domains.sms.models.DryRun; -import com.sinch.sdk.domains.sms.models.DryRunPerRecipientDetails; -import com.sinch.sdk.domains.sms.models.Parameters; -import com.sinch.sdk.domains.sms.models.requests.BatchesListRequestParameters; -import com.sinch.sdk.domains.sms.models.requests.SendSmsBatchTextRequest; -import com.sinch.sdk.domains.sms.models.requests.UpdateSmsBatchTextRequest; -import com.sinch.sdk.domains.sms.models.responses.BatchesListResponse; -import com.sinch.sdk.e2e.Config; -import io.cucumber.java.en.Given; -import io.cucumber.java.en.Then; -import io.cucumber.java.en.When; -import java.time.Instant; -import java.util.Arrays; -import java.util.Collections; -import java.util.concurrent.atomic.AtomicInteger; -import org.junit.jupiter.api.Assertions; - -public class BatchesSteps { - - BatchesService service; - - BatchText sendTextResponse; - BatchText sendTextWithParametersResponse; - DryRun dryRunResponse; - BatchesListResponse listOnePageResponse; - BatchesListResponse listAllResponse; - BatchesListResponse listAllByPageResponse; - BatchText getBatchResponse; - BatchText updateResponse; - BatchText replaceResponse; - BatchText cancelResponse; - Boolean sendDeliveryFeedbackPassed; - - @Given("^the SMS service \"Batches\" is available") - public void serviceAvailable() { - - service = Config.getSinchClient().sms().batches(); - } - - @When("^I send a request to send a text message$") - public void send() { - SendSmsBatchTextRequest request = - SendSmsBatchTextRequest.builder() - .setBody("SMS body message") - .setTo(Collections.singletonList("+12017777777")) - .setFrom("+12015555555") - .setSendAt(Instant.parse("2024-06-06T09:25:00Z")) - .setDeliveryReport(DeliveryReportType.FULL) - .setFeedbackEnabled(true) - .build(); - - sendTextResponse = service.send(request); - } - - @When("^I send a request to send a text message with multiple parameters$") - public void sendWithParameters() { - SendSmsBatchTextRequest request = - SendSmsBatchTextRequest.builder() - .setBody("Hello ${name}! Get 20% off with this discount code ${code}") - .setTo(Arrays.asList("+12017777777", "+12018888888")) - .setFrom("+12015555555") - .setParameters( - new Parameters( - Arrays.asList( - new Parameters.Entry("name", new Pair<>("+12017777777", "John"), "there"), - new Parameters.Entry("name", new Pair<>("+12018888888", "Paul")), - new Parameters.Entry( - "code", new Pair<>("+12017777777", "HALLOWEEN20 \uD83C\uDF83"))))) - .setDeliveryReport(DeliveryReportType.FULL) - .build(); - - sendTextWithParametersResponse = service.send(request); - } - - @When("^I send a request to perform a dry run of a batch$") - public void dryRun() { - SendSmsBatchTextRequest request = - SendSmsBatchTextRequest.builder() - .setBody("Hello ${name}!") - .setTo(Arrays.asList("+12017777777", "+12018888888", "+12019999999")) - .setFrom("+12015555555") - .setParameters( - new Parameters( - Arrays.asList( - new Parameters.Entry("name", new Pair<>("+12017777777", "John"), "there")))) - .setDeliveryReport(DeliveryReportType.NONE) - .build(); - - dryRunResponse = service.dryRun(true, 3, request); - } - - @When("^I send a request to list the SMS batches$") - public void listOnePage() { - BatchesListRequestParameters request = - BatchesListRequestParameters.builder().setPageSize(2).build(); - - listOnePageResponse = service.list(request); - } - - @When("^I send a request to list all the SMS batches$") - public void listAll() { - BatchesListRequestParameters request = - BatchesListRequestParameters.builder().setPageSize(2).build(); - - listAllResponse = service.list(request); - } - - @When("^I iterate manually over the SMS batches pages$") - public void listAllByPage() { - BatchesListRequestParameters request = - BatchesListRequestParameters.builder().setPageSize(2).build(); - - listAllByPageResponse = service.list(request); - } - - @When("^I send a request to retrieve an SMS batch$") - public void get() { - - getBatchResponse = service.get("foo"); - } - - @When("^I send a request to update an SMS batch$") - public void update() { - - UpdateSmsBatchTextRequest request = - UpdateSmsBatchTextRequest.builder() - .setFrom("+12016666666") - .setToAdd(Collections.singletonList("01W4FFL35P4NC4K35SMSGROUP1")) - .setDeliveryReport(DeliveryReportType.SUMMARY) - .build(); - updateResponse = service.update("foo", request); - } - - @When("^I send a request to replace an SMS batch$") - public void replace() { - - SendSmsBatchTextRequest request = - SendSmsBatchTextRequest.builder() - .setFrom("+12016666666") - .setTo(Collections.singletonList("+12018888888")) - .setBody("This is the replacement batch") - .setSendAt(Instant.parse("2024-06-06T09:35:00Z")) - .build(); - replaceResponse = service.replace("foo", request); - } - - @When("^I send a request to cancel an SMS batch$") - public void cancel() { - - cancelResponse = service.cancel("foo"); - } - - @When("^I send a request to send delivery feedbacks$") - public void sendDeliveryFeedback() { - - service.sendDeliveryFeedback("foo", Arrays.asList("+12017777777")); - sendDeliveryFeedbackPassed = true; - } - - @Then("the response contains the text SMS details") - public void sendResult() { - BatchText expected = - BatchText.builder() - .setId("01W4FFL35P4NC4K35SMSBATCH1") - .setTo(Collections.singletonList("12017777777")) - .setFrom("12015555555") - .setCanceled(false) - .setBody("SMS body message") - .setCreatedAt(Instant.parse("2024-06-06T09:22:14.304Z")) - .setModifiedAt(Instant.parse("2024-06-06T09:22:14.304Z")) - .setDeliveryReport(DeliveryReportType.FULL) - .setSendAt(Instant.parse("2024-06-06T09:25:00Z")) - .setExpireAt(Instant.parse("2024-06-09T09:25:00Z")) - .setFeedbackEnabled(true) - .setFlashMessage(false) - .build(); - - TestHelpers.recursiveEquals(sendTextResponse, expected); - } - - @Then("the response contains the text SMS details with multiple parameters") - public void sendWithParametersResult() { - BatchText expected = - BatchText.builder() - .setId("01W4FFL35P4NC4K35SMSBATCH2") - .setTo(Arrays.asList("12017777777", "12018888888")) - .setFrom("12015555555") - .setCanceled(false) - .setParameters( - new Parameters( - Arrays.asList( - new Parameters.Entry("name", new Pair<>("+12017777777", "John"), "there"), - new Parameters.Entry("name", new Pair<>("+12018888888", "Paul")), - new Parameters.Entry( - "code", new Pair<>("+12017777777", "HALLOWEEN20 \uD83C\uDF83"))))) - .setBody("Hello ${name}! Get 20% off with this discount code ${code}") - .setCreatedAt(Instant.parse("2024-06-06T09:22:14.304Z")) - .setModifiedAt(Instant.parse("2024-06-06T09:22:14.304Z")) - .setDeliveryReport(DeliveryReportType.FULL) - .setExpireAt(Instant.parse("2024-06-06T09:22:14.304Z")) - .setFlashMessage(false) - .build(); - - TestHelpers.recursiveEquals(sendTextWithParametersResponse, expected); - } - - @Then( - "the response contains the calculated bodies and number of parts for all messages in the" - + " batch") - public void dryRunResult() { - DryRun expected = - DryRun.builder() - .setNumberOfRecipients(3) - .setNumberOfMessages(3) - .setPerRecipient( - Arrays.asList( - DryRunPerRecipientDetails.builder() - .setRecipient("12017777777") - .setNumberOfParts(1) - .setBody("Hello John!") - .setEncoding("text") - .build(), - DryRunPerRecipientDetails.builder() - .setRecipient("12019999999") - .setNumberOfParts(1) - .setBody("Hello there!") - .setEncoding("text") - .build(), - DryRunPerRecipientDetails.builder() - .setRecipient("12018888888") - .setNumberOfParts(1) - .setBody("Hello there!") - .setEncoding("text") - .build())) - .build(); - - TestHelpers.recursiveEquals(dryRunResponse, expected); - } - - @Then("the response contains \"{int}\" SMS batches") - public void onePageResult(int expected) { - - Assertions.assertEquals(listOnePageResponse.getContent().size(), expected); - } - - @Then("the SMS batches list contains \"{int}\" SMS batches") - public void listAllResult(int expected) { - - BatchesListResponse response = - null != listAllResponse ? listAllResponse : listAllByPageResponse; - - AtomicInteger count = new AtomicInteger(); - response.iterator().forEachRemaining(_unused -> count.getAndIncrement()); - - Assertions.assertEquals(count.get(), expected); - } - - @Then("the SMS batches iteration result contains the data from \"{int}\" pages") - public void listAllByPageResult(int expected) { - - int count = listAllByPageResponse.getContent().isEmpty() ? 0 : 1; - while (listAllByPageResponse.hasNextPage()) { - count++; - listAllByPageResponse = listAllByPageResponse.nextPage(); - } - Assertions.assertEquals(count, expected); - } - - @Then("the response contains the SMS batch details") - public void getResult() { - - BatchText expected = - BatchText.builder() - .setId("01W4FFL35P4NC4K35SMSBATCH1") - .setTo(Collections.singletonList("12017777777")) - .setFrom("12015555555") - .setCanceled(false) - .setBody("SMS body message") - .setCreatedAt(Instant.parse("2024-06-06T09:22:14.304Z")) - .setModifiedAt(Instant.parse("2024-06-06T09:22:14.304Z")) - .setDeliveryReport(DeliveryReportType.FULL) - .setSendAt(Instant.parse("2024-06-06T09:25:00Z")) - .setExpireAt(Instant.parse("2024-06-09T09:25:00Z")) - .setFeedbackEnabled(true) - .setFlashMessage(false) - .build(); - - TestHelpers.recursiveEquals(getBatchResponse, expected); - } - - @Then("the response contains the SMS batch details with updated data") - public void updateResult() { - - BatchText expected = - BatchText.builder() - .setId("01W4FFL35P4NC4K35SMSBATCH1") - .setTo(Arrays.asList("12017777777", "01W4FFL35P4NC4K35SMSGROUP1")) - .setFrom("12016666666") - .setCanceled(false) - .setBody("SMS body message") - .setCreatedAt(Instant.parse("2024-06-06T09:22:14.304Z")) - .setModifiedAt(Instant.parse("2024-06-06T09:22:48.054Z")) - .setDeliveryReport(DeliveryReportType.SUMMARY) - .setSendAt(Instant.parse("2024-06-06T09:25:00Z")) - .setExpireAt(Instant.parse("2024-06-09T09:25:00Z")) - .setFeedbackEnabled(true) - .setFlashMessage(false) - .build(); - - TestHelpers.recursiveEquals(updateResponse, expected); - } - - @Then("the response contains the new SMS batch details with the provided data for replacement") - public void replaceResult() { - - BatchText expected = - BatchText.builder() - .setId("01W4FFL35P4NC4K35SMSBATCH1") - .setTo(Arrays.asList("12018888888")) - .setFrom("12016666666") - .setCanceled(false) - .setBody("This is the replacement batch") - .setCreatedAt(Instant.parse("2024-06-06T09:22:14.304Z")) - .setModifiedAt(Instant.parse("2024-06-06T09:23:32.504Z")) - .setDeliveryReport(DeliveryReportType.NONE) - .setSendAt(Instant.parse("2024-06-06T09:35:00Z")) - .setExpireAt(Instant.parse("2024-06-09T09:35:00Z")) - .setFlashMessage(false) - .build(); - - TestHelpers.recursiveEquals(replaceResponse, expected); - } - - @Then("the response contains the SMS batch details with a cancelled status") - public void cancelResult() { - - BatchText expected = - BatchText.builder() - .setId("01W4FFL35P4NC4K35SMSBATCH1") - .setTo(Arrays.asList("12017777777")) - .setFrom("12015555555") - .setCanceled(true) - .setBody("SMS body message") - .setCreatedAt(Instant.parse("2024-06-06T09:22:14.304Z")) - .setModifiedAt(Instant.parse("2024-06-06T09:22:29.978Z")) - .setDeliveryReport(DeliveryReportType.FULL) - .setSendAt(Instant.parse("2024-06-06T09:25:00Z")) - .setExpireAt(Instant.parse("2024-06-09T09:25:00Z")) - .setFeedbackEnabled(true) - .setFlashMessage(false) - .build(); - - TestHelpers.recursiveEquals(cancelResponse, expected); - } - - @Then("the delivery feedback response contains no data") - public void setSendDeliveryFeedbackResult() { - Assertions.assertTrue(sendDeliveryFeedbackPassed); - } -} diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v0/DeliveryReportsSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v0/DeliveryReportsSteps.java deleted file mode 100644 index 74ec37136..000000000 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v0/DeliveryReportsSteps.java +++ /dev/null @@ -1,184 +0,0 @@ -package com.sinch.sdk.e2e.domains.sms.v0; - -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.domains.sms.DeliveryReportsService; -import com.sinch.sdk.domains.sms.models.DeliveryReportBatch; -import com.sinch.sdk.domains.sms.models.DeliveryReportBatchSMS; -import com.sinch.sdk.domains.sms.models.DeliveryReportErrorCode; -import com.sinch.sdk.domains.sms.models.DeliveryReportRecipient; -import com.sinch.sdk.domains.sms.models.DeliveryReportRecipientSMS; -import com.sinch.sdk.domains.sms.models.DeliveryReportStatus; -import com.sinch.sdk.domains.sms.models.DeliveryReportStatusDetails; -import com.sinch.sdk.domains.sms.models.DeliveryReportType; -import com.sinch.sdk.domains.sms.models.requests.DeliveryReportBatchGetRequestParameters; -import com.sinch.sdk.domains.sms.models.requests.DeliveryReportListRequestParameters; -import com.sinch.sdk.domains.sms.models.responses.DeliveryReportsListResponse; -import com.sinch.sdk.e2e.Config; -import io.cucumber.java.en.Given; -import io.cucumber.java.en.Then; -import io.cucumber.java.en.When; -import java.time.Instant; -import java.util.Arrays; -import java.util.Collections; -import java.util.concurrent.atomic.AtomicInteger; -import org.junit.jupiter.api.Assertions; - -public class DeliveryReportsSteps { - - DeliveryReportsService service; - - DeliveryReportBatch summaryReport; - DeliveryReportBatch fullReport; - DeliveryReportRecipient recipientReport; - DeliveryReportsListResponse listOnePageResponse; - DeliveryReportsListResponse listAllResponse; - DeliveryReportsListResponse listAllByPageResponse; - - @Given("^the SMS service \"Delivery Reports\" is available") - public void serviceAvailable() { - - service = Config.getSinchClient().sms().deliveryReports(); - } - - @When("^I send a request to retrieve a summary SMS delivery report$") - public void getSummary() { - DeliveryReportBatchGetRequestParameters request = - DeliveryReportBatchGetRequestParameters.builder() - .setType(DeliveryReportType.SUMMARY) - .setStatuses(Arrays.asList(DeliveryReportStatus.DELIVERED, DeliveryReportStatus.FAILED)) - .setCodes(Arrays.asList(15, 0)) - .build(); - - summaryReport = service.get("foo", request); - } - - @When("^I send a request to retrieve a full SMS delivery report$") - public void getFull() { - DeliveryReportBatchGetRequestParameters request = - DeliveryReportBatchGetRequestParameters.builder().setType(DeliveryReportType.FULL).build(); - - fullReport = service.get("foo", request); - } - - @When("^I send a request to retrieve a recipient's delivery report$") - public void getRecipient() { - - recipientReport = service.getForNumber("foo", "+12345678"); - } - - @When("^I send a request to list the SMS delivery reports$") - public void listOnePage() { - DeliveryReportListRequestParameters request = - DeliveryReportListRequestParameters.builder().setPageSize(2).build(); - - listOnePageResponse = service.list(request); - } - - @When("^I send a request to list all the SMS delivery reports$") - public void listAll() { - DeliveryReportListRequestParameters request = - DeliveryReportListRequestParameters.builder().setPageSize(2).build(); - - listAllResponse = service.list(request); - } - - @When("^I iterate manually over the SMS delivery reports pages$") - public void listAllByPage() { - DeliveryReportListRequestParameters request = - DeliveryReportListRequestParameters.builder().setPageSize(2).build(); - - listAllByPageResponse = service.list(request); - } - - @Then("the response contains a summary SMS delivery report") - public void getSummaryResult() { - DeliveryReportBatch expected = - DeliveryReportBatchSMS.builder() - .setBatchId("01W4FFL35P4NC4K35SMSBATCH1") - .setClientReference("reference_e2e") - .setStatuses( - Arrays.asList( - DeliveryReportStatusDetails.builder() - .setCode(15) - .setCount(1) - .setStatus(DeliveryReportStatus.FAILED) - .build(), - DeliveryReportStatusDetails.builder() - .setCode(0) - .setCount(1) - .setStatus(DeliveryReportStatus.DELIVERED) - .build())) - .setTotalMessageCount(2) - .build(); - TestHelpers.recursiveEquals(summaryReport, expected); - } - - @Then("the response contains a full SMS delivery report") - public void getFullResult() { - DeliveryReportBatch expected = - DeliveryReportBatchSMS.builder() - .setBatchId("01W4FFL35P4NC4K35SMSBATCH1") - .setClientReference("reference_e2e") - .setStatuses( - Arrays.asList( - DeliveryReportStatusDetails.builder() - .setCode(0) - .setCount(1) - .setStatus(DeliveryReportStatus.DELIVERED) - .setRecipients(Collections.singletonList("12017777777")) - .build(), - DeliveryReportStatusDetails.builder() - .setCode(15) - .setCount(1) - .setStatus(DeliveryReportStatus.FAILED) - .setRecipients(Collections.singletonList("12018888888")) - .build())) - .setTotalMessageCount(2) - .build(); - TestHelpers.recursiveEquals(fullReport, expected); - } - - @Then("the response contains the recipient's delivery report details") - public void getRecipientResult() { - DeliveryReportRecipient expected = - DeliveryReportRecipientSMS.builder() - .setAt(Instant.parse("2024-06-06T13:06:27.833Z")) - .setBatchId("01W4FFL35P4NC4K35SMSBATCH1") - .setClientReference("reference_e2e") - .setCode(DeliveryReportErrorCode.from(0)) - .setOperatorStatusAt(Instant.parse("2024-06-06T13:06:00Z")) - .setRecipient("12017777777") - .setStatus(DeliveryReportStatus.DELIVERED) - .build(); - - TestHelpers.recursiveEquals(recipientReport, expected); - } - - @Then("the response contains \"{int}\" SMS delivery reports") - public void onePageResult(int expected) { - - Assertions.assertEquals(listOnePageResponse.getContent().size(), expected); - } - - @Then("the SMS delivery reports list contains \"{int}\" SMS delivery reports") - public void listAllResult(int expected) { - DeliveryReportsListResponse response = - null != listAllResponse ? listAllResponse : listAllByPageResponse; - - AtomicInteger count = new AtomicInteger(); - response.iterator().forEachRemaining(_unused -> count.getAndIncrement()); - - Assertions.assertEquals(count.get(), expected); - } - - @Then("the SMS delivery reports iteration result contains the data from \"{int}\" pages") - public void listAllByPageResult(int expected) { - - int count = listAllByPageResponse.getContent().isEmpty() ? 0 : 1; - while (listAllByPageResponse.hasNextPage()) { - count++; - listAllByPageResponse = listAllByPageResponse.nextPage(); - } - Assertions.assertEquals(count, expected); - } -} diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v0/GroupsSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v0/GroupsSteps.java deleted file mode 100644 index 41edc12d1..000000000 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v0/GroupsSteps.java +++ /dev/null @@ -1,227 +0,0 @@ -package com.sinch.sdk.e2e.domains.sms.v0; - -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.domains.sms.GroupsService; -import com.sinch.sdk.domains.sms.models.Group; -import com.sinch.sdk.domains.sms.models.requests.GroupCreateRequestParameters; -import com.sinch.sdk.domains.sms.models.requests.GroupReplaceRequestParameters; -import com.sinch.sdk.domains.sms.models.requests.GroupUpdateRequestParameters; -import com.sinch.sdk.domains.sms.models.requests.GroupsListRequestParameters; -import com.sinch.sdk.domains.sms.models.responses.GroupsListResponse; -import com.sinch.sdk.e2e.Config; -import io.cucumber.java.en.Given; -import io.cucumber.java.en.Then; -import io.cucumber.java.en.When; -import java.time.Instant; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.concurrent.atomic.AtomicInteger; -import org.junit.jupiter.api.Assertions; - -public class GroupsSteps { - - GroupsService service; - Group createResponse; - Group getResponse; - GroupsListResponse listOnePageResponse; - GroupsListResponse listAllResponse; - GroupsListResponse listAllByPageResponse; - Group updateResponse; - Group updateRemoveNameResponse; - Group replaceResponse; - Boolean deletePassed; - Collection lisMembersResponse; - - @Given("^the SMS service \"Groups\" is available") - public void serviceAvailable() { - - service = Config.getSinchClient().sms().groups(); - } - - @When("^I send a request to create an SMS group$") - public void create() { - GroupCreateRequestParameters request = - GroupCreateRequestParameters.builder() - .setName("Group master") - .setMembers(Arrays.asList("+12017778888", "+12018887777")) - .setChildGroupIds(Collections.singletonList("01W4FFL35P4NC4K35SUBGROUP1")) - .build(); - - createResponse = service.create(request); - } - - @When("^I send a request to retrieve an SMS group$") - public void get() { - - getResponse = service.get("01W4FFL35P4NC4K35SMSGROUP1"); - } - - @When("^I send a request to list the existing SMS groups$") - public void listOnePage() { - GroupsListRequestParameters request = - GroupsListRequestParameters.builder().setPageSize(2).build(); - - listOnePageResponse = service.list(request); - } - - @When("^I send a request to list all the SMS groups$") - public void listAll() { - GroupsListRequestParameters request = - GroupsListRequestParameters.builder().setPageSize(2).build(); - - listAllResponse = service.list(request); - } - - @When("^I iterate manually over the SMS groups pages$") - public void listAllByPage() { - GroupsListRequestParameters request = - GroupsListRequestParameters.builder().setPageSize(2).build(); - - listAllByPageResponse = service.list(request); - } - - @When("^I send a request to update an SMS group$") - public void update() { - - GroupUpdateRequestParameters parameters = - GroupUpdateRequestParameters.builder() - .setName("Updated group name") - .setAdd(Arrays.asList("+12017771111", "+12017772222")) - .setRemove(Arrays.asList("+12017773333", "+12017774444")) - .setAddFromGroup("01W4FFL35P4NC4K35SMSGROUP2") - .setRemoveFromGroup("01W4FFL35P4NC4K35SMSGROUP3") - .build(); - updateResponse = service.update("groupid", parameters); - } - - @When("^I send a request to update an SMS group to remove its name$") - public void updateRemoveName() { - - GroupUpdateRequestParameters parameters = - GroupUpdateRequestParameters.builder().setName(null).build(); - updateRemoveNameResponse = service.update("groupid", parameters); - } - - @When("^I send a request to replace an SMS group$") - public void replace() { - - GroupReplaceRequestParameters parameters = - GroupReplaceRequestParameters.builder() - .setName("Replacement group") - .setMembers(Arrays.asList("+12018881111", "+12018882222", "+12018883333")) - .build(); - replaceResponse = service.replace("groupid", parameters); - } - - @When("^I send a request to delete an SMS group$") - public void delete() { - - service.delete("groupid"); - deletePassed = true; - } - - @When("^I send a request to list the members of an SMS group$") - public void listMembers() { - - lisMembersResponse = service.listMembers("groupid"); - } - - @Then("the response contains the SMS group details") - public void createOrGetResult() { - Group expected = - Group.builder() - .setId("01W4FFL35P4NC4K35SMSGROUP1") - .setName("Group master") - .setSize(2) - .setCreatedAt(Instant.parse("2024-06-06T08:59:22.156Z")) - .setModifiedAt(Instant.parse("2024-06-06T08:59:22.156Z")) - .setChildGroupIds(Collections.singletonList("01W4FFL35P4NC4K35SUBGROUP1")) - .build(); - - Group current = null != createResponse ? createResponse : getResponse; - - TestHelpers.recursiveEquals(current, expected); - } - - @Then("the response contains \"{int}\" SMS groups") - public void onePageResult(int expected) { - - Assertions.assertEquals(listOnePageResponse.getContent().size(), expected); - } - - @Then("the SMS groups list contains \"{int}\" SMS groups") - public void listAllResult(int expected) { - GroupsListResponse response = null != listAllResponse ? listAllResponse : listAllByPageResponse; - - AtomicInteger count = new AtomicInteger(); - response.iterator().forEachRemaining(_unused -> count.getAndIncrement()); - - Assertions.assertEquals(count.get(), expected); - } - - @Then("the SMS groups iteration result contains the data from \"{int}\" pages") - public void listAllByPageResult(int expected) { - - int count = listAllByPageResponse.getContent().isEmpty() ? 0 : 1; - while (listAllByPageResponse.hasNextPage()) { - count++; - listAllByPageResponse = listAllByPageResponse.nextPage(); - } - Assertions.assertEquals(count, expected); - } - - @Then("the response contains the updated SMS group details") - public void updateResult() { - Group expected = - Group.builder() - .setId("01W4FFL35P4NC4K35SMSGROUP1") - .setName("Updated group name") - .setSize(6) - .setCreatedAt(Instant.parse("2024-06-06T08:59:22.156Z")) - .setModifiedAt(Instant.parse("2024-06-06T09:19:58.147Z")) - .setChildGroupIds(Arrays.asList("01W4FFL35P4NC4K35SUBGROUP1")) - .build(); - TestHelpers.recursiveEquals(updateResponse, expected); - } - - @Then("the response contains the updated SMS group details where the name has been removed") - public void updateRemoveNameResult() { - Group expected = - Group.builder() - .setId("01W4FFL35P4NC4K35SMSGROUP2") - .setSize(5) - .setCreatedAt(Instant.parse("2024-06-06T12:45:18.761Z")) - .setModifiedAt(Instant.parse("2024-06-06T13:12:05.137Z")) - .setChildGroupIds(Collections.emptyList()) - .build(); - TestHelpers.recursiveEquals(updateRemoveNameResponse, expected); - } - - @Then("the response contains the replaced SMS group details") - public void replaceResult() { - Group expected = - Group.builder() - .setId("01W4FFL35P4NC4K35SMSGROUP1") - .setName("Replacement group") - .setSize(3) - .setCreatedAt(Instant.parse("2024-06-06T08:59:22.156Z")) - .setModifiedAt(Instant.parse("2024-08-21T09:39:36.679Z")) - .setChildGroupIds(Collections.singletonList("01W4FFL35P4NC4K35SUBGROUP1")) - .build(); - TestHelpers.recursiveEquals(replaceResponse, expected); - } - - @Then("the delete SMS group response contains no data") - public void deleteResult() { - Assertions.assertTrue(deletePassed); - } - - @Then("the response contains the phone numbers of the SMS group") - public void lisMembersResult() { - Collection expected = - new ArrayList<>(Arrays.asList("12018881111", "12018882222", "12018883333")); - TestHelpers.recursiveEquals(lisMembersResponse, expected); - } -} diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v0/InboundsSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v0/InboundsSteps.java deleted file mode 100644 index 85f323bbe..000000000 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v0/InboundsSteps.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.sinch.sdk.e2e.domains.sms.v0; - -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.domains.sms.InboundsService; -import com.sinch.sdk.domains.sms.models.InboundText; -import com.sinch.sdk.domains.sms.models.requests.InboundsListRequestParameters; -import com.sinch.sdk.domains.sms.models.responses.InboundsListResponse; -import com.sinch.sdk.e2e.Config; -import io.cucumber.java.en.Given; -import io.cucumber.java.en.Then; -import io.cucumber.java.en.When; -import java.time.Instant; -import java.util.Arrays; -import java.util.concurrent.atomic.AtomicInteger; -import org.junit.jupiter.api.Assertions; - -public class InboundsSteps { - - InboundsService service; - InboundText getResponse; - InboundsListResponse listOnePageResponse; - InboundsListResponse listAllResponse; - InboundsListResponse listAllByPageResponse; - - @Given("^the SMS service \"Inbounds\" is available") - public void serviceAvailable() { - - service = Config.getSinchClient().sms().inbounds(); - } - - @When("^I send a request to retrieve an inbound message") - public void get() { - - getResponse = (InboundText) service.get("inboundid"); - } - - @When("^I send a request to list the inbound messages$") - public void listOnePage() { - InboundsListRequestParameters request = - InboundsListRequestParameters.builder() - .setTo(Arrays.asList("12017777777", "12018888888")) - .setPageSize(2) - .build(); - - listOnePageResponse = service.list(request); - } - - @When("^I send a request to list all the inbound messages$") - public void listAll() { - InboundsListRequestParameters request = - InboundsListRequestParameters.builder() - .setTo(Arrays.asList("12017777777", "12018888888")) - .setPageSize(2) - .build(); - - listAllResponse = service.list(request); - } - - @When("^I iterate manually over the inbound messages pages$") - public void listAllByPage() { - InboundsListRequestParameters request = - InboundsListRequestParameters.builder() - .setTo(Arrays.asList("12017777777", "12018888888")) - .setPageSize(2) - .build(); - - listAllByPageResponse = service.list(request); - } - - @Then("the response contains the inbound message details") - public void getResult() { - InboundText expected = - InboundText.builder() - .setBody("Hello John!") - .setFrom("12015555555") - .setId("01W4FFL35P4NC4K35INBOUND01") - .setOperatorId("311071") - .setReceivedAt(Instant.parse("2024-06-06T14:16:54.777Z")) - .setTo("12017777777") - .build(); - - TestHelpers.recursiveEquals(getResponse, expected); - } - - @Then("the response contains \"{int}\" inbound messages") - public void onePageResult(int expected) { - - Assertions.assertEquals(listOnePageResponse.getContent().size(), expected); - } - - @Then("the inbound messages list contains \"{int}\" inbound messages") - public void listAllResult(int expected) { - InboundsListResponse response = - null != listAllResponse ? listAllResponse : listAllByPageResponse; - - AtomicInteger count = new AtomicInteger(); - response.iterator().forEachRemaining(_unused -> count.getAndIncrement()); - - Assertions.assertEquals(count.get(), expected); - } - - @Then("the inbound messages iteration result contains the data from \"{int}\" pages") - public void listAllByPageResult(int expected) { - - int count = listAllByPageResponse.getContent().isEmpty() ? 0 : 1; - while (listAllByPageResponse.hasNextPage()) { - count++; - listAllByPageResponse = listAllByPageResponse.nextPage(); - } - Assertions.assertEquals(count, expected); - } -} diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v0/SmsIT.java b/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v0/SmsIT.java deleted file mode 100644 index 0361145fe..000000000 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v0/SmsIT.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.sinch.sdk.e2e.domains.sms.v0; - -import static io.cucumber.junit.platform.engine.Constants.GLUE_PROPERTY_NAME; - -import org.junit.platform.suite.api.ConfigurationParameter; -import org.junit.platform.suite.api.IncludeEngines; -import org.junit.platform.suite.api.SelectClasspathResource; -import org.junit.platform.suite.api.Suite; -import org.junit.platform.suite.api.SuiteDisplayName; - -@Suite -@SuiteDisplayName("SMS V0") -@IncludeEngines("cucumber") -@SelectClasspathResource("features/sms") -@ConfigurationParameter(key = GLUE_PROPERTY_NAME, value = "com.sinch.sdk.e2e.domains.sms.v0") -public class SmsIT {} diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v0/WebhooksSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v0/WebhooksSteps.java deleted file mode 100644 index 390644936..000000000 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v0/WebhooksSteps.java +++ /dev/null @@ -1,151 +0,0 @@ -package com.sinch.sdk.e2e.domains.sms.v0; - -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.domains.sms.WebHooksService; -import com.sinch.sdk.domains.sms.models.DeliveryReportBatchSMS; -import com.sinch.sdk.domains.sms.models.DeliveryReportErrorCode; -import com.sinch.sdk.domains.sms.models.DeliveryReportRecipient; -import com.sinch.sdk.domains.sms.models.DeliveryReportRecipientSMS; -import com.sinch.sdk.domains.sms.models.DeliveryReportStatus; -import com.sinch.sdk.domains.sms.models.DeliveryReportStatusDetails; -import com.sinch.sdk.domains.sms.models.InboundText; -import com.sinch.sdk.domains.sms.models.webhooks.WebhooksEvent; -import com.sinch.sdk.e2e.Config; -import com.sinch.sdk.e2e.domains.WebhooksHelper; -import io.cucumber.java.en.Given; -import io.cucumber.java.en.Then; -import io.cucumber.java.en.When; -import java.io.IOException; -import java.net.URL; -import java.time.Instant; -import java.util.Arrays; - -public class WebhooksSteps { - - static final String WEBHOOKS_PATH_PREFIX = "/webhooks/sms"; - static final String WEBHOOKS_URL = Config.SMS_HOST_NAME + WEBHOOKS_PATH_PREFIX; - - WebHooksService service; - WebhooksHelper.Response incoming; - WebhooksHelper.Response deliveryReport; - WebhooksHelper.Response deliveryReportRecipientDelivered; - WebhooksHelper.Response deliveryReportRecipientAborted; - - @Given("^the SMS Webhooks handler is available") - public void serviceAvailable() { - - service = Config.getSinchClient().sms().webHooks(); - } - - @When("^I send a request to trigger an \"incoming SMS\" event") - public void incoming() throws IOException { - - incoming = WebhooksHelper.callURL(new URL(WEBHOOKS_URL + "/incoming-sms"), service::parse); - } - - @When("^I send a request to trigger an \"SMS delivery report\" event") - public void deliveryReport() throws IOException { - - deliveryReport = - WebhooksHelper.callURL(new URL(WEBHOOKS_URL + "/delivery-report-sms"), service::parse); - } - - @When( - "^I send a request to trigger an \"SMS recipient delivery report\" event with the status" - + " \"Delivered\"") - public void deliveryReportRecipientDelivered() throws IOException { - - deliveryReportRecipientDelivered = - WebhooksHelper.callURL( - new URL(WEBHOOKS_URL + "/recipient-delivery-report-sms-delivered"), service::parse); - } - - @When( - "^I send a request to trigger an \"SMS recipient delivery report\" event with the status" - + " \"Aborted\"") - public void deliveryReportRecipientAborted() throws IOException { - - deliveryReportRecipientAborted = - WebhooksHelper.callURL( - new URL(WEBHOOKS_URL + "/recipient-delivery-report-sms-aborted"), service::parse); - } - - @Then("the SMS event describes an \"incoming SMS\" event") - public void incomingResult() { - InboundText expected = - InboundText.builder() - .setBody("Hello John! 👋") - .setFrom("12015555555") - .setId("01W4FFL35P4NC4K35SMSBATCH8") - .setOperatorId("311071") - .setReceivedAt(Instant.parse("2024-06-06T07:52:37.386Z")) - .setTo("12017777777") - .build(); - - TestHelpers.recursiveEquals(incoming.event, expected); - } - - @Then("the SMS event describes an \"SMS delivery report\" event") - public void deliveryReportResult() { - DeliveryReportBatchSMS expected = - DeliveryReportBatchSMS.builder() - .setBatchId("01W4FFL35P4NC4K35SMSBATCH8") - .setClientReference("client-ref") - .setStatuses( - Arrays.asList( - DeliveryReportStatusDetails.builder() - .setCode(0) - .setCount(2) - .setRecipients(Arrays.asList("12017777777", "33612345678")) - .setStatus(DeliveryReportStatus.DELIVERED) - .build())) - .setTotalMessageCount(2) - .build(); - - TestHelpers.recursiveEquals(deliveryReport.event, expected); - } - - @Then( - "the SMS event describes an SMS recipient delivery report event with the status" - + " \"Delivered\"") - public void deliveryReportRecipientDeliveredResult() { - DeliveryReportRecipient expected = - DeliveryReportRecipientSMS.builder() - .setAt(Instant.parse("2024-06-06T08:17:19.210Z")) - .setBatchId("01W4FFL35P4NC4K35SMSBATCH9") - .setClientReference("client-ref") - .setCode(DeliveryReportErrorCode.from(0)) - .setOperatorStatusAt(Instant.parse("2024-06-06T08:17:00Z")) - .setRecipient("12017777777") - .setStatus(DeliveryReportStatus.DELIVERED) - .build(); - - TestHelpers.recursiveEquals(deliveryReportRecipientDelivered.event, expected); - } - - @Then( - "the SMS event describes an SMS recipient delivery report event with the status \"Aborted\"") - public void deliveryReportRecipientAbortedResult() { - DeliveryReportRecipient expected = - DeliveryReportRecipientSMS.builder() - .setAt(Instant.parse("2024-06-06T08:17:15.603Z")) - .setBatchId("01W4FFL35P4NC4K35SMSBATCH9") - .setClientReference("client-ref") - .setCode(DeliveryReportErrorCode.UNPROVISIONED_REGION) - .setRecipient("12010000000") - .setStatus(DeliveryReportStatus.ABORTED) - .build(); - - TestHelpers.recursiveEquals(deliveryReportRecipientAborted.event, expected); - } - - @Then("the header of the event {string} contains a valid signature") - public void validateHeader(String _unused) { - // dummy empty validation: V0 do not support authentication - } - - @Then("the header of the event {string} with the status {string} contains a valid signature") - public void validateHeader(String _unused, String status) { - // dummy empty validation: V0 do not support authentication - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/adapters/api/v1/BatchesApi.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/adapters/api/v1/BatchesApi.java deleted file mode 100644 index 50ee62f98..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/adapters/api/v1/BatchesApi.java +++ /dev/null @@ -1,858 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.adapters.api.v1; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.core.exceptions.ApiExceptionBuilder; -import com.sinch.sdk.core.http.AuthManager; -import com.sinch.sdk.core.http.HttpClient; -import com.sinch.sdk.core.http.HttpMapper; -import com.sinch.sdk.core.http.HttpMethod; -import com.sinch.sdk.core.http.HttpRequest; -import com.sinch.sdk.core.http.HttpResponse; -import com.sinch.sdk.core.http.HttpStatus; -import com.sinch.sdk.core.http.URLParameter; -import com.sinch.sdk.core.http.URLPathUtils; -import com.sinch.sdk.core.models.ServerConfiguration; -import com.sinch.sdk.domains.sms.models.dto.v1.ApiBatchListDto; -import com.sinch.sdk.domains.sms.models.dto.v1.ApiDeliveryFeedbackDto; -import com.sinch.sdk.domains.sms.models.dto.v1.DryRun200ResponseDto; -import com.sinch.sdk.domains.sms.models.dto.v1.SendSMS201ResponseDto; -import com.sinch.sdk.domains.sms.models.dto.v1.SendSMSRequestDto; -import com.sinch.sdk.domains.sms.models.dto.v1.UpdateBatchMessageRequestDto; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.logging.Logger; - -public class BatchesApi { - - private static final Logger LOGGER = Logger.getLogger(BatchesApi.class.getName()); - private HttpClient httpClient; - private ServerConfiguration serverConfiguration; - private Map authManagersByOasSecuritySchemes; - private HttpMapper mapper; - - public BatchesApi( - HttpClient httpClient, - ServerConfiguration serverConfiguration, - Map authManagersByOasSecuritySchemes, - HttpMapper mapper) { - this.httpClient = httpClient; - this.serverConfiguration = serverConfiguration; - this.authManagersByOasSecuritySchemes = authManagersByOasSecuritySchemes; - this.mapper = mapper; - } - - /** - * Cancel a batch message A batch can be canceled at any point. If a batch is canceled while - * it's currently being delivered some messages currently being processed might still be - * delivered. The delivery report will indicate which messages were canceled and which - * weren't. Canceling a batch scheduled in the future will result in an empty delivery report - * while canceling an already sent batch would result in no change to the completed delivery - * report. - * - * @param servicePlanId Your service plan ID. You can find this on your - * [Dashboard](https://dashboard.sinch.com/sms/api/rest). (required) - * @param batchId The batch ID you received from sending a message. (required) - * @return SendSMS201ResponseDto - * @throws ApiException if fails to make API call - */ - public SendSMS201ResponseDto cancelBatchMessage(String servicePlanId, String batchId) - throws ApiException { - - LOGGER.finest( - "[cancelBatchMessage]" - + " " - + "servicePlanId: " - + servicePlanId - + ", " - + "batchId: " - + batchId); - - HttpRequest httpRequest = cancelBatchMessageRequestBuilder(servicePlanId, batchId); - HttpResponse response = - httpClient.invokeAPI( - this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); - - if (HttpStatus.isSuccessfulStatus(response.getCode())) { - TypeReference localVarReturnType = - new TypeReference() {}; - return mapper.deserialize(response, localVarReturnType); - } - // fallback to default errors handling: - // all error cases definition are not required from specs: will try some "hardcoded" content - // parsing - throw ApiExceptionBuilder.build( - response.getMessage(), - response.getCode(), - mapper.deserialize(response, new TypeReference>() {})); - } - - private HttpRequest cancelBatchMessageRequestBuilder(String servicePlanId, String batchId) - throws ApiException { - // verify the required parameter 'servicePlanId' is set - if (servicePlanId == null) { - throw new ApiException( - 400, "Missing the required parameter 'servicePlanId' when calling cancelBatchMessage"); - } - // verify the required parameter 'batchId' is set - if (batchId == null) { - throw new ApiException( - 400, "Missing the required parameter 'batchId' when calling cancelBatchMessage"); - } - - String localVarPath = - "/xms/v1/{service_plan_id}/batches/{batch_id}" - .replaceAll( - "\\{" + "service_plan_id" + "\\}", - URLPathUtils.encodePathSegment(servicePlanId.toString())) - .replaceAll( - "\\{" + "batch_id" + "\\}", URLPathUtils.encodePathSegment(batchId.toString())); - - List localVarQueryParams = new ArrayList<>(); - - Map localVarHeaderParams = new HashMap<>(); - - final Collection localVarAccepts = Arrays.asList("application/json"); - - final Collection localVarContentTypes = Arrays.asList(); - - final Collection localVarAuthNames = Arrays.asList("BearerAuth"); - final String serializedBody = null; - - return new HttpRequest( - localVarPath, - HttpMethod.DELETE, - localVarQueryParams, - serializedBody, - localVarHeaderParams, - localVarAccepts, - localVarContentTypes, - localVarAuthNames); - } - - /** - * Send delivery feedback for a message Send feedback if your system can confirm successful - * message delivery. Feedback can only be provided if `feedback_enabled` was set when - * batch was submitted. **Batches**: It is possible to submit feedback multiple times for the same - * batch for different recipients. Feedback without specified recipients is treated as successful - * message delivery to all recipients referenced in the batch. Note that the - * `recipients` key is still required even if the value is empty. **Groups**: If the - * batch message was creating using a group ID, at least one recipient is required. Excluding - * recipients (an empty recipient list) does not work and will result in a failed request. - * - * @param servicePlanId Your service plan ID. You can find this on your - * [Dashboard](https://dashboard.sinch.com/sms/api/rest). (required) - * @param batchId The batch ID you received from sending a message. (required) - * @param apiDeliveryFeedbackDto A list of phone numbers (MSISDNs) that successfully received the - * message. (required) - * @throws ApiException if fails to make API call - */ - public void deliveryFeedback( - String servicePlanId, String batchId, ApiDeliveryFeedbackDto apiDeliveryFeedbackDto) - throws ApiException { - - LOGGER.finest( - "[deliveryFeedback]" - + " " - + "servicePlanId: " - + servicePlanId - + ", " - + "batchId: " - + batchId - + ", " - + "apiDeliveryFeedbackDto: " - + apiDeliveryFeedbackDto); - - HttpRequest httpRequest = - deliveryFeedbackRequestBuilder(servicePlanId, batchId, apiDeliveryFeedbackDto); - HttpResponse response = - httpClient.invokeAPI( - this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); - - if (HttpStatus.isSuccessfulStatus(response.getCode())) { - return; - } - // fallback to default errors handling: - // all error cases definition are not required from specs: will try some "hardcoded" content - // parsing - throw ApiExceptionBuilder.build( - response.getMessage(), - response.getCode(), - mapper.deserialize(response, new TypeReference>() {})); - } - - private HttpRequest deliveryFeedbackRequestBuilder( - String servicePlanId, String batchId, ApiDeliveryFeedbackDto apiDeliveryFeedbackDto) - throws ApiException { - // verify the required parameter 'servicePlanId' is set - if (servicePlanId == null) { - throw new ApiException( - 400, "Missing the required parameter 'servicePlanId' when calling deliveryFeedback"); - } - // verify the required parameter 'batchId' is set - if (batchId == null) { - throw new ApiException( - 400, "Missing the required parameter 'batchId' when calling deliveryFeedback"); - } - // verify the required parameter 'apiDeliveryFeedbackDto' is set - if (apiDeliveryFeedbackDto == null) { - throw new ApiException( - 400, - "Missing the required parameter 'apiDeliveryFeedbackDto' when calling deliveryFeedback"); - } - - String localVarPath = - "/xms/v1/{service_plan_id}/batches/{batch_id}/delivery_feedback" - .replaceAll( - "\\{" + "service_plan_id" + "\\}", - URLPathUtils.encodePathSegment(servicePlanId.toString())) - .replaceAll( - "\\{" + "batch_id" + "\\}", URLPathUtils.encodePathSegment(batchId.toString())); - - List localVarQueryParams = new ArrayList<>(); - - Map localVarHeaderParams = new HashMap<>(); - - final Collection localVarAccepts = Arrays.asList(); - - final Collection localVarContentTypes = Arrays.asList("application/json"); - - final Collection localVarAuthNames = Arrays.asList("BearerAuth"); - final String serializedBody = mapper.serialize(localVarContentTypes, apiDeliveryFeedbackDto); - - return new HttpRequest( - localVarPath, - HttpMethod.POST, - localVarQueryParams, - serializedBody, - localVarHeaderParams, - localVarAccepts, - localVarContentTypes, - localVarAuthNames); - } - - /** - * Dry run This operation will perform a dry run of a batch which calculates the bodies and number - * of parts for all messages in the batch without actually sending any messages. - * - * @param servicePlanId Your service plan ID. You can find this on your - * [Dashboard](https://dashboard.sinch.com/sms/api/rest). (required) - * @param perRecipient Whether to include per recipient details in the response (optional) - * @param numberOfRecipients Max number of recipients to include per recipient details for in the - * response (optional, default to 100) - * @param sendSMSRequestDto (optional) - * @return DryRun200ResponseDto - * @throws ApiException if fails to make API call - */ - public DryRun200ResponseDto dryRun( - String servicePlanId, - Boolean perRecipient, - Integer numberOfRecipients, - SendSMSRequestDto sendSMSRequestDto) - throws ApiException { - - LOGGER.finest( - "[dryRun]" - + " " - + "servicePlanId: " - + servicePlanId - + ", " - + "perRecipient: " - + perRecipient - + ", " - + "numberOfRecipients: " - + numberOfRecipients - + ", " - + "sendSMSRequestDto: " - + sendSMSRequestDto); - - HttpRequest httpRequest = - dryRunRequestBuilder(servicePlanId, perRecipient, numberOfRecipients, sendSMSRequestDto); - HttpResponse response = - httpClient.invokeAPI( - this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); - - if (HttpStatus.isSuccessfulStatus(response.getCode())) { - TypeReference localVarReturnType = - new TypeReference() {}; - return mapper.deserialize(response, localVarReturnType); - } - // fallback to default errors handling: - // all error cases definition are not required from specs: will try some "hardcoded" content - // parsing - throw ApiExceptionBuilder.build( - response.getMessage(), - response.getCode(), - mapper.deserialize(response, new TypeReference>() {})); - } - - private HttpRequest dryRunRequestBuilder( - String servicePlanId, - Boolean perRecipient, - Integer numberOfRecipients, - SendSMSRequestDto sendSMSRequestDto) - throws ApiException { - // verify the required parameter 'servicePlanId' is set - if (servicePlanId == null) { - throw new ApiException( - 400, "Missing the required parameter 'servicePlanId' when calling dryRun"); - } - - String localVarPath = - "/xms/v1/{service_plan_id}/batches/dry_run" - .replaceAll( - "\\{" + "service_plan_id" + "\\}", - URLPathUtils.encodePathSegment(servicePlanId.toString())); - - List localVarQueryParams = new ArrayList<>(); - if (null != perRecipient) { - localVarQueryParams.add( - new URLParameter( - "per_recipient", - perRecipient, - URLParameter.STYLE.valueOf("form".toUpperCase()), - true)); - } - if (null != numberOfRecipients) { - localVarQueryParams.add( - new URLParameter( - "number_of_recipients", - numberOfRecipients, - URLParameter.STYLE.valueOf("form".toUpperCase()), - true)); - } - - Map localVarHeaderParams = new HashMap<>(); - - final Collection localVarAccepts = Arrays.asList("application/json"); - - final Collection localVarContentTypes = Arrays.asList("application/json"); - - final Collection localVarAuthNames = Arrays.asList("BearerAuth"); - final String serializedBody = mapper.serialize(localVarContentTypes, sendSMSRequestDto); - - return new HttpRequest( - localVarPath, - HttpMethod.POST, - localVarQueryParams, - serializedBody, - localVarHeaderParams, - localVarAccepts, - localVarContentTypes, - localVarAuthNames); - } - - /** - * Get a batch message This operation returns a specific batch that matches the provided batch ID. - * - * @param servicePlanId Your service plan ID. You can find this on your - * [Dashboard](https://dashboard.sinch.com/sms/api/rest). (required) - * @param batchId The batch ID you received from sending a message. (required) - * @return SendSMS201ResponseDto - * @throws ApiException if fails to make API call - */ - public SendSMS201ResponseDto getBatchMessage(String servicePlanId, String batchId) - throws ApiException { - - LOGGER.finest( - "[getBatchMessage]" - + " " - + "servicePlanId: " - + servicePlanId - + ", " - + "batchId: " - + batchId); - - HttpRequest httpRequest = getBatchMessageRequestBuilder(servicePlanId, batchId); - HttpResponse response = - httpClient.invokeAPI( - this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); - - if (HttpStatus.isSuccessfulStatus(response.getCode())) { - TypeReference localVarReturnType = - new TypeReference() {}; - return mapper.deserialize(response, localVarReturnType); - } - // fallback to default errors handling: - // all error cases definition are not required from specs: will try some "hardcoded" content - // parsing - throw ApiExceptionBuilder.build( - response.getMessage(), - response.getCode(), - mapper.deserialize(response, new TypeReference>() {})); - } - - private HttpRequest getBatchMessageRequestBuilder(String servicePlanId, String batchId) - throws ApiException { - // verify the required parameter 'servicePlanId' is set - if (servicePlanId == null) { - throw new ApiException( - 400, "Missing the required parameter 'servicePlanId' when calling getBatchMessage"); - } - // verify the required parameter 'batchId' is set - if (batchId == null) { - throw new ApiException( - 400, "Missing the required parameter 'batchId' when calling getBatchMessage"); - } - - String localVarPath = - "/xms/v1/{service_plan_id}/batches/{batch_id}" - .replaceAll( - "\\{" + "service_plan_id" + "\\}", - URLPathUtils.encodePathSegment(servicePlanId.toString())) - .replaceAll( - "\\{" + "batch_id" + "\\}", URLPathUtils.encodePathSegment(batchId.toString())); - - List localVarQueryParams = new ArrayList<>(); - - Map localVarHeaderParams = new HashMap<>(); - - final Collection localVarAccepts = Arrays.asList("application/json"); - - final Collection localVarContentTypes = Arrays.asList(); - - final Collection localVarAuthNames = Arrays.asList("BearerAuth"); - final String serializedBody = null; - - return new HttpRequest( - localVarPath, - HttpMethod.GET, - localVarQueryParams, - serializedBody, - localVarHeaderParams, - localVarAccepts, - localVarContentTypes, - localVarAuthNames); - } - - /** - * List Batches With the list operation you can list batch messages created in the last 14 days - * that you have created. This operation supports pagination. - * - * @param servicePlanId Your service plan ID. You can find this on your - * [Dashboard](https://dashboard.sinch.com/sms/api/rest). (required) - * @param page The page number starting from 0. (optional) - * @param pageSize Determines the size of a page. (optional, default to 30) - * @param from Only list messages sent from this sender number. Multiple originating numbers can - * be comma separated. Must be phone numbers or short code. (optional) - * @param startDate Only list messages received at or after this date/time. Formatted as - * [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601): `YYYY-MM-DDThh:mm:ss.SSSZ`. - * Default: Now-24 (optional) - * @param endDate Only list messages received before this date/time. Formatted as - * [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601): `YYYY-MM-DDThh:mm:ss.SSSZ`. - * (optional) - * @param clientReference Client reference to include (optional) - * @return ApiBatchListDto - * @throws ApiException if fails to make API call - */ - public ApiBatchListDto listBatches( - String servicePlanId, - Integer page, - Integer pageSize, - String from, - String startDate, - String endDate, - String clientReference) - throws ApiException { - - LOGGER.finest( - "[listBatches]" - + " " - + "servicePlanId: " - + servicePlanId - + ", " - + "page: " - + page - + ", " - + "pageSize: " - + pageSize - + ", " - + "from: " - + from - + ", " - + "startDate: " - + startDate - + ", " - + "endDate: " - + endDate - + ", " - + "clientReference: " - + clientReference); - - HttpRequest httpRequest = - listBatchesRequestBuilder( - servicePlanId, page, pageSize, from, startDate, endDate, clientReference); - HttpResponse response = - httpClient.invokeAPI( - this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); - - if (HttpStatus.isSuccessfulStatus(response.getCode())) { - TypeReference localVarReturnType = new TypeReference() {}; - return mapper.deserialize(response, localVarReturnType); - } - // fallback to default errors handling: - // all error cases definition are not required from specs: will try some "hardcoded" content - // parsing - throw ApiExceptionBuilder.build( - response.getMessage(), - response.getCode(), - mapper.deserialize(response, new TypeReference>() {})); - } - - private HttpRequest listBatchesRequestBuilder( - String servicePlanId, - Integer page, - Integer pageSize, - String from, - String startDate, - String endDate, - String clientReference) - throws ApiException { - // verify the required parameter 'servicePlanId' is set - if (servicePlanId == null) { - throw new ApiException( - 400, "Missing the required parameter 'servicePlanId' when calling listBatches"); - } - - String localVarPath = - "/xms/v1/{service_plan_id}/batches" - .replaceAll( - "\\{" + "service_plan_id" + "\\}", - URLPathUtils.encodePathSegment(servicePlanId.toString())); - - List localVarQueryParams = new ArrayList<>(); - if (null != page) { - localVarQueryParams.add( - new URLParameter("page", page, URLParameter.STYLE.valueOf("form".toUpperCase()), true)); - } - if (null != pageSize) { - localVarQueryParams.add( - new URLParameter( - "page_size", pageSize, URLParameter.STYLE.valueOf("form".toUpperCase()), true)); - } - if (null != from) { - localVarQueryParams.add( - new URLParameter("from", from, URLParameter.STYLE.valueOf("form".toUpperCase()), true)); - } - if (null != startDate) { - localVarQueryParams.add( - new URLParameter( - "start_date", startDate, URLParameter.STYLE.valueOf("form".toUpperCase()), true)); - } - if (null != endDate) { - localVarQueryParams.add( - new URLParameter( - "end_date", endDate, URLParameter.STYLE.valueOf("form".toUpperCase()), true)); - } - if (null != clientReference) { - localVarQueryParams.add( - new URLParameter( - "client_reference", - clientReference, - URLParameter.STYLE.valueOf("form".toUpperCase()), - true)); - } - - Map localVarHeaderParams = new HashMap<>(); - - final Collection localVarAccepts = Arrays.asList("application/json"); - - final Collection localVarContentTypes = Arrays.asList(); - - final Collection localVarAuthNames = Arrays.asList("BearerAuth"); - final String serializedBody = null; - - return new HttpRequest( - localVarPath, - HttpMethod.GET, - localVarQueryParams, - serializedBody, - localVarHeaderParams, - localVarAccepts, - localVarContentTypes, - localVarAuthNames); - } - - /** - * Replace a batch This operation will replace all the parameters of a batch with the provided - * values. It is the same as cancelling a batch and sending a new one instead. - * - * @param servicePlanId Your service plan ID. You can find this on your - * [Dashboard](https://dashboard.sinch.com/sms/api/rest). (required) - * @param batchId The batch ID you received from sending a message. (required) - * @param sendSMSRequestDto (optional) - * @return SendSMS201ResponseDto - * @throws ApiException if fails to make API call - */ - public SendSMS201ResponseDto replaceBatch( - String servicePlanId, String batchId, SendSMSRequestDto sendSMSRequestDto) - throws ApiException { - - LOGGER.finest( - "[replaceBatch]" - + " " - + "servicePlanId: " - + servicePlanId - + ", " - + "batchId: " - + batchId - + ", " - + "sendSMSRequestDto: " - + sendSMSRequestDto); - - HttpRequest httpRequest = replaceBatchRequestBuilder(servicePlanId, batchId, sendSMSRequestDto); - HttpResponse response = - httpClient.invokeAPI( - this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); - - if (HttpStatus.isSuccessfulStatus(response.getCode())) { - TypeReference localVarReturnType = - new TypeReference() {}; - return mapper.deserialize(response, localVarReturnType); - } - // fallback to default errors handling: - // all error cases definition are not required from specs: will try some "hardcoded" content - // parsing - throw ApiExceptionBuilder.build( - response.getMessage(), - response.getCode(), - mapper.deserialize(response, new TypeReference>() {})); - } - - private HttpRequest replaceBatchRequestBuilder( - String servicePlanId, String batchId, SendSMSRequestDto sendSMSRequestDto) - throws ApiException { - // verify the required parameter 'servicePlanId' is set - if (servicePlanId == null) { - throw new ApiException( - 400, "Missing the required parameter 'servicePlanId' when calling replaceBatch"); - } - // verify the required parameter 'batchId' is set - if (batchId == null) { - throw new ApiException( - 400, "Missing the required parameter 'batchId' when calling replaceBatch"); - } - - String localVarPath = - "/xms/v1/{service_plan_id}/batches/{batch_id}" - .replaceAll( - "\\{" + "service_plan_id" + "\\}", - URLPathUtils.encodePathSegment(servicePlanId.toString())) - .replaceAll( - "\\{" + "batch_id" + "\\}", URLPathUtils.encodePathSegment(batchId.toString())); - - List localVarQueryParams = new ArrayList<>(); - - Map localVarHeaderParams = new HashMap<>(); - - final Collection localVarAccepts = Arrays.asList("application/json"); - - final Collection localVarContentTypes = Arrays.asList("application/json"); - - final Collection localVarAuthNames = Arrays.asList("BearerAuth"); - final String serializedBody = mapper.serialize(localVarContentTypes, sendSMSRequestDto); - - return new HttpRequest( - localVarPath, - HttpMethod.PUT, - localVarQueryParams, - serializedBody, - localVarHeaderParams, - localVarAccepts, - localVarContentTypes, - localVarAuthNames); - } - - /** - * Send Send a message or a batch of messages. Depending on the length of the body, one message - * might be split into multiple parts and charged accordingly. Any groups targeted in a scheduled - * batch will be evaluated at the time of sending. If a group is deleted between batch creation - * and scheduled date, it will be considered empty. Be sure to use the correct <a - * href=\"/docs/sms/api-reference/#base-url\" - * target=\"_blank\">region</a> in the server URL. - * - * @param servicePlanId Your service plan ID. You can find this on your - * [Dashboard](https://dashboard.sinch.com/sms/api/rest). (required) - * @param sendSMSRequestDto Default schema is Text if type is not specified. (optional) - * @return SendSMS201ResponseDto - * @throws ApiException if fails to make API call - */ - public SendSMS201ResponseDto sendSMS(String servicePlanId, SendSMSRequestDto sendSMSRequestDto) - throws ApiException { - - LOGGER.finest( - "[sendSMS]" - + " " - + "servicePlanId: " - + servicePlanId - + ", " - + "sendSMSRequestDto: " - + sendSMSRequestDto); - - HttpRequest httpRequest = sendSMSRequestBuilder(servicePlanId, sendSMSRequestDto); - HttpResponse response = - httpClient.invokeAPI( - this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); - - if (HttpStatus.isSuccessfulStatus(response.getCode())) { - TypeReference localVarReturnType = - new TypeReference() {}; - return mapper.deserialize(response, localVarReturnType); - } - // fallback to default errors handling: - // all error cases definition are not required from specs: will try some "hardcoded" content - // parsing - throw ApiExceptionBuilder.build( - response.getMessage(), - response.getCode(), - mapper.deserialize(response, new TypeReference>() {})); - } - - private HttpRequest sendSMSRequestBuilder( - String servicePlanId, SendSMSRequestDto sendSMSRequestDto) throws ApiException { - // verify the required parameter 'servicePlanId' is set - if (servicePlanId == null) { - throw new ApiException( - 400, "Missing the required parameter 'servicePlanId' when calling sendSMS"); - } - - String localVarPath = - "/xms/v1/{service_plan_id}/batches" - .replaceAll( - "\\{" + "service_plan_id" + "\\}", - URLPathUtils.encodePathSegment(servicePlanId.toString())); - - List localVarQueryParams = new ArrayList<>(); - - Map localVarHeaderParams = new HashMap<>(); - - final Collection localVarAccepts = Arrays.asList("application/json"); - - final Collection localVarContentTypes = Arrays.asList("application/json"); - - final Collection localVarAuthNames = Arrays.asList("BearerAuth"); - final String serializedBody = mapper.serialize(localVarContentTypes, sendSMSRequestDto); - - return new HttpRequest( - localVarPath, - HttpMethod.POST, - localVarQueryParams, - serializedBody, - localVarHeaderParams, - localVarAccepts, - localVarContentTypes, - localVarAuthNames); - } - - /** - * Update a BatchResponse message This operation updates all specified parameters of a batch that - * matches the provided batch ID. - * - * @param servicePlanId Your service plan ID. You can find this on your - * [Dashboard](https://dashboard.sinch.com/sms/api/rest). (required) - * @param batchId The batch ID you received from sending a message. (required) - * @param updateBatchMessageRequestDto (optional) - * @return SendSMS201ResponseDto - * @throws ApiException if fails to make API call - */ - public SendSMS201ResponseDto updateBatchMessage( - String servicePlanId, - String batchId, - UpdateBatchMessageRequestDto updateBatchMessageRequestDto) - throws ApiException { - - LOGGER.finest( - "[updateBatchMessage]" - + " " - + "servicePlanId: " - + servicePlanId - + ", " - + "batchId: " - + batchId - + ", " - + "updateBatchMessageRequestDto: " - + updateBatchMessageRequestDto); - - HttpRequest httpRequest = - updateBatchMessageRequestBuilder(servicePlanId, batchId, updateBatchMessageRequestDto); - HttpResponse response = - httpClient.invokeAPI( - this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); - - if (HttpStatus.isSuccessfulStatus(response.getCode())) { - TypeReference localVarReturnType = - new TypeReference() {}; - return mapper.deserialize(response, localVarReturnType); - } - // fallback to default errors handling: - // all error cases definition are not required from specs: will try some "hardcoded" content - // parsing - throw ApiExceptionBuilder.build( - response.getMessage(), - response.getCode(), - mapper.deserialize(response, new TypeReference>() {})); - } - - private HttpRequest updateBatchMessageRequestBuilder( - String servicePlanId, - String batchId, - UpdateBatchMessageRequestDto updateBatchMessageRequestDto) - throws ApiException { - // verify the required parameter 'servicePlanId' is set - if (servicePlanId == null) { - throw new ApiException( - 400, "Missing the required parameter 'servicePlanId' when calling updateBatchMessage"); - } - // verify the required parameter 'batchId' is set - if (batchId == null) { - throw new ApiException( - 400, "Missing the required parameter 'batchId' when calling updateBatchMessage"); - } - - String localVarPath = - "/xms/v1/{service_plan_id}/batches/{batch_id}" - .replaceAll( - "\\{" + "service_plan_id" + "\\}", - URLPathUtils.encodePathSegment(servicePlanId.toString())) - .replaceAll( - "\\{" + "batch_id" + "\\}", URLPathUtils.encodePathSegment(batchId.toString())); - - List localVarQueryParams = new ArrayList<>(); - - Map localVarHeaderParams = new HashMap<>(); - - final Collection localVarAccepts = Arrays.asList("application/json"); - - final Collection localVarContentTypes = Arrays.asList("application/json"); - - final Collection localVarAuthNames = Arrays.asList("BearerAuth"); - final String serializedBody = - mapper.serialize(localVarContentTypes, updateBatchMessageRequestDto); - - return new HttpRequest( - localVarPath, - HttpMethod.POST, - localVarQueryParams, - serializedBody, - localVarHeaderParams, - localVarAccepts, - localVarContentTypes, - localVarAuthNames); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/adapters/api/v1/DeliveryReportsApi.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/adapters/api/v1/DeliveryReportsApi.java deleted file mode 100644 index 392c8cb29..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/adapters/api/v1/DeliveryReportsApi.java +++ /dev/null @@ -1,433 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.adapters.api.v1; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.core.exceptions.ApiExceptionBuilder; -import com.sinch.sdk.core.http.AuthManager; -import com.sinch.sdk.core.http.HttpClient; -import com.sinch.sdk.core.http.HttpMapper; -import com.sinch.sdk.core.http.HttpMethod; -import com.sinch.sdk.core.http.HttpRequest; -import com.sinch.sdk.core.http.HttpResponse; -import com.sinch.sdk.core.http.HttpStatus; -import com.sinch.sdk.core.http.URLParameter; -import com.sinch.sdk.core.http.URLPathUtils; -import com.sinch.sdk.core.models.ServerConfiguration; -import com.sinch.sdk.domains.sms.models.dto.v1.DeliveryReportDto; -import com.sinch.sdk.domains.sms.models.dto.v1.DeliveryReportListDto; -import com.sinch.sdk.domains.sms.models.dto.v1.RecipientDeliveryReportDto; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.logging.Logger; - -public class DeliveryReportsApi { - - private static final Logger LOGGER = Logger.getLogger(DeliveryReportsApi.class.getName()); - private HttpClient httpClient; - private ServerConfiguration serverConfiguration; - private Map authManagersByOasSecuritySchemes; - private HttpMapper mapper; - - public DeliveryReportsApi( - HttpClient httpClient, - ServerConfiguration serverConfiguration, - Map authManagersByOasSecuritySchemes, - HttpMapper mapper) { - this.httpClient = httpClient; - this.serverConfiguration = serverConfiguration; - this.authManagersByOasSecuritySchemes = authManagersByOasSecuritySchemes; - this.mapper = mapper; - } - - /** - * Retrieve a delivery report Delivery reports can be retrieved even if no callback was requested. - * The difference between a summary and a full report is only that the full report contains the - * phone numbers in <a - * href=\"https://community.sinch.com/t5/Glossary/E-164/ta-p/7537\" - * target=\"_blank\">E.164</a> format for each status code. - * - * @param servicePlanId Your service plan ID. You can find this on your - * [Dashboard](https://dashboard.sinch.com/sms/api/rest). (required) - * @param batchId The batch ID you received from sending a message. (required) - * @param type The type of delivery report. - A `summary` will count the number of - * messages sent per status. - A `full` report give that of a `summary` - * report but in addition, lists phone numbers. (optional, default to summary) - * @param status Comma separated list of delivery_report_statuses to include (optional) - * @param code Comma separated list of delivery_receipt_error_codes to include\" (optional) - * @return DeliveryReportDto - * @throws ApiException if fails to make API call - */ - public DeliveryReportDto getDeliveryReportByBatchId( - String servicePlanId, String batchId, String type, String status, String code) - throws ApiException { - - LOGGER.finest( - "[getDeliveryReportByBatchId]" - + " " - + "servicePlanId: " - + servicePlanId - + ", " - + "batchId: " - + batchId - + ", " - + "type: " - + type - + ", " - + "status: " - + status - + ", " - + "code: " - + code); - - HttpRequest httpRequest = - getDeliveryReportByBatchIdRequestBuilder(servicePlanId, batchId, type, status, code); - HttpResponse response = - httpClient.invokeAPI( - this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); - - if (HttpStatus.isSuccessfulStatus(response.getCode())) { - TypeReference localVarReturnType = - new TypeReference() {}; - return mapper.deserialize(response, localVarReturnType); - } - // fallback to default errors handling: - // all error cases definition are not required from specs: will try some "hardcoded" content - // parsing - throw ApiExceptionBuilder.build( - response.getMessage(), - response.getCode(), - mapper.deserialize(response, new TypeReference>() {})); - } - - private HttpRequest getDeliveryReportByBatchIdRequestBuilder( - String servicePlanId, String batchId, String type, String status, String code) - throws ApiException { - // verify the required parameter 'servicePlanId' is set - if (servicePlanId == null) { - throw new ApiException( - 400, - "Missing the required parameter 'servicePlanId' when calling getDeliveryReportByBatchId"); - } - // verify the required parameter 'batchId' is set - if (batchId == null) { - throw new ApiException( - 400, "Missing the required parameter 'batchId' when calling getDeliveryReportByBatchId"); - } - - String localVarPath = - "/xms/v1/{service_plan_id}/batches/{batch_id}/delivery_report" - .replaceAll( - "\\{" + "service_plan_id" + "\\}", - URLPathUtils.encodePathSegment(servicePlanId.toString())) - .replaceAll( - "\\{" + "batch_id" + "\\}", URLPathUtils.encodePathSegment(batchId.toString())); - - List localVarQueryParams = new ArrayList<>(); - if (null != type) { - localVarQueryParams.add( - new URLParameter("type", type, URLParameter.STYLE.valueOf("form".toUpperCase()), true)); - } - if (null != status) { - localVarQueryParams.add( - new URLParameter( - "status", status, URLParameter.STYLE.valueOf("form".toUpperCase()), true)); - } - if (null != code) { - localVarQueryParams.add( - new URLParameter("code", code, URLParameter.STYLE.valueOf("form".toUpperCase()), true)); - } - - Map localVarHeaderParams = new HashMap<>(); - - final Collection localVarAccepts = Arrays.asList("application/json"); - - final Collection localVarContentTypes = Arrays.asList(); - - final Collection localVarAuthNames = Arrays.asList("BearerAuth"); - final String serializedBody = null; - - return new HttpRequest( - localVarPath, - HttpMethod.GET, - localVarQueryParams, - serializedBody, - localVarHeaderParams, - localVarAccepts, - localVarContentTypes, - localVarAuthNames); - } - - /** - * Retrieve a recipient delivery report A recipient delivery report contains the message status - * for a single recipient phone number. - * - * @param servicePlanId Your service plan ID. You can find this on your - * [Dashboard](https://dashboard.sinch.com/sms/api/rest). (required) - * @param batchId The batch ID you received from sending a message. (required) - * @param recipientMsisdn Phone number for which you to want to search. (required) - * @return RecipientDeliveryReportDto - * @throws ApiException if fails to make API call - */ - public RecipientDeliveryReportDto getDeliveryReportByPhoneNumber( - String servicePlanId, String batchId, String recipientMsisdn) throws ApiException { - - LOGGER.finest( - "[getDeliveryReportByPhoneNumber]" - + " " - + "servicePlanId: " - + servicePlanId - + ", " - + "batchId: " - + batchId - + ", " - + "recipientMsisdn: " - + recipientMsisdn); - - HttpRequest httpRequest = - getDeliveryReportByPhoneNumberRequestBuilder(servicePlanId, batchId, recipientMsisdn); - HttpResponse response = - httpClient.invokeAPI( - this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); - - if (HttpStatus.isSuccessfulStatus(response.getCode())) { - TypeReference localVarReturnType = - new TypeReference() {}; - return mapper.deserialize(response, localVarReturnType); - } - // fallback to default errors handling: - // all error cases definition are not required from specs: will try some "hardcoded" content - // parsing - throw ApiExceptionBuilder.build( - response.getMessage(), - response.getCode(), - mapper.deserialize(response, new TypeReference>() {})); - } - - private HttpRequest getDeliveryReportByPhoneNumberRequestBuilder( - String servicePlanId, String batchId, String recipientMsisdn) throws ApiException { - // verify the required parameter 'servicePlanId' is set - if (servicePlanId == null) { - throw new ApiException( - 400, - "Missing the required parameter 'servicePlanId' when calling" - + " getDeliveryReportByPhoneNumber"); - } - // verify the required parameter 'batchId' is set - if (batchId == null) { - throw new ApiException( - 400, - "Missing the required parameter 'batchId' when calling getDeliveryReportByPhoneNumber"); - } - // verify the required parameter 'recipientMsisdn' is set - if (recipientMsisdn == null) { - throw new ApiException( - 400, - "Missing the required parameter 'recipientMsisdn' when calling" - + " getDeliveryReportByPhoneNumber"); - } - - String localVarPath = - "/xms/v1/{service_plan_id}/batches/{batch_id}/delivery_report/{recipient_msisdn}" - .replaceAll( - "\\{" + "service_plan_id" + "\\}", - URLPathUtils.encodePathSegment(servicePlanId.toString())) - .replaceAll( - "\\{" + "batch_id" + "\\}", URLPathUtils.encodePathSegment(batchId.toString())) - .replaceAll( - "\\{" + "recipient_msisdn" + "\\}", - URLPathUtils.encodePathSegment(recipientMsisdn.toString())); - - List localVarQueryParams = new ArrayList<>(); - - Map localVarHeaderParams = new HashMap<>(); - - final Collection localVarAccepts = Arrays.asList("application/json"); - - final Collection localVarContentTypes = Arrays.asList(); - - final Collection localVarAuthNames = Arrays.asList("BearerAuth"); - final String serializedBody = null; - - return new HttpRequest( - localVarPath, - HttpMethod.GET, - localVarQueryParams, - serializedBody, - localVarHeaderParams, - localVarAccepts, - localVarContentTypes, - localVarAuthNames); - } - - /** - * Retrieve a list of delivery reports Get a list of finished delivery reports. This operation - * supports pagination. - * - * @param servicePlanId Your service plan ID. You can find this on your - * [Dashboard](https://dashboard.sinch.com/sms/api/rest). (required) - * @param page The page number starting from 0. (optional, default to 0) - * @param pageSize Determines the size of a page. (optional, default to 30) - * @param startDate Only list messages received at or after this date/time. Default: 24h ago - * (optional) - * @param endDate Only list messages received before this date/time. (optional) - * @param status Comma separated list of delivery report statuses to include. (optional) - * @param code Comma separated list of delivery receipt error codes to include. (optional) - * @param clientReference Client reference to include (optional) - * @return DeliveryReportListDto - * @throws ApiException if fails to make API call - */ - public DeliveryReportListDto getDeliveryReports( - String servicePlanId, - Integer page, - Integer pageSize, - String startDate, - String endDate, - String status, - String code, - String clientReference) - throws ApiException { - - LOGGER.finest( - "[getDeliveryReports]" - + " " - + "servicePlanId: " - + servicePlanId - + ", " - + "page: " - + page - + ", " - + "pageSize: " - + pageSize - + ", " - + "startDate: " - + startDate - + ", " - + "endDate: " - + endDate - + ", " - + "status: " - + status - + ", " - + "code: " - + code - + ", " - + "clientReference: " - + clientReference); - - HttpRequest httpRequest = - getDeliveryReportsRequestBuilder( - servicePlanId, page, pageSize, startDate, endDate, status, code, clientReference); - HttpResponse response = - httpClient.invokeAPI( - this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); - - if (HttpStatus.isSuccessfulStatus(response.getCode())) { - TypeReference localVarReturnType = - new TypeReference() {}; - return mapper.deserialize(response, localVarReturnType); - } - // fallback to default errors handling: - // all error cases definition are not required from specs: will try some "hardcoded" content - // parsing - throw ApiExceptionBuilder.build( - response.getMessage(), - response.getCode(), - mapper.deserialize(response, new TypeReference>() {})); - } - - private HttpRequest getDeliveryReportsRequestBuilder( - String servicePlanId, - Integer page, - Integer pageSize, - String startDate, - String endDate, - String status, - String code, - String clientReference) - throws ApiException { - // verify the required parameter 'servicePlanId' is set - if (servicePlanId == null) { - throw new ApiException( - 400, "Missing the required parameter 'servicePlanId' when calling getDeliveryReports"); - } - - String localVarPath = - "/xms/v1/{service_plan_id}/delivery_reports" - .replaceAll( - "\\{" + "service_plan_id" + "\\}", - URLPathUtils.encodePathSegment(servicePlanId.toString())); - - List localVarQueryParams = new ArrayList<>(); - if (null != page) { - localVarQueryParams.add( - new URLParameter("page", page, URLParameter.STYLE.valueOf("form".toUpperCase()), true)); - } - if (null != pageSize) { - localVarQueryParams.add( - new URLParameter( - "page_size", pageSize, URLParameter.STYLE.valueOf("form".toUpperCase()), true)); - } - if (null != startDate) { - localVarQueryParams.add( - new URLParameter( - "start_date", startDate, URLParameter.STYLE.valueOf("form".toUpperCase()), true)); - } - if (null != endDate) { - localVarQueryParams.add( - new URLParameter( - "end_date", endDate, URLParameter.STYLE.valueOf("form".toUpperCase()), true)); - } - if (null != status) { - localVarQueryParams.add( - new URLParameter( - "status", status, URLParameter.STYLE.valueOf("form".toUpperCase()), true)); - } - if (null != code) { - localVarQueryParams.add( - new URLParameter("code", code, URLParameter.STYLE.valueOf("form".toUpperCase()), true)); - } - if (null != clientReference) { - localVarQueryParams.add( - new URLParameter( - "client_reference", - clientReference, - URLParameter.STYLE.valueOf("form".toUpperCase()), - true)); - } - - Map localVarHeaderParams = new HashMap<>(); - - final Collection localVarAccepts = Arrays.asList("application/json"); - - final Collection localVarContentTypes = Arrays.asList(); - - final Collection localVarAuthNames = Arrays.asList("BearerAuth"); - final String serializedBody = null; - - return new HttpRequest( - localVarPath, - HttpMethod.GET, - localVarQueryParams, - serializedBody, - localVarHeaderParams, - localVarAccepts, - localVarContentTypes, - localVarAuthNames); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/adapters/api/v1/GroupsApi.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/adapters/api/v1/GroupsApi.java deleted file mode 100644 index 5406fec1a..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/adapters/api/v1/GroupsApi.java +++ /dev/null @@ -1,644 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.adapters.api.v1; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.core.exceptions.ApiExceptionBuilder; -import com.sinch.sdk.core.http.AuthManager; -import com.sinch.sdk.core.http.HttpClient; -import com.sinch.sdk.core.http.HttpMapper; -import com.sinch.sdk.core.http.HttpMethod; -import com.sinch.sdk.core.http.HttpRequest; -import com.sinch.sdk.core.http.HttpResponse; -import com.sinch.sdk.core.http.HttpStatus; -import com.sinch.sdk.core.http.URLParameter; -import com.sinch.sdk.core.http.URLPathUtils; -import com.sinch.sdk.core.models.ServerConfiguration; -import com.sinch.sdk.domains.sms.models.dto.v1.ApiGroupListDto; -import com.sinch.sdk.domains.sms.models.dto.v1.CreateGroupResponseDto; -import com.sinch.sdk.domains.sms.models.dto.v1.GroupObjectDto; -import com.sinch.sdk.domains.sms.models.dto.v1.ReplaceGroupRequestDto; -import com.sinch.sdk.domains.sms.models.dto.v1.UpdateGroupRequestDto; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.logging.Logger; - -public class GroupsApi { - - private static final Logger LOGGER = Logger.getLogger(GroupsApi.class.getName()); - private HttpClient httpClient; - private ServerConfiguration serverConfiguration; - private Map authManagersByOasSecuritySchemes; - private HttpMapper mapper; - - public GroupsApi( - HttpClient httpClient, - ServerConfiguration serverConfiguration, - Map authManagersByOasSecuritySchemes, - HttpMapper mapper) { - this.httpClient = httpClient; - this.serverConfiguration = serverConfiguration; - this.authManagersByOasSecuritySchemes = authManagersByOasSecuritySchemes; - this.mapper = mapper; - } - - /** - * Create a group A group is a set of phone numbers (MSISDNs) that can be used as a target in the - * `send_batch_msg` operation. An MSISDN can only occur once in a group and any attempts - * to add a duplicate would be ignored but not rejected. - * - * @param servicePlanId Your service plan ID. You can find this on your - * [Dashboard](https://dashboard.sinch.com/sms/api/rest). (required) - * @param groupObjectDto (optional) - * @return CreateGroupResponseDto - * @throws ApiException if fails to make API call - */ - public CreateGroupResponseDto createGroup(String servicePlanId, GroupObjectDto groupObjectDto) - throws ApiException { - - LOGGER.finest( - "[createGroup]" - + " " - + "servicePlanId: " - + servicePlanId - + ", " - + "groupObjectDto: " - + groupObjectDto); - - HttpRequest httpRequest = createGroupRequestBuilder(servicePlanId, groupObjectDto); - HttpResponse response = - httpClient.invokeAPI( - this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); - - if (HttpStatus.isSuccessfulStatus(response.getCode())) { - TypeReference localVarReturnType = - new TypeReference() {}; - return mapper.deserialize(response, localVarReturnType); - } - // fallback to default errors handling: - // all error cases definition are not required from specs: will try some "hardcoded" content - // parsing - throw ApiExceptionBuilder.build( - response.getMessage(), - response.getCode(), - mapper.deserialize(response, new TypeReference>() {})); - } - - private HttpRequest createGroupRequestBuilder(String servicePlanId, GroupObjectDto groupObjectDto) - throws ApiException { - // verify the required parameter 'servicePlanId' is set - if (servicePlanId == null) { - throw new ApiException( - 400, "Missing the required parameter 'servicePlanId' when calling createGroup"); - } - - String localVarPath = - "/xms/v1/{service_plan_id}/groups" - .replaceAll( - "\\{" + "service_plan_id" + "\\}", - URLPathUtils.encodePathSegment(servicePlanId.toString())); - - List localVarQueryParams = new ArrayList<>(); - - Map localVarHeaderParams = new HashMap<>(); - - final Collection localVarAccepts = Arrays.asList("application/json"); - - final Collection localVarContentTypes = Arrays.asList("application/json"); - - final Collection localVarAuthNames = Arrays.asList("BearerAuth"); - final String serializedBody = mapper.serialize(localVarContentTypes, groupObjectDto); - - return new HttpRequest( - localVarPath, - HttpMethod.POST, - localVarQueryParams, - serializedBody, - localVarHeaderParams, - localVarAccepts, - localVarContentTypes, - localVarAuthNames); - } - - /** - * Delete a group This operation deletes the group with the provided group ID. - * - * @param servicePlanId Your service plan ID. You can find this on your - * [Dashboard](https://dashboard.sinch.com/sms/api/rest). (required) - * @param groupId ID of a group that you are interested in getting. (required) - * @throws ApiException if fails to make API call - */ - public void deleteGroup(String servicePlanId, String groupId) throws ApiException { - - LOGGER.finest( - "[deleteGroup]" + " " + "servicePlanId: " + servicePlanId + ", " + "groupId: " + groupId); - - HttpRequest httpRequest = deleteGroupRequestBuilder(servicePlanId, groupId); - HttpResponse response = - httpClient.invokeAPI( - this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); - - if (HttpStatus.isSuccessfulStatus(response.getCode())) { - return; - } - // fallback to default errors handling: - // all error cases definition are not required from specs: will try some "hardcoded" content - // parsing - throw ApiExceptionBuilder.build( - response.getMessage(), - response.getCode(), - mapper.deserialize(response, new TypeReference>() {})); - } - - private HttpRequest deleteGroupRequestBuilder(String servicePlanId, String groupId) - throws ApiException { - // verify the required parameter 'servicePlanId' is set - if (servicePlanId == null) { - throw new ApiException( - 400, "Missing the required parameter 'servicePlanId' when calling deleteGroup"); - } - // verify the required parameter 'groupId' is set - if (groupId == null) { - throw new ApiException( - 400, "Missing the required parameter 'groupId' when calling deleteGroup"); - } - - String localVarPath = - "/xms/v1/{service_plan_id}/groups/{group_id}" - .replaceAll( - "\\{" + "service_plan_id" + "\\}", - URLPathUtils.encodePathSegment(servicePlanId.toString())) - .replaceAll( - "\\{" + "group_id" + "\\}", URLPathUtils.encodePathSegment(groupId.toString())); - - List localVarQueryParams = new ArrayList<>(); - - Map localVarHeaderParams = new HashMap<>(); - - final Collection localVarAccepts = Arrays.asList(); - - final Collection localVarContentTypes = Arrays.asList(); - - final Collection localVarAuthNames = Arrays.asList("BearerAuth"); - final String serializedBody = null; - - return new HttpRequest( - localVarPath, - HttpMethod.DELETE, - localVarQueryParams, - serializedBody, - localVarHeaderParams, - localVarAccepts, - localVarContentTypes, - localVarAuthNames); - } - - /** - * Get phone numbers for a group This operation retrieves the members of the group with the - * provided group ID. - * - * @param servicePlanId Your service plan ID. You can find this on your - * [Dashboard](https://dashboard.sinch.com/sms/api/rest). (required) - * @param groupId ID of a group that you are interested in getting. (required) - * @return List<String> - * @throws ApiException if fails to make API call - */ - public List getMembers(String servicePlanId, String groupId) throws ApiException { - - LOGGER.finest( - "[getMembers]" + " " + "servicePlanId: " + servicePlanId + ", " + "groupId: " + groupId); - - HttpRequest httpRequest = getMembersRequestBuilder(servicePlanId, groupId); - HttpResponse response = - httpClient.invokeAPI( - this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); - - if (HttpStatus.isSuccessfulStatus(response.getCode())) { - TypeReference> localVarReturnType = new TypeReference>() {}; - return mapper.deserialize(response, localVarReturnType); - } - // fallback to default errors handling: - // all error cases definition are not required from specs: will try some "hardcoded" content - // parsing - throw ApiExceptionBuilder.build( - response.getMessage(), - response.getCode(), - mapper.deserialize(response, new TypeReference>() {})); - } - - private HttpRequest getMembersRequestBuilder(String servicePlanId, String groupId) - throws ApiException { - // verify the required parameter 'servicePlanId' is set - if (servicePlanId == null) { - throw new ApiException( - 400, "Missing the required parameter 'servicePlanId' when calling getMembers"); - } - // verify the required parameter 'groupId' is set - if (groupId == null) { - throw new ApiException( - 400, "Missing the required parameter 'groupId' when calling getMembers"); - } - - String localVarPath = - "/xms/v1/{service_plan_id}/groups/{group_id}/members" - .replaceAll( - "\\{" + "service_plan_id" + "\\}", - URLPathUtils.encodePathSegment(servicePlanId.toString())) - .replaceAll( - "\\{" + "group_id" + "\\}", URLPathUtils.encodePathSegment(groupId.toString())); - - List localVarQueryParams = new ArrayList<>(); - - Map localVarHeaderParams = new HashMap<>(); - - final Collection localVarAccepts = Arrays.asList("application/json"); - - final Collection localVarContentTypes = Arrays.asList(); - - final Collection localVarAuthNames = Arrays.asList("BearerAuth"); - final String serializedBody = null; - - return new HttpRequest( - localVarPath, - HttpMethod.GET, - localVarQueryParams, - serializedBody, - localVarHeaderParams, - localVarAccepts, - localVarContentTypes, - localVarAuthNames); - } - - /** - * List Groups With the list operation you can list all groups that you have created. This - * operation supports pagination. Groups are returned in reverse chronological order. - * - * @param servicePlanId Your service plan ID. You can find this on your - * [Dashboard](https://dashboard.sinch.com/sms/api/rest). (required) - * @param page The page number starting from 0. (optional, default to 0) - * @param pageSize Determines the size of a page. (optional, default to 30) - * @return ApiGroupListDto - * @throws ApiException if fails to make API call - */ - public ApiGroupListDto listGroups(String servicePlanId, Integer page, Integer pageSize) - throws ApiException { - - LOGGER.finest( - "[listGroups]" - + " " - + "servicePlanId: " - + servicePlanId - + ", " - + "page: " - + page - + ", " - + "pageSize: " - + pageSize); - - HttpRequest httpRequest = listGroupsRequestBuilder(servicePlanId, page, pageSize); - HttpResponse response = - httpClient.invokeAPI( - this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); - - if (HttpStatus.isSuccessfulStatus(response.getCode())) { - TypeReference localVarReturnType = new TypeReference() {}; - return mapper.deserialize(response, localVarReturnType); - } - // fallback to default errors handling: - // all error cases definition are not required from specs: will try some "hardcoded" content - // parsing - throw ApiExceptionBuilder.build( - response.getMessage(), - response.getCode(), - mapper.deserialize(response, new TypeReference>() {})); - } - - private HttpRequest listGroupsRequestBuilder(String servicePlanId, Integer page, Integer pageSize) - throws ApiException { - // verify the required parameter 'servicePlanId' is set - if (servicePlanId == null) { - throw new ApiException( - 400, "Missing the required parameter 'servicePlanId' when calling listGroups"); - } - - String localVarPath = - "/xms/v1/{service_plan_id}/groups" - .replaceAll( - "\\{" + "service_plan_id" + "\\}", - URLPathUtils.encodePathSegment(servicePlanId.toString())); - - List localVarQueryParams = new ArrayList<>(); - if (null != page) { - localVarQueryParams.add( - new URLParameter("page", page, URLParameter.STYLE.valueOf("form".toUpperCase()), true)); - } - if (null != pageSize) { - localVarQueryParams.add( - new URLParameter( - "page_size", pageSize, URLParameter.STYLE.valueOf("form".toUpperCase()), true)); - } - - Map localVarHeaderParams = new HashMap<>(); - - final Collection localVarAccepts = Arrays.asList("application/json"); - - final Collection localVarContentTypes = Arrays.asList(); - - final Collection localVarAuthNames = Arrays.asList("BearerAuth"); - final String serializedBody = null; - - return new HttpRequest( - localVarPath, - HttpMethod.GET, - localVarQueryParams, - serializedBody, - localVarHeaderParams, - localVarAccepts, - localVarContentTypes, - localVarAuthNames); - } - - /** - * Replace a group The replace operation will replace all parameters, including members, of an - * existing group with new values. Replacing a group targeted by a batch message scheduled in the - * future is allowed and changes will be reflected when the batch is sent. - * - * @param servicePlanId Your service plan ID. You can find this on your - * [Dashboard](https://dashboard.sinch.com/sms/api/rest). (required) - * @param groupId ID of a group that you are interested in getting. (required) - * @param replaceGroupRequestDto (optional) - * @return CreateGroupResponseDto - * @throws ApiException if fails to make API call - */ - public CreateGroupResponseDto replaceGroup( - String servicePlanId, String groupId, ReplaceGroupRequestDto replaceGroupRequestDto) - throws ApiException { - - LOGGER.finest( - "[replaceGroup]" - + " " - + "servicePlanId: " - + servicePlanId - + ", " - + "groupId: " - + groupId - + ", " - + "replaceGroupRequestDto: " - + replaceGroupRequestDto); - - HttpRequest httpRequest = - replaceGroupRequestBuilder(servicePlanId, groupId, replaceGroupRequestDto); - HttpResponse response = - httpClient.invokeAPI( - this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); - - if (HttpStatus.isSuccessfulStatus(response.getCode())) { - TypeReference localVarReturnType = - new TypeReference() {}; - return mapper.deserialize(response, localVarReturnType); - } - // fallback to default errors handling: - // all error cases definition are not required from specs: will try some "hardcoded" content - // parsing - throw ApiExceptionBuilder.build( - response.getMessage(), - response.getCode(), - mapper.deserialize(response, new TypeReference>() {})); - } - - private HttpRequest replaceGroupRequestBuilder( - String servicePlanId, String groupId, ReplaceGroupRequestDto replaceGroupRequestDto) - throws ApiException { - // verify the required parameter 'servicePlanId' is set - if (servicePlanId == null) { - throw new ApiException( - 400, "Missing the required parameter 'servicePlanId' when calling replaceGroup"); - } - // verify the required parameter 'groupId' is set - if (groupId == null) { - throw new ApiException( - 400, "Missing the required parameter 'groupId' when calling replaceGroup"); - } - - String localVarPath = - "/xms/v1/{service_plan_id}/groups/{group_id}" - .replaceAll( - "\\{" + "service_plan_id" + "\\}", - URLPathUtils.encodePathSegment(servicePlanId.toString())) - .replaceAll( - "\\{" + "group_id" + "\\}", URLPathUtils.encodePathSegment(groupId.toString())); - - List localVarQueryParams = new ArrayList<>(); - - Map localVarHeaderParams = new HashMap<>(); - - final Collection localVarAccepts = Arrays.asList("application/json"); - - final Collection localVarContentTypes = Arrays.asList("application/json"); - - final Collection localVarAuthNames = Arrays.asList("BearerAuth"); - final String serializedBody = mapper.serialize(localVarContentTypes, replaceGroupRequestDto); - - return new HttpRequest( - localVarPath, - HttpMethod.PUT, - localVarQueryParams, - serializedBody, - localVarHeaderParams, - localVarAccepts, - localVarContentTypes, - localVarAuthNames); - } - - /** - * Retrieve a group This operation retrieves a specific group with the provided group ID. - * - * @param servicePlanId Your service plan ID. You can find this on your - * [Dashboard](https://dashboard.sinch.com/sms/api/rest). (required) - * @param groupId ID of a group that you are interested in getting. (required) - * @return CreateGroupResponseDto - * @throws ApiException if fails to make API call - */ - public CreateGroupResponseDto retrieveGroup(String servicePlanId, String groupId) - throws ApiException { - - LOGGER.finest( - "[retrieveGroup]" + " " + "servicePlanId: " + servicePlanId + ", " + "groupId: " + groupId); - - HttpRequest httpRequest = retrieveGroupRequestBuilder(servicePlanId, groupId); - HttpResponse response = - httpClient.invokeAPI( - this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); - - if (HttpStatus.isSuccessfulStatus(response.getCode())) { - TypeReference localVarReturnType = - new TypeReference() {}; - return mapper.deserialize(response, localVarReturnType); - } - // fallback to default errors handling: - // all error cases definition are not required from specs: will try some "hardcoded" content - // parsing - throw ApiExceptionBuilder.build( - response.getMessage(), - response.getCode(), - mapper.deserialize(response, new TypeReference>() {})); - } - - private HttpRequest retrieveGroupRequestBuilder(String servicePlanId, String groupId) - throws ApiException { - // verify the required parameter 'servicePlanId' is set - if (servicePlanId == null) { - throw new ApiException( - 400, "Missing the required parameter 'servicePlanId' when calling retrieveGroup"); - } - // verify the required parameter 'groupId' is set - if (groupId == null) { - throw new ApiException( - 400, "Missing the required parameter 'groupId' when calling retrieveGroup"); - } - - String localVarPath = - "/xms/v1/{service_plan_id}/groups/{group_id}" - .replaceAll( - "\\{" + "service_plan_id" + "\\}", - URLPathUtils.encodePathSegment(servicePlanId.toString())) - .replaceAll( - "\\{" + "group_id" + "\\}", URLPathUtils.encodePathSegment(groupId.toString())); - - List localVarQueryParams = new ArrayList<>(); - - Map localVarHeaderParams = new HashMap<>(); - - final Collection localVarAccepts = Arrays.asList("application/json"); - - final Collection localVarContentTypes = Arrays.asList(); - - final Collection localVarAuthNames = Arrays.asList("BearerAuth"); - final String serializedBody = null; - - return new HttpRequest( - localVarPath, - HttpMethod.GET, - localVarQueryParams, - serializedBody, - localVarHeaderParams, - localVarAccepts, - localVarContentTypes, - localVarAuthNames); - } - - /** - * Update a group With the update group operation, you can add and remove members in an existing - * group as well as rename the group. This method encompasses a few ways to update a group: 1. By - * using `add` and `remove` arrays containing phone numbers, you control the - * group movements. Any list of valid numbers in E.164 format can be added. 2. By using the - * `auto_update` object, your customer can add or remove themselves from groups. 3. You - * can also add or remove other groups into this group with `add_from_group` and - * `remove_from_group`. #### Other group update info - The request will not be rejected - * for duplicate adds or unknown removes. - The additions will be done before the deletions. If an - * phone number is on both lists, it will not be apart of the resulting group. - Updating a group - * targeted by a batch message scheduled in the future is allowed. Changes will be reflected when - * the batch is sent. - * - * @param servicePlanId Your service plan ID. You can find this on your - * [Dashboard](https://dashboard.sinch.com/sms/api/rest). (required) - * @param groupId ID of a group that you are interested in getting. (required) - * @param updateGroupRequestDto (optional) - * @return CreateGroupResponseDto - * @throws ApiException if fails to make API call - */ - public CreateGroupResponseDto updateGroup( - String servicePlanId, String groupId, UpdateGroupRequestDto updateGroupRequestDto) - throws ApiException { - - LOGGER.finest( - "[updateGroup]" - + " " - + "servicePlanId: " - + servicePlanId - + ", " - + "groupId: " - + groupId - + ", " - + "updateGroupRequestDto: " - + updateGroupRequestDto); - - HttpRequest httpRequest = - updateGroupRequestBuilder(servicePlanId, groupId, updateGroupRequestDto); - HttpResponse response = - httpClient.invokeAPI( - this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); - - if (HttpStatus.isSuccessfulStatus(response.getCode())) { - TypeReference localVarReturnType = - new TypeReference() {}; - return mapper.deserialize(response, localVarReturnType); - } - // fallback to default errors handling: - // all error cases definition are not required from specs: will try some "hardcoded" content - // parsing - throw ApiExceptionBuilder.build( - response.getMessage(), - response.getCode(), - mapper.deserialize(response, new TypeReference>() {})); - } - - private HttpRequest updateGroupRequestBuilder( - String servicePlanId, String groupId, UpdateGroupRequestDto updateGroupRequestDto) - throws ApiException { - // verify the required parameter 'servicePlanId' is set - if (servicePlanId == null) { - throw new ApiException( - 400, "Missing the required parameter 'servicePlanId' when calling updateGroup"); - } - // verify the required parameter 'groupId' is set - if (groupId == null) { - throw new ApiException( - 400, "Missing the required parameter 'groupId' when calling updateGroup"); - } - - String localVarPath = - "/xms/v1/{service_plan_id}/groups/{group_id}" - .replaceAll( - "\\{" + "service_plan_id" + "\\}", - URLPathUtils.encodePathSegment(servicePlanId.toString())) - .replaceAll( - "\\{" + "group_id" + "\\}", URLPathUtils.encodePathSegment(groupId.toString())); - - List localVarQueryParams = new ArrayList<>(); - - Map localVarHeaderParams = new HashMap<>(); - - final Collection localVarAccepts = Arrays.asList("application/json"); - - final Collection localVarContentTypes = Arrays.asList("application/json"); - - final Collection localVarAuthNames = Arrays.asList("BearerAuth"); - final String serializedBody = mapper.serialize(localVarContentTypes, updateGroupRequestDto); - - return new HttpRequest( - localVarPath, - HttpMethod.POST, - localVarQueryParams, - serializedBody, - localVarHeaderParams, - localVarAccepts, - localVarContentTypes, - localVarAuthNames); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/adapters/api/v1/InboundsApi.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/adapters/api/v1/InboundsApi.java deleted file mode 100644 index 442939769..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/adapters/api/v1/InboundsApi.java +++ /dev/null @@ -1,298 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.adapters.api.v1; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.core.exceptions.ApiExceptionBuilder; -import com.sinch.sdk.core.http.AuthManager; -import com.sinch.sdk.core.http.HttpClient; -import com.sinch.sdk.core.http.HttpMapper; -import com.sinch.sdk.core.http.HttpMethod; -import com.sinch.sdk.core.http.HttpRequest; -import com.sinch.sdk.core.http.HttpResponse; -import com.sinch.sdk.core.http.HttpStatus; -import com.sinch.sdk.core.http.URLParameter; -import com.sinch.sdk.core.http.URLPathUtils; -import com.sinch.sdk.core.models.ServerConfiguration; -import com.sinch.sdk.domains.sms.models.dto.v1.ApiInboundListDto; -import com.sinch.sdk.domains.sms.models.dto.v1.InboundDto; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.logging.Logger; - -public class InboundsApi { - - private static final Logger LOGGER = Logger.getLogger(InboundsApi.class.getName()); - private HttpClient httpClient; - private ServerConfiguration serverConfiguration; - private Map authManagersByOasSecuritySchemes; - private HttpMapper mapper; - - public InboundsApi( - HttpClient httpClient, - ServerConfiguration serverConfiguration, - Map authManagersByOasSecuritySchemes, - HttpMapper mapper) { - this.httpClient = httpClient; - this.serverConfiguration = serverConfiguration; - this.authManagersByOasSecuritySchemes = authManagersByOasSecuritySchemes; - this.mapper = mapper; - } - - /** - * List incoming messages With the list operation, you can list all inbound messages that you have - * received. This operation supports pagination. Inbounds are returned in reverse chronological - * order. - * - * @param servicePlanId Your service plan ID. You can find this on your - * [Dashboard](https://dashboard.sinch.com/sms/api/rest). (required) - * @param page The page number starting from 0. (optional, default to 0) - * @param pageSize Determines the size of a page (optional, default to 30) - * @param to Only list messages sent to this destination. Multiple phone numbers formatted as - * either <a - * href=\"https://community.sinch.com/t5/Glossary/E-164/ta-p/7537\" - * target=\"_blank\">E.164</a> or short codes can be comma separated. - * (optional) - * @param startDate Only list messages received at or after this date/time. Formatted as - * [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601): `YYYY-MM-DDThh:mm:ss.SSSZ`. - * Default: Now-24 (optional, default to Now-24) - * @param endDate Only list messages received before this date/time. Formatted as - * [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601): `YYYY-MM-DDThh:mm:ss.SSSZ`. - * (optional) - * @param clientReference Using a client reference in inbound messages requires additional setup - * on your account. Contact your <a - * href=\"https://dashboard.sinch.com/settings/account-details\" - * target=\"_blank\">account manager</a> to enable this feature. Only - * list inbound messages that are in response to messages with a previously provided client - * reference. (optional) - * @return ApiInboundListDto - * @throws ApiException if fails to make API call - */ - public ApiInboundListDto listInboundMessages( - String servicePlanId, - Integer page, - Integer pageSize, - String to, - String startDate, - String endDate, - String clientReference) - throws ApiException { - - LOGGER.finest( - "[listInboundMessages]" - + " " - + "servicePlanId: " - + servicePlanId - + ", " - + "page: " - + page - + ", " - + "pageSize: " - + pageSize - + ", " - + "to: " - + to - + ", " - + "startDate: " - + startDate - + ", " - + "endDate: " - + endDate - + ", " - + "clientReference: " - + clientReference); - - HttpRequest httpRequest = - listInboundMessagesRequestBuilder( - servicePlanId, page, pageSize, to, startDate, endDate, clientReference); - HttpResponse response = - httpClient.invokeAPI( - this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); - - if (HttpStatus.isSuccessfulStatus(response.getCode())) { - TypeReference localVarReturnType = - new TypeReference() {}; - return mapper.deserialize(response, localVarReturnType); - } - // fallback to default errors handling: - // all error cases definition are not required from specs: will try some "hardcoded" content - // parsing - throw ApiExceptionBuilder.build( - response.getMessage(), - response.getCode(), - mapper.deserialize(response, new TypeReference>() {})); - } - - private HttpRequest listInboundMessagesRequestBuilder( - String servicePlanId, - Integer page, - Integer pageSize, - String to, - String startDate, - String endDate, - String clientReference) - throws ApiException { - // verify the required parameter 'servicePlanId' is set - if (servicePlanId == null) { - throw new ApiException( - 400, "Missing the required parameter 'servicePlanId' when calling listInboundMessages"); - } - - String localVarPath = - "/xms/v1/{service_plan_id}/inbounds" - .replaceAll( - "\\{" + "service_plan_id" + "\\}", - URLPathUtils.encodePathSegment(servicePlanId.toString())); - - List localVarQueryParams = new ArrayList<>(); - if (null != page) { - localVarQueryParams.add( - new URLParameter("page", page, URLParameter.STYLE.valueOf("form".toUpperCase()), true)); - } - if (null != pageSize) { - localVarQueryParams.add( - new URLParameter( - "page_size", pageSize, URLParameter.STYLE.valueOf("form".toUpperCase()), true)); - } - if (null != to) { - localVarQueryParams.add( - new URLParameter("to", to, URLParameter.STYLE.valueOf("form".toUpperCase()), true)); - } - if (null != startDate) { - localVarQueryParams.add( - new URLParameter( - "start_date", startDate, URLParameter.STYLE.valueOf("form".toUpperCase()), true)); - } - if (null != endDate) { - localVarQueryParams.add( - new URLParameter( - "end_date", endDate, URLParameter.STYLE.valueOf("form".toUpperCase()), true)); - } - if (null != clientReference) { - localVarQueryParams.add( - new URLParameter( - "client_reference", - clientReference, - URLParameter.STYLE.valueOf("form".toUpperCase()), - true)); - } - - Map localVarHeaderParams = new HashMap<>(); - - final Collection localVarAccepts = Arrays.asList("application/json"); - - final Collection localVarContentTypes = Arrays.asList(); - - final Collection localVarAuthNames = Arrays.asList("BearerAuth"); - final String serializedBody = null; - - return new HttpRequest( - localVarPath, - HttpMethod.GET, - localVarQueryParams, - serializedBody, - localVarHeaderParams, - localVarAccepts, - localVarContentTypes, - localVarAuthNames); - } - - /** - * Retrieve inbound message This operation retrieves a specific inbound message with the provided - * inbound ID. - * - * @param servicePlanId Your service plan ID. You can find this on your - * [Dashboard](https://dashboard.sinch.com/sms/api/rest). (required) - * @param inboundId The inbound ID found when listing inbound messages. (required) - * @return InboundDto - * @throws ApiException if fails to make API call - */ - public InboundDto retrieveInboundMessage(String servicePlanId, String inboundId) - throws ApiException { - - LOGGER.finest( - "[retrieveInboundMessage]" - + " " - + "servicePlanId: " - + servicePlanId - + ", " - + "inboundId: " - + inboundId); - - HttpRequest httpRequest = retrieveInboundMessageRequestBuilder(servicePlanId, inboundId); - HttpResponse response = - httpClient.invokeAPI( - this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); - - if (HttpStatus.isSuccessfulStatus(response.getCode())) { - TypeReference localVarReturnType = new TypeReference() {}; - return mapper.deserialize(response, localVarReturnType); - } - // fallback to default errors handling: - // all error cases definition are not required from specs: will try some "hardcoded" content - // parsing - throw ApiExceptionBuilder.build( - response.getMessage(), - response.getCode(), - mapper.deserialize(response, new TypeReference>() {})); - } - - private HttpRequest retrieveInboundMessageRequestBuilder(String servicePlanId, String inboundId) - throws ApiException { - // verify the required parameter 'servicePlanId' is set - if (servicePlanId == null) { - throw new ApiException( - 400, - "Missing the required parameter 'servicePlanId' when calling retrieveInboundMessage"); - } - // verify the required parameter 'inboundId' is set - if (inboundId == null) { - throw new ApiException( - 400, "Missing the required parameter 'inboundId' when calling retrieveInboundMessage"); - } - - String localVarPath = - "/xms/v1/{service_plan_id}/inbounds/{inbound_id}" - .replaceAll( - "\\{" + "service_plan_id" + "\\}", - URLPathUtils.encodePathSegment(servicePlanId.toString())) - .replaceAll( - "\\{" + "inbound_id" + "\\}", URLPathUtils.encodePathSegment(inboundId.toString())); - - List localVarQueryParams = new ArrayList<>(); - - Map localVarHeaderParams = new HashMap<>(); - - final Collection localVarAccepts = Arrays.asList("application/json"); - - final Collection localVarContentTypes = Arrays.asList(); - - final Collection localVarAuthNames = Arrays.asList("BearerAuth"); - final String serializedBody = null; - - return new HttpRequest( - localVarPath, - HttpMethod.GET, - localVarQueryParams, - serializedBody, - localVarHeaderParams, - localVarAccepts, - localVarContentTypes, - localVarAuthNames); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/AddKeywordDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/AddKeywordDto.java deleted file mode 100644 index 11893e285..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/AddKeywordDto.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import java.util.Objects; - -/** Keyword to be sent in MO to add MSISDN to a group */ -@JsonPropertyOrder({ - AddKeywordDto.JSON_PROPERTY_FIRST_WORD, - AddKeywordDto.JSON_PROPERTY_SECOND_WORD -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class AddKeywordDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_FIRST_WORD = "first_word"; - private String firstWord; - private boolean firstWordDefined = false; - - public static final String JSON_PROPERTY_SECOND_WORD = "second_word"; - private String secondWord; - private boolean secondWordDefined = false; - - public AddKeywordDto() {} - - public AddKeywordDto firstWord(String firstWord) { - this.firstWord = firstWord; - this.firstWordDefined = true; - return this; - } - - /** - * Opt-in keyword like \"JOIN\" if _auto_update.to_ is dedicated long/short number or - * unique brand keyword like \"Sinch\" if it is a shared short code. - * - * @return firstWord - */ - @JsonProperty(JSON_PROPERTY_FIRST_WORD) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getFirstWord() { - return firstWord; - } - - @JsonIgnore - public boolean getFirstWordDefined() { - return firstWordDefined; - } - - @JsonProperty(JSON_PROPERTY_FIRST_WORD) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setFirstWord(String firstWord) { - this.firstWord = firstWord; - this.firstWordDefined = true; - } - - public AddKeywordDto secondWord(String secondWord) { - this.secondWord = secondWord; - this.secondWordDefined = true; - return this; - } - - /** - * Opt-in keyword like \"JOIN\" if _auto_update.to_ is shared short code. - * - * @return secondWord - */ - @JsonProperty(JSON_PROPERTY_SECOND_WORD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getSecondWord() { - return secondWord; - } - - @JsonIgnore - public boolean getSecondWordDefined() { - return secondWordDefined; - } - - @JsonProperty(JSON_PROPERTY_SECOND_WORD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setSecondWord(String secondWord) { - this.secondWord = secondWord; - this.secondWordDefined = true; - } - - /** Return true if this addKeyword object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AddKeywordDto addKeyword = (AddKeywordDto) o; - return Objects.equals(this.firstWord, addKeyword.firstWord) - && Objects.equals(this.secondWord, addKeyword.secondWord); - } - - @Override - public int hashCode() { - return Objects.hash(firstWord, secondWord); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AddKeywordDto {\n"); - sb.append(" firstWord: ").append(toIndentedString(firstWord)).append("\n"); - sb.append(" secondWord: ").append(toIndentedString(secondWord)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiBatchListBatchesInnerDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiBatchListBatchesInnerDto.java deleted file mode 100644 index 96563da42..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiBatchListBatchesInnerDto.java +++ /dev/null @@ -1,382 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.MapperFeature; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.deser.std.StdDeserializer; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; -import com.sinch.sdk.core.models.AbstractOpenApiSchema; -import com.sinch.sdk.core.utils.databind.JSONNavigator; -import java.io.IOException; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; - -@JsonDeserialize(using = ApiBatchListBatchesInnerDto.ApiBatchListBatchesInnerDtoDeserializer.class) -@JsonSerialize(using = ApiBatchListBatchesInnerDto.ApiBatchListBatchesInnerDtoSerializer.class) -public final class ApiBatchListBatchesInnerDto extends AbstractOpenApiSchema { - private static final Logger log = Logger.getLogger(ApiBatchListBatchesInnerDto.class.getName()); - - public static final class ApiBatchListBatchesInnerDtoSerializer - extends StdSerializer { - private static final long serialVersionUID = 1L; - - public ApiBatchListBatchesInnerDtoSerializer(Class t) { - super(t); - } - - public ApiBatchListBatchesInnerDtoSerializer() { - this(null); - } - - @Override - public void serialize( - ApiBatchListBatchesInnerDto value, JsonGenerator jgen, SerializerProvider provider) - throws IOException, JsonProcessingException { - jgen.writeObject(value.getActualInstance()); - } - } - - public static final class ApiBatchListBatchesInnerDtoDeserializer - extends StdDeserializer { - - private static final long serialVersionUID = 1L; - - public ApiBatchListBatchesInnerDtoDeserializer() { - this(ApiBatchListBatchesInnerDto.class); - } - - public ApiBatchListBatchesInnerDtoDeserializer(Class vc) { - super(vc); - } - - @Override - public ApiBatchListBatchesInnerDto deserialize(JsonParser jp, DeserializationContext ctxt) - throws IOException, JsonProcessingException { - JsonNode tree = jp.readValueAsTree(); - Object deserialized = null; - ApiBatchListBatchesInnerDto newApiBatchListBatchesInnerDto = - new ApiBatchListBatchesInnerDto(); - Map result2 = - tree.traverse(jp.getCodec()).readValueAs(new TypeReference>() {}); - String discriminatorValue = (String) result2.get("type"); - switch (discriminatorValue) { - case "BinaryResponse": - deserialized = tree.traverse(jp.getCodec()).readValueAs(BinaryResponseDto.class); - newApiBatchListBatchesInnerDto.setActualInstance(deserialized); - return newApiBatchListBatchesInnerDto; - case "MediaResponse": - deserialized = tree.traverse(jp.getCodec()).readValueAs(MediaResponseDto.class); - newApiBatchListBatchesInnerDto.setActualInstance(deserialized); - return newApiBatchListBatchesInnerDto; - case "TextResponse": - deserialized = tree.traverse(jp.getCodec()).readValueAs(TextResponseDto.class); - newApiBatchListBatchesInnerDto.setActualInstance(deserialized); - return newApiBatchListBatchesInnerDto; - case "mt_binary": - deserialized = tree.traverse(jp.getCodec()).readValueAs(BinaryResponseDto.class); - newApiBatchListBatchesInnerDto.setActualInstance(deserialized); - return newApiBatchListBatchesInnerDto; - case "mt_media": - deserialized = tree.traverse(jp.getCodec()).readValueAs(MediaResponseDto.class); - newApiBatchListBatchesInnerDto.setActualInstance(deserialized); - return newApiBatchListBatchesInnerDto; - case "mt_text": - deserialized = tree.traverse(jp.getCodec()).readValueAs(TextResponseDto.class); - newApiBatchListBatchesInnerDto.setActualInstance(deserialized); - return newApiBatchListBatchesInnerDto; - default: - log.log( - Level.WARNING, - String.format( - "Failed to lookup discriminator value `%s` for ApiBatchListBatchesInnerDto." - + " Possible values: BinaryResponse MediaResponse TextResponse mt_binary" - + " mt_media mt_text", - discriminatorValue)); - } - - boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); - int match = 0; - JsonToken token = tree.traverse(jp.getCodec()).nextToken(); - // deserialize BinaryResponseDto - try { - boolean attemptParsing = true; - // ensure that we respect type coercion as set on the client ObjectMapper - if (BinaryResponseDto.class.equals(Integer.class) - || BinaryResponseDto.class.equals(Long.class) - || BinaryResponseDto.class.equals(Float.class) - || BinaryResponseDto.class.equals(Double.class) - || BinaryResponseDto.class.equals(Boolean.class) - || BinaryResponseDto.class.equals(String.class)) { - attemptParsing = typeCoercion; - if (!attemptParsing) { - attemptParsing |= - ((BinaryResponseDto.class.equals(Integer.class) - || BinaryResponseDto.class.equals(Long.class)) - && token == JsonToken.VALUE_NUMBER_INT); - attemptParsing |= - ((BinaryResponseDto.class.equals(Float.class) - || BinaryResponseDto.class.equals(Double.class)) - && token == JsonToken.VALUE_NUMBER_FLOAT); - attemptParsing |= - (BinaryResponseDto.class.equals(Boolean.class) - && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); - attemptParsing |= - (BinaryResponseDto.class.equals(String.class) && token == JsonToken.VALUE_STRING); - } - } - if (attemptParsing) { - deserialized = tree.traverse(jp.getCodec()).readValueAs(BinaryResponseDto.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 'BinaryResponseDto'"); - } - } catch (Exception e) { - // deserialization failed, continue - log.log(Level.FINER, "Input data does not match schema 'BinaryResponseDto'", e); - } - - // deserialize MediaResponseDto - try { - boolean attemptParsing = true; - // ensure that we respect type coercion as set on the client ObjectMapper - if (MediaResponseDto.class.equals(Integer.class) - || MediaResponseDto.class.equals(Long.class) - || MediaResponseDto.class.equals(Float.class) - || MediaResponseDto.class.equals(Double.class) - || MediaResponseDto.class.equals(Boolean.class) - || MediaResponseDto.class.equals(String.class)) { - attemptParsing = typeCoercion; - if (!attemptParsing) { - attemptParsing |= - ((MediaResponseDto.class.equals(Integer.class) - || MediaResponseDto.class.equals(Long.class)) - && token == JsonToken.VALUE_NUMBER_INT); - attemptParsing |= - ((MediaResponseDto.class.equals(Float.class) - || MediaResponseDto.class.equals(Double.class)) - && token == JsonToken.VALUE_NUMBER_FLOAT); - attemptParsing |= - (MediaResponseDto.class.equals(Boolean.class) - && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); - attemptParsing |= - (MediaResponseDto.class.equals(String.class) && token == JsonToken.VALUE_STRING); - } - } - if (attemptParsing) { - deserialized = tree.traverse(jp.getCodec()).readValueAs(MediaResponseDto.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 'MediaResponseDto'"); - } - } catch (Exception e) { - // deserialization failed, continue - log.log(Level.FINER, "Input data does not match schema 'MediaResponseDto'", e); - } - - // deserialize TextResponseDto - try { - boolean attemptParsing = true; - // ensure that we respect type coercion as set on the client ObjectMapper - if (TextResponseDto.class.equals(Integer.class) - || TextResponseDto.class.equals(Long.class) - || TextResponseDto.class.equals(Float.class) - || TextResponseDto.class.equals(Double.class) - || TextResponseDto.class.equals(Boolean.class) - || TextResponseDto.class.equals(String.class)) { - attemptParsing = typeCoercion; - if (!attemptParsing) { - attemptParsing |= - ((TextResponseDto.class.equals(Integer.class) - || TextResponseDto.class.equals(Long.class)) - && token == JsonToken.VALUE_NUMBER_INT); - attemptParsing |= - ((TextResponseDto.class.equals(Float.class) - || TextResponseDto.class.equals(Double.class)) - && token == JsonToken.VALUE_NUMBER_FLOAT); - attemptParsing |= - (TextResponseDto.class.equals(Boolean.class) - && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); - attemptParsing |= - (TextResponseDto.class.equals(String.class) && token == JsonToken.VALUE_STRING); - } - } - if (attemptParsing) { - deserialized = tree.traverse(jp.getCodec()).readValueAs(TextResponseDto.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 'TextResponseDto'"); - } - } catch (Exception e) { - // deserialization failed, continue - log.log(Level.FINER, "Input data does not match schema 'TextResponseDto'", e); - } - - if (match == 1) { - ApiBatchListBatchesInnerDto ret = new ApiBatchListBatchesInnerDto(); - ret.setActualInstance(deserialized); - return ret; - } - throw new IOException( - String.format( - "Failed deserialization for ApiBatchListBatchesInnerDto: %d classes match result," - + " expected 1", - match)); - } - - /** Handle deserialization of the 'null' value. */ - @Override - public ApiBatchListBatchesInnerDto getNullValue(DeserializationContext ctxt) - throws JsonMappingException { - throw new JsonMappingException( - ctxt.getParser(), "ApiBatchListBatchesInnerDto cannot be null"); - } - } - - // store a list of schema names defined in oneOf - public static final Map> schemas = new HashMap<>(); - - public ApiBatchListBatchesInnerDto() { - super("oneOf", Boolean.FALSE); - } - - public ApiBatchListBatchesInnerDto(BinaryResponseDto o) { - super("oneOf", Boolean.FALSE); - setActualInstance(o); - } - - public ApiBatchListBatchesInnerDto(MediaResponseDto o) { - super("oneOf", Boolean.FALSE); - setActualInstance(o); - } - - public ApiBatchListBatchesInnerDto(TextResponseDto o) { - super("oneOf", Boolean.FALSE); - setActualInstance(o); - } - - static { - schemas.put("BinaryResponseDto", BinaryResponseDto.class); - schemas.put("MediaResponseDto", MediaResponseDto.class); - schemas.put("TextResponseDto", TextResponseDto.class); - JSONNavigator.registerDescendants( - ApiBatchListBatchesInnerDto.class, Collections.unmodifiableMap(schemas)); - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("BinaryResponse", BinaryResponseDto.class); - mappings.put("MediaResponse", MediaResponseDto.class); - mappings.put("TextResponse", TextResponseDto.class); - mappings.put("mt_binary", BinaryResponseDto.class); - mappings.put("mt_media", MediaResponseDto.class); - mappings.put("mt_text", TextResponseDto.class); - mappings.put("ApiBatchList_batches_inner", ApiBatchListBatchesInnerDto.class); - JSONNavigator.registerDiscriminator(ApiBatchListBatchesInnerDto.class, "type", mappings); - } - - @Override - public Map> getSchemas() { - return ApiBatchListBatchesInnerDto.schemas; - } - - /** - * Set the instance that matches the oneOf child schema, check the instance parameter is valid - * against the oneOf child schemas: BinaryResponseDto, MediaResponseDto, TextResponseDto - * - *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a - * composed schema (allOf, anyOf, oneOf). - */ - @Override - public void setActualInstance(Object instance) { - if (JSONNavigator.isInstanceOf(BinaryResponseDto.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - - if (JSONNavigator.isInstanceOf(MediaResponseDto.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - - if (JSONNavigator.isInstanceOf(TextResponseDto.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - - throw new RuntimeException( - "Invalid instance type. Must be BinaryResponseDto, MediaResponseDto, TextResponseDto"); - } - - /** - * Get the actual instance, which can be the following: BinaryResponseDto, MediaResponseDto, - * TextResponseDto - * - * @return The actual instance (BinaryResponseDto, MediaResponseDto, TextResponseDto) - */ - @Override - public Object getActualInstance() { - return super.getActualInstance(); - } - - /** - * Get the actual instance of `BinaryResponseDto`. If the actual instance is not - * `BinaryResponseDto`, the ClassCastException will be thrown. - * - * @return The actual instance of `BinaryResponseDto` - * @throws ClassCastException if the instance is not `BinaryResponseDto` - */ - public BinaryResponseDto getBinaryResponseDto() throws ClassCastException { - return (BinaryResponseDto) super.getActualInstance(); - } - - /** - * Get the actual instance of `MediaResponseDto`. If the actual instance is not - * `MediaResponseDto`, the ClassCastException will be thrown. - * - * @return The actual instance of `MediaResponseDto` - * @throws ClassCastException if the instance is not `MediaResponseDto` - */ - public MediaResponseDto getMediaResponseDto() throws ClassCastException { - return (MediaResponseDto) super.getActualInstance(); - } - - /** - * Get the actual instance of `TextResponseDto`. If the actual instance is not `TextResponseDto`, - * the ClassCastException will be thrown. - * - * @return The actual instance of `TextResponseDto` - * @throws ClassCastException if the instance is not `TextResponseDto` - */ - public TextResponseDto getTextResponseDto() throws ClassCastException { - return (TextResponseDto) super.getActualInstance(); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiBatchListDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiBatchListDto.java deleted file mode 100644 index b81877b2f..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiBatchListDto.java +++ /dev/null @@ -1,220 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** ApiBatchListDto */ -@JsonPropertyOrder({ - ApiBatchListDto.JSON_PROPERTY_COUNT, - ApiBatchListDto.JSON_PROPERTY_PAGE, - ApiBatchListDto.JSON_PROPERTY_BATCHES, - ApiBatchListDto.JSON_PROPERTY_PAGE_SIZE -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class ApiBatchListDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_COUNT = "count"; - private Long count; - private boolean countDefined = false; - - public static final String JSON_PROPERTY_PAGE = "page"; - private Integer page; - private boolean pageDefined = false; - - public static final String JSON_PROPERTY_BATCHES = "batches"; - private List batches; - private boolean batchesDefined = false; - - public static final String JSON_PROPERTY_PAGE_SIZE = "page_size"; - private Integer pageSize; - private boolean pageSizeDefined = false; - - public ApiBatchListDto() {} - - public ApiBatchListDto count(Long count) { - this.count = count; - this.countDefined = true; - return this; - } - - /** - * The total number of entries matching the given filters. - * - * @return count - */ - @JsonProperty(JSON_PROPERTY_COUNT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Long getCount() { - return count; - } - - @JsonIgnore - public boolean getCountDefined() { - return countDefined; - } - - @JsonProperty(JSON_PROPERTY_COUNT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCount(Long count) { - this.count = count; - this.countDefined = true; - } - - public ApiBatchListDto page(Integer page) { - this.page = page; - this.pageDefined = true; - return this; - } - - /** - * The requested page. - * - * @return page - */ - @JsonProperty(JSON_PROPERTY_PAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getPage() { - return page; - } - - @JsonIgnore - public boolean getPageDefined() { - return pageDefined; - } - - @JsonProperty(JSON_PROPERTY_PAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setPage(Integer page) { - this.page = page; - this.pageDefined = true; - } - - public ApiBatchListDto batches(List batches) { - this.batches = batches; - this.batchesDefined = true; - return this; - } - - public ApiBatchListDto addBatchesItem(ApiBatchListBatchesInnerDto batchesItem) { - if (this.batches == null) { - this.batches = new ArrayList<>(); - } - this.batchesDefined = true; - this.batches.add(batchesItem); - return this; - } - - /** - * The page of batches matching the given filters. - * - * @return batches - */ - @JsonProperty(JSON_PROPERTY_BATCHES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List getBatches() { - return batches; - } - - @JsonIgnore - public boolean getBatchesDefined() { - return batchesDefined; - } - - @JsonProperty(JSON_PROPERTY_BATCHES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setBatches(List batches) { - this.batches = batches; - this.batchesDefined = true; - } - - public ApiBatchListDto pageSize(Integer pageSize) { - this.pageSize = pageSize; - this.pageSizeDefined = true; - return this; - } - - /** - * The number of entries returned in this request. - * - * @return pageSize - */ - @JsonProperty(JSON_PROPERTY_PAGE_SIZE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getPageSize() { - return pageSize; - } - - @JsonIgnore - public boolean getPageSizeDefined() { - return pageSizeDefined; - } - - @JsonProperty(JSON_PROPERTY_PAGE_SIZE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setPageSize(Integer pageSize) { - this.pageSize = pageSize; - this.pageSizeDefined = true; - } - - /** Return true if this ApiBatchList object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ApiBatchListDto apiBatchList = (ApiBatchListDto) o; - return Objects.equals(this.count, apiBatchList.count) - && Objects.equals(this.page, apiBatchList.page) - && Objects.equals(this.batches, apiBatchList.batches) - && Objects.equals(this.pageSize, apiBatchList.pageSize); - } - - @Override - public int hashCode() { - return Objects.hash(count, page, batches, pageSize); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ApiBatchListDto {\n"); - sb.append(" count: ").append(toIndentedString(count)).append("\n"); - sb.append(" page: ").append(toIndentedString(page)).append("\n"); - sb.append(" batches: ").append(toIndentedString(batches)).append("\n"); - sb.append(" pageSize: ").append(toIndentedString(pageSize)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiDeliveryFeedbackDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiDeliveryFeedbackDto.java deleted file mode 100644 index 007236969..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiDeliveryFeedbackDto.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** ApiDeliveryFeedbackDto */ -@JsonPropertyOrder({ApiDeliveryFeedbackDto.JSON_PROPERTY_RECIPIENTS}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class ApiDeliveryFeedbackDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_RECIPIENTS = "recipients"; - private List recipients; - private boolean recipientsDefined = false; - - public ApiDeliveryFeedbackDto() {} - - public ApiDeliveryFeedbackDto recipients(List recipients) { - this.recipients = recipients; - this.recipientsDefined = true; - return this; - } - - public ApiDeliveryFeedbackDto addRecipientsItem(String recipientsItem) { - if (this.recipients == null) { - this.recipients = new ArrayList<>(); - } - this.recipientsDefined = true; - this.recipients.add(recipientsItem); - return this; - } - - /** - * A list of phone numbers (MSISDNs) that have successfully received the message. The key is - * required, however, the value can be an empty array (`[]`) for *a batch*. If the - * feedback was enabled for *a group*, at least one phone number is required. - * - * @return recipients - */ - @JsonProperty(JSON_PROPERTY_RECIPIENTS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public List getRecipients() { - return recipients; - } - - @JsonIgnore - public boolean getRecipientsDefined() { - return recipientsDefined; - } - - @JsonProperty(JSON_PROPERTY_RECIPIENTS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setRecipients(List recipients) { - this.recipients = recipients; - this.recipientsDefined = true; - } - - /** Return true if this ApiDeliveryFeedback object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ApiDeliveryFeedbackDto apiDeliveryFeedback = (ApiDeliveryFeedbackDto) o; - return Objects.equals(this.recipients, apiDeliveryFeedback.recipients); - } - - @Override - public int hashCode() { - return Objects.hash(recipients); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ApiDeliveryFeedbackDto {\n"); - sb.append(" recipients: ").append(toIndentedString(recipients)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiGroupAutoUpdateDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiGroupAutoUpdateDto.java deleted file mode 100644 index 413acc366..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiGroupAutoUpdateDto.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import java.util.Objects; - -/** ApiGroupAutoUpdateDto */ -@JsonPropertyOrder({ - ApiGroupAutoUpdateDto.JSON_PROPERTY_TO, - ApiGroupAutoUpdateDto.JSON_PROPERTY_ADD, - ApiGroupAutoUpdateDto.JSON_PROPERTY_REMOVE -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class ApiGroupAutoUpdateDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_TO = "to"; - private String to; - private boolean toDefined = false; - - public static final String JSON_PROPERTY_ADD = "add"; - private AddKeywordDto add; - private boolean addDefined = false; - - public static final String JSON_PROPERTY_REMOVE = "remove"; - private RemoveKeywordDto remove; - private boolean removeDefined = false; - - public ApiGroupAutoUpdateDto() {} - - public ApiGroupAutoUpdateDto to(String to) { - this.to = to; - this.toDefined = true; - return this; - } - - /** - * Short code or long number addressed in MO. Constraints: Must be valid MSISDN or short code. - * - * @return to - */ - @JsonProperty(JSON_PROPERTY_TO) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getTo() { - return to; - } - - @JsonIgnore - public boolean getToDefined() { - return toDefined; - } - - @JsonProperty(JSON_PROPERTY_TO) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setTo(String to) { - this.to = to; - this.toDefined = true; - } - - public ApiGroupAutoUpdateDto add(AddKeywordDto add) { - this.add = add; - this.addDefined = true; - return this; - } - - /** - * Get add - * - * @return add - */ - @JsonProperty(JSON_PROPERTY_ADD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public AddKeywordDto getAdd() { - return add; - } - - @JsonIgnore - public boolean getAddDefined() { - return addDefined; - } - - @JsonProperty(JSON_PROPERTY_ADD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setAdd(AddKeywordDto add) { - this.add = add; - this.addDefined = true; - } - - public ApiGroupAutoUpdateDto remove(RemoveKeywordDto remove) { - this.remove = remove; - this.removeDefined = true; - return this; - } - - /** - * Get remove - * - * @return remove - */ - @JsonProperty(JSON_PROPERTY_REMOVE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public RemoveKeywordDto getRemove() { - return remove; - } - - @JsonIgnore - public boolean getRemoveDefined() { - return removeDefined; - } - - @JsonProperty(JSON_PROPERTY_REMOVE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setRemove(RemoveKeywordDto remove) { - this.remove = remove; - this.removeDefined = true; - } - - /** Return true if this ApiGroupAutoUpdate object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ApiGroupAutoUpdateDto apiGroupAutoUpdate = (ApiGroupAutoUpdateDto) o; - return Objects.equals(this.to, apiGroupAutoUpdate.to) - && Objects.equals(this.add, apiGroupAutoUpdate.add) - && Objects.equals(this.remove, apiGroupAutoUpdate.remove); - } - - @Override - public int hashCode() { - return Objects.hash(to, add, remove); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ApiGroupAutoUpdateDto {\n"); - sb.append(" to: ").append(toIndentedString(to)).append("\n"); - sb.append(" add: ").append(toIndentedString(add)).append("\n"); - sb.append(" remove: ").append(toIndentedString(remove)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiGroupDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiGroupDto.java deleted file mode 100644 index 3daa95666..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiGroupDto.java +++ /dev/null @@ -1,298 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.time.OffsetDateTime; -import java.util.LinkedHashSet; -import java.util.Objects; -import java.util.Set; - -/** ApiGroupDto */ -@JsonPropertyOrder({ - ApiGroupDto.JSON_PROPERTY_ID, - ApiGroupDto.JSON_PROPERTY_NAME, - ApiGroupDto.JSON_PROPERTY_SIZE, - ApiGroupDto.JSON_PROPERTY_CREATED_AT, - ApiGroupDto.JSON_PROPERTY_MODIFIED_AT, - ApiGroupDto.JSON_PROPERTY_CHILD_GROUPS, - ApiGroupDto.JSON_PROPERTY_AUTO_UPDATE -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class ApiGroupDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_ID = "id"; - private String id; - private boolean idDefined = false; - - public static final String JSON_PROPERTY_NAME = "name"; - private String name; - private boolean nameDefined = false; - - public static final String JSON_PROPERTY_SIZE = "size"; - private Integer size; - private boolean sizeDefined = false; - - public static final String JSON_PROPERTY_CREATED_AT = "created_at"; - private OffsetDateTime createdAt; - private boolean createdAtDefined = false; - - public static final String JSON_PROPERTY_MODIFIED_AT = "modified_at"; - private OffsetDateTime modifiedAt; - private boolean modifiedAtDefined = false; - - public static final String JSON_PROPERTY_CHILD_GROUPS = "child_groups"; - private Set childGroups; - private boolean childGroupsDefined = false; - - public static final String JSON_PROPERTY_AUTO_UPDATE = "auto_update"; - private ApiGroupAutoUpdateDto autoUpdate; - private boolean autoUpdateDefined = false; - - public ApiGroupDto() {} - - @JsonCreator - public ApiGroupDto( - @JsonProperty(JSON_PROPERTY_ID) String id, - @JsonProperty(JSON_PROPERTY_SIZE) Integer size, - @JsonProperty(JSON_PROPERTY_CREATED_AT) OffsetDateTime createdAt, - @JsonProperty(JSON_PROPERTY_MODIFIED_AT) OffsetDateTime modifiedAt) { - this(); - this.id = id; - this.idDefined = true; - this.size = size; - this.sizeDefined = true; - this.createdAt = createdAt; - this.createdAtDefined = true; - this.modifiedAt = modifiedAt; - this.modifiedAtDefined = true; - } - - /** - * Unique identifier for the group - * - * @return id - */ - @JsonProperty(JSON_PROPERTY_ID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getId() { - return id; - } - - @JsonIgnore - public boolean getIdDefined() { - return idDefined; - } - - public ApiGroupDto name(String name) { - this.name = name; - this.nameDefined = true; - return this; - } - - /** - * Name of group if set. - * - * @return name - */ - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getName() { - return name; - } - - @JsonIgnore - public boolean getNameDefined() { - return nameDefined; - } - - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setName(String name) { - this.name = name; - this.nameDefined = true; - } - - /** - * The number of members currently in the group. - * - * @return size - */ - @JsonProperty(JSON_PROPERTY_SIZE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getSize() { - return size; - } - - @JsonIgnore - public boolean getSizeDefined() { - return sizeDefined; - } - - /** - * Timestamp for when the group was created. YYYY-MM-DDThh:mm:ss.SSSZ format - * - * @return createdAt - */ - @JsonProperty(JSON_PROPERTY_CREATED_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - @JsonIgnore - public boolean getCreatedAtDefined() { - return createdAtDefined; - } - - /** - * Timestamp for when the group was last updated. YYYY-MM-DDThh:mm:ss.SSSZ format - * - * @return modifiedAt - */ - @JsonProperty(JSON_PROPERTY_MODIFIED_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getModifiedAt() { - return modifiedAt; - } - - @JsonIgnore - public boolean getModifiedAtDefined() { - return modifiedAtDefined; - } - - public ApiGroupDto childGroups(Set childGroups) { - this.childGroups = childGroups; - this.childGroupsDefined = true; - return this; - } - - public ApiGroupDto addChildGroupsItem(Object childGroupsItem) { - if (this.childGroups == null) { - this.childGroups = new LinkedHashSet<>(); - } - this.childGroupsDefined = true; - this.childGroups.add(childGroupsItem); - return this; - } - - /** - * MSISDNs of child group will be included in this group. If present then this group will be auto - * populated. Constraints: Elements must be group IDs. - * - * @return childGroups - */ - @JsonProperty(JSON_PROPERTY_CHILD_GROUPS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Set getChildGroups() { - return childGroups; - } - - @JsonIgnore - public boolean getChildGroupsDefined() { - return childGroupsDefined; - } - - @JsonDeserialize(as = LinkedHashSet.class) - @JsonProperty(JSON_PROPERTY_CHILD_GROUPS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setChildGroups(Set childGroups) { - this.childGroups = childGroups; - this.childGroupsDefined = true; - } - - public ApiGroupDto autoUpdate(ApiGroupAutoUpdateDto autoUpdate) { - this.autoUpdate = autoUpdate; - this.autoUpdateDefined = true; - return this; - } - - /** - * Get autoUpdate - * - * @return autoUpdate - */ - @JsonProperty(JSON_PROPERTY_AUTO_UPDATE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public ApiGroupAutoUpdateDto getAutoUpdate() { - return autoUpdate; - } - - @JsonIgnore - public boolean getAutoUpdateDefined() { - return autoUpdateDefined; - } - - @JsonProperty(JSON_PROPERTY_AUTO_UPDATE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setAutoUpdate(ApiGroupAutoUpdateDto autoUpdate) { - this.autoUpdate = autoUpdate; - this.autoUpdateDefined = true; - } - - /** Return true if this ApiGroup object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ApiGroupDto apiGroup = (ApiGroupDto) o; - return Objects.equals(this.id, apiGroup.id) - && Objects.equals(this.name, apiGroup.name) - && Objects.equals(this.size, apiGroup.size) - && Objects.equals(this.createdAt, apiGroup.createdAt) - && Objects.equals(this.modifiedAt, apiGroup.modifiedAt) - && Objects.equals(this.childGroups, apiGroup.childGroups) - && Objects.equals(this.autoUpdate, apiGroup.autoUpdate); - } - - @Override - public int hashCode() { - return Objects.hash(id, name, size, createdAt, modifiedAt, childGroups, autoUpdate); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ApiGroupDto {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" size: ").append(toIndentedString(size)).append("\n"); - sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); - sb.append(" modifiedAt: ").append(toIndentedString(modifiedAt)).append("\n"); - sb.append(" childGroups: ").append(toIndentedString(childGroups)).append("\n"); - sb.append(" autoUpdate: ").append(toIndentedString(autoUpdate)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiGroupListDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiGroupListDto.java deleted file mode 100644 index 952441729..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiGroupListDto.java +++ /dev/null @@ -1,220 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** ApiGroupListDto */ -@JsonPropertyOrder({ - ApiGroupListDto.JSON_PROPERTY_COUNT, - ApiGroupListDto.JSON_PROPERTY_PAGE, - ApiGroupListDto.JSON_PROPERTY_GROUPS, - ApiGroupListDto.JSON_PROPERTY_PAGE_SIZE -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class ApiGroupListDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_COUNT = "count"; - private Long count; - private boolean countDefined = false; - - public static final String JSON_PROPERTY_PAGE = "page"; - private Integer page; - private boolean pageDefined = false; - - public static final String JSON_PROPERTY_GROUPS = "groups"; - private List groups; - private boolean groupsDefined = false; - - public static final String JSON_PROPERTY_PAGE_SIZE = "page_size"; - private Integer pageSize; - private boolean pageSizeDefined = false; - - public ApiGroupListDto() {} - - public ApiGroupListDto count(Long count) { - this.count = count; - this.countDefined = true; - return this; - } - - /** - * The total number of entries matching the given filters. - * - * @return count - */ - @JsonProperty(JSON_PROPERTY_COUNT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Long getCount() { - return count; - } - - @JsonIgnore - public boolean getCountDefined() { - return countDefined; - } - - @JsonProperty(JSON_PROPERTY_COUNT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCount(Long count) { - this.count = count; - this.countDefined = true; - } - - public ApiGroupListDto page(Integer page) { - this.page = page; - this.pageDefined = true; - return this; - } - - /** - * The requested page. - * - * @return page - */ - @JsonProperty(JSON_PROPERTY_PAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getPage() { - return page; - } - - @JsonIgnore - public boolean getPageDefined() { - return pageDefined; - } - - @JsonProperty(JSON_PROPERTY_PAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setPage(Integer page) { - this.page = page; - this.pageDefined = true; - } - - public ApiGroupListDto groups(List groups) { - this.groups = groups; - this.groupsDefined = true; - return this; - } - - public ApiGroupListDto addGroupsItem(ApiGroupDto groupsItem) { - if (this.groups == null) { - this.groups = new ArrayList<>(); - } - this.groupsDefined = true; - this.groups.add(groupsItem); - return this; - } - - /** - * Get groups - * - * @return groups - */ - @JsonProperty(JSON_PROPERTY_GROUPS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List getGroups() { - return groups; - } - - @JsonIgnore - public boolean getGroupsDefined() { - return groupsDefined; - } - - @JsonProperty(JSON_PROPERTY_GROUPS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setGroups(List groups) { - this.groups = groups; - this.groupsDefined = true; - } - - public ApiGroupListDto pageSize(Integer pageSize) { - this.pageSize = pageSize; - this.pageSizeDefined = true; - return this; - } - - /** - * The number of entries returned in this request. - * - * @return pageSize - */ - @JsonProperty(JSON_PROPERTY_PAGE_SIZE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getPageSize() { - return pageSize; - } - - @JsonIgnore - public boolean getPageSizeDefined() { - return pageSizeDefined; - } - - @JsonProperty(JSON_PROPERTY_PAGE_SIZE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setPageSize(Integer pageSize) { - this.pageSize = pageSize; - this.pageSizeDefined = true; - } - - /** Return true if this ApiGroupList object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ApiGroupListDto apiGroupList = (ApiGroupListDto) o; - return Objects.equals(this.count, apiGroupList.count) - && Objects.equals(this.page, apiGroupList.page) - && Objects.equals(this.groups, apiGroupList.groups) - && Objects.equals(this.pageSize, apiGroupList.pageSize); - } - - @Override - public int hashCode() { - return Objects.hash(count, page, groups, pageSize); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ApiGroupListDto {\n"); - sb.append(" count: ").append(toIndentedString(count)).append("\n"); - sb.append(" page: ").append(toIndentedString(page)).append("\n"); - sb.append(" groups: ").append(toIndentedString(groups)).append("\n"); - sb.append(" pageSize: ").append(toIndentedString(pageSize)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiInboundListDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiInboundListDto.java deleted file mode 100644 index a174cd186..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiInboundListDto.java +++ /dev/null @@ -1,220 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** ApiInboundListDto */ -@JsonPropertyOrder({ - ApiInboundListDto.JSON_PROPERTY_COUNT, - ApiInboundListDto.JSON_PROPERTY_PAGE, - ApiInboundListDto.JSON_PROPERTY_INBOUNDS, - ApiInboundListDto.JSON_PROPERTY_PAGE_SIZE -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class ApiInboundListDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_COUNT = "count"; - private Long count; - private boolean countDefined = false; - - public static final String JSON_PROPERTY_PAGE = "page"; - private Integer page; - private boolean pageDefined = false; - - public static final String JSON_PROPERTY_INBOUNDS = "inbounds"; - private List inbounds; - private boolean inboundsDefined = false; - - public static final String JSON_PROPERTY_PAGE_SIZE = "page_size"; - private Integer pageSize; - private boolean pageSizeDefined = false; - - public ApiInboundListDto() {} - - public ApiInboundListDto count(Long count) { - this.count = count; - this.countDefined = true; - return this; - } - - /** - * The total number of inbounds matching the given filters - * - * @return count - */ - @JsonProperty(JSON_PROPERTY_COUNT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Long getCount() { - return count; - } - - @JsonIgnore - public boolean getCountDefined() { - return countDefined; - } - - @JsonProperty(JSON_PROPERTY_COUNT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCount(Long count) { - this.count = count; - this.countDefined = true; - } - - public ApiInboundListDto page(Integer page) { - this.page = page; - this.pageDefined = true; - return this; - } - - /** - * The requested page. - * - * @return page - */ - @JsonProperty(JSON_PROPERTY_PAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getPage() { - return page; - } - - @JsonIgnore - public boolean getPageDefined() { - return pageDefined; - } - - @JsonProperty(JSON_PROPERTY_PAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setPage(Integer page) { - this.page = page; - this.pageDefined = true; - } - - public ApiInboundListDto inbounds(List inbounds) { - this.inbounds = inbounds; - this.inboundsDefined = true; - return this; - } - - public ApiInboundListDto addInboundsItem(InboundDto inboundsItem) { - if (this.inbounds == null) { - this.inbounds = new ArrayList<>(); - } - this.inboundsDefined = true; - this.inbounds.add(inboundsItem); - return this; - } - - /** - * The page of inbounds matching the given filters. - * - * @return inbounds - */ - @JsonProperty(JSON_PROPERTY_INBOUNDS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List getInbounds() { - return inbounds; - } - - @JsonIgnore - public boolean getInboundsDefined() { - return inboundsDefined; - } - - @JsonProperty(JSON_PROPERTY_INBOUNDS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setInbounds(List inbounds) { - this.inbounds = inbounds; - this.inboundsDefined = true; - } - - public ApiInboundListDto pageSize(Integer pageSize) { - this.pageSize = pageSize; - this.pageSizeDefined = true; - return this; - } - - /** - * The number of inbounds returned in this request. - * - * @return pageSize - */ - @JsonProperty(JSON_PROPERTY_PAGE_SIZE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getPageSize() { - return pageSize; - } - - @JsonIgnore - public boolean getPageSizeDefined() { - return pageSizeDefined; - } - - @JsonProperty(JSON_PROPERTY_PAGE_SIZE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setPageSize(Integer pageSize) { - this.pageSize = pageSize; - this.pageSizeDefined = true; - } - - /** Return true if this ApiInboundList object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ApiInboundListDto apiInboundList = (ApiInboundListDto) o; - return Objects.equals(this.count, apiInboundList.count) - && Objects.equals(this.page, apiInboundList.page) - && Objects.equals(this.inbounds, apiInboundList.inbounds) - && Objects.equals(this.pageSize, apiInboundList.pageSize); - } - - @Override - public int hashCode() { - return Objects.hash(count, page, inbounds, pageSize); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ApiInboundListDto {\n"); - sb.append(" count: ").append(toIndentedString(count)).append("\n"); - sb.append(" page: ").append(toIndentedString(page)).append("\n"); - sb.append(" inbounds: ").append(toIndentedString(inbounds)).append("\n"); - sb.append(" pageSize: ").append(toIndentedString(pageSize)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiMoMessageDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiMoMessageDto.java deleted file mode 100644 index 40c256fe0..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiMoMessageDto.java +++ /dev/null @@ -1,423 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.sinch.sdk.core.utils.databind.JSONNavigator; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; - -/** The page of inbounds matching the given filters. */ -@JsonPropertyOrder({ - ApiMoMessageDto.JSON_PROPERTY_FROM, - ApiMoMessageDto.JSON_PROPERTY_ID, - ApiMoMessageDto.JSON_PROPERTY_RECEIVED_AT, - ApiMoMessageDto.JSON_PROPERTY_TO, - ApiMoMessageDto.JSON_PROPERTY_TYPE, - ApiMoMessageDto.JSON_PROPERTY_BODY, - ApiMoMessageDto.JSON_PROPERTY_CLIENT_REFERENCE, - ApiMoMessageDto.JSON_PROPERTY_OPERATOR_ID, - ApiMoMessageDto.JSON_PROPERTY_SENT_AT -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) - -/*@JsonIgnoreProperties( - value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization - allowSetters = true // allows the type to be set during deserialization -)*/ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NONE, - include = JsonTypeInfo.As.EXISTING_PROPERTY, - property = "type", - visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = MOBinaryDto.class, name = "MOBinary"), - @JsonSubTypes.Type(value = MOTextDto.class, name = "MOText"), -}) -public class ApiMoMessageDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_FROM = "from"; - private String from; - private boolean fromDefined = false; - - public static final String JSON_PROPERTY_ID = "id"; - private String id; - private boolean idDefined = false; - - public static final String JSON_PROPERTY_RECEIVED_AT = "received_at"; - private OffsetDateTime receivedAt; - private boolean receivedAtDefined = false; - - public static final String JSON_PROPERTY_TO = "to"; - private String to; - private boolean toDefined = false; - - public static final String JSON_PROPERTY_TYPE = "type"; - private String type; - private boolean typeDefined = false; - - public static final String JSON_PROPERTY_BODY = "body"; - private String body; - private boolean bodyDefined = false; - - public static final String JSON_PROPERTY_CLIENT_REFERENCE = "client_reference"; - private String clientReference; - private boolean clientReferenceDefined = false; - - public static final String JSON_PROPERTY_OPERATOR_ID = "operator_id"; - private String operatorId; - private boolean operatorIdDefined = false; - - public static final String JSON_PROPERTY_SENT_AT = "sent_at"; - private OffsetDateTime sentAt; - private boolean sentAtDefined = false; - - public ApiMoMessageDto() {} - - @JsonCreator - public ApiMoMessageDto(@JsonProperty(JSON_PROPERTY_TYPE) String type) { - this(); - this.type = type; - this.typeDefined = true; - } - - public ApiMoMessageDto from(String from) { - this.from = from; - this.fromDefined = true; - return this; - } - - /** - * The phone number that sent the message. <a - * href=\"https://community.sinch.com/t5/Glossary/MSISDN/ta-p/7628\" - * target=\"_blank\">More info</a> - * - * @return from - */ - @JsonProperty(JSON_PROPERTY_FROM) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getFrom() { - return from; - } - - @JsonIgnore - public boolean getFromDefined() { - return fromDefined; - } - - @JsonProperty(JSON_PROPERTY_FROM) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setFrom(String from) { - this.from = from; - this.fromDefined = true; - } - - public ApiMoMessageDto id(String id) { - this.id = id; - this.idDefined = true; - return this; - } - - /** - * The ID of this inbound message. - * - * @return id - */ - @JsonProperty(JSON_PROPERTY_ID) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getId() { - return id; - } - - @JsonIgnore - public boolean getIdDefined() { - return idDefined; - } - - @JsonProperty(JSON_PROPERTY_ID) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setId(String id) { - this.id = id; - this.idDefined = true; - } - - public ApiMoMessageDto receivedAt(OffsetDateTime receivedAt) { - this.receivedAt = receivedAt; - this.receivedAtDefined = true; - return this; - } - - /** - * When the system received the message. Formatted as <a - * href=\"https://en.wikipedia.org/wiki/ISO_8601\" - * target=\"_blank\">ISO-8601</a>: `YYYY-MM-DDThh:mm:ss.SSSZ`. - * - * @return receivedAt - */ - @JsonProperty(JSON_PROPERTY_RECEIVED_AT) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public OffsetDateTime getReceivedAt() { - return receivedAt; - } - - @JsonIgnore - public boolean getReceivedAtDefined() { - return receivedAtDefined; - } - - @JsonProperty(JSON_PROPERTY_RECEIVED_AT) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setReceivedAt(OffsetDateTime receivedAt) { - this.receivedAt = receivedAt; - this.receivedAtDefined = true; - } - - public ApiMoMessageDto to(String to) { - this.to = to; - this.toDefined = true; - return this; - } - - /** - * The Sinch phone number or short code to which the message was sent. - * - * @return to - */ - @JsonProperty(JSON_PROPERTY_TO) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getTo() { - return to; - } - - @JsonIgnore - public boolean getToDefined() { - return toDefined; - } - - @JsonProperty(JSON_PROPERTY_TO) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setTo(String to) { - this.to = to; - this.toDefined = true; - } - - /** - * Get type - * - * @return type - */ - @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getType() { - return type; - } - - @JsonIgnore - public boolean getTypeDefined() { - return typeDefined; - } - - public ApiMoMessageDto body(String body) { - this.body = body; - this.bodyDefined = true; - return this; - } - - /** - * Get body - * - * @return body - */ - @JsonProperty(JSON_PROPERTY_BODY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getBody() { - return body; - } - - @JsonIgnore - public boolean getBodyDefined() { - return bodyDefined; - } - - @JsonProperty(JSON_PROPERTY_BODY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setBody(String body) { - this.body = body; - this.bodyDefined = true; - } - - public ApiMoMessageDto clientReference(String clientReference) { - this.clientReference = clientReference; - this.clientReferenceDefined = true; - return this; - } - - /** - * If this inbound message is in response to a previously sent message that contained a client - * reference, then this field contains *that* client reference. Utilizing this feature requires - * additional setup on your account. Contact your <a - * href=\"https://dashboard.sinch.com/settings/account-details\" - * target=\"_blank\">account manager</a> to enable this feature. - * - * @return clientReference - */ - @JsonProperty(JSON_PROPERTY_CLIENT_REFERENCE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getClientReference() { - return clientReference; - } - - @JsonIgnore - public boolean getClientReferenceDefined() { - return clientReferenceDefined; - } - - @JsonProperty(JSON_PROPERTY_CLIENT_REFERENCE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setClientReference(String clientReference) { - this.clientReference = clientReference; - this.clientReferenceDefined = true; - } - - public ApiMoMessageDto operatorId(String operatorId) { - this.operatorId = operatorId; - this.operatorIdDefined = true; - return this; - } - - /** - * The MCC/MNC of the sender's operator if known. - * - * @return operatorId - */ - @JsonProperty(JSON_PROPERTY_OPERATOR_ID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getOperatorId() { - return operatorId; - } - - @JsonIgnore - public boolean getOperatorIdDefined() { - return operatorIdDefined; - } - - @JsonProperty(JSON_PROPERTY_OPERATOR_ID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setOperatorId(String operatorId) { - this.operatorId = operatorId; - this.operatorIdDefined = true; - } - - public ApiMoMessageDto sentAt(OffsetDateTime sentAt) { - this.sentAt = sentAt; - this.sentAtDefined = true; - return this; - } - - /** - * When the message left the originating device. Only available if provided by operator. Formatted - * as <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" - * target=\"_blank\">ISO-8601</a>: `YYYY-MM-DDThh:mm:ss.SSSZ`. - * - * @return sentAt - */ - @JsonProperty(JSON_PROPERTY_SENT_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getSentAt() { - return sentAt; - } - - @JsonIgnore - public boolean getSentAtDefined() { - return sentAtDefined; - } - - @JsonProperty(JSON_PROPERTY_SENT_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setSentAt(OffsetDateTime sentAt) { - this.sentAt = sentAt; - this.sentAtDefined = true; - } - - /** Return true if this ApiMoMessage object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ApiMoMessageDto apiMoMessage = (ApiMoMessageDto) o; - return Objects.equals(this.from, apiMoMessage.from) - && Objects.equals(this.id, apiMoMessage.id) - && Objects.equals(this.receivedAt, apiMoMessage.receivedAt) - && Objects.equals(this.to, apiMoMessage.to) - && Objects.equals(this.type, apiMoMessage.type) - && Objects.equals(this.body, apiMoMessage.body) - && Objects.equals(this.clientReference, apiMoMessage.clientReference) - && Objects.equals(this.operatorId, apiMoMessage.operatorId) - && Objects.equals(this.sentAt, apiMoMessage.sentAt); - } - - @Override - public int hashCode() { - return Objects.hash(from, id, receivedAt, to, type, body, clientReference, operatorId, sentAt); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ApiMoMessageDto {\n"); - sb.append(" from: ").append(toIndentedString(from)).append("\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" receivedAt: ").append(toIndentedString(receivedAt)).append("\n"); - sb.append(" to: ").append(toIndentedString(to)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" body: ").append(toIndentedString(body)).append("\n"); - sb.append(" clientReference: ").append(toIndentedString(clientReference)).append("\n"); - sb.append(" operatorId: ").append(toIndentedString(operatorId)).append("\n"); - sb.append(" sentAt: ").append(toIndentedString(sentAt)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("MOBinary", MOBinaryDto.class); - mappings.put("MOText", MOTextDto.class); - mappings.put("ApiMoMessage", ApiMoMessageDto.class); - JSONNavigator.registerDiscriminator(ApiMoMessageDto.class, "type", mappings); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiUpdateBinaryMtMessageDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiUpdateBinaryMtMessageDto.java deleted file mode 100644 index 0c450211a..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiUpdateBinaryMtMessageDto.java +++ /dev/null @@ -1,487 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonValue; -import java.time.OffsetDateTime; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** ApiUpdateBinaryMtMessageDto */ -@JsonPropertyOrder({ - ApiUpdateBinaryMtMessageDto.JSON_PROPERTY_FROM, - ApiUpdateBinaryMtMessageDto.JSON_PROPERTY_TYPE, - ApiUpdateBinaryMtMessageDto.JSON_PROPERTY_TO_ADD, - ApiUpdateBinaryMtMessageDto.JSON_PROPERTY_TO_REMOVE, - ApiUpdateBinaryMtMessageDto.JSON_PROPERTY_DELIVERY_REPORT, - ApiUpdateBinaryMtMessageDto.JSON_PROPERTY_SEND_AT, - ApiUpdateBinaryMtMessageDto.JSON_PROPERTY_EXPIRE_AT, - ApiUpdateBinaryMtMessageDto.JSON_PROPERTY_CALLBACK_URL, - ApiUpdateBinaryMtMessageDto.JSON_PROPERTY_BODY, - ApiUpdateBinaryMtMessageDto.JSON_PROPERTY_UDH -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class ApiUpdateBinaryMtMessageDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_FROM = "from"; - private String from; - private boolean fromDefined = false; - - /** SMS in binary format */ - public enum TypeEnum { - MT_BINARY("mt_binary"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - TypeEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static TypeEnum fromValue(String value) { - for (TypeEnum b : TypeEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_TYPE = "type"; - private String type; - private boolean typeDefined = false; - - public static final String JSON_PROPERTY_TO_ADD = "to_add"; - private List toAdd; - private boolean toAddDefined = false; - - public static final String JSON_PROPERTY_TO_REMOVE = "to_remove"; - private List toRemove; - private boolean toRemoveDefined = false; - - public static final String JSON_PROPERTY_DELIVERY_REPORT = "delivery_report"; - private String deliveryReport; - private boolean deliveryReportDefined = false; - - public static final String JSON_PROPERTY_SEND_AT = "send_at"; - private OffsetDateTime sendAt; - private boolean sendAtDefined = false; - - public static final String JSON_PROPERTY_EXPIRE_AT = "expire_at"; - private OffsetDateTime expireAt; - private boolean expireAtDefined = false; - - public static final String JSON_PROPERTY_CALLBACK_URL = "callback_url"; - private String callbackUrl; - private boolean callbackUrlDefined = false; - - public static final String JSON_PROPERTY_BODY = "body"; - private String body; - private boolean bodyDefined = false; - - public static final String JSON_PROPERTY_UDH = "udh"; - private String udh; - private boolean udhDefined = false; - - public ApiUpdateBinaryMtMessageDto() {} - - public ApiUpdateBinaryMtMessageDto from(String from) { - this.from = from; - this.fromDefined = true; - return this; - } - - /** - * Sender number. Must be valid phone number, short code or alphanumeric. - * - * @return from - */ - @JsonProperty(JSON_PROPERTY_FROM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getFrom() { - return from; - } - - @JsonIgnore - public boolean getFromDefined() { - return fromDefined; - } - - @JsonProperty(JSON_PROPERTY_FROM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setFrom(String from) { - this.from = from; - this.fromDefined = true; - } - - public ApiUpdateBinaryMtMessageDto type(String type) { - this.type = type; - this.typeDefined = true; - return this; - } - - /** - * SMS in binary format - * - * @return type - */ - @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getType() { - return type; - } - - @JsonIgnore - public boolean getTypeDefined() { - return typeDefined; - } - - @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setType(String type) { - this.type = type; - this.typeDefined = true; - } - - public ApiUpdateBinaryMtMessageDto toAdd(List toAdd) { - this.toAdd = toAdd; - this.toAddDefined = true; - return this; - } - - public ApiUpdateBinaryMtMessageDto addToAddItem(String toAddItem) { - if (this.toAdd == null) { - this.toAdd = new ArrayList<>(); - } - this.toAddDefined = true; - this.toAdd.add(toAddItem); - return this; - } - - /** - * List of phone numbers and group IDs to add to the batch. - * - * @return toAdd - */ - @JsonProperty(JSON_PROPERTY_TO_ADD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List getToAdd() { - return toAdd; - } - - @JsonIgnore - public boolean getToAddDefined() { - return toAddDefined; - } - - @JsonProperty(JSON_PROPERTY_TO_ADD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setToAdd(List toAdd) { - this.toAdd = toAdd; - this.toAddDefined = true; - } - - public ApiUpdateBinaryMtMessageDto toRemove(List toRemove) { - this.toRemove = toRemove; - this.toRemoveDefined = true; - return this; - } - - public ApiUpdateBinaryMtMessageDto addToRemoveItem(String toRemoveItem) { - if (this.toRemove == null) { - this.toRemove = new ArrayList<>(); - } - this.toRemoveDefined = true; - this.toRemove.add(toRemoveItem); - return this; - } - - /** - * List of phone numbers and group IDs to remove from the batch. - * - * @return toRemove - */ - @JsonProperty(JSON_PROPERTY_TO_REMOVE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List getToRemove() { - return toRemove; - } - - @JsonIgnore - public boolean getToRemoveDefined() { - return toRemoveDefined; - } - - @JsonProperty(JSON_PROPERTY_TO_REMOVE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setToRemove(List toRemove) { - this.toRemove = toRemove; - this.toRemoveDefined = true; - } - - public ApiUpdateBinaryMtMessageDto deliveryReport(String deliveryReport) { - this.deliveryReport = deliveryReport; - this.deliveryReportDefined = true; - return this; - } - - /** - * Request delivery report callback. Note that delivery reports can be fetched from the API - * regardless of this setting. - * - * @return deliveryReport - */ - @JsonProperty(JSON_PROPERTY_DELIVERY_REPORT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getDeliveryReport() { - return deliveryReport; - } - - @JsonIgnore - public boolean getDeliveryReportDefined() { - return deliveryReportDefined; - } - - @JsonProperty(JSON_PROPERTY_DELIVERY_REPORT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDeliveryReport(String deliveryReport) { - this.deliveryReport = deliveryReport; - this.deliveryReportDefined = true; - } - - public ApiUpdateBinaryMtMessageDto sendAt(OffsetDateTime sendAt) { - this.sendAt = sendAt; - this.sendAtDefined = true; - return this; - } - - /** - * If set, in the future the message will be delayed until `send_at` occurs. Formatted - * as <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" - * target=\"_blank\">ISO-8601</a>: `YYYY-MM-DDThh:mm:ss.SSSZ`. - * Constraints: Must be before expire_at. If set in the past, messages will be sent immediately. - * - * @return sendAt - */ - @JsonProperty(JSON_PROPERTY_SEND_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getSendAt() { - return sendAt; - } - - @JsonIgnore - public boolean getSendAtDefined() { - return sendAtDefined; - } - - @JsonProperty(JSON_PROPERTY_SEND_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setSendAt(OffsetDateTime sendAt) { - this.sendAt = sendAt; - this.sendAtDefined = true; - } - - public ApiUpdateBinaryMtMessageDto expireAt(OffsetDateTime expireAt) { - this.expireAt = expireAt; - this.expireAtDefined = true; - return this; - } - - /** - * If set, the system will stop trying to deliver the message at this point. Constraints: Must be - * after `send_at` Default: 3 days after `send_at` - * - * @return expireAt - */ - @JsonProperty(JSON_PROPERTY_EXPIRE_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getExpireAt() { - return expireAt; - } - - @JsonIgnore - public boolean getExpireAtDefined() { - return expireAtDefined; - } - - @JsonProperty(JSON_PROPERTY_EXPIRE_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setExpireAt(OffsetDateTime expireAt) { - this.expireAt = expireAt; - this.expireAtDefined = true; - } - - public ApiUpdateBinaryMtMessageDto callbackUrl(String callbackUrl) { - this.callbackUrl = callbackUrl; - this.callbackUrlDefined = true; - return this; - } - - /** - * Override the default callback URL for this batch. Constraints: Must be valid URL. - * - * @return callbackUrl - */ - @JsonProperty(JSON_PROPERTY_CALLBACK_URL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCallbackUrl() { - return callbackUrl; - } - - @JsonIgnore - public boolean getCallbackUrlDefined() { - return callbackUrlDefined; - } - - @JsonProperty(JSON_PROPERTY_CALLBACK_URL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCallbackUrl(String callbackUrl) { - this.callbackUrl = callbackUrl; - this.callbackUrlDefined = true; - } - - public ApiUpdateBinaryMtMessageDto body(String body) { - this.body = body; - this.bodyDefined = true; - return this; - } - - /** - * The message content Base64 encoded. Max 140 bytes together with udh. - * - * @return body - */ - @JsonProperty(JSON_PROPERTY_BODY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getBody() { - return body; - } - - @JsonIgnore - public boolean getBodyDefined() { - return bodyDefined; - } - - @JsonProperty(JSON_PROPERTY_BODY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setBody(String body) { - this.body = body; - this.bodyDefined = true; - } - - public ApiUpdateBinaryMtMessageDto udh(String udh) { - this.udh = udh; - this.udhDefined = true; - return this; - } - - /** - * The UDH header of a binary message HEX encoded. Max 140 bytes together with body. - * - * @return udh - */ - @JsonProperty(JSON_PROPERTY_UDH) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getUdh() { - return udh; - } - - @JsonIgnore - public boolean getUdhDefined() { - return udhDefined; - } - - @JsonProperty(JSON_PROPERTY_UDH) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setUdh(String udh) { - this.udh = udh; - this.udhDefined = true; - } - - /** Return true if this ApiUpdateBinaryMtMessage object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ApiUpdateBinaryMtMessageDto apiUpdateBinaryMtMessage = (ApiUpdateBinaryMtMessageDto) o; - return Objects.equals(this.from, apiUpdateBinaryMtMessage.from) - && Objects.equals(this.type, apiUpdateBinaryMtMessage.type) - && Objects.equals(this.toAdd, apiUpdateBinaryMtMessage.toAdd) - && Objects.equals(this.toRemove, apiUpdateBinaryMtMessage.toRemove) - && Objects.equals(this.deliveryReport, apiUpdateBinaryMtMessage.deliveryReport) - && Objects.equals(this.sendAt, apiUpdateBinaryMtMessage.sendAt) - && Objects.equals(this.expireAt, apiUpdateBinaryMtMessage.expireAt) - && Objects.equals(this.callbackUrl, apiUpdateBinaryMtMessage.callbackUrl) - && Objects.equals(this.body, apiUpdateBinaryMtMessage.body) - && Objects.equals(this.udh, apiUpdateBinaryMtMessage.udh); - } - - @Override - public int hashCode() { - return Objects.hash( - from, type, toAdd, toRemove, deliveryReport, sendAt, expireAt, callbackUrl, body, udh); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ApiUpdateBinaryMtMessageDto {\n"); - sb.append(" from: ").append(toIndentedString(from)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" toAdd: ").append(toIndentedString(toAdd)).append("\n"); - sb.append(" toRemove: ").append(toIndentedString(toRemove)).append("\n"); - sb.append(" deliveryReport: ").append(toIndentedString(deliveryReport)).append("\n"); - sb.append(" sendAt: ").append(toIndentedString(sendAt)).append("\n"); - sb.append(" expireAt: ").append(toIndentedString(expireAt)).append("\n"); - sb.append(" callbackUrl: ").append(toIndentedString(callbackUrl)).append("\n"); - sb.append(" body: ").append(toIndentedString(body)).append("\n"); - sb.append(" udh: ").append(toIndentedString(udh)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiUpdateMmsMtMessageDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiUpdateMmsMtMessageDto.java deleted file mode 100644 index 736c68283..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiUpdateMmsMtMessageDto.java +++ /dev/null @@ -1,536 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonValue; -import java.time.OffsetDateTime; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** ApiUpdateMmsMtMessageDto */ -@JsonPropertyOrder({ - ApiUpdateMmsMtMessageDto.JSON_PROPERTY_FROM, - ApiUpdateMmsMtMessageDto.JSON_PROPERTY_TYPE, - ApiUpdateMmsMtMessageDto.JSON_PROPERTY_TO_ADD, - ApiUpdateMmsMtMessageDto.JSON_PROPERTY_TO_REMOVE, - ApiUpdateMmsMtMessageDto.JSON_PROPERTY_DELIVERY_REPORT, - ApiUpdateMmsMtMessageDto.JSON_PROPERTY_SEND_AT, - ApiUpdateMmsMtMessageDto.JSON_PROPERTY_EXPIRE_AT, - ApiUpdateMmsMtMessageDto.JSON_PROPERTY_CALLBACK_URL, - ApiUpdateMmsMtMessageDto.JSON_PROPERTY_BODY, - ApiUpdateMmsMtMessageDto.JSON_PROPERTY_PARAMETERS, - ApiUpdateMmsMtMessageDto.JSON_PROPERTY_STRICT_VALIDATION -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class ApiUpdateMmsMtMessageDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_FROM = "from"; - private String from; - private boolean fromDefined = false; - - /** MMS */ - public enum TypeEnum { - MT_MEDIA("mt_media"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - TypeEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static TypeEnum fromValue(String value) { - for (TypeEnum b : TypeEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_TYPE = "type"; - private String type; - private boolean typeDefined = false; - - public static final String JSON_PROPERTY_TO_ADD = "to_add"; - private List toAdd; - private boolean toAddDefined = false; - - public static final String JSON_PROPERTY_TO_REMOVE = "to_remove"; - private List toRemove; - private boolean toRemoveDefined = false; - - public static final String JSON_PROPERTY_DELIVERY_REPORT = "delivery_report"; - private String deliveryReport; - private boolean deliveryReportDefined = false; - - public static final String JSON_PROPERTY_SEND_AT = "send_at"; - private OffsetDateTime sendAt; - private boolean sendAtDefined = false; - - public static final String JSON_PROPERTY_EXPIRE_AT = "expire_at"; - private OffsetDateTime expireAt; - private boolean expireAtDefined = false; - - public static final String JSON_PROPERTY_CALLBACK_URL = "callback_url"; - private String callbackUrl; - private boolean callbackUrlDefined = false; - - public static final String JSON_PROPERTY_BODY = "body"; - private MediaBodyDto body; - private boolean bodyDefined = false; - - public static final String JSON_PROPERTY_PARAMETERS = "parameters"; - private ParameterObjDto parameters; - private boolean parametersDefined = false; - - public static final String JSON_PROPERTY_STRICT_VALIDATION = "strict_validation"; - private Boolean strictValidation; - private boolean strictValidationDefined = false; - - public ApiUpdateMmsMtMessageDto() {} - - public ApiUpdateMmsMtMessageDto from(String from) { - this.from = from; - this.fromDefined = true; - return this; - } - - /** - * Sender number. Must be valid phone number, short code or alphanumeric. - * - * @return from - */ - @JsonProperty(JSON_PROPERTY_FROM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getFrom() { - return from; - } - - @JsonIgnore - public boolean getFromDefined() { - return fromDefined; - } - - @JsonProperty(JSON_PROPERTY_FROM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setFrom(String from) { - this.from = from; - this.fromDefined = true; - } - - public ApiUpdateMmsMtMessageDto type(String type) { - this.type = type; - this.typeDefined = true; - return this; - } - - /** - * MMS - * - * @return type - */ - @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getType() { - return type; - } - - @JsonIgnore - public boolean getTypeDefined() { - return typeDefined; - } - - @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setType(String type) { - this.type = type; - this.typeDefined = true; - } - - public ApiUpdateMmsMtMessageDto toAdd(List toAdd) { - this.toAdd = toAdd; - this.toAddDefined = true; - return this; - } - - public ApiUpdateMmsMtMessageDto addToAddItem(String toAddItem) { - if (this.toAdd == null) { - this.toAdd = new ArrayList<>(); - } - this.toAddDefined = true; - this.toAdd.add(toAddItem); - return this; - } - - /** - * List of phone numbers and group IDs to add to the batch. - * - * @return toAdd - */ - @JsonProperty(JSON_PROPERTY_TO_ADD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List getToAdd() { - return toAdd; - } - - @JsonIgnore - public boolean getToAddDefined() { - return toAddDefined; - } - - @JsonProperty(JSON_PROPERTY_TO_ADD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setToAdd(List toAdd) { - this.toAdd = toAdd; - this.toAddDefined = true; - } - - public ApiUpdateMmsMtMessageDto toRemove(List toRemove) { - this.toRemove = toRemove; - this.toRemoveDefined = true; - return this; - } - - public ApiUpdateMmsMtMessageDto addToRemoveItem(String toRemoveItem) { - if (this.toRemove == null) { - this.toRemove = new ArrayList<>(); - } - this.toRemoveDefined = true; - this.toRemove.add(toRemoveItem); - return this; - } - - /** - * List of phone numbers and group IDs to remove from the batch. - * - * @return toRemove - */ - @JsonProperty(JSON_PROPERTY_TO_REMOVE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List getToRemove() { - return toRemove; - } - - @JsonIgnore - public boolean getToRemoveDefined() { - return toRemoveDefined; - } - - @JsonProperty(JSON_PROPERTY_TO_REMOVE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setToRemove(List toRemove) { - this.toRemove = toRemove; - this.toRemoveDefined = true; - } - - public ApiUpdateMmsMtMessageDto deliveryReport(String deliveryReport) { - this.deliveryReport = deliveryReport; - this.deliveryReportDefined = true; - return this; - } - - /** - * Request delivery report callback. Note that delivery reports can be fetched from the API - * regardless of this setting. - * - * @return deliveryReport - */ - @JsonProperty(JSON_PROPERTY_DELIVERY_REPORT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getDeliveryReport() { - return deliveryReport; - } - - @JsonIgnore - public boolean getDeliveryReportDefined() { - return deliveryReportDefined; - } - - @JsonProperty(JSON_PROPERTY_DELIVERY_REPORT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDeliveryReport(String deliveryReport) { - this.deliveryReport = deliveryReport; - this.deliveryReportDefined = true; - } - - public ApiUpdateMmsMtMessageDto sendAt(OffsetDateTime sendAt) { - this.sendAt = sendAt; - this.sendAtDefined = true; - return this; - } - - /** - * If set, in the future the message will be delayed until `send_at` occurs. Formatted - * as <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" - * target=\"_blank\">ISO-8601</a>: `YYYY-MM-DDThh:mm:ss.SSSZ`. - * Constraints: Must be before expire_at. If set in the past, messages will be sent immediately. - * - * @return sendAt - */ - @JsonProperty(JSON_PROPERTY_SEND_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getSendAt() { - return sendAt; - } - - @JsonIgnore - public boolean getSendAtDefined() { - return sendAtDefined; - } - - @JsonProperty(JSON_PROPERTY_SEND_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setSendAt(OffsetDateTime sendAt) { - this.sendAt = sendAt; - this.sendAtDefined = true; - } - - public ApiUpdateMmsMtMessageDto expireAt(OffsetDateTime expireAt) { - this.expireAt = expireAt; - this.expireAtDefined = true; - return this; - } - - /** - * If set, the system will stop trying to deliver the message at this point. Constraints: Must be - * after `send_at` Default: 3 days after `send_at` - * - * @return expireAt - */ - @JsonProperty(JSON_PROPERTY_EXPIRE_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getExpireAt() { - return expireAt; - } - - @JsonIgnore - public boolean getExpireAtDefined() { - return expireAtDefined; - } - - @JsonProperty(JSON_PROPERTY_EXPIRE_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setExpireAt(OffsetDateTime expireAt) { - this.expireAt = expireAt; - this.expireAtDefined = true; - } - - public ApiUpdateMmsMtMessageDto callbackUrl(String callbackUrl) { - this.callbackUrl = callbackUrl; - this.callbackUrlDefined = true; - return this; - } - - /** - * Override the default callback URL for this batch. Constraints: Must be valid URL. - * - * @return callbackUrl - */ - @JsonProperty(JSON_PROPERTY_CALLBACK_URL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCallbackUrl() { - return callbackUrl; - } - - @JsonIgnore - public boolean getCallbackUrlDefined() { - return callbackUrlDefined; - } - - @JsonProperty(JSON_PROPERTY_CALLBACK_URL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCallbackUrl(String callbackUrl) { - this.callbackUrl = callbackUrl; - this.callbackUrlDefined = true; - } - - public ApiUpdateMmsMtMessageDto body(MediaBodyDto body) { - this.body = body; - this.bodyDefined = true; - return this; - } - - /** - * Get body - * - * @return body - */ - @JsonProperty(JSON_PROPERTY_BODY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public MediaBodyDto getBody() { - return body; - } - - @JsonIgnore - public boolean getBodyDefined() { - return bodyDefined; - } - - @JsonProperty(JSON_PROPERTY_BODY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setBody(MediaBodyDto body) { - this.body = body; - this.bodyDefined = true; - } - - public ApiUpdateMmsMtMessageDto parameters(ParameterObjDto parameters) { - this.parameters = parameters; - this.parametersDefined = true; - return this; - } - - /** - * Get parameters - * - * @return parameters - */ - @JsonProperty(JSON_PROPERTY_PARAMETERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public ParameterObjDto getParameters() { - return parameters; - } - - @JsonIgnore - public boolean getParametersDefined() { - return parametersDefined; - } - - @JsonProperty(JSON_PROPERTY_PARAMETERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setParameters(ParameterObjDto parameters) { - this.parameters = parameters; - this.parametersDefined = true; - } - - public ApiUpdateMmsMtMessageDto strictValidation(Boolean strictValidation) { - this.strictValidation = strictValidation; - this.strictValidationDefined = true; - return this; - } - - /** - * Whether or not you want the media included in your message to be checked against [Sinch MMS - * channel best practices](/docs/mms/bestpractices/). If set to true, your message will be - * rejected if it doesn't conform to the listed recommendations, otherwise no validation will - * be performed. - * - * @return strictValidation - */ - @JsonProperty(JSON_PROPERTY_STRICT_VALIDATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getStrictValidation() { - return strictValidation; - } - - @JsonIgnore - public boolean getStrictValidationDefined() { - return strictValidationDefined; - } - - @JsonProperty(JSON_PROPERTY_STRICT_VALIDATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setStrictValidation(Boolean strictValidation) { - this.strictValidation = strictValidation; - this.strictValidationDefined = true; - } - - /** Return true if this ApiUpdateMmsMtMessage object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ApiUpdateMmsMtMessageDto apiUpdateMmsMtMessage = (ApiUpdateMmsMtMessageDto) o; - return Objects.equals(this.from, apiUpdateMmsMtMessage.from) - && Objects.equals(this.type, apiUpdateMmsMtMessage.type) - && Objects.equals(this.toAdd, apiUpdateMmsMtMessage.toAdd) - && Objects.equals(this.toRemove, apiUpdateMmsMtMessage.toRemove) - && Objects.equals(this.deliveryReport, apiUpdateMmsMtMessage.deliveryReport) - && Objects.equals(this.sendAt, apiUpdateMmsMtMessage.sendAt) - && Objects.equals(this.expireAt, apiUpdateMmsMtMessage.expireAt) - && Objects.equals(this.callbackUrl, apiUpdateMmsMtMessage.callbackUrl) - && Objects.equals(this.body, apiUpdateMmsMtMessage.body) - && Objects.equals(this.parameters, apiUpdateMmsMtMessage.parameters) - && Objects.equals(this.strictValidation, apiUpdateMmsMtMessage.strictValidation); - } - - @Override - public int hashCode() { - return Objects.hash( - from, - type, - toAdd, - toRemove, - deliveryReport, - sendAt, - expireAt, - callbackUrl, - body, - parameters, - strictValidation); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ApiUpdateMmsMtMessageDto {\n"); - sb.append(" from: ").append(toIndentedString(from)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" toAdd: ").append(toIndentedString(toAdd)).append("\n"); - sb.append(" toRemove: ").append(toIndentedString(toRemove)).append("\n"); - sb.append(" deliveryReport: ").append(toIndentedString(deliveryReport)).append("\n"); - sb.append(" sendAt: ").append(toIndentedString(sendAt)).append("\n"); - sb.append(" expireAt: ").append(toIndentedString(expireAt)).append("\n"); - sb.append(" callbackUrl: ").append(toIndentedString(callbackUrl)).append("\n"); - sb.append(" body: ").append(toIndentedString(body)).append("\n"); - sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); - sb.append(" strictValidation: ").append(toIndentedString(strictValidation)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiUpdateMtMessageDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiUpdateMtMessageDto.java deleted file mode 100644 index c5ec8d857..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiUpdateMtMessageDto.java +++ /dev/null @@ -1,379 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import java.time.OffsetDateTime; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** ApiUpdateMtMessageDto */ -@JsonPropertyOrder({ - ApiUpdateMtMessageDto.JSON_PROPERTY_FROM, - ApiUpdateMtMessageDto.JSON_PROPERTY_TYPE, - ApiUpdateMtMessageDto.JSON_PROPERTY_TO_ADD, - ApiUpdateMtMessageDto.JSON_PROPERTY_TO_REMOVE, - ApiUpdateMtMessageDto.JSON_PROPERTY_DELIVERY_REPORT, - ApiUpdateMtMessageDto.JSON_PROPERTY_SEND_AT, - ApiUpdateMtMessageDto.JSON_PROPERTY_EXPIRE_AT, - ApiUpdateMtMessageDto.JSON_PROPERTY_CALLBACK_URL -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class ApiUpdateMtMessageDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_FROM = "from"; - private String from; - private boolean fromDefined = false; - - public static final String JSON_PROPERTY_TYPE = "type"; - private String type; - private boolean typeDefined = false; - - public static final String JSON_PROPERTY_TO_ADD = "to_add"; - private List toAdd; - private boolean toAddDefined = false; - - public static final String JSON_PROPERTY_TO_REMOVE = "to_remove"; - private List toRemove; - private boolean toRemoveDefined = false; - - public static final String JSON_PROPERTY_DELIVERY_REPORT = "delivery_report"; - private String deliveryReport; - private boolean deliveryReportDefined = false; - - public static final String JSON_PROPERTY_SEND_AT = "send_at"; - private OffsetDateTime sendAt; - private boolean sendAtDefined = false; - - public static final String JSON_PROPERTY_EXPIRE_AT = "expire_at"; - private OffsetDateTime expireAt; - private boolean expireAtDefined = false; - - public static final String JSON_PROPERTY_CALLBACK_URL = "callback_url"; - private String callbackUrl; - private boolean callbackUrlDefined = false; - - public ApiUpdateMtMessageDto() {} - - public ApiUpdateMtMessageDto from(String from) { - this.from = from; - this.fromDefined = true; - return this; - } - - /** - * Sender number. Must be valid phone number, short code or alphanumeric. - * - * @return from - */ - @JsonProperty(JSON_PROPERTY_FROM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getFrom() { - return from; - } - - @JsonIgnore - public boolean getFromDefined() { - return fromDefined; - } - - @JsonProperty(JSON_PROPERTY_FROM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setFrom(String from) { - this.from = from; - this.fromDefined = true; - } - - public ApiUpdateMtMessageDto type(String type) { - this.type = type; - this.typeDefined = true; - return this; - } - - /** - * Get type - * - * @return type - */ - @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getType() { - return type; - } - - @JsonIgnore - public boolean getTypeDefined() { - return typeDefined; - } - - @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setType(String type) { - this.type = type; - this.typeDefined = true; - } - - public ApiUpdateMtMessageDto toAdd(List toAdd) { - this.toAdd = toAdd; - this.toAddDefined = true; - return this; - } - - public ApiUpdateMtMessageDto addToAddItem(String toAddItem) { - if (this.toAdd == null) { - this.toAdd = new ArrayList<>(); - } - this.toAddDefined = true; - this.toAdd.add(toAddItem); - return this; - } - - /** - * List of phone numbers and group IDs to add to the batch. - * - * @return toAdd - */ - @JsonProperty(JSON_PROPERTY_TO_ADD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List getToAdd() { - return toAdd; - } - - @JsonIgnore - public boolean getToAddDefined() { - return toAddDefined; - } - - @JsonProperty(JSON_PROPERTY_TO_ADD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setToAdd(List toAdd) { - this.toAdd = toAdd; - this.toAddDefined = true; - } - - public ApiUpdateMtMessageDto toRemove(List toRemove) { - this.toRemove = toRemove; - this.toRemoveDefined = true; - return this; - } - - public ApiUpdateMtMessageDto addToRemoveItem(String toRemoveItem) { - if (this.toRemove == null) { - this.toRemove = new ArrayList<>(); - } - this.toRemoveDefined = true; - this.toRemove.add(toRemoveItem); - return this; - } - - /** - * List of phone numbers and group IDs to remove from the batch. - * - * @return toRemove - */ - @JsonProperty(JSON_PROPERTY_TO_REMOVE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List getToRemove() { - return toRemove; - } - - @JsonIgnore - public boolean getToRemoveDefined() { - return toRemoveDefined; - } - - @JsonProperty(JSON_PROPERTY_TO_REMOVE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setToRemove(List toRemove) { - this.toRemove = toRemove; - this.toRemoveDefined = true; - } - - public ApiUpdateMtMessageDto deliveryReport(String deliveryReport) { - this.deliveryReport = deliveryReport; - this.deliveryReportDefined = true; - return this; - } - - /** - * Request delivery report callback. Note that delivery reports can be fetched from the API - * regardless of this setting. - * - * @return deliveryReport - */ - @JsonProperty(JSON_PROPERTY_DELIVERY_REPORT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getDeliveryReport() { - return deliveryReport; - } - - @JsonIgnore - public boolean getDeliveryReportDefined() { - return deliveryReportDefined; - } - - @JsonProperty(JSON_PROPERTY_DELIVERY_REPORT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDeliveryReport(String deliveryReport) { - this.deliveryReport = deliveryReport; - this.deliveryReportDefined = true; - } - - public ApiUpdateMtMessageDto sendAt(OffsetDateTime sendAt) { - this.sendAt = sendAt; - this.sendAtDefined = true; - return this; - } - - /** - * If set, in the future the message will be delayed until `send_at` occurs. Formatted - * as <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" - * target=\"_blank\">ISO-8601</a>: `YYYY-MM-DDThh:mm:ss.SSSZ`. - * Constraints: Must be before expire_at. If set in the past, messages will be sent immediately. - * - * @return sendAt - */ - @JsonProperty(JSON_PROPERTY_SEND_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getSendAt() { - return sendAt; - } - - @JsonIgnore - public boolean getSendAtDefined() { - return sendAtDefined; - } - - @JsonProperty(JSON_PROPERTY_SEND_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setSendAt(OffsetDateTime sendAt) { - this.sendAt = sendAt; - this.sendAtDefined = true; - } - - public ApiUpdateMtMessageDto expireAt(OffsetDateTime expireAt) { - this.expireAt = expireAt; - this.expireAtDefined = true; - return this; - } - - /** - * If set, the system will stop trying to deliver the message at this point. Constraints: Must be - * after `send_at` Default: 3 days after `send_at` - * - * @return expireAt - */ - @JsonProperty(JSON_PROPERTY_EXPIRE_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getExpireAt() { - return expireAt; - } - - @JsonIgnore - public boolean getExpireAtDefined() { - return expireAtDefined; - } - - @JsonProperty(JSON_PROPERTY_EXPIRE_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setExpireAt(OffsetDateTime expireAt) { - this.expireAt = expireAt; - this.expireAtDefined = true; - } - - public ApiUpdateMtMessageDto callbackUrl(String callbackUrl) { - this.callbackUrl = callbackUrl; - this.callbackUrlDefined = true; - return this; - } - - /** - * Override the default callback URL for this batch. Constraints: Must be valid URL. - * - * @return callbackUrl - */ - @JsonProperty(JSON_PROPERTY_CALLBACK_URL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCallbackUrl() { - return callbackUrl; - } - - @JsonIgnore - public boolean getCallbackUrlDefined() { - return callbackUrlDefined; - } - - @JsonProperty(JSON_PROPERTY_CALLBACK_URL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCallbackUrl(String callbackUrl) { - this.callbackUrl = callbackUrl; - this.callbackUrlDefined = true; - } - - /** Return true if this ApiUpdateMtMessage object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ApiUpdateMtMessageDto apiUpdateMtMessage = (ApiUpdateMtMessageDto) o; - return Objects.equals(this.from, apiUpdateMtMessage.from) - && Objects.equals(this.type, apiUpdateMtMessage.type) - && Objects.equals(this.toAdd, apiUpdateMtMessage.toAdd) - && Objects.equals(this.toRemove, apiUpdateMtMessage.toRemove) - && Objects.equals(this.deliveryReport, apiUpdateMtMessage.deliveryReport) - && Objects.equals(this.sendAt, apiUpdateMtMessage.sendAt) - && Objects.equals(this.expireAt, apiUpdateMtMessage.expireAt) - && Objects.equals(this.callbackUrl, apiUpdateMtMessage.callbackUrl); - } - - @Override - public int hashCode() { - return Objects.hash(from, type, toAdd, toRemove, deliveryReport, sendAt, expireAt, callbackUrl); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ApiUpdateMtMessageDto {\n"); - sb.append(" from: ").append(toIndentedString(from)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" toAdd: ").append(toIndentedString(toAdd)).append("\n"); - sb.append(" toRemove: ").append(toIndentedString(toRemove)).append("\n"); - sb.append(" deliveryReport: ").append(toIndentedString(deliveryReport)).append("\n"); - sb.append(" sendAt: ").append(toIndentedString(sendAt)).append("\n"); - sb.append(" expireAt: ").append(toIndentedString(expireAt)).append("\n"); - sb.append(" callbackUrl: ").append(toIndentedString(callbackUrl)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiUpdateTextMtMessageDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiUpdateTextMtMessageDto.java deleted file mode 100644 index 7423abd00..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ApiUpdateTextMtMessageDto.java +++ /dev/null @@ -1,496 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonValue; -import java.time.OffsetDateTime; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** ApiUpdateTextMtMessageDto */ -@JsonPropertyOrder({ - ApiUpdateTextMtMessageDto.JSON_PROPERTY_FROM, - ApiUpdateTextMtMessageDto.JSON_PROPERTY_TYPE, - ApiUpdateTextMtMessageDto.JSON_PROPERTY_TO_ADD, - ApiUpdateTextMtMessageDto.JSON_PROPERTY_TO_REMOVE, - ApiUpdateTextMtMessageDto.JSON_PROPERTY_DELIVERY_REPORT, - ApiUpdateTextMtMessageDto.JSON_PROPERTY_SEND_AT, - ApiUpdateTextMtMessageDto.JSON_PROPERTY_EXPIRE_AT, - ApiUpdateTextMtMessageDto.JSON_PROPERTY_CALLBACK_URL, - ApiUpdateTextMtMessageDto.JSON_PROPERTY_PARAMETERS, - ApiUpdateTextMtMessageDto.JSON_PROPERTY_BODY -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class ApiUpdateTextMtMessageDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_FROM = "from"; - private String from; - private boolean fromDefined = false; - - /** Regular SMS */ - public enum TypeEnum { - MT_TEXT("mt_text"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - TypeEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static TypeEnum fromValue(String value) { - for (TypeEnum b : TypeEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_TYPE = "type"; - private String type; - private boolean typeDefined = false; - - public static final String JSON_PROPERTY_TO_ADD = "to_add"; - private List toAdd; - private boolean toAddDefined = false; - - public static final String JSON_PROPERTY_TO_REMOVE = "to_remove"; - private List toRemove; - private boolean toRemoveDefined = false; - - public static final String JSON_PROPERTY_DELIVERY_REPORT = "delivery_report"; - private String deliveryReport; - private boolean deliveryReportDefined = false; - - public static final String JSON_PROPERTY_SEND_AT = "send_at"; - private OffsetDateTime sendAt; - private boolean sendAtDefined = false; - - public static final String JSON_PROPERTY_EXPIRE_AT = "expire_at"; - private OffsetDateTime expireAt; - private boolean expireAtDefined = false; - - public static final String JSON_PROPERTY_CALLBACK_URL = "callback_url"; - private String callbackUrl; - private boolean callbackUrlDefined = false; - - public static final String JSON_PROPERTY_PARAMETERS = "parameters"; - private ParameterObjDto parameters; - private boolean parametersDefined = false; - - public static final String JSON_PROPERTY_BODY = "body"; - private String body; - private boolean bodyDefined = false; - - public ApiUpdateTextMtMessageDto() {} - - public ApiUpdateTextMtMessageDto from(String from) { - this.from = from; - this.fromDefined = true; - return this; - } - - /** - * Sender number. Must be valid phone number, short code or alphanumeric. - * - * @return from - */ - @JsonProperty(JSON_PROPERTY_FROM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getFrom() { - return from; - } - - @JsonIgnore - public boolean getFromDefined() { - return fromDefined; - } - - @JsonProperty(JSON_PROPERTY_FROM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setFrom(String from) { - this.from = from; - this.fromDefined = true; - } - - public ApiUpdateTextMtMessageDto type(String type) { - this.type = type; - this.typeDefined = true; - return this; - } - - /** - * Regular SMS - * - * @return type - */ - @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getType() { - return type; - } - - @JsonIgnore - public boolean getTypeDefined() { - return typeDefined; - } - - @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setType(String type) { - this.type = type; - this.typeDefined = true; - } - - public ApiUpdateTextMtMessageDto toAdd(List toAdd) { - this.toAdd = toAdd; - this.toAddDefined = true; - return this; - } - - public ApiUpdateTextMtMessageDto addToAddItem(String toAddItem) { - if (this.toAdd == null) { - this.toAdd = new ArrayList<>(); - } - this.toAddDefined = true; - this.toAdd.add(toAddItem); - return this; - } - - /** - * List of phone numbers and group IDs to add to the batch. - * - * @return toAdd - */ - @JsonProperty(JSON_PROPERTY_TO_ADD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List getToAdd() { - return toAdd; - } - - @JsonIgnore - public boolean getToAddDefined() { - return toAddDefined; - } - - @JsonProperty(JSON_PROPERTY_TO_ADD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setToAdd(List toAdd) { - this.toAdd = toAdd; - this.toAddDefined = true; - } - - public ApiUpdateTextMtMessageDto toRemove(List toRemove) { - this.toRemove = toRemove; - this.toRemoveDefined = true; - return this; - } - - public ApiUpdateTextMtMessageDto addToRemoveItem(String toRemoveItem) { - if (this.toRemove == null) { - this.toRemove = new ArrayList<>(); - } - this.toRemoveDefined = true; - this.toRemove.add(toRemoveItem); - return this; - } - - /** - * List of phone numbers and group IDs to remove from the batch. - * - * @return toRemove - */ - @JsonProperty(JSON_PROPERTY_TO_REMOVE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List getToRemove() { - return toRemove; - } - - @JsonIgnore - public boolean getToRemoveDefined() { - return toRemoveDefined; - } - - @JsonProperty(JSON_PROPERTY_TO_REMOVE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setToRemove(List toRemove) { - this.toRemove = toRemove; - this.toRemoveDefined = true; - } - - public ApiUpdateTextMtMessageDto deliveryReport(String deliveryReport) { - this.deliveryReport = deliveryReport; - this.deliveryReportDefined = true; - return this; - } - - /** - * Request delivery report callback. Note that delivery reports can be fetched from the API - * regardless of this setting. - * - * @return deliveryReport - */ - @JsonProperty(JSON_PROPERTY_DELIVERY_REPORT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getDeliveryReport() { - return deliveryReport; - } - - @JsonIgnore - public boolean getDeliveryReportDefined() { - return deliveryReportDefined; - } - - @JsonProperty(JSON_PROPERTY_DELIVERY_REPORT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDeliveryReport(String deliveryReport) { - this.deliveryReport = deliveryReport; - this.deliveryReportDefined = true; - } - - public ApiUpdateTextMtMessageDto sendAt(OffsetDateTime sendAt) { - this.sendAt = sendAt; - this.sendAtDefined = true; - return this; - } - - /** - * If set, in the future the message will be delayed until `send_at` occurs. Formatted - * as <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" - * target=\"_blank\">ISO-8601</a>: `YYYY-MM-DDThh:mm:ss.SSSZ`. - * Constraints: Must be before expire_at. If set in the past, messages will be sent immediately. - * - * @return sendAt - */ - @JsonProperty(JSON_PROPERTY_SEND_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getSendAt() { - return sendAt; - } - - @JsonIgnore - public boolean getSendAtDefined() { - return sendAtDefined; - } - - @JsonProperty(JSON_PROPERTY_SEND_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setSendAt(OffsetDateTime sendAt) { - this.sendAt = sendAt; - this.sendAtDefined = true; - } - - public ApiUpdateTextMtMessageDto expireAt(OffsetDateTime expireAt) { - this.expireAt = expireAt; - this.expireAtDefined = true; - return this; - } - - /** - * If set, the system will stop trying to deliver the message at this point. Constraints: Must be - * after `send_at` Default: 3 days after `send_at` - * - * @return expireAt - */ - @JsonProperty(JSON_PROPERTY_EXPIRE_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getExpireAt() { - return expireAt; - } - - @JsonIgnore - public boolean getExpireAtDefined() { - return expireAtDefined; - } - - @JsonProperty(JSON_PROPERTY_EXPIRE_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setExpireAt(OffsetDateTime expireAt) { - this.expireAt = expireAt; - this.expireAtDefined = true; - } - - public ApiUpdateTextMtMessageDto callbackUrl(String callbackUrl) { - this.callbackUrl = callbackUrl; - this.callbackUrlDefined = true; - return this; - } - - /** - * Override the default callback URL for this batch. Constraints: Must be valid URL. - * - * @return callbackUrl - */ - @JsonProperty(JSON_PROPERTY_CALLBACK_URL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCallbackUrl() { - return callbackUrl; - } - - @JsonIgnore - public boolean getCallbackUrlDefined() { - return callbackUrlDefined; - } - - @JsonProperty(JSON_PROPERTY_CALLBACK_URL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCallbackUrl(String callbackUrl) { - this.callbackUrl = callbackUrl; - this.callbackUrlDefined = true; - } - - public ApiUpdateTextMtMessageDto parameters(ParameterObjDto parameters) { - this.parameters = parameters; - this.parametersDefined = true; - return this; - } - - /** - * Get parameters - * - * @return parameters - */ - @JsonProperty(JSON_PROPERTY_PARAMETERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public ParameterObjDto getParameters() { - return parameters; - } - - @JsonIgnore - public boolean getParametersDefined() { - return parametersDefined; - } - - @JsonProperty(JSON_PROPERTY_PARAMETERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setParameters(ParameterObjDto parameters) { - this.parameters = parameters; - this.parametersDefined = true; - } - - public ApiUpdateTextMtMessageDto body(String body) { - this.body = body; - this.bodyDefined = true; - return this; - } - - /** - * The message content - * - * @return body - */ - @JsonProperty(JSON_PROPERTY_BODY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getBody() { - return body; - } - - @JsonIgnore - public boolean getBodyDefined() { - return bodyDefined; - } - - @JsonProperty(JSON_PROPERTY_BODY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setBody(String body) { - this.body = body; - this.bodyDefined = true; - } - - /** Return true if this ApiUpdateTextMtMessage object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ApiUpdateTextMtMessageDto apiUpdateTextMtMessage = (ApiUpdateTextMtMessageDto) o; - return Objects.equals(this.from, apiUpdateTextMtMessage.from) - && Objects.equals(this.type, apiUpdateTextMtMessage.type) - && Objects.equals(this.toAdd, apiUpdateTextMtMessage.toAdd) - && Objects.equals(this.toRemove, apiUpdateTextMtMessage.toRemove) - && Objects.equals(this.deliveryReport, apiUpdateTextMtMessage.deliveryReport) - && Objects.equals(this.sendAt, apiUpdateTextMtMessage.sendAt) - && Objects.equals(this.expireAt, apiUpdateTextMtMessage.expireAt) - && Objects.equals(this.callbackUrl, apiUpdateTextMtMessage.callbackUrl) - && Objects.equals(this.parameters, apiUpdateTextMtMessage.parameters) - && Objects.equals(this.body, apiUpdateTextMtMessage.body); - } - - @Override - public int hashCode() { - return Objects.hash( - from, - type, - toAdd, - toRemove, - deliveryReport, - sendAt, - expireAt, - callbackUrl, - parameters, - body); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ApiUpdateTextMtMessageDto {\n"); - sb.append(" from: ").append(toIndentedString(from)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" toAdd: ").append(toIndentedString(toAdd)).append("\n"); - sb.append(" toRemove: ").append(toIndentedString(toRemove)).append("\n"); - sb.append(" deliveryReport: ").append(toIndentedString(deliveryReport)).append("\n"); - sb.append(" sendAt: ").append(toIndentedString(sendAt)).append("\n"); - sb.append(" expireAt: ").append(toIndentedString(expireAt)).append("\n"); - sb.append(" callbackUrl: ").append(toIndentedString(callbackUrl)).append("\n"); - sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); - sb.append(" body: ").append(toIndentedString(body)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/BinaryRequestDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/BinaryRequestDto.java deleted file mode 100644 index f70b7dd73..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/BinaryRequestDto.java +++ /dev/null @@ -1,731 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonValue; -import java.time.OffsetDateTime; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** BinaryRequestDto */ -@JsonPropertyOrder({ - BinaryRequestDto.JSON_PROPERTY_TO, - BinaryRequestDto.JSON_PROPERTY_BODY, - BinaryRequestDto.JSON_PROPERTY_UDH, - BinaryRequestDto.JSON_PROPERTY_FROM, - BinaryRequestDto.JSON_PROPERTY_TYPE, - BinaryRequestDto.JSON_PROPERTY_DELIVERY_REPORT, - BinaryRequestDto.JSON_PROPERTY_SEND_AT, - BinaryRequestDto.JSON_PROPERTY_EXPIRE_AT, - BinaryRequestDto.JSON_PROPERTY_CALLBACK_URL, - BinaryRequestDto.JSON_PROPERTY_CLIENT_REFERENCE, - BinaryRequestDto.JSON_PROPERTY_FEEDBACK_ENABLED, - BinaryRequestDto.JSON_PROPERTY_FLASH_MESSAGE, - BinaryRequestDto.JSON_PROPERTY_TRUNCATE_CONCAT, - BinaryRequestDto.JSON_PROPERTY_MAX_NUMBER_OF_MESSAGE_PARTS, - BinaryRequestDto.JSON_PROPERTY_FROM_TON, - BinaryRequestDto.JSON_PROPERTY_FROM_NPI -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class BinaryRequestDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_TO = "to"; - private List to; - private boolean toDefined = false; - - public static final String JSON_PROPERTY_BODY = "body"; - private String body; - private boolean bodyDefined = false; - - public static final String JSON_PROPERTY_UDH = "udh"; - private String udh; - private boolean udhDefined = false; - - public static final String JSON_PROPERTY_FROM = "from"; - private String from; - private boolean fromDefined = false; - - /** - * SMS in <a - * href=\"https://community.sinch.com/t5/Glossary/Binary-SMS/ta-p/7470\" - * target=\"_blank\">binary</a> format. - */ - public enum TypeEnum { - MT_BINARY("mt_binary"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - TypeEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static TypeEnum fromValue(String value) { - for (TypeEnum b : TypeEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_TYPE = "type"; - private String type; - private boolean typeDefined = false; - - public static final String JSON_PROPERTY_DELIVERY_REPORT = "delivery_report"; - private String deliveryReport; - private boolean deliveryReportDefined = false; - - public static final String JSON_PROPERTY_SEND_AT = "send_at"; - private OffsetDateTime sendAt; - private boolean sendAtDefined = false; - - public static final String JSON_PROPERTY_EXPIRE_AT = "expire_at"; - private OffsetDateTime expireAt; - private boolean expireAtDefined = false; - - public static final String JSON_PROPERTY_CALLBACK_URL = "callback_url"; - private String callbackUrl; - private boolean callbackUrlDefined = false; - - public static final String JSON_PROPERTY_CLIENT_REFERENCE = "client_reference"; - private String clientReference; - private boolean clientReferenceDefined = false; - - public static final String JSON_PROPERTY_FEEDBACK_ENABLED = "feedback_enabled"; - private Boolean feedbackEnabled; - private boolean feedbackEnabledDefined = false; - - public static final String JSON_PROPERTY_FLASH_MESSAGE = "flash_message"; - private Boolean flashMessage; - private boolean flashMessageDefined = false; - - public static final String JSON_PROPERTY_TRUNCATE_CONCAT = "truncate_concat"; - private Boolean truncateConcat; - private boolean truncateConcatDefined = false; - - public static final String JSON_PROPERTY_MAX_NUMBER_OF_MESSAGE_PARTS = - "max_number_of_message_parts"; - private Integer maxNumberOfMessageParts; - private boolean maxNumberOfMessagePartsDefined = false; - - public static final String JSON_PROPERTY_FROM_TON = "from_ton"; - private Integer fromTon; - private boolean fromTonDefined = false; - - public static final String JSON_PROPERTY_FROM_NPI = "from_npi"; - private Integer fromNpi; - private boolean fromNpiDefined = false; - - public BinaryRequestDto() {} - - public BinaryRequestDto to(List to) { - this.to = to; - this.toDefined = true; - return this; - } - - public BinaryRequestDto addToItem(String toItem) { - if (this.to == null) { - this.to = new ArrayList<>(); - } - this.toDefined = true; - this.to.add(toItem); - return this; - } - - /** - * A list of phone numbers and group IDs that will receive the batch. [More - * info](https://community.sinch.com/t5/Glossary/MSISDN/ta-p/7628). - * - * @return to - */ - @JsonProperty(JSON_PROPERTY_TO) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public List getTo() { - return to; - } - - @JsonIgnore - public boolean getToDefined() { - return toDefined; - } - - @JsonProperty(JSON_PROPERTY_TO) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setTo(List to) { - this.to = to; - this.toDefined = true; - } - - public BinaryRequestDto body(String body) { - this.body = body; - this.bodyDefined = true; - return this; - } - - /** - * The message content Base64 encoded. Max 140 bytes including `udh`. - * - * @return body - */ - @JsonProperty(JSON_PROPERTY_BODY) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getBody() { - return body; - } - - @JsonIgnore - public boolean getBodyDefined() { - return bodyDefined; - } - - @JsonProperty(JSON_PROPERTY_BODY) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setBody(String body) { - this.body = body; - this.bodyDefined = true; - } - - public BinaryRequestDto udh(String udh) { - this.udh = udh; - this.udhDefined = true; - return this; - } - - /** - * The UDH header of a binary message HEX encoded. Max 140 bytes including the `body`. - * - * @return udh - */ - @JsonProperty(JSON_PROPERTY_UDH) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getUdh() { - return udh; - } - - @JsonIgnore - public boolean getUdhDefined() { - return udhDefined; - } - - @JsonProperty(JSON_PROPERTY_UDH) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setUdh(String udh) { - this.udh = udh; - this.udhDefined = true; - } - - public BinaryRequestDto from(String from) { - this.from = from; - this.fromDefined = true; - return this; - } - - /** - * Sender number. Must be valid phone number, short code or alphanumeric. Required if Automatic - * Default Originator not configured. - * - * @return from - */ - @JsonProperty(JSON_PROPERTY_FROM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getFrom() { - return from; - } - - @JsonIgnore - public boolean getFromDefined() { - return fromDefined; - } - - @JsonProperty(JSON_PROPERTY_FROM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setFrom(String from) { - this.from = from; - this.fromDefined = true; - } - - public BinaryRequestDto type(String type) { - this.type = type; - this.typeDefined = true; - return this; - } - - /** - * SMS in <a - * href=\"https://community.sinch.com/t5/Glossary/Binary-SMS/ta-p/7470\" - * target=\"_blank\">binary</a> format. - * - * @return type - */ - @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getType() { - return type; - } - - @JsonIgnore - public boolean getTypeDefined() { - return typeDefined; - } - - @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setType(String type) { - this.type = type; - this.typeDefined = true; - } - - public BinaryRequestDto deliveryReport(String deliveryReport) { - this.deliveryReport = deliveryReport; - this.deliveryReportDefined = true; - return this; - } - - /** - * Request delivery report callback. Note that delivery reports can be fetched from the API - * regardless of this setting. - * - * @return deliveryReport - */ - @JsonProperty(JSON_PROPERTY_DELIVERY_REPORT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getDeliveryReport() { - return deliveryReport; - } - - @JsonIgnore - public boolean getDeliveryReportDefined() { - return deliveryReportDefined; - } - - @JsonProperty(JSON_PROPERTY_DELIVERY_REPORT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDeliveryReport(String deliveryReport) { - this.deliveryReport = deliveryReport; - this.deliveryReportDefined = true; - } - - public BinaryRequestDto sendAt(OffsetDateTime sendAt) { - this.sendAt = sendAt; - this.sendAtDefined = true; - return this; - } - - /** - * If set in the future the message will be delayed until `send_at` occurs. Must be - * before `expire_at`. If set in the past, messages will be sent immediately. Formatted - * as [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601). For example: - * `YYYY-MM-DDThh:mm:ss.SSSZ`. - * - * @return sendAt - */ - @JsonProperty(JSON_PROPERTY_SEND_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getSendAt() { - return sendAt; - } - - @JsonIgnore - public boolean getSendAtDefined() { - return sendAtDefined; - } - - @JsonProperty(JSON_PROPERTY_SEND_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setSendAt(OffsetDateTime sendAt) { - this.sendAt = sendAt; - this.sendAtDefined = true; - } - - public BinaryRequestDto expireAt(OffsetDateTime expireAt) { - this.expireAt = expireAt; - this.expireAtDefined = true; - return this; - } - - /** - * If set, the system will stop trying to deliver the message at this point. Must be after - * `send_at`. Default and max is 3 days after `send_at`. Formatted as - * [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601). For example: - * `YYYY-MM-DDThh:mm:ss.SSSZ`. - * - * @return expireAt - */ - @JsonProperty(JSON_PROPERTY_EXPIRE_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getExpireAt() { - return expireAt; - } - - @JsonIgnore - public boolean getExpireAtDefined() { - return expireAtDefined; - } - - @JsonProperty(JSON_PROPERTY_EXPIRE_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setExpireAt(OffsetDateTime expireAt) { - this.expireAt = expireAt; - this.expireAtDefined = true; - } - - public BinaryRequestDto callbackUrl(String callbackUrl) { - this.callbackUrl = callbackUrl; - this.callbackUrlDefined = true; - return this; - } - - /** - * Override the *default* callback URL for this batch. Must be a valid URL. Learn how to set a - * default callback URL <a - * href=\"https://community.sinch.com/t5/SMS/How-do-I-assign-a-callback-URL-to-an-SMS-service-plan/ta-p/8414\" - * target=\"_blank\">here</a>. - * - * @return callbackUrl - */ - @JsonProperty(JSON_PROPERTY_CALLBACK_URL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCallbackUrl() { - return callbackUrl; - } - - @JsonIgnore - public boolean getCallbackUrlDefined() { - return callbackUrlDefined; - } - - @JsonProperty(JSON_PROPERTY_CALLBACK_URL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCallbackUrl(String callbackUrl) { - this.callbackUrl = callbackUrl; - this.callbackUrlDefined = true; - } - - public BinaryRequestDto clientReference(String clientReference) { - this.clientReference = clientReference; - this.clientReferenceDefined = true; - return this; - } - - /** - * The client identifier of a batch message. If set, the identifier will be added in the delivery - * report/callback of this batch. - * - * @return clientReference - */ - @JsonProperty(JSON_PROPERTY_CLIENT_REFERENCE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getClientReference() { - return clientReference; - } - - @JsonIgnore - public boolean getClientReferenceDefined() { - return clientReferenceDefined; - } - - @JsonProperty(JSON_PROPERTY_CLIENT_REFERENCE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setClientReference(String clientReference) { - this.clientReference = clientReference; - this.clientReferenceDefined = true; - } - - public BinaryRequestDto feedbackEnabled(Boolean feedbackEnabled) { - this.feedbackEnabled = feedbackEnabled; - this.feedbackEnabledDefined = true; - return this; - } - - /** - * If set to true then - * [feedback](/docs/sms/api-reference/sms/tag/Batches/#tag/Batches/operation/deliveryFeedback) is - * expected after successful delivery. - * - * @return feedbackEnabled - */ - @JsonProperty(JSON_PROPERTY_FEEDBACK_ENABLED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getFeedbackEnabled() { - return feedbackEnabled; - } - - @JsonIgnore - public boolean getFeedbackEnabledDefined() { - return feedbackEnabledDefined; - } - - @JsonProperty(JSON_PROPERTY_FEEDBACK_ENABLED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setFeedbackEnabled(Boolean feedbackEnabled) { - this.feedbackEnabled = feedbackEnabled; - this.feedbackEnabledDefined = true; - } - - public BinaryRequestDto flashMessage(Boolean flashMessage) { - this.flashMessage = flashMessage; - this.flashMessageDefined = true; - return this; - } - - /** - * Shows message on screen without user interaction while not saving the message to the inbox. - * - * @return flashMessage - */ - @JsonProperty(JSON_PROPERTY_FLASH_MESSAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getFlashMessage() { - return flashMessage; - } - - @JsonIgnore - public boolean getFlashMessageDefined() { - return flashMessageDefined; - } - - @JsonProperty(JSON_PROPERTY_FLASH_MESSAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setFlashMessage(Boolean flashMessage) { - this.flashMessage = flashMessage; - this.flashMessageDefined = true; - } - - public BinaryRequestDto truncateConcat(Boolean truncateConcat) { - this.truncateConcat = truncateConcat; - this.truncateConcatDefined = true; - return this; - } - - /** - * If set to `true`, the message will be shortened when exceeding one part. - * - * @return truncateConcat - */ - @JsonProperty(JSON_PROPERTY_TRUNCATE_CONCAT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getTruncateConcat() { - return truncateConcat; - } - - @JsonIgnore - public boolean getTruncateConcatDefined() { - return truncateConcatDefined; - } - - @JsonProperty(JSON_PROPERTY_TRUNCATE_CONCAT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setTruncateConcat(Boolean truncateConcat) { - this.truncateConcat = truncateConcat; - this.truncateConcatDefined = true; - } - - public BinaryRequestDto maxNumberOfMessageParts(Integer maxNumberOfMessageParts) { - this.maxNumberOfMessageParts = maxNumberOfMessageParts; - this.maxNumberOfMessagePartsDefined = true; - return this; - } - - /** - * Message will be dispatched only if it is not split to more parts than the maximum number of - * message parts. minimum: 1 - * - * @return maxNumberOfMessageParts - */ - @JsonProperty(JSON_PROPERTY_MAX_NUMBER_OF_MESSAGE_PARTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getMaxNumberOfMessageParts() { - return maxNumberOfMessageParts; - } - - @JsonIgnore - public boolean getMaxNumberOfMessagePartsDefined() { - return maxNumberOfMessagePartsDefined; - } - - @JsonProperty(JSON_PROPERTY_MAX_NUMBER_OF_MESSAGE_PARTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setMaxNumberOfMessageParts(Integer maxNumberOfMessageParts) { - this.maxNumberOfMessageParts = maxNumberOfMessageParts; - this.maxNumberOfMessagePartsDefined = true; - } - - public BinaryRequestDto fromTon(Integer fromTon) { - this.fromTon = fromTon; - this.fromTonDefined = true; - return this; - } - - /** - * The type of number for the sender number. Use to override the automatic detection. minimum: 0 - * maximum: 6 - * - * @return fromTon - */ - @JsonProperty(JSON_PROPERTY_FROM_TON) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getFromTon() { - return fromTon; - } - - @JsonIgnore - public boolean getFromTonDefined() { - return fromTonDefined; - } - - @JsonProperty(JSON_PROPERTY_FROM_TON) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setFromTon(Integer fromTon) { - this.fromTon = fromTon; - this.fromTonDefined = true; - } - - public BinaryRequestDto fromNpi(Integer fromNpi) { - this.fromNpi = fromNpi; - this.fromNpiDefined = true; - return this; - } - - /** - * Number Plan Indicator for the sender number. Use to override the automatic detection. minimum: - * 0 maximum: 18 - * - * @return fromNpi - */ - @JsonProperty(JSON_PROPERTY_FROM_NPI) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getFromNpi() { - return fromNpi; - } - - @JsonIgnore - public boolean getFromNpiDefined() { - return fromNpiDefined; - } - - @JsonProperty(JSON_PROPERTY_FROM_NPI) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setFromNpi(Integer fromNpi) { - this.fromNpi = fromNpi; - this.fromNpiDefined = true; - } - - /** Return true if this BinaryRequest object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - BinaryRequestDto binaryRequest = (BinaryRequestDto) o; - return Objects.equals(this.to, binaryRequest.to) - && Objects.equals(this.body, binaryRequest.body) - && Objects.equals(this.udh, binaryRequest.udh) - && Objects.equals(this.from, binaryRequest.from) - && Objects.equals(this.type, binaryRequest.type) - && Objects.equals(this.deliveryReport, binaryRequest.deliveryReport) - && Objects.equals(this.sendAt, binaryRequest.sendAt) - && Objects.equals(this.expireAt, binaryRequest.expireAt) - && Objects.equals(this.callbackUrl, binaryRequest.callbackUrl) - && Objects.equals(this.clientReference, binaryRequest.clientReference) - && Objects.equals(this.feedbackEnabled, binaryRequest.feedbackEnabled) - && Objects.equals(this.flashMessage, binaryRequest.flashMessage) - && Objects.equals(this.truncateConcat, binaryRequest.truncateConcat) - && Objects.equals(this.maxNumberOfMessageParts, binaryRequest.maxNumberOfMessageParts) - && Objects.equals(this.fromTon, binaryRequest.fromTon) - && Objects.equals(this.fromNpi, binaryRequest.fromNpi); - } - - @Override - public int hashCode() { - return Objects.hash( - to, - body, - udh, - from, - type, - deliveryReport, - sendAt, - expireAt, - callbackUrl, - clientReference, - feedbackEnabled, - flashMessage, - truncateConcat, - maxNumberOfMessageParts, - fromTon, - fromNpi); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class BinaryRequestDto {\n"); - sb.append(" to: ").append(toIndentedString(to)).append("\n"); - sb.append(" body: ").append(toIndentedString(body)).append("\n"); - sb.append(" udh: ").append(toIndentedString(udh)).append("\n"); - sb.append(" from: ").append(toIndentedString(from)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" deliveryReport: ").append(toIndentedString(deliveryReport)).append("\n"); - sb.append(" sendAt: ").append(toIndentedString(sendAt)).append("\n"); - sb.append(" expireAt: ").append(toIndentedString(expireAt)).append("\n"); - sb.append(" callbackUrl: ").append(toIndentedString(callbackUrl)).append("\n"); - sb.append(" clientReference: ").append(toIndentedString(clientReference)).append("\n"); - sb.append(" feedbackEnabled: ").append(toIndentedString(feedbackEnabled)).append("\n"); - sb.append(" flashMessage: ").append(toIndentedString(flashMessage)).append("\n"); - sb.append(" truncateConcat: ").append(toIndentedString(truncateConcat)).append("\n"); - sb.append(" maxNumberOfMessageParts: ") - .append(toIndentedString(maxNumberOfMessageParts)) - .append("\n"); - sb.append(" fromTon: ").append(toIndentedString(fromTon)).append("\n"); - sb.append(" fromNpi: ").append(toIndentedString(fromNpi)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/BinaryResponseDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/BinaryResponseDto.java deleted file mode 100644 index 3e7b5bb77..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/BinaryResponseDto.java +++ /dev/null @@ -1,843 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonValue; -import java.time.OffsetDateTime; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** BinaryResponseDto */ -@JsonPropertyOrder({ - BinaryResponseDto.JSON_PROPERTY_ID, - BinaryResponseDto.JSON_PROPERTY_TO, - BinaryResponseDto.JSON_PROPERTY_FROM, - BinaryResponseDto.JSON_PROPERTY_CANCELED, - BinaryResponseDto.JSON_PROPERTY_BODY, - BinaryResponseDto.JSON_PROPERTY_UDH, - BinaryResponseDto.JSON_PROPERTY_TYPE, - BinaryResponseDto.JSON_PROPERTY_CREATED_AT, - BinaryResponseDto.JSON_PROPERTY_MODIFIED_AT, - BinaryResponseDto.JSON_PROPERTY_DELIVERY_REPORT, - BinaryResponseDto.JSON_PROPERTY_SEND_AT, - BinaryResponseDto.JSON_PROPERTY_EXPIRE_AT, - BinaryResponseDto.JSON_PROPERTY_CALLBACK_URL, - BinaryResponseDto.JSON_PROPERTY_CLIENT_REFERENCE, - BinaryResponseDto.JSON_PROPERTY_FEEDBACK_ENABLED, - BinaryResponseDto.JSON_PROPERTY_FLASH_MESSAGE, - BinaryResponseDto.JSON_PROPERTY_TRUNCATE_CONCAT, - BinaryResponseDto.JSON_PROPERTY_MAX_NUMBER_OF_MESSAGE_PARTS, - BinaryResponseDto.JSON_PROPERTY_FROM_TON, - BinaryResponseDto.JSON_PROPERTY_FROM_NPI -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class BinaryResponseDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_ID = "id"; - private String id; - private boolean idDefined = false; - - public static final String JSON_PROPERTY_TO = "to"; - private List to; - private boolean toDefined = false; - - public static final String JSON_PROPERTY_FROM = "from"; - private String from; - private boolean fromDefined = false; - - public static final String JSON_PROPERTY_CANCELED = "canceled"; - private Boolean canceled; - private boolean canceledDefined = false; - - public static final String JSON_PROPERTY_BODY = "body"; - private String body; - private boolean bodyDefined = false; - - public static final String JSON_PROPERTY_UDH = "udh"; - private String udh; - private boolean udhDefined = false; - - /** - * SMS in <a - * href=\"https://community.sinch.com/t5/Glossary/Binary-SMS/ta-p/7470\" - * target=\"_blank\">binary</a> format. - */ - public enum TypeEnum { - MT_BINARY("mt_binary"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - TypeEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static TypeEnum fromValue(String value) { - for (TypeEnum b : TypeEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_TYPE = "type"; - private String type; - private boolean typeDefined = false; - - public static final String JSON_PROPERTY_CREATED_AT = "created_at"; - private OffsetDateTime createdAt; - private boolean createdAtDefined = false; - - public static final String JSON_PROPERTY_MODIFIED_AT = "modified_at"; - private OffsetDateTime modifiedAt; - private boolean modifiedAtDefined = false; - - public static final String JSON_PROPERTY_DELIVERY_REPORT = "delivery_report"; - private String deliveryReport; - private boolean deliveryReportDefined = false; - - public static final String JSON_PROPERTY_SEND_AT = "send_at"; - private OffsetDateTime sendAt; - private boolean sendAtDefined = false; - - public static final String JSON_PROPERTY_EXPIRE_AT = "expire_at"; - private OffsetDateTime expireAt; - private boolean expireAtDefined = false; - - public static final String JSON_PROPERTY_CALLBACK_URL = "callback_url"; - private String callbackUrl; - private boolean callbackUrlDefined = false; - - public static final String JSON_PROPERTY_CLIENT_REFERENCE = "client_reference"; - private String clientReference; - private boolean clientReferenceDefined = false; - - public static final String JSON_PROPERTY_FEEDBACK_ENABLED = "feedback_enabled"; - private Boolean feedbackEnabled; - private boolean feedbackEnabledDefined = false; - - public static final String JSON_PROPERTY_FLASH_MESSAGE = "flash_message"; - private Boolean flashMessage; - private boolean flashMessageDefined = false; - - public static final String JSON_PROPERTY_TRUNCATE_CONCAT = "truncate_concat"; - private Boolean truncateConcat; - private boolean truncateConcatDefined = false; - - public static final String JSON_PROPERTY_MAX_NUMBER_OF_MESSAGE_PARTS = - "max_number_of_message_parts"; - private Integer maxNumberOfMessageParts; - private boolean maxNumberOfMessagePartsDefined = false; - - public static final String JSON_PROPERTY_FROM_TON = "from_ton"; - private Integer fromTon; - private boolean fromTonDefined = false; - - public static final String JSON_PROPERTY_FROM_NPI = "from_npi"; - private Integer fromNpi; - private boolean fromNpiDefined = false; - - public BinaryResponseDto() {} - - @JsonCreator - public BinaryResponseDto( - @JsonProperty(JSON_PROPERTY_ID) String id, - @JsonProperty(JSON_PROPERTY_CANCELED) Boolean canceled, - @JsonProperty(JSON_PROPERTY_CREATED_AT) OffsetDateTime createdAt, - @JsonProperty(JSON_PROPERTY_MODIFIED_AT) OffsetDateTime modifiedAt) { - this(); - this.id = id; - this.idDefined = true; - this.canceled = canceled; - this.canceledDefined = true; - this.createdAt = createdAt; - this.createdAtDefined = true; - this.modifiedAt = modifiedAt; - this.modifiedAtDefined = true; - } - - /** - * Unique identifier for batch. - * - * @return id - */ - @JsonProperty(JSON_PROPERTY_ID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getId() { - return id; - } - - @JsonIgnore - public boolean getIdDefined() { - return idDefined; - } - - public BinaryResponseDto to(List to) { - this.to = to; - this.toDefined = true; - return this; - } - - public BinaryResponseDto addToItem(String toItem) { - if (this.to == null) { - this.to = new ArrayList<>(); - } - this.toDefined = true; - this.to.add(toItem); - return this; - } - - /** - * A list of phone numbers and group IDs that have received the batch. [More - * info](https://community.sinch.com/t5/Glossary/MSISDN/ta-p/7628). - * - * @return to - */ - @JsonProperty(JSON_PROPERTY_TO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List getTo() { - return to; - } - - @JsonIgnore - public boolean getToDefined() { - return toDefined; - } - - @JsonProperty(JSON_PROPERTY_TO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setTo(List to) { - this.to = to; - this.toDefined = true; - } - - public BinaryResponseDto from(String from) { - this.from = from; - this.fromDefined = true; - return this; - } - - /** - * The sender number provided. Required if the Automatic Default Originator is not configured. - * - * @return from - */ - @JsonProperty(JSON_PROPERTY_FROM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getFrom() { - return from; - } - - @JsonIgnore - public boolean getFromDefined() { - return fromDefined; - } - - @JsonProperty(JSON_PROPERTY_FROM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setFrom(String from) { - this.from = from; - this.fromDefined = true; - } - - /** - * Indicates whether or not the batch has been canceled. - * - * @return canceled - */ - @JsonProperty(JSON_PROPERTY_CANCELED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getCanceled() { - return canceled; - } - - @JsonIgnore - public boolean getCanceledDefined() { - return canceledDefined; - } - - public BinaryResponseDto body(String body) { - this.body = body; - this.bodyDefined = true; - return this; - } - - /** - * The message content provided. Base64 encoded. - * - * @return body - */ - @JsonProperty(JSON_PROPERTY_BODY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getBody() { - return body; - } - - @JsonIgnore - public boolean getBodyDefined() { - return bodyDefined; - } - - @JsonProperty(JSON_PROPERTY_BODY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setBody(String body) { - this.body = body; - this.bodyDefined = true; - } - - public BinaryResponseDto udh(String udh) { - this.udh = udh; - this.udhDefined = true; - return this; - } - - /** - * The <a - * href=\"https://community.sinch.com/t5/Glossary/UDH-User-Data-Header/ta-p/7776\" - * target=\"_blank\">UDH</a> header of a binary message HEX encoded. Max - * 140 bytes including the `body`. - * - * @return udh - */ - @JsonProperty(JSON_PROPERTY_UDH) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getUdh() { - return udh; - } - - @JsonIgnore - public boolean getUdhDefined() { - return udhDefined; - } - - @JsonProperty(JSON_PROPERTY_UDH) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setUdh(String udh) { - this.udh = udh; - this.udhDefined = true; - } - - public BinaryResponseDto type(String type) { - this.type = type; - this.typeDefined = true; - return this; - } - - /** - * SMS in <a - * href=\"https://community.sinch.com/t5/Glossary/Binary-SMS/ta-p/7470\" - * target=\"_blank\">binary</a> format. - * - * @return type - */ - @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getType() { - return type; - } - - @JsonIgnore - public boolean getTypeDefined() { - return typeDefined; - } - - @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setType(String type) { - this.type = type; - this.typeDefined = true; - } - - /** - * Timestamp for when batch was created. Formatted as - * [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601). For example: - * `YYYY-MM-DDThh:mm:ss.SSSZ`. - * - * @return createdAt - */ - @JsonProperty(JSON_PROPERTY_CREATED_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - @JsonIgnore - public boolean getCreatedAtDefined() { - return createdAtDefined; - } - - /** - * Timestamp for when batch was last updated. Formatted as - * [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601). For example: - * `YYYY-MM-DDThh:mm:ss.SSSZ`. - * - * @return modifiedAt - */ - @JsonProperty(JSON_PROPERTY_MODIFIED_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getModifiedAt() { - return modifiedAt; - } - - @JsonIgnore - public boolean getModifiedAtDefined() { - return modifiedAtDefined; - } - - public BinaryResponseDto deliveryReport(String deliveryReport) { - this.deliveryReport = deliveryReport; - this.deliveryReportDefined = true; - return this; - } - - /** - * The delivery report callback option selected. Will be either `none`, - * `summary`, `full`, `per_recipient`, or - * `per_recipient_final`. - * - * @return deliveryReport - */ - @JsonProperty(JSON_PROPERTY_DELIVERY_REPORT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getDeliveryReport() { - return deliveryReport; - } - - @JsonIgnore - public boolean getDeliveryReportDefined() { - return deliveryReportDefined; - } - - @JsonProperty(JSON_PROPERTY_DELIVERY_REPORT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDeliveryReport(String deliveryReport) { - this.deliveryReport = deliveryReport; - this.deliveryReportDefined = true; - } - - public BinaryResponseDto sendAt(OffsetDateTime sendAt) { - this.sendAt = sendAt; - this.sendAtDefined = true; - return this; - } - - /** - * If set, the date and time the message should be delivered. Formatted as - * [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601). For example: - * `YYYY-MM-DDThh:mm:ss.SSSZ`. - * - * @return sendAt - */ - @JsonProperty(JSON_PROPERTY_SEND_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getSendAt() { - return sendAt; - } - - @JsonIgnore - public boolean getSendAtDefined() { - return sendAtDefined; - } - - @JsonProperty(JSON_PROPERTY_SEND_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setSendAt(OffsetDateTime sendAt) { - this.sendAt = sendAt; - this.sendAtDefined = true; - } - - public BinaryResponseDto expireAt(OffsetDateTime expireAt) { - this.expireAt = expireAt; - this.expireAtDefined = true; - return this; - } - - /** - * If set, the date and time the message will expire. Formatted as - * [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601). For example: - * `YYYY-MM-DDThh:mm:ss.SSSZ`. - * - * @return expireAt - */ - @JsonProperty(JSON_PROPERTY_EXPIRE_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getExpireAt() { - return expireAt; - } - - @JsonIgnore - public boolean getExpireAtDefined() { - return expireAtDefined; - } - - @JsonProperty(JSON_PROPERTY_EXPIRE_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setExpireAt(OffsetDateTime expireAt) { - this.expireAt = expireAt; - this.expireAtDefined = true; - } - - public BinaryResponseDto callbackUrl(String callbackUrl) { - this.callbackUrl = callbackUrl; - this.callbackUrlDefined = true; - return this; - } - - /** - * The callback URL provided in the request. - * - * @return callbackUrl - */ - @JsonProperty(JSON_PROPERTY_CALLBACK_URL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCallbackUrl() { - return callbackUrl; - } - - @JsonIgnore - public boolean getCallbackUrlDefined() { - return callbackUrlDefined; - } - - @JsonProperty(JSON_PROPERTY_CALLBACK_URL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCallbackUrl(String callbackUrl) { - this.callbackUrl = callbackUrl; - this.callbackUrlDefined = true; - } - - public BinaryResponseDto clientReference(String clientReference) { - this.clientReference = clientReference; - this.clientReferenceDefined = true; - return this; - } - - /** - * The string input to identify this batch message. If set, the identifier will be added in the - * delivery report/callback of this batch. - * - * @return clientReference - */ - @JsonProperty(JSON_PROPERTY_CLIENT_REFERENCE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getClientReference() { - return clientReference; - } - - @JsonIgnore - public boolean getClientReferenceDefined() { - return clientReferenceDefined; - } - - @JsonProperty(JSON_PROPERTY_CLIENT_REFERENCE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setClientReference(String clientReference) { - this.clientReference = clientReference; - this.clientReferenceDefined = true; - } - - public BinaryResponseDto feedbackEnabled(Boolean feedbackEnabled) { - this.feedbackEnabled = feedbackEnabled; - this.feedbackEnabledDefined = true; - return this; - } - - /** - * If set to true, then - * [feedback](/docs/sms/api-reference/sms/tag/Batches/#tag/Batches/operation/deliveryFeedback) is - * expected after successful delivery. - * - * @return feedbackEnabled - */ - @JsonProperty(JSON_PROPERTY_FEEDBACK_ENABLED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getFeedbackEnabled() { - return feedbackEnabled; - } - - @JsonIgnore - public boolean getFeedbackEnabledDefined() { - return feedbackEnabledDefined; - } - - @JsonProperty(JSON_PROPERTY_FEEDBACK_ENABLED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setFeedbackEnabled(Boolean feedbackEnabled) { - this.feedbackEnabled = feedbackEnabled; - this.feedbackEnabledDefined = true; - } - - public BinaryResponseDto flashMessage(Boolean flashMessage) { - this.flashMessage = flashMessage; - this.flashMessageDefined = true; - return this; - } - - /** - * If sent as a flash message, displays `true`. - * - * @return flashMessage - */ - @JsonProperty(JSON_PROPERTY_FLASH_MESSAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getFlashMessage() { - return flashMessage; - } - - @JsonIgnore - public boolean getFlashMessageDefined() { - return flashMessageDefined; - } - - @JsonProperty(JSON_PROPERTY_FLASH_MESSAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setFlashMessage(Boolean flashMessage) { - this.flashMessage = flashMessage; - this.flashMessageDefined = true; - } - - public BinaryResponseDto truncateConcat(Boolean truncateConcat) { - this.truncateConcat = truncateConcat; - this.truncateConcatDefined = true; - return this; - } - - /** - * If set to `true`, the message was shortened when exceeding one part. - * - * @return truncateConcat - */ - @JsonProperty(JSON_PROPERTY_TRUNCATE_CONCAT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getTruncateConcat() { - return truncateConcat; - } - - @JsonIgnore - public boolean getTruncateConcatDefined() { - return truncateConcatDefined; - } - - @JsonProperty(JSON_PROPERTY_TRUNCATE_CONCAT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setTruncateConcat(Boolean truncateConcat) { - this.truncateConcat = truncateConcat; - this.truncateConcatDefined = true; - } - - public BinaryResponseDto maxNumberOfMessageParts(Integer maxNumberOfMessageParts) { - this.maxNumberOfMessageParts = maxNumberOfMessageParts; - this.maxNumberOfMessagePartsDefined = true; - return this; - } - - /** - * Displays the number of message parts set in the request. minimum: 1 - * - * @return maxNumberOfMessageParts - */ - @JsonProperty(JSON_PROPERTY_MAX_NUMBER_OF_MESSAGE_PARTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getMaxNumberOfMessageParts() { - return maxNumberOfMessageParts; - } - - @JsonIgnore - public boolean getMaxNumberOfMessagePartsDefined() { - return maxNumberOfMessagePartsDefined; - } - - @JsonProperty(JSON_PROPERTY_MAX_NUMBER_OF_MESSAGE_PARTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setMaxNumberOfMessageParts(Integer maxNumberOfMessageParts) { - this.maxNumberOfMessageParts = maxNumberOfMessageParts; - this.maxNumberOfMessagePartsDefined = true; - } - - public BinaryResponseDto fromTon(Integer fromTon) { - this.fromTon = fromTon; - this.fromTonDefined = true; - return this; - } - - /** - * The type of number for the sender number. minimum: 0 maximum: 6 - * - * @return fromTon - */ - @JsonProperty(JSON_PROPERTY_FROM_TON) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getFromTon() { - return fromTon; - } - - @JsonIgnore - public boolean getFromTonDefined() { - return fromTonDefined; - } - - @JsonProperty(JSON_PROPERTY_FROM_TON) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setFromTon(Integer fromTon) { - this.fromTon = fromTon; - this.fromTonDefined = true; - } - - public BinaryResponseDto fromNpi(Integer fromNpi) { - this.fromNpi = fromNpi; - this.fromNpiDefined = true; - return this; - } - - /** - * Number Plan Indicator for the sender number. minimum: 0 maximum: 18 - * - * @return fromNpi - */ - @JsonProperty(JSON_PROPERTY_FROM_NPI) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getFromNpi() { - return fromNpi; - } - - @JsonIgnore - public boolean getFromNpiDefined() { - return fromNpiDefined; - } - - @JsonProperty(JSON_PROPERTY_FROM_NPI) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setFromNpi(Integer fromNpi) { - this.fromNpi = fromNpi; - this.fromNpiDefined = true; - } - - /** Return true if this BinaryResponse object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - BinaryResponseDto binaryResponse = (BinaryResponseDto) o; - return Objects.equals(this.id, binaryResponse.id) - && Objects.equals(this.to, binaryResponse.to) - && Objects.equals(this.from, binaryResponse.from) - && Objects.equals(this.canceled, binaryResponse.canceled) - && Objects.equals(this.body, binaryResponse.body) - && Objects.equals(this.udh, binaryResponse.udh) - && Objects.equals(this.type, binaryResponse.type) - && Objects.equals(this.createdAt, binaryResponse.createdAt) - && Objects.equals(this.modifiedAt, binaryResponse.modifiedAt) - && Objects.equals(this.deliveryReport, binaryResponse.deliveryReport) - && Objects.equals(this.sendAt, binaryResponse.sendAt) - && Objects.equals(this.expireAt, binaryResponse.expireAt) - && Objects.equals(this.callbackUrl, binaryResponse.callbackUrl) - && Objects.equals(this.clientReference, binaryResponse.clientReference) - && Objects.equals(this.feedbackEnabled, binaryResponse.feedbackEnabled) - && Objects.equals(this.flashMessage, binaryResponse.flashMessage) - && Objects.equals(this.truncateConcat, binaryResponse.truncateConcat) - && Objects.equals(this.maxNumberOfMessageParts, binaryResponse.maxNumberOfMessageParts) - && Objects.equals(this.fromTon, binaryResponse.fromTon) - && Objects.equals(this.fromNpi, binaryResponse.fromNpi); - } - - @Override - public int hashCode() { - return Objects.hash( - id, - to, - from, - canceled, - body, - udh, - type, - createdAt, - modifiedAt, - deliveryReport, - sendAt, - expireAt, - callbackUrl, - clientReference, - feedbackEnabled, - flashMessage, - truncateConcat, - maxNumberOfMessageParts, - fromTon, - fromNpi); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class BinaryResponseDto {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" to: ").append(toIndentedString(to)).append("\n"); - sb.append(" from: ").append(toIndentedString(from)).append("\n"); - sb.append(" canceled: ").append(toIndentedString(canceled)).append("\n"); - sb.append(" body: ").append(toIndentedString(body)).append("\n"); - sb.append(" udh: ").append(toIndentedString(udh)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); - sb.append(" modifiedAt: ").append(toIndentedString(modifiedAt)).append("\n"); - sb.append(" deliveryReport: ").append(toIndentedString(deliveryReport)).append("\n"); - sb.append(" sendAt: ").append(toIndentedString(sendAt)).append("\n"); - sb.append(" expireAt: ").append(toIndentedString(expireAt)).append("\n"); - sb.append(" callbackUrl: ").append(toIndentedString(callbackUrl)).append("\n"); - sb.append(" clientReference: ").append(toIndentedString(clientReference)).append("\n"); - sb.append(" feedbackEnabled: ").append(toIndentedString(feedbackEnabled)).append("\n"); - sb.append(" flashMessage: ").append(toIndentedString(flashMessage)).append("\n"); - sb.append(" truncateConcat: ").append(toIndentedString(truncateConcat)).append("\n"); - sb.append(" maxNumberOfMessageParts: ") - .append(toIndentedString(maxNumberOfMessageParts)) - .append("\n"); - sb.append(" fromTon: ").append(toIndentedString(fromTon)).append("\n"); - sb.append(" fromNpi: ").append(toIndentedString(fromNpi)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/CreateGroupResponseDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/CreateGroupResponseDto.java deleted file mode 100644 index 1c0ec2759..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/CreateGroupResponseDto.java +++ /dev/null @@ -1,308 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.time.OffsetDateTime; -import java.util.LinkedHashSet; -import java.util.Objects; -import java.util.Set; - -/** CreateGroupResponseDto */ -@JsonPropertyOrder({ - CreateGroupResponseDto.JSON_PROPERTY_ID, - CreateGroupResponseDto.JSON_PROPERTY_NAME, - CreateGroupResponseDto.JSON_PROPERTY_SIZE, - CreateGroupResponseDto.JSON_PROPERTY_CREATED_AT, - CreateGroupResponseDto.JSON_PROPERTY_MODIFIED_AT, - CreateGroupResponseDto.JSON_PROPERTY_CHILD_GROUPS, - CreateGroupResponseDto.JSON_PROPERTY_AUTO_UPDATE -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class CreateGroupResponseDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_ID = "id"; - private String id; - private boolean idDefined = false; - - public static final String JSON_PROPERTY_NAME = "name"; - private String name; - private boolean nameDefined = false; - - public static final String JSON_PROPERTY_SIZE = "size"; - private Integer size; - private boolean sizeDefined = false; - - public static final String JSON_PROPERTY_CREATED_AT = "created_at"; - private OffsetDateTime createdAt; - private boolean createdAtDefined = false; - - public static final String JSON_PROPERTY_MODIFIED_AT = "modified_at"; - private OffsetDateTime modifiedAt; - private boolean modifiedAtDefined = false; - - public static final String JSON_PROPERTY_CHILD_GROUPS = "child_groups"; - private Set childGroups; - private boolean childGroupsDefined = false; - - public static final String JSON_PROPERTY_AUTO_UPDATE = "auto_update"; - private GroupAutoUpdateDto autoUpdate; - private boolean autoUpdateDefined = false; - - public CreateGroupResponseDto() {} - - @JsonCreator - public CreateGroupResponseDto( - @JsonProperty(JSON_PROPERTY_SIZE) Integer size, - @JsonProperty(JSON_PROPERTY_CREATED_AT) OffsetDateTime createdAt, - @JsonProperty(JSON_PROPERTY_MODIFIED_AT) OffsetDateTime modifiedAt) { - this(); - this.size = size; - this.sizeDefined = true; - this.createdAt = createdAt; - this.createdAtDefined = true; - this.modifiedAt = modifiedAt; - this.modifiedAtDefined = true; - } - - public CreateGroupResponseDto id(String id) { - this.id = id; - this.idDefined = true; - return this; - } - - /** - * The ID used to reference this group. - * - * @return id - */ - @JsonProperty(JSON_PROPERTY_ID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getId() { - return id; - } - - @JsonIgnore - public boolean getIdDefined() { - return idDefined; - } - - @JsonProperty(JSON_PROPERTY_ID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setId(String id) { - this.id = id; - this.idDefined = true; - } - - public CreateGroupResponseDto name(String name) { - this.name = name; - this.nameDefined = true; - return this; - } - - /** - * Name of group, if set. - * - * @return name - */ - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getName() { - return name; - } - - @JsonIgnore - public boolean getNameDefined() { - return nameDefined; - } - - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setName(String name) { - this.name = name; - this.nameDefined = true; - } - - /** - * The number of members currently in the group. - * - * @return size - */ - @JsonProperty(JSON_PROPERTY_SIZE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getSize() { - return size; - } - - @JsonIgnore - public boolean getSizeDefined() { - return sizeDefined; - } - - /** - * Timestamp for group creation. Format: YYYY-MM-DDThh:mm:ss.SSSZ - * - * @return createdAt - */ - @JsonProperty(JSON_PROPERTY_CREATED_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - @JsonIgnore - public boolean getCreatedAtDefined() { - return createdAtDefined; - } - - /** - * Timestamp for when the group was last updated. Format: YYYY-MM-DDThh:mm:ss.SSSZ - * - * @return modifiedAt - */ - @JsonProperty(JSON_PROPERTY_MODIFIED_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getModifiedAt() { - return modifiedAt; - } - - @JsonIgnore - public boolean getModifiedAtDefined() { - return modifiedAtDefined; - } - - public CreateGroupResponseDto childGroups(Set childGroups) { - this.childGroups = childGroups; - this.childGroupsDefined = true; - return this; - } - - public CreateGroupResponseDto addChildGroupsItem(Object childGroupsItem) { - if (this.childGroups == null) { - this.childGroups = new LinkedHashSet<>(); - } - this.childGroupsDefined = true; - this.childGroups.add(childGroupsItem); - return this; - } - - /** - * Phone numbers (MSISDNs) of child group will be included in this group. If present, this group - * will be auto populated. Constraints: Elements must be group IDs. - * - * @return childGroups - */ - @JsonProperty(JSON_PROPERTY_CHILD_GROUPS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Set getChildGroups() { - return childGroups; - } - - @JsonIgnore - public boolean getChildGroupsDefined() { - return childGroupsDefined; - } - - @JsonDeserialize(as = LinkedHashSet.class) - @JsonProperty(JSON_PROPERTY_CHILD_GROUPS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setChildGroups(Set childGroups) { - this.childGroups = childGroups; - this.childGroupsDefined = true; - } - - public CreateGroupResponseDto autoUpdate(GroupAutoUpdateDto autoUpdate) { - this.autoUpdate = autoUpdate; - this.autoUpdateDefined = true; - return this; - } - - /** - * Get autoUpdate - * - * @return autoUpdate - */ - @JsonProperty(JSON_PROPERTY_AUTO_UPDATE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public GroupAutoUpdateDto getAutoUpdate() { - return autoUpdate; - } - - @JsonIgnore - public boolean getAutoUpdateDefined() { - return autoUpdateDefined; - } - - @JsonProperty(JSON_PROPERTY_AUTO_UPDATE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setAutoUpdate(GroupAutoUpdateDto autoUpdate) { - this.autoUpdate = autoUpdate; - this.autoUpdateDefined = true; - } - - /** Return true if this createGroupResponse object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - CreateGroupResponseDto createGroupResponse = (CreateGroupResponseDto) o; - return Objects.equals(this.id, createGroupResponse.id) - && Objects.equals(this.name, createGroupResponse.name) - && Objects.equals(this.size, createGroupResponse.size) - && Objects.equals(this.createdAt, createGroupResponse.createdAt) - && Objects.equals(this.modifiedAt, createGroupResponse.modifiedAt) - && Objects.equals(this.childGroups, createGroupResponse.childGroups) - && Objects.equals(this.autoUpdate, createGroupResponse.autoUpdate); - } - - @Override - public int hashCode() { - return Objects.hash(id, name, size, createdAt, modifiedAt, childGroups, autoUpdate); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateGroupResponseDto {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" size: ").append(toIndentedString(size)).append("\n"); - sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); - sb.append(" modifiedAt: ").append(toIndentedString(modifiedAt)).append("\n"); - sb.append(" childGroups: ").append(toIndentedString(childGroups)).append("\n"); - sb.append(" autoUpdate: ").append(toIndentedString(autoUpdate)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/DeliveryReportDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/DeliveryReportDto.java deleted file mode 100644 index 20ad2b4ea..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/DeliveryReportDto.java +++ /dev/null @@ -1,288 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonValue; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** DeliveryReportDto */ -@JsonPropertyOrder({ - DeliveryReportDto.JSON_PROPERTY_BATCH_ID, - DeliveryReportDto.JSON_PROPERTY_STATUSES, - DeliveryReportDto.JSON_PROPERTY_TOTAL_MESSAGE_COUNT, - DeliveryReportDto.JSON_PROPERTY_TYPE, - DeliveryReportDto.JSON_PROPERTY_CLIENT_REFERENCE -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class DeliveryReportDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_BATCH_ID = "batch_id"; - private String batchId; - private boolean batchIdDefined = false; - - public static final String JSON_PROPERTY_STATUSES = "statuses"; - private List statuses; - private boolean statusesDefined = false; - - public static final String JSON_PROPERTY_TOTAL_MESSAGE_COUNT = "total_message_count"; - private Integer totalMessageCount; - private boolean totalMessageCountDefined = false; - - /** The delivery report type. */ - public enum TypeEnum { - SMS("delivery_report_sms"), - - MMS("delivery_report_mms"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - TypeEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static TypeEnum fromValue(String value) { - for (TypeEnum b : TypeEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_TYPE = "type"; - private String type; - private boolean typeDefined = false; - - public static final String JSON_PROPERTY_CLIENT_REFERENCE = "client_reference"; - private String clientReference; - private boolean clientReferenceDefined = false; - - public DeliveryReportDto() {} - - @JsonCreator - public DeliveryReportDto(@JsonProperty(JSON_PROPERTY_BATCH_ID) String batchId) { - this(); - this.batchId = batchId; - this.batchIdDefined = true; - } - - /** - * The ID of the batch this delivery report belongs to. - * - * @return batchId - */ - @JsonProperty(JSON_PROPERTY_BATCH_ID) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getBatchId() { - return batchId; - } - - @JsonIgnore - public boolean getBatchIdDefined() { - return batchIdDefined; - } - - public DeliveryReportDto statuses(List statuses) { - this.statuses = statuses; - this.statusesDefined = true; - return this; - } - - public DeliveryReportDto addStatusesItem(MessageDeliveryStatusDto statusesItem) { - if (this.statuses == null) { - this.statuses = new ArrayList<>(); - } - this.statusesDefined = true; - this.statuses.add(statusesItem); - return this; - } - - /** - * Array with status objects. Only status codes with at least one recipient will be listed. - * - * @return statuses - */ - @JsonProperty(JSON_PROPERTY_STATUSES) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public List getStatuses() { - return statuses; - } - - @JsonIgnore - public boolean getStatusesDefined() { - return statusesDefined; - } - - @JsonProperty(JSON_PROPERTY_STATUSES) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setStatuses(List statuses) { - this.statuses = statuses; - this.statusesDefined = true; - } - - public DeliveryReportDto totalMessageCount(Integer totalMessageCount) { - this.totalMessageCount = totalMessageCount; - this.totalMessageCountDefined = true; - return this; - } - - /** - * The total number of messages in the batch. minimum: 0 - * - * @return totalMessageCount - */ - @JsonProperty(JSON_PROPERTY_TOTAL_MESSAGE_COUNT) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public Integer getTotalMessageCount() { - return totalMessageCount; - } - - @JsonIgnore - public boolean getTotalMessageCountDefined() { - return totalMessageCountDefined; - } - - @JsonProperty(JSON_PROPERTY_TOTAL_MESSAGE_COUNT) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setTotalMessageCount(Integer totalMessageCount) { - this.totalMessageCount = totalMessageCount; - this.totalMessageCountDefined = true; - } - - public DeliveryReportDto type(String type) { - this.type = type; - this.typeDefined = true; - return this; - } - - /** - * The delivery report type. - * - * @return type - */ - @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getType() { - return type; - } - - @JsonIgnore - public boolean getTypeDefined() { - return typeDefined; - } - - @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setType(String type) { - this.type = type; - this.typeDefined = true; - } - - public DeliveryReportDto clientReference(String clientReference) { - this.clientReference = clientReference; - this.clientReferenceDefined = true; - return this; - } - - /** - * The client identifier of the batch this delivery report belongs to, if set when submitting - * batch. - * - * @return clientReference - */ - @JsonProperty(JSON_PROPERTY_CLIENT_REFERENCE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getClientReference() { - return clientReference; - } - - @JsonIgnore - public boolean getClientReferenceDefined() { - return clientReferenceDefined; - } - - @JsonProperty(JSON_PROPERTY_CLIENT_REFERENCE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setClientReference(String clientReference) { - this.clientReference = clientReference; - this.clientReferenceDefined = true; - } - - /** Return true if this DeliveryReport object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DeliveryReportDto deliveryReport = (DeliveryReportDto) o; - return Objects.equals(this.batchId, deliveryReport.batchId) - && Objects.equals(this.statuses, deliveryReport.statuses) - && Objects.equals(this.totalMessageCount, deliveryReport.totalMessageCount) - && Objects.equals(this.type, deliveryReport.type) - && Objects.equals(this.clientReference, deliveryReport.clientReference); - } - - @Override - public int hashCode() { - return Objects.hash(batchId, statuses, totalMessageCount, type, clientReference); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeliveryReportDto {\n"); - sb.append(" batchId: ").append(toIndentedString(batchId)).append("\n"); - sb.append(" statuses: ").append(toIndentedString(statuses)).append("\n"); - sb.append(" totalMessageCount: ").append(toIndentedString(totalMessageCount)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" clientReference: ").append(toIndentedString(clientReference)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/DeliveryReportListDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/DeliveryReportListDto.java deleted file mode 100644 index fdae1d136..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/DeliveryReportListDto.java +++ /dev/null @@ -1,221 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** DeliveryReportListDto */ -@JsonPropertyOrder({ - DeliveryReportListDto.JSON_PROPERTY_COUNT, - DeliveryReportListDto.JSON_PROPERTY_PAGE, - DeliveryReportListDto.JSON_PROPERTY_PAGE_SIZE, - DeliveryReportListDto.JSON_PROPERTY_DELIVERY_REPORTS -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class DeliveryReportListDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_COUNT = "count"; - private Long count; - private boolean countDefined = false; - - public static final String JSON_PROPERTY_PAGE = "page"; - private Integer page; - private boolean pageDefined = false; - - public static final String JSON_PROPERTY_PAGE_SIZE = "page_size"; - private Integer pageSize; - private boolean pageSizeDefined = false; - - public static final String JSON_PROPERTY_DELIVERY_REPORTS = "delivery_reports"; - private List deliveryReports; - private boolean deliveryReportsDefined = false; - - public DeliveryReportListDto() {} - - public DeliveryReportListDto count(Long count) { - this.count = count; - this.countDefined = true; - return this; - } - - /** - * The total number of entries matching the given filters. - * - * @return count - */ - @JsonProperty(JSON_PROPERTY_COUNT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Long getCount() { - return count; - } - - @JsonIgnore - public boolean getCountDefined() { - return countDefined; - } - - @JsonProperty(JSON_PROPERTY_COUNT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCount(Long count) { - this.count = count; - this.countDefined = true; - } - - public DeliveryReportListDto page(Integer page) { - this.page = page; - this.pageDefined = true; - return this; - } - - /** - * The requested page. - * - * @return page - */ - @JsonProperty(JSON_PROPERTY_PAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getPage() { - return page; - } - - @JsonIgnore - public boolean getPageDefined() { - return pageDefined; - } - - @JsonProperty(JSON_PROPERTY_PAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setPage(Integer page) { - this.page = page; - this.pageDefined = true; - } - - public DeliveryReportListDto pageSize(Integer pageSize) { - this.pageSize = pageSize; - this.pageSizeDefined = true; - return this; - } - - /** - * The number of entries returned in this request. - * - * @return pageSize - */ - @JsonProperty(JSON_PROPERTY_PAGE_SIZE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getPageSize() { - return pageSize; - } - - @JsonIgnore - public boolean getPageSizeDefined() { - return pageSizeDefined; - } - - @JsonProperty(JSON_PROPERTY_PAGE_SIZE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setPageSize(Integer pageSize) { - this.pageSize = pageSize; - this.pageSizeDefined = true; - } - - public DeliveryReportListDto deliveryReports(List deliveryReports) { - this.deliveryReports = deliveryReports; - this.deliveryReportsDefined = true; - return this; - } - - public DeliveryReportListDto addDeliveryReportsItem( - RecipientDeliveryReportDto deliveryReportsItem) { - if (this.deliveryReports == null) { - this.deliveryReports = new ArrayList<>(); - } - this.deliveryReportsDefined = true; - this.deliveryReports.add(deliveryReportsItem); - return this; - } - - /** - * The page of delivery reports matching the given filters. - * - * @return deliveryReports - */ - @JsonProperty(JSON_PROPERTY_DELIVERY_REPORTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List getDeliveryReports() { - return deliveryReports; - } - - @JsonIgnore - public boolean getDeliveryReportsDefined() { - return deliveryReportsDefined; - } - - @JsonProperty(JSON_PROPERTY_DELIVERY_REPORTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDeliveryReports(List deliveryReports) { - this.deliveryReports = deliveryReports; - this.deliveryReportsDefined = true; - } - - /** Return true if this DeliveryReportList object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DeliveryReportListDto deliveryReportList = (DeliveryReportListDto) o; - return Objects.equals(this.count, deliveryReportList.count) - && Objects.equals(this.page, deliveryReportList.page) - && Objects.equals(this.pageSize, deliveryReportList.pageSize) - && Objects.equals(this.deliveryReports, deliveryReportList.deliveryReports); - } - - @Override - public int hashCode() { - return Objects.hash(count, page, pageSize, deliveryReports); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeliveryReportListDto {\n"); - sb.append(" count: ").append(toIndentedString(count)).append("\n"); - sb.append(" page: ").append(toIndentedString(page)).append("\n"); - sb.append(" pageSize: ").append(toIndentedString(pageSize)).append("\n"); - sb.append(" deliveryReports: ").append(toIndentedString(deliveryReports)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/DryRun200ResponseDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/DryRun200ResponseDto.java deleted file mode 100644 index ca00e9cf9..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/DryRun200ResponseDto.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** DryRun200ResponseDto */ -@JsonPropertyOrder({ - DryRun200ResponseDto.JSON_PROPERTY_NUMBER_OF_RECIPIENTS, - DryRun200ResponseDto.JSON_PROPERTY_NUMBER_OF_MESSAGES, - DryRun200ResponseDto.JSON_PROPERTY_PER_RECIPIENT -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class DryRun200ResponseDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_NUMBER_OF_RECIPIENTS = "number_of_recipients"; - private Integer numberOfRecipients; - private boolean numberOfRecipientsDefined = false; - - public static final String JSON_PROPERTY_NUMBER_OF_MESSAGES = "number_of_messages"; - private Integer numberOfMessages; - private boolean numberOfMessagesDefined = false; - - public static final String JSON_PROPERTY_PER_RECIPIENT = "per_recipient"; - private List perRecipient; - private boolean perRecipientDefined = false; - - public DryRun200ResponseDto() {} - - public DryRun200ResponseDto numberOfRecipients(Integer numberOfRecipients) { - this.numberOfRecipients = numberOfRecipients; - this.numberOfRecipientsDefined = true; - return this; - } - - /** - * The number of recipients in the batch - * - * @return numberOfRecipients - */ - @JsonProperty(JSON_PROPERTY_NUMBER_OF_RECIPIENTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getNumberOfRecipients() { - return numberOfRecipients; - } - - @JsonIgnore - public boolean getNumberOfRecipientsDefined() { - return numberOfRecipientsDefined; - } - - @JsonProperty(JSON_PROPERTY_NUMBER_OF_RECIPIENTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setNumberOfRecipients(Integer numberOfRecipients) { - this.numberOfRecipients = numberOfRecipients; - this.numberOfRecipientsDefined = true; - } - - public DryRun200ResponseDto numberOfMessages(Integer numberOfMessages) { - this.numberOfMessages = numberOfMessages; - this.numberOfMessagesDefined = true; - return this; - } - - /** - * The total number of SMS message parts to be sent in the batch - * - * @return numberOfMessages - */ - @JsonProperty(JSON_PROPERTY_NUMBER_OF_MESSAGES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getNumberOfMessages() { - return numberOfMessages; - } - - @JsonIgnore - public boolean getNumberOfMessagesDefined() { - return numberOfMessagesDefined; - } - - @JsonProperty(JSON_PROPERTY_NUMBER_OF_MESSAGES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setNumberOfMessages(Integer numberOfMessages) { - this.numberOfMessages = numberOfMessages; - this.numberOfMessagesDefined = true; - } - - public DryRun200ResponseDto perRecipient( - List perRecipient) { - this.perRecipient = perRecipient; - this.perRecipientDefined = true; - return this; - } - - public DryRun200ResponseDto addPerRecipientItem( - DryRun200ResponsePerRecipientInnerDto perRecipientItem) { - if (this.perRecipient == null) { - this.perRecipient = new ArrayList<>(); - } - this.perRecipientDefined = true; - this.perRecipient.add(perRecipientItem); - return this; - } - - /** - * The recipient, the number of message parts to this recipient, the body of the message, and the - * encoding type of each message - * - * @return perRecipient - */ - @JsonProperty(JSON_PROPERTY_PER_RECIPIENT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List getPerRecipient() { - return perRecipient; - } - - @JsonIgnore - public boolean getPerRecipientDefined() { - return perRecipientDefined; - } - - @JsonProperty(JSON_PROPERTY_PER_RECIPIENT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setPerRecipient(List perRecipient) { - this.perRecipient = perRecipient; - this.perRecipientDefined = true; - } - - /** Return true if this Dry_Run_200_response object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DryRun200ResponseDto dryRun200Response = (DryRun200ResponseDto) o; - return Objects.equals(this.numberOfRecipients, dryRun200Response.numberOfRecipients) - && Objects.equals(this.numberOfMessages, dryRun200Response.numberOfMessages) - && Objects.equals(this.perRecipient, dryRun200Response.perRecipient); - } - - @Override - public int hashCode() { - return Objects.hash(numberOfRecipients, numberOfMessages, perRecipient); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DryRun200ResponseDto {\n"); - sb.append(" numberOfRecipients: ").append(toIndentedString(numberOfRecipients)).append("\n"); - sb.append(" numberOfMessages: ").append(toIndentedString(numberOfMessages)).append("\n"); - sb.append(" perRecipient: ").append(toIndentedString(perRecipient)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/DryRun200ResponsePerRecipientInnerDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/DryRun200ResponsePerRecipientInnerDto.java deleted file mode 100644 index f1d9431aa..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/DryRun200ResponsePerRecipientInnerDto.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import java.util.Objects; - -/** DryRun200ResponsePerRecipientInnerDto */ -@JsonPropertyOrder({ - DryRun200ResponsePerRecipientInnerDto.JSON_PROPERTY_RECIPIENT, - DryRun200ResponsePerRecipientInnerDto.JSON_PROPERTY_NUMBER_OF_PARTS, - DryRun200ResponsePerRecipientInnerDto.JSON_PROPERTY_BODY, - DryRun200ResponsePerRecipientInnerDto.JSON_PROPERTY_ENCODING -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class DryRun200ResponsePerRecipientInnerDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_RECIPIENT = "recipient"; - private String recipient; - private boolean recipientDefined = false; - - public static final String JSON_PROPERTY_NUMBER_OF_PARTS = "number_of_parts"; - private Integer numberOfParts; - private boolean numberOfPartsDefined = false; - - public static final String JSON_PROPERTY_BODY = "body"; - private String body; - private boolean bodyDefined = false; - - public static final String JSON_PROPERTY_ENCODING = "encoding"; - private String encoding; - private boolean encodingDefined = false; - - public DryRun200ResponsePerRecipientInnerDto() {} - - public DryRun200ResponsePerRecipientInnerDto recipient(String recipient) { - this.recipient = recipient; - this.recipientDefined = true; - return this; - } - - /** - * Get recipient - * - * @return recipient - */ - @JsonProperty(JSON_PROPERTY_RECIPIENT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getRecipient() { - return recipient; - } - - @JsonIgnore - public boolean getRecipientDefined() { - return recipientDefined; - } - - @JsonProperty(JSON_PROPERTY_RECIPIENT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setRecipient(String recipient) { - this.recipient = recipient; - this.recipientDefined = true; - } - - public DryRun200ResponsePerRecipientInnerDto numberOfParts(Integer numberOfParts) { - this.numberOfParts = numberOfParts; - this.numberOfPartsDefined = true; - return this; - } - - /** - * Get number of parts - * - * @return number of parts - */ - @JsonProperty(JSON_PROPERTY_NUMBER_OF_PARTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getNumberOfParts() { - return numberOfParts; - } - - @JsonIgnore - public boolean getNumberOfPartsDefined() { - return numberOfPartsDefined; - } - - @JsonProperty(JSON_PROPERTY_NUMBER_OF_PARTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setNumberOfParts(Integer numberOfParts) { - this.numberOfParts = numberOfParts; - this.numberOfPartsDefined = true; - } - - public DryRun200ResponsePerRecipientInnerDto body(String body) { - this.body = body; - this.bodyDefined = true; - return this; - } - - /** - * Get body - * - * @return body - */ - @JsonProperty(JSON_PROPERTY_BODY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getBody() { - return body; - } - - @JsonIgnore - public boolean getBodyDefined() { - return bodyDefined; - } - - @JsonProperty(JSON_PROPERTY_BODY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setBody(String body) { - this.body = body; - this.bodyDefined = true; - } - - public DryRun200ResponsePerRecipientInnerDto encoding(String encoding) { - this.encoding = encoding; - this.encodingDefined = true; - return this; - } - - /** - * Get encoding - * - * @return encoding - */ - @JsonProperty(JSON_PROPERTY_ENCODING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getEncoding() { - return encoding; - } - - @JsonIgnore - public boolean getEncodingDefined() { - return encodingDefined; - } - - @JsonProperty(JSON_PROPERTY_ENCODING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setEncoding(String encoding) { - this.encoding = encoding; - this.encodingDefined = true; - } - - /** Return true if this Dry_Run_200_response_per_recipient_inner object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DryRun200ResponsePerRecipientInnerDto dryRun200ResponsePerRecipientInner = - (DryRun200ResponsePerRecipientInnerDto) o; - return Objects.equals(this.recipient, dryRun200ResponsePerRecipientInner.recipient) - && Objects.equals(this.numberOfParts, dryRun200ResponsePerRecipientInner.numberOfParts) - && Objects.equals(this.body, dryRun200ResponsePerRecipientInner.body) - && Objects.equals(this.encoding, dryRun200ResponsePerRecipientInner.encoding); - } - - @Override - public int hashCode() { - return Objects.hash(recipient, numberOfParts, body, encoding); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DryRun200ResponsePerRecipientInnerDto {\n"); - sb.append(" recipient: ").append(toIndentedString(recipient)).append("\n"); - sb.append(" numberOfParts: ").append(toIndentedString(numberOfParts)).append("\n"); - sb.append(" body: ").append(toIndentedString(body)).append("\n"); - sb.append(" encoding: ").append(toIndentedString(encoding)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ErrorResponseObjDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ErrorResponseObjDto.java deleted file mode 100644 index cecd3af37..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ErrorResponseObjDto.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import java.util.Objects; - -/** ErrorResponseObjDto */ -@JsonPropertyOrder({ErrorResponseObjDto.JSON_PROPERTY_CODE, ErrorResponseObjDto.JSON_PROPERTY_TEXT}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class ErrorResponseObjDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_CODE = "code"; - private String code; - private boolean codeDefined = false; - - public static final String JSON_PROPERTY_TEXT = "text"; - private String text; - private boolean textDefined = false; - - public ErrorResponseObjDto() {} - - public ErrorResponseObjDto code(String code) { - this.code = code; - this.codeDefined = true; - return this; - } - - /** - * The error code. See [error codes](/docs/sms/api-reference/#error-codes). - * - * @return code - */ - @JsonProperty(JSON_PROPERTY_CODE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCode() { - return code; - } - - @JsonIgnore - public boolean getCodeDefined() { - return codeDefined; - } - - @JsonProperty(JSON_PROPERTY_CODE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCode(String code) { - this.code = code; - this.codeDefined = true; - } - - public ErrorResponseObjDto text(String text) { - this.text = text; - this.textDefined = true; - return this; - } - - /** - * The human readable description of the error. - * - * @return text - */ - @JsonProperty(JSON_PROPERTY_TEXT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getText() { - return text; - } - - @JsonIgnore - public boolean getTextDefined() { - return textDefined; - } - - @JsonProperty(JSON_PROPERTY_TEXT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setText(String text) { - this.text = text; - this.textDefined = true; - } - - /** Return true if this errorResponseObj object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ErrorResponseObjDto errorResponseObj = (ErrorResponseObjDto) o; - return Objects.equals(this.code, errorResponseObj.code) - && Objects.equals(this.text, errorResponseObj.text); - } - - @Override - public int hashCode() { - return Objects.hash(code, text); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ErrorResponseObjDto {\n"); - sb.append(" code: ").append(toIndentedString(code)).append("\n"); - sb.append(" text: ").append(toIndentedString(text)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/GroupAutoUpdateDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/GroupAutoUpdateDto.java deleted file mode 100644 index f4d844aa3..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/GroupAutoUpdateDto.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import java.util.Objects; - -/** GroupAutoUpdateDto */ -@JsonPropertyOrder({ - GroupAutoUpdateDto.JSON_PROPERTY_TO, - GroupAutoUpdateDto.JSON_PROPERTY_ADD, - GroupAutoUpdateDto.JSON_PROPERTY_REMOVE -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class GroupAutoUpdateDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_TO = "to"; - private String to; - private boolean toDefined = false; - - public static final String JSON_PROPERTY_ADD = "add"; - private AddKeywordDto add; - private boolean addDefined = false; - - public static final String JSON_PROPERTY_REMOVE = "remove"; - private RemoveKeywordDto remove; - private boolean removeDefined = false; - - public GroupAutoUpdateDto() {} - - public GroupAutoUpdateDto to(String to) { - this.to = to; - this.toDefined = true; - return this; - } - - /** - * Short code or long number addressed in <a - * href=\"https://community.sinch.com/t5/Glossary/MO-Mobile-Originated/ta-p/7618\" - * target=\"_blank\">MO</a>. Constraints: Must be valid MSISDN or short - * code. - * - * @return to - */ - @JsonProperty(JSON_PROPERTY_TO) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getTo() { - return to; - } - - @JsonIgnore - public boolean getToDefined() { - return toDefined; - } - - @JsonProperty(JSON_PROPERTY_TO) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setTo(String to) { - this.to = to; - this.toDefined = true; - } - - public GroupAutoUpdateDto add(AddKeywordDto add) { - this.add = add; - this.addDefined = true; - return this; - } - - /** - * Get add - * - * @return add - */ - @JsonProperty(JSON_PROPERTY_ADD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public AddKeywordDto getAdd() { - return add; - } - - @JsonIgnore - public boolean getAddDefined() { - return addDefined; - } - - @JsonProperty(JSON_PROPERTY_ADD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setAdd(AddKeywordDto add) { - this.add = add; - this.addDefined = true; - } - - public GroupAutoUpdateDto remove(RemoveKeywordDto remove) { - this.remove = remove; - this.removeDefined = true; - return this; - } - - /** - * Get remove - * - * @return remove - */ - @JsonProperty(JSON_PROPERTY_REMOVE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public RemoveKeywordDto getRemove() { - return remove; - } - - @JsonIgnore - public boolean getRemoveDefined() { - return removeDefined; - } - - @JsonProperty(JSON_PROPERTY_REMOVE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setRemove(RemoveKeywordDto remove) { - this.remove = remove; - this.removeDefined = true; - } - - /** Return true if this GroupAutoUpdate object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - GroupAutoUpdateDto groupAutoUpdate = (GroupAutoUpdateDto) o; - return Objects.equals(this.to, groupAutoUpdate.to) - && Objects.equals(this.add, groupAutoUpdate.add) - && Objects.equals(this.remove, groupAutoUpdate.remove); - } - - @Override - public int hashCode() { - return Objects.hash(to, add, remove); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GroupAutoUpdateDto {\n"); - sb.append(" to: ").append(toIndentedString(to)).append("\n"); - sb.append(" add: ").append(toIndentedString(add)).append("\n"); - sb.append(" remove: ").append(toIndentedString(remove)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/GroupObjectAutoUpdateDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/GroupObjectAutoUpdateDto.java deleted file mode 100644 index 217dde72e..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/GroupObjectAutoUpdateDto.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import java.util.Objects; - -/** GroupObjectAutoUpdateDto */ -@JsonPropertyOrder({ - GroupObjectAutoUpdateDto.JSON_PROPERTY_TO, - GroupObjectAutoUpdateDto.JSON_PROPERTY_ADD, - GroupObjectAutoUpdateDto.JSON_PROPERTY_REMOVE -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class GroupObjectAutoUpdateDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_TO = "to"; - private String to; - private boolean toDefined = false; - - public static final String JSON_PROPERTY_ADD = "add"; - private UpdateGroupRequestAutoUpdateAddDto add; - private boolean addDefined = false; - - public static final String JSON_PROPERTY_REMOVE = "remove"; - private GroupObjectAutoUpdateRemoveDto remove; - private boolean removeDefined = false; - - public GroupObjectAutoUpdateDto() {} - - public GroupObjectAutoUpdateDto to(String to) { - this.to = to; - this.toDefined = true; - return this; - } - - /** - * Short code or long number addressed in <a - * href=\"https://community.sinch.com/t5/Glossary/MO-Mobile-Originated/ta-p/7618\" - * target=\"_blank\">MO</a>. Constraints: Must be valid phone number or - * short code. - * - * @return to - */ - @JsonProperty(JSON_PROPERTY_TO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getTo() { - return to; - } - - @JsonIgnore - public boolean getToDefined() { - return toDefined; - } - - @JsonProperty(JSON_PROPERTY_TO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setTo(String to) { - this.to = to; - this.toDefined = true; - } - - public GroupObjectAutoUpdateDto add(UpdateGroupRequestAutoUpdateAddDto add) { - this.add = add; - this.addDefined = true; - return this; - } - - /** - * Get add - * - * @return add - */ - @JsonProperty(JSON_PROPERTY_ADD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public UpdateGroupRequestAutoUpdateAddDto getAdd() { - return add; - } - - @JsonIgnore - public boolean getAddDefined() { - return addDefined; - } - - @JsonProperty(JSON_PROPERTY_ADD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setAdd(UpdateGroupRequestAutoUpdateAddDto add) { - this.add = add; - this.addDefined = true; - } - - public GroupObjectAutoUpdateDto remove(GroupObjectAutoUpdateRemoveDto remove) { - this.remove = remove; - this.removeDefined = true; - return this; - } - - /** - * Get remove - * - * @return remove - */ - @JsonProperty(JSON_PROPERTY_REMOVE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public GroupObjectAutoUpdateRemoveDto getRemove() { - return remove; - } - - @JsonIgnore - public boolean getRemoveDefined() { - return removeDefined; - } - - @JsonProperty(JSON_PROPERTY_REMOVE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setRemove(GroupObjectAutoUpdateRemoveDto remove) { - this.remove = remove; - this.removeDefined = true; - } - - /** Return true if this groupObject_auto_update object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - GroupObjectAutoUpdateDto groupObjectAutoUpdate = (GroupObjectAutoUpdateDto) o; - return Objects.equals(this.to, groupObjectAutoUpdate.to) - && Objects.equals(this.add, groupObjectAutoUpdate.add) - && Objects.equals(this.remove, groupObjectAutoUpdate.remove); - } - - @Override - public int hashCode() { - return Objects.hash(to, add, remove); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GroupObjectAutoUpdateDto {\n"); - sb.append(" to: ").append(toIndentedString(to)).append("\n"); - sb.append(" add: ").append(toIndentedString(add)).append("\n"); - sb.append(" remove: ").append(toIndentedString(remove)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/GroupObjectAutoUpdateRemoveDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/GroupObjectAutoUpdateRemoveDto.java deleted file mode 100644 index 7036c4041..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/GroupObjectAutoUpdateRemoveDto.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import java.util.Objects; - -/** Keyword to be sent in MO to remove from a group. */ -@JsonPropertyOrder({ - GroupObjectAutoUpdateRemoveDto.JSON_PROPERTY_FIRST_WORD, - GroupObjectAutoUpdateRemoveDto.JSON_PROPERTY_SECOND_WORD -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class GroupObjectAutoUpdateRemoveDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_FIRST_WORD = "first_word"; - private String firstWord; - private boolean firstWordDefined = false; - - public static final String JSON_PROPERTY_SECOND_WORD = "second_word"; - private String secondWord; - private boolean secondWordDefined = false; - - public GroupObjectAutoUpdateRemoveDto() {} - - public GroupObjectAutoUpdateRemoveDto firstWord(String firstWord) { - this.firstWord = firstWord; - this.firstWordDefined = true; - return this; - } - - /** - * Opt-out keyword like \"LEAVE\" If auto_update.to is dedicated long/short number or - * unique brand keyword like \"Sinch\" if it is a shared short code. Constraints: Must - * be one word. - * - * @return firstWord - */ - @JsonProperty(JSON_PROPERTY_FIRST_WORD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getFirstWord() { - return firstWord; - } - - @JsonIgnore - public boolean getFirstWordDefined() { - return firstWordDefined; - } - - @JsonProperty(JSON_PROPERTY_FIRST_WORD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setFirstWord(String firstWord) { - this.firstWord = firstWord; - this.firstWordDefined = true; - } - - public GroupObjectAutoUpdateRemoveDto secondWord(String secondWord) { - this.secondWord = secondWord; - this.secondWordDefined = true; - return this; - } - - /** - * Opt-out keyword like \"LEAVE\" if auto_update.to is shared short code. Constraints: - * Must be one word. - * - * @return secondWord - */ - @JsonProperty(JSON_PROPERTY_SECOND_WORD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getSecondWord() { - return secondWord; - } - - @JsonIgnore - public boolean getSecondWordDefined() { - return secondWordDefined; - } - - @JsonProperty(JSON_PROPERTY_SECOND_WORD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setSecondWord(String secondWord) { - this.secondWord = secondWord; - this.secondWordDefined = true; - } - - /** Return true if this groupObject_auto_update_remove object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - GroupObjectAutoUpdateRemoveDto groupObjectAutoUpdateRemove = (GroupObjectAutoUpdateRemoveDto) o; - return Objects.equals(this.firstWord, groupObjectAutoUpdateRemove.firstWord) - && Objects.equals(this.secondWord, groupObjectAutoUpdateRemove.secondWord); - } - - @Override - public int hashCode() { - return Objects.hash(firstWord, secondWord); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GroupObjectAutoUpdateRemoveDto {\n"); - sb.append(" firstWord: ").append(toIndentedString(firstWord)).append("\n"); - sb.append(" secondWord: ").append(toIndentedString(secondWord)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/GroupObjectDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/GroupObjectDto.java deleted file mode 100644 index b93ee452b..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/GroupObjectDto.java +++ /dev/null @@ -1,237 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** GroupObjectDto */ -@JsonPropertyOrder({ - GroupObjectDto.JSON_PROPERTY_NAME, - GroupObjectDto.JSON_PROPERTY_MEMBERS, - GroupObjectDto.JSON_PROPERTY_CHILD_GROUPS, - GroupObjectDto.JSON_PROPERTY_AUTO_UPDATE -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class GroupObjectDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_NAME = "name"; - private String name; - private boolean nameDefined = false; - - public static final String JSON_PROPERTY_MEMBERS = "members"; - private List members; - private boolean membersDefined = false; - - public static final String JSON_PROPERTY_CHILD_GROUPS = "child_groups"; - private List childGroups; - private boolean childGroupsDefined = false; - - public static final String JSON_PROPERTY_AUTO_UPDATE = "auto_update"; - private GroupObjectAutoUpdateDto autoUpdate; - private boolean autoUpdateDefined = false; - - public GroupObjectDto() {} - - public GroupObjectDto name(String name) { - this.name = name; - this.nameDefined = true; - return this; - } - - /** - * Name of the group - * - * @return name - */ - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getName() { - return name; - } - - @JsonIgnore - public boolean getNameDefined() { - return nameDefined; - } - - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setName(String name) { - this.name = name; - this.nameDefined = true; - } - - public GroupObjectDto members(List members) { - this.members = members; - this.membersDefined = true; - return this; - } - - public GroupObjectDto addMembersItem(String membersItem) { - if (this.members == null) { - this.members = new ArrayList<>(); - } - this.membersDefined = true; - this.members.add(membersItem); - return this; - } - - /** - * \"Initial list of phone numbers in <a - * href=\"https://community.sinch.com/t5/Glossary/E-164/ta-p/7537\" - * target=\"_blank\">E.164</a> format <a - * href=\"https://community.sinch.com/t5/Glossary/MSISDN/ta-p/7628\" - * target=\"_blank\">MSISDNs</a> for the group.\" - * - * @return members - */ - @JsonProperty(JSON_PROPERTY_MEMBERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List getMembers() { - return members; - } - - @JsonIgnore - public boolean getMembersDefined() { - return membersDefined; - } - - @JsonProperty(JSON_PROPERTY_MEMBERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setMembers(List members) { - this.members = members; - this.membersDefined = true; - } - - public GroupObjectDto childGroups(List childGroups) { - this.childGroups = childGroups; - this.childGroupsDefined = true; - return this; - } - - public GroupObjectDto addChildGroupsItem(String childGroupsItem) { - if (this.childGroups == null) { - this.childGroups = new ArrayList<>(); - } - this.childGroupsDefined = true; - this.childGroups.add(childGroupsItem); - return this; - } - - /** - * Phone numbers (<a - * href=\"https://community.sinch.com/t5/Glossary/MSISDN/ta-p/7628\" - * target=\"_blank\">MSISDNs</a>) of child group will be included in this - * group. If present then this group will be auto populated. Constraints: Elements must be group - * IDs. - * - * @return childGroups - */ - @JsonProperty(JSON_PROPERTY_CHILD_GROUPS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List getChildGroups() { - return childGroups; - } - - @JsonIgnore - public boolean getChildGroupsDefined() { - return childGroupsDefined; - } - - @JsonProperty(JSON_PROPERTY_CHILD_GROUPS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setChildGroups(List childGroups) { - this.childGroups = childGroups; - this.childGroupsDefined = true; - } - - public GroupObjectDto autoUpdate(GroupObjectAutoUpdateDto autoUpdate) { - this.autoUpdate = autoUpdate; - this.autoUpdateDefined = true; - return this; - } - - /** - * Get autoUpdate - * - * @return autoUpdate - */ - @JsonProperty(JSON_PROPERTY_AUTO_UPDATE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public GroupObjectAutoUpdateDto getAutoUpdate() { - return autoUpdate; - } - - @JsonIgnore - public boolean getAutoUpdateDefined() { - return autoUpdateDefined; - } - - @JsonProperty(JSON_PROPERTY_AUTO_UPDATE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setAutoUpdate(GroupObjectAutoUpdateDto autoUpdate) { - this.autoUpdate = autoUpdate; - this.autoUpdateDefined = true; - } - - /** Return true if this groupObject object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - GroupObjectDto groupObject = (GroupObjectDto) o; - return Objects.equals(this.name, groupObject.name) - && Objects.equals(this.members, groupObject.members) - && Objects.equals(this.childGroups, groupObject.childGroups) - && Objects.equals(this.autoUpdate, groupObject.autoUpdate); - } - - @Override - public int hashCode() { - return Objects.hash(name, members, childGroups, autoUpdate); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GroupObjectDto {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" members: ").append(toIndentedString(members)).append("\n"); - sb.append(" childGroups: ").append(toIndentedString(childGroups)).append("\n"); - sb.append(" autoUpdate: ").append(toIndentedString(autoUpdate)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/InboundDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/InboundDto.java deleted file mode 100644 index 4c8880cb1..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/InboundDto.java +++ /dev/null @@ -1,294 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.MapperFeature; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.deser.std.StdDeserializer; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; -import com.sinch.sdk.core.models.AbstractOpenApiSchema; -import com.sinch.sdk.core.utils.databind.JSONNavigator; -import java.io.IOException; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; - -@JsonDeserialize(using = InboundDto.InboundDtoDeserializer.class) -@JsonSerialize(using = InboundDto.InboundDtoSerializer.class) -public final class InboundDto extends AbstractOpenApiSchema { - private static final Logger log = Logger.getLogger(InboundDto.class.getName()); - - public static final class InboundDtoSerializer extends StdSerializer { - private static final long serialVersionUID = 1L; - - public InboundDtoSerializer(Class t) { - super(t); - } - - public InboundDtoSerializer() { - this(null); - } - - @Override - public void serialize(InboundDto value, JsonGenerator jgen, SerializerProvider provider) - throws IOException, JsonProcessingException { - jgen.writeObject(value.getActualInstance()); - } - } - - public static final class InboundDtoDeserializer extends StdDeserializer { - - private static final long serialVersionUID = 1L; - - public InboundDtoDeserializer() { - this(InboundDto.class); - } - - public InboundDtoDeserializer(Class vc) { - super(vc); - } - - @Override - public InboundDto deserialize(JsonParser jp, DeserializationContext ctxt) - throws IOException, JsonProcessingException { - JsonNode tree = jp.readValueAsTree(); - Object deserialized = null; - InboundDto newInboundDto = new InboundDto(); - Map result2 = - tree.traverse(jp.getCodec()).readValueAs(new TypeReference>() {}); - String discriminatorValue = (String) result2.get("type"); - switch (discriminatorValue) { - case "MOBinary": - deserialized = tree.traverse(jp.getCodec()).readValueAs(MOBinaryDto.class); - newInboundDto.setActualInstance(deserialized); - return newInboundDto; - case "MOText": - deserialized = tree.traverse(jp.getCodec()).readValueAs(MOTextDto.class); - newInboundDto.setActualInstance(deserialized); - return newInboundDto; - case "mo_binary": - deserialized = tree.traverse(jp.getCodec()).readValueAs(MOBinaryDto.class); - newInboundDto.setActualInstance(deserialized); - return newInboundDto; - case "mo_text": - deserialized = tree.traverse(jp.getCodec()).readValueAs(MOTextDto.class); - newInboundDto.setActualInstance(deserialized); - return newInboundDto; - default: - log.log( - Level.WARNING, - String.format( - "Failed to lookup discriminator value `%s` for InboundDto. Possible values:" - + " MOBinary MOText mo_binary mo_text", - discriminatorValue)); - } - - boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); - int match = 0; - JsonToken token = tree.traverse(jp.getCodec()).nextToken(); - // deserialize MOBinaryDto - try { - boolean attemptParsing = true; - // ensure that we respect type coercion as set on the client ObjectMapper - if (MOBinaryDto.class.equals(Integer.class) - || MOBinaryDto.class.equals(Long.class) - || MOBinaryDto.class.equals(Float.class) - || MOBinaryDto.class.equals(Double.class) - || MOBinaryDto.class.equals(Boolean.class) - || MOBinaryDto.class.equals(String.class)) { - attemptParsing = typeCoercion; - if (!attemptParsing) { - attemptParsing |= - ((MOBinaryDto.class.equals(Integer.class) || MOBinaryDto.class.equals(Long.class)) - && token == JsonToken.VALUE_NUMBER_INT); - attemptParsing |= - ((MOBinaryDto.class.equals(Float.class) || MOBinaryDto.class.equals(Double.class)) - && token == JsonToken.VALUE_NUMBER_FLOAT); - attemptParsing |= - (MOBinaryDto.class.equals(Boolean.class) - && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); - attemptParsing |= - (MOBinaryDto.class.equals(String.class) && token == JsonToken.VALUE_STRING); - } - } - if (attemptParsing) { - deserialized = tree.traverse(jp.getCodec()).readValueAs(MOBinaryDto.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 'MOBinaryDto'"); - } - } catch (Exception e) { - // deserialization failed, continue - log.log(Level.FINER, "Input data does not match schema 'MOBinaryDto'", e); - } - - // deserialize MOTextDto - try { - boolean attemptParsing = true; - // ensure that we respect type coercion as set on the client ObjectMapper - if (MOTextDto.class.equals(Integer.class) - || MOTextDto.class.equals(Long.class) - || MOTextDto.class.equals(Float.class) - || MOTextDto.class.equals(Double.class) - || MOTextDto.class.equals(Boolean.class) - || MOTextDto.class.equals(String.class)) { - attemptParsing = typeCoercion; - if (!attemptParsing) { - attemptParsing |= - ((MOTextDto.class.equals(Integer.class) || MOTextDto.class.equals(Long.class)) - && token == JsonToken.VALUE_NUMBER_INT); - attemptParsing |= - ((MOTextDto.class.equals(Float.class) || MOTextDto.class.equals(Double.class)) - && token == JsonToken.VALUE_NUMBER_FLOAT); - attemptParsing |= - (MOTextDto.class.equals(Boolean.class) - && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); - attemptParsing |= - (MOTextDto.class.equals(String.class) && token == JsonToken.VALUE_STRING); - } - } - if (attemptParsing) { - deserialized = tree.traverse(jp.getCodec()).readValueAs(MOTextDto.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 'MOTextDto'"); - } - } catch (Exception e) { - // deserialization failed, continue - log.log(Level.FINER, "Input data does not match schema 'MOTextDto'", e); - } - - if (match == 1) { - InboundDto ret = new InboundDto(); - ret.setActualInstance(deserialized); - return ret; - } - throw new IOException( - String.format( - "Failed deserialization for InboundDto: %d classes match result, expected 1", match)); - } - - /** Handle deserialization of the 'null' value. */ - @Override - public InboundDto getNullValue(DeserializationContext ctxt) throws JsonMappingException { - throw new JsonMappingException(ctxt.getParser(), "InboundDto cannot be null"); - } - } - - // store a list of schema names defined in oneOf - public static final Map> schemas = new HashMap<>(); - - public InboundDto() { - super("oneOf", Boolean.FALSE); - } - - public InboundDto(MOBinaryDto o) { - super("oneOf", Boolean.FALSE); - setActualInstance(o); - } - - public InboundDto(MOTextDto o) { - super("oneOf", Boolean.FALSE); - setActualInstance(o); - } - - static { - schemas.put("MOBinaryDto", MOBinaryDto.class); - schemas.put("MOTextDto", MOTextDto.class); - JSONNavigator.registerDescendants(InboundDto.class, Collections.unmodifiableMap(schemas)); - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("MOBinary", MOBinaryDto.class); - mappings.put("MOText", MOTextDto.class); - mappings.put("mo_binary", MOBinaryDto.class); - mappings.put("mo_text", MOTextDto.class); - mappings.put("Inbound", InboundDto.class); - JSONNavigator.registerDiscriminator(InboundDto.class, "type", mappings); - } - - @Override - public Map> getSchemas() { - return InboundDto.schemas; - } - - /** - * Set the instance that matches the oneOf child schema, check the instance parameter is valid - * against the oneOf child schemas: MOBinaryDto, MOTextDto - * - *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a - * composed schema (allOf, anyOf, oneOf). - */ - @Override - public void setActualInstance(Object instance) { - if (JSONNavigator.isInstanceOf(MOBinaryDto.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - - if (JSONNavigator.isInstanceOf(MOTextDto.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - - throw new RuntimeException("Invalid instance type. Must be MOBinaryDto, MOTextDto"); - } - - /** - * Get the actual instance, which can be the following: MOBinaryDto, MOTextDto - * - * @return The actual instance (MOBinaryDto, MOTextDto) - */ - @Override - public Object getActualInstance() { - return super.getActualInstance(); - } - - /** - * Get the actual instance of `MOBinaryDto`. If the actual instance is not `MOBinaryDto`, the - * ClassCastException will be thrown. - * - * @return The actual instance of `MOBinaryDto` - * @throws ClassCastException if the instance is not `MOBinaryDto` - */ - public MOBinaryDto getMOBinaryDto() throws ClassCastException { - return (MOBinaryDto) super.getActualInstance(); - } - - /** - * Get the actual instance of `MOTextDto`. If the actual instance is not `MOTextDto`, the - * ClassCastException will be thrown. - * - * @return The actual instance of `MOTextDto` - * @throws ClassCastException if the instance is not `MOTextDto` - */ - public MOTextDto getMOTextDto() throws ClassCastException { - return (MOTextDto) super.getActualInstance(); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/MOBinaryDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/MOBinaryDto.java deleted file mode 100644 index 2a11c7fac..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/MOBinaryDto.java +++ /dev/null @@ -1,268 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonValue; -import com.sinch.sdk.core.utils.databind.JSONNavigator; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; - -/** MOBinaryDto */ -@JsonPropertyOrder({ - MOBinaryDto.JSON_PROPERTY_BODY, - MOBinaryDto.JSON_PROPERTY_TYPE, - MOBinaryDto.JSON_PROPERTY_UDH -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) - -/*@JsonIgnoreProperties( - value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization - allowSetters = true // allows the type to be set during deserialization -)*/ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NONE, - include = JsonTypeInfo.As.EXISTING_PROPERTY, - property = "type", - visible = true) -public class MOBinaryDto extends ApiMoMessageDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_BODY = "body"; - private String body; - private boolean bodyDefined = false; - - /** SMS in binary format */ - public enum TypeEnum { - MO_BINARY("mo_binary"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - TypeEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static TypeEnum fromValue(String value) { - for (TypeEnum b : TypeEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_TYPE = "type"; - private String type; - private boolean typeDefined = false; - - public static final String JSON_PROPERTY_UDH = "udh"; - private String udh; - private boolean udhDefined = false; - - public MOBinaryDto() {} - - @JsonCreator - public MOBinaryDto(@JsonProperty(JSON_PROPERTY_TYPE) String type) { - this(); - this.type = type; - this.typeDefined = true; - } - - public MOBinaryDto body(String body) { - this.body = body; - this.bodyDefined = true; - return this; - } - - /** - * The message content Base64 encoded. Max 140 bytes together with udh. - * - * @return body - */ - @JsonProperty(JSON_PROPERTY_BODY) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getBody() { - return body; - } - - @JsonIgnore - public boolean getBodyDefined() { - return bodyDefined; - } - - @JsonProperty(JSON_PROPERTY_BODY) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setBody(String body) { - this.body = body; - this.bodyDefined = true; - } - - /** - * SMS in binary format - * - * @return type - */ - @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getType() { - return type; - } - - @JsonIgnore - public boolean getTypeDefined() { - return typeDefined; - } - - public MOBinaryDto udh(String udh) { - this.udh = udh; - this.udhDefined = true; - return this; - } - - /** - * The UDH header of a binary message HEX encoded. Max 140 bytes together with body. - * - * @return udh - */ - @JsonProperty(JSON_PROPERTY_UDH) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getUdh() { - return udh; - } - - @JsonIgnore - public boolean getUdhDefined() { - return udhDefined; - } - - @JsonProperty(JSON_PROPERTY_UDH) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setUdh(String udh) { - this.udh = udh; - this.udhDefined = true; - } - - @Override - public MOBinaryDto from(String from) { - this.setFrom(from); - return this; - } - - @Override - public MOBinaryDto id(String id) { - this.setId(id); - return this; - } - - @Override - public MOBinaryDto receivedAt(OffsetDateTime receivedAt) { - this.setReceivedAt(receivedAt); - return this; - } - - @Override - public MOBinaryDto to(String to) { - this.setTo(to); - return this; - } - - @Override - public MOBinaryDto clientReference(String clientReference) { - this.setClientReference(clientReference); - return this; - } - - @Override - public MOBinaryDto operatorId(String operatorId) { - this.setOperatorId(operatorId); - return this; - } - - @Override - public MOBinaryDto sentAt(OffsetDateTime sentAt) { - this.setSentAt(sentAt); - return this; - } - - /** Return true if this MOBinary object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - MOBinaryDto moBinary = (MOBinaryDto) o; - return Objects.equals(this.body, moBinary.body) - && Objects.equals(this.type, moBinary.type) - && Objects.equals(this.udh, moBinary.udh) - && super.equals(o); - } - - @Override - public int hashCode() { - return Objects.hash(body, type, udh, super.hashCode()); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class MOBinaryDto {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" body: ").append(toIndentedString(body)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" udh: ").append(toIndentedString(udh)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("MOBinary", MOBinaryDto.class); - JSONNavigator.registerDiscriminator(MOBinaryDto.class, "type", mappings); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/MOTextDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/MOTextDto.java deleted file mode 100644 index a57f53a54..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/MOTextDto.java +++ /dev/null @@ -1,229 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonValue; -import com.sinch.sdk.core.utils.databind.JSONNavigator; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; - -/** MOTextDto */ -@JsonPropertyOrder({MOTextDto.JSON_PROPERTY_BODY, MOTextDto.JSON_PROPERTY_TYPE}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) - -/*@JsonIgnoreProperties( - value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization - allowSetters = true // allows the type to be set during deserialization -)*/ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NONE, - include = JsonTypeInfo.As.EXISTING_PROPERTY, - property = "type", - visible = true) -public class MOTextDto extends ApiMoMessageDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_BODY = "body"; - private String body; - private boolean bodyDefined = false; - - /** Regular SMS */ - public enum TypeEnum { - MO_TEXT("mo_text"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - TypeEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static TypeEnum fromValue(String value) { - for (TypeEnum b : TypeEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_TYPE = "type"; - private String type; - private boolean typeDefined = false; - - public MOTextDto() {} - - @JsonCreator - public MOTextDto(@JsonProperty(JSON_PROPERTY_TYPE) String type) { - this(); - this.type = type; - this.typeDefined = true; - } - - public MOTextDto body(String body) { - this.body = body; - this.bodyDefined = true; - return this; - } - - /** - * Get body - * - * @return body - */ - @JsonProperty(JSON_PROPERTY_BODY) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getBody() { - return body; - } - - @JsonIgnore - public boolean getBodyDefined() { - return bodyDefined; - } - - @JsonProperty(JSON_PROPERTY_BODY) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setBody(String body) { - this.body = body; - this.bodyDefined = true; - } - - /** - * Regular SMS - * - * @return type - */ - @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getType() { - return type; - } - - @JsonIgnore - public boolean getTypeDefined() { - return typeDefined; - } - - @Override - public MOTextDto from(String from) { - this.setFrom(from); - return this; - } - - @Override - public MOTextDto id(String id) { - this.setId(id); - return this; - } - - @Override - public MOTextDto receivedAt(OffsetDateTime receivedAt) { - this.setReceivedAt(receivedAt); - return this; - } - - @Override - public MOTextDto to(String to) { - this.setTo(to); - return this; - } - - @Override - public MOTextDto clientReference(String clientReference) { - this.setClientReference(clientReference); - return this; - } - - @Override - public MOTextDto operatorId(String operatorId) { - this.setOperatorId(operatorId); - return this; - } - - @Override - public MOTextDto sentAt(OffsetDateTime sentAt) { - this.setSentAt(sentAt); - return this; - } - - /** Return true if this MOText object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - MOTextDto moText = (MOTextDto) o; - return Objects.equals(this.body, moText.body) - && Objects.equals(this.type, moText.type) - && super.equals(o); - } - - @Override - public int hashCode() { - return Objects.hash(body, type, super.hashCode()); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class MOTextDto {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" body: ").append(toIndentedString(body)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("MOText", MOTextDto.class); - JSONNavigator.registerDiscriminator(MOTextDto.class, "type", mappings); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/MediaBodyDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/MediaBodyDto.java deleted file mode 100644 index 60c73d685..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/MediaBodyDto.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import java.util.Objects; - -/** The message content, including a URL to the media file */ -@JsonPropertyOrder({MediaBodyDto.JSON_PROPERTY_URL, MediaBodyDto.JSON_PROPERTY_MESSAGE}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class MediaBodyDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_URL = "url"; - private String url; - private boolean urlDefined = false; - - public static final String JSON_PROPERTY_MESSAGE = "message"; - private String message; - private boolean messageDefined = false; - - public MediaBodyDto() {} - - public MediaBodyDto url(String url) { - this.url = url; - this.urlDefined = true; - return this; - } - - /** - * URL to the media file - * - * @return url - */ - @JsonProperty(JSON_PROPERTY_URL) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getUrl() { - return url; - } - - @JsonIgnore - public boolean getUrlDefined() { - return urlDefined; - } - - @JsonProperty(JSON_PROPERTY_URL) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setUrl(String url) { - this.url = url; - this.urlDefined = true; - } - - public MediaBodyDto message(String message) { - this.message = message; - this.messageDefined = true; - return this; - } - - /** - * The message text. Text only media messages will be rejected, please use SMS instead. - * - * @return message - */ - @JsonProperty(JSON_PROPERTY_MESSAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getMessage() { - return message; - } - - @JsonIgnore - public boolean getMessageDefined() { - return messageDefined; - } - - @JsonProperty(JSON_PROPERTY_MESSAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setMessage(String message) { - this.message = message; - this.messageDefined = true; - } - - /** Return true if this MediaBody object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - MediaBodyDto mediaBody = (MediaBodyDto) o; - return Objects.equals(this.url, mediaBody.url) - && Objects.equals(this.message, mediaBody.message); - } - - @Override - public int hashCode() { - return Objects.hash(url, message); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class MediaBodyDto {\n"); - sb.append(" url: ").append(toIndentedString(url)).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/MediaRequestDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/MediaRequestDto.java deleted file mode 100644 index 798495dbc..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/MediaRequestDto.java +++ /dev/null @@ -1,566 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonValue; -import java.time.OffsetDateTime; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** Only available in the US. Contact support if you wish to send MMS. */ -@JsonPropertyOrder({ - MediaRequestDto.JSON_PROPERTY_TO, - MediaRequestDto.JSON_PROPERTY_BODY, - MediaRequestDto.JSON_PROPERTY_FROM, - MediaRequestDto.JSON_PROPERTY_PARAMETERS, - MediaRequestDto.JSON_PROPERTY_TYPE, - MediaRequestDto.JSON_PROPERTY_DELIVERY_REPORT, - MediaRequestDto.JSON_PROPERTY_SEND_AT, - MediaRequestDto.JSON_PROPERTY_EXPIRE_AT, - MediaRequestDto.JSON_PROPERTY_CALLBACK_URL, - MediaRequestDto.JSON_PROPERTY_CLIENT_REFERENCE, - MediaRequestDto.JSON_PROPERTY_FEEDBACK_ENABLED, - MediaRequestDto.JSON_PROPERTY_STRICT_VALIDATION -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class MediaRequestDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_TO = "to"; - private List to; - private boolean toDefined = false; - - public static final String JSON_PROPERTY_BODY = "body"; - private MediaBodyDto body; - private boolean bodyDefined = false; - - public static final String JSON_PROPERTY_FROM = "from"; - private String from; - private boolean fromDefined = false; - - public static final String JSON_PROPERTY_PARAMETERS = "parameters"; - private ParameterObjDto parameters; - private boolean parametersDefined = false; - - /** MMS */ - public enum TypeEnum { - MT_MEDIA("mt_media"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - TypeEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static TypeEnum fromValue(String value) { - for (TypeEnum b : TypeEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_TYPE = "type"; - private String type; - private boolean typeDefined = false; - - public static final String JSON_PROPERTY_DELIVERY_REPORT = "delivery_report"; - private String deliveryReport; - private boolean deliveryReportDefined = false; - - public static final String JSON_PROPERTY_SEND_AT = "send_at"; - private OffsetDateTime sendAt; - private boolean sendAtDefined = false; - - public static final String JSON_PROPERTY_EXPIRE_AT = "expire_at"; - private OffsetDateTime expireAt; - private boolean expireAtDefined = false; - - public static final String JSON_PROPERTY_CALLBACK_URL = "callback_url"; - private String callbackUrl; - private boolean callbackUrlDefined = false; - - public static final String JSON_PROPERTY_CLIENT_REFERENCE = "client_reference"; - private String clientReference; - private boolean clientReferenceDefined = false; - - public static final String JSON_PROPERTY_FEEDBACK_ENABLED = "feedback_enabled"; - private Boolean feedbackEnabled; - private boolean feedbackEnabledDefined = false; - - public static final String JSON_PROPERTY_STRICT_VALIDATION = "strict_validation"; - private Boolean strictValidation; - private boolean strictValidationDefined = false; - - public MediaRequestDto() {} - - @JsonCreator - public MediaRequestDto(@JsonProperty(JSON_PROPERTY_TYPE) String type) { - this(); - this.type = type; - this.typeDefined = true; - } - - public MediaRequestDto to(List to) { - this.to = to; - this.toDefined = true; - return this; - } - - public MediaRequestDto addToItem(String toItem) { - if (this.to == null) { - this.to = new ArrayList<>(); - } - this.toDefined = true; - this.to.add(toItem); - return this; - } - - /** - * List of Phone numbers and group IDs that will receive the batch. <a - * href=\"https://community.sinch.com/t5/Glossary/MSISDN/ta-p/7628\" - * target=\"_blank\">More info</a> - * - * @return to - */ - @JsonProperty(JSON_PROPERTY_TO) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public List getTo() { - return to; - } - - @JsonIgnore - public boolean getToDefined() { - return toDefined; - } - - @JsonProperty(JSON_PROPERTY_TO) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setTo(List to) { - this.to = to; - this.toDefined = true; - } - - public MediaRequestDto body(MediaBodyDto body) { - this.body = body; - this.bodyDefined = true; - return this; - } - - /** - * Get body - * - * @return body - */ - @JsonProperty(JSON_PROPERTY_BODY) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public MediaBodyDto getBody() { - return body; - } - - @JsonIgnore - public boolean getBodyDefined() { - return bodyDefined; - } - - @JsonProperty(JSON_PROPERTY_BODY) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setBody(MediaBodyDto body) { - this.body = body; - this.bodyDefined = true; - } - - public MediaRequestDto from(String from) { - this.from = from; - this.fromDefined = true; - return this; - } - - /** - * Sender number. Must be valid phone number, short code or alphanumeric. Required if Automatic - * Default Originator not configured. - * - * @return from - */ - @JsonProperty(JSON_PROPERTY_FROM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getFrom() { - return from; - } - - @JsonIgnore - public boolean getFromDefined() { - return fromDefined; - } - - @JsonProperty(JSON_PROPERTY_FROM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setFrom(String from) { - this.from = from; - this.fromDefined = true; - } - - public MediaRequestDto parameters(ParameterObjDto parameters) { - this.parameters = parameters; - this.parametersDefined = true; - return this; - } - - /** - * Get parameters - * - * @return parameters - */ - @JsonProperty(JSON_PROPERTY_PARAMETERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public ParameterObjDto getParameters() { - return parameters; - } - - @JsonIgnore - public boolean getParametersDefined() { - return parametersDefined; - } - - @JsonProperty(JSON_PROPERTY_PARAMETERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setParameters(ParameterObjDto parameters) { - this.parameters = parameters; - this.parametersDefined = true; - } - - /** - * MMS - * - * @return type - */ - @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getType() { - return type; - } - - @JsonIgnore - public boolean getTypeDefined() { - return typeDefined; - } - - public MediaRequestDto deliveryReport(String deliveryReport) { - this.deliveryReport = deliveryReport; - this.deliveryReportDefined = true; - return this; - } - - /** - * Request delivery report callback. Note that delivery reports can be fetched from the API - * regardless of this setting. - * - * @return deliveryReport - */ - @JsonProperty(JSON_PROPERTY_DELIVERY_REPORT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getDeliveryReport() { - return deliveryReport; - } - - @JsonIgnore - public boolean getDeliveryReportDefined() { - return deliveryReportDefined; - } - - @JsonProperty(JSON_PROPERTY_DELIVERY_REPORT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDeliveryReport(String deliveryReport) { - this.deliveryReport = deliveryReport; - this.deliveryReportDefined = true; - } - - public MediaRequestDto sendAt(OffsetDateTime sendAt) { - this.sendAt = sendAt; - this.sendAtDefined = true; - return this; - } - - /** - * If set in the future, the message will be delayed until `send_at` occurs. Must be - * before `expire_at`. If set in the past, messages will be sent immediately. Formatted - * as <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" - * target=\"_blank\">ISO-8601</a>: `YYYY-MM-DDThh:mm:ss.SSSZ`. - * - * @return sendAt - */ - @JsonProperty(JSON_PROPERTY_SEND_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getSendAt() { - return sendAt; - } - - @JsonIgnore - public boolean getSendAtDefined() { - return sendAtDefined; - } - - @JsonProperty(JSON_PROPERTY_SEND_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setSendAt(OffsetDateTime sendAt) { - this.sendAt = sendAt; - this.sendAtDefined = true; - } - - public MediaRequestDto expireAt(OffsetDateTime expireAt) { - this.expireAt = expireAt; - this.expireAtDefined = true; - return this; - } - - /** - * If set, the system will stop trying to deliver the message at this point. Must be after - * `send_at`. Default and max is 3 days after `send_at`. Formatted as <a - * href=\"https://en.wikipedia.org/wiki/ISO_8601\" - * target=\"_blank\">ISO-8601</a>: `YYYY-MM-DDThh:mm:ss.SSSZ`. - * - * @return expireAt - */ - @JsonProperty(JSON_PROPERTY_EXPIRE_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getExpireAt() { - return expireAt; - } - - @JsonIgnore - public boolean getExpireAtDefined() { - return expireAtDefined; - } - - @JsonProperty(JSON_PROPERTY_EXPIRE_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setExpireAt(OffsetDateTime expireAt) { - this.expireAt = expireAt; - this.expireAtDefined = true; - } - - public MediaRequestDto callbackUrl(String callbackUrl) { - this.callbackUrl = callbackUrl; - this.callbackUrlDefined = true; - return this; - } - - /** - * Override the default callback URL for this batch. Must be valid URL. - * - * @return callbackUrl - */ - @JsonProperty(JSON_PROPERTY_CALLBACK_URL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCallbackUrl() { - return callbackUrl; - } - - @JsonIgnore - public boolean getCallbackUrlDefined() { - return callbackUrlDefined; - } - - @JsonProperty(JSON_PROPERTY_CALLBACK_URL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCallbackUrl(String callbackUrl) { - this.callbackUrl = callbackUrl; - this.callbackUrlDefined = true; - } - - public MediaRequestDto clientReference(String clientReference) { - this.clientReference = clientReference; - this.clientReferenceDefined = true; - return this; - } - - /** - * The client identifier of a batch message. If set, the identifier will be added in the delivery - * report/callback of this batch - * - * @return clientReference - */ - @JsonProperty(JSON_PROPERTY_CLIENT_REFERENCE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getClientReference() { - return clientReference; - } - - @JsonIgnore - public boolean getClientReferenceDefined() { - return clientReferenceDefined; - } - - @JsonProperty(JSON_PROPERTY_CLIENT_REFERENCE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setClientReference(String clientReference) { - this.clientReference = clientReference; - this.clientReferenceDefined = true; - } - - public MediaRequestDto feedbackEnabled(Boolean feedbackEnabled) { - this.feedbackEnabled = feedbackEnabled; - this.feedbackEnabledDefined = true; - return this; - } - - /** - * If set to `true`, then - * [feedback](/docs/sms/api-reference/sms/tag/Batches/#tag/Batches/operation/deliveryFeedback) is - * expected after successful delivery. - * - * @return feedbackEnabled - */ - @JsonProperty(JSON_PROPERTY_FEEDBACK_ENABLED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getFeedbackEnabled() { - return feedbackEnabled; - } - - @JsonIgnore - public boolean getFeedbackEnabledDefined() { - return feedbackEnabledDefined; - } - - @JsonProperty(JSON_PROPERTY_FEEDBACK_ENABLED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setFeedbackEnabled(Boolean feedbackEnabled) { - this.feedbackEnabled = feedbackEnabled; - this.feedbackEnabledDefined = true; - } - - public MediaRequestDto strictValidation(Boolean strictValidation) { - this.strictValidation = strictValidation; - this.strictValidationDefined = true; - return this; - } - - /** - * Whether or not you want the media included in your message to be checked against [Sinch MMS - * channel best practices](/docs/mms/bestpractices/). If set to true, your message will be - * rejected if it doesn't conform to the listed recommendations, otherwise no validation will - * be performed. - * - * @return strictValidation - */ - @JsonProperty(JSON_PROPERTY_STRICT_VALIDATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getStrictValidation() { - return strictValidation; - } - - @JsonIgnore - public boolean getStrictValidationDefined() { - return strictValidationDefined; - } - - @JsonProperty(JSON_PROPERTY_STRICT_VALIDATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setStrictValidation(Boolean strictValidation) { - this.strictValidation = strictValidation; - this.strictValidationDefined = true; - } - - /** Return true if this MediaRequest object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - MediaRequestDto mediaRequest = (MediaRequestDto) o; - return Objects.equals(this.to, mediaRequest.to) - && Objects.equals(this.body, mediaRequest.body) - && Objects.equals(this.from, mediaRequest.from) - && Objects.equals(this.parameters, mediaRequest.parameters) - && Objects.equals(this.type, mediaRequest.type) - && Objects.equals(this.deliveryReport, mediaRequest.deliveryReport) - && Objects.equals(this.sendAt, mediaRequest.sendAt) - && Objects.equals(this.expireAt, mediaRequest.expireAt) - && Objects.equals(this.callbackUrl, mediaRequest.callbackUrl) - && Objects.equals(this.clientReference, mediaRequest.clientReference) - && Objects.equals(this.feedbackEnabled, mediaRequest.feedbackEnabled) - && Objects.equals(this.strictValidation, mediaRequest.strictValidation); - } - - @Override - public int hashCode() { - return Objects.hash( - to, - body, - from, - parameters, - type, - deliveryReport, - sendAt, - expireAt, - callbackUrl, - clientReference, - feedbackEnabled, - strictValidation); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class MediaRequestDto {\n"); - sb.append(" to: ").append(toIndentedString(to)).append("\n"); - sb.append(" body: ").append(toIndentedString(body)).append("\n"); - sb.append(" from: ").append(toIndentedString(from)).append("\n"); - sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" deliveryReport: ").append(toIndentedString(deliveryReport)).append("\n"); - sb.append(" sendAt: ").append(toIndentedString(sendAt)).append("\n"); - sb.append(" expireAt: ").append(toIndentedString(expireAt)).append("\n"); - sb.append(" callbackUrl: ").append(toIndentedString(callbackUrl)).append("\n"); - sb.append(" clientReference: ").append(toIndentedString(clientReference)).append("\n"); - sb.append(" feedbackEnabled: ").append(toIndentedString(feedbackEnabled)).append("\n"); - sb.append(" strictValidation: ").append(toIndentedString(strictValidation)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/MediaResponseDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/MediaResponseDto.java deleted file mode 100644 index b58e59ad8..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/MediaResponseDto.java +++ /dev/null @@ -1,670 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonValue; -import java.time.OffsetDateTime; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** MediaResponseDto */ -@JsonPropertyOrder({ - MediaResponseDto.JSON_PROPERTY_ID, - MediaResponseDto.JSON_PROPERTY_TO, - MediaResponseDto.JSON_PROPERTY_FROM, - MediaResponseDto.JSON_PROPERTY_CANCELED, - MediaResponseDto.JSON_PROPERTY_BODY, - MediaResponseDto.JSON_PROPERTY_PARAMETERS, - MediaResponseDto.JSON_PROPERTY_TYPE, - MediaResponseDto.JSON_PROPERTY_CREATED_AT, - MediaResponseDto.JSON_PROPERTY_MODIFIED_AT, - MediaResponseDto.JSON_PROPERTY_DELIVERY_REPORT, - MediaResponseDto.JSON_PROPERTY_SEND_AT, - MediaResponseDto.JSON_PROPERTY_EXPIRE_AT, - MediaResponseDto.JSON_PROPERTY_CALLBACK_URL, - MediaResponseDto.JSON_PROPERTY_CLIENT_REFERENCE, - MediaResponseDto.JSON_PROPERTY_FEEDBACK_ENABLED, - MediaResponseDto.JSON_PROPERTY_STRICT_VALIDATION -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class MediaResponseDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_ID = "id"; - private String id; - private boolean idDefined = false; - - public static final String JSON_PROPERTY_TO = "to"; - private List to; - private boolean toDefined = false; - - public static final String JSON_PROPERTY_FROM = "from"; - private String from; - private boolean fromDefined = false; - - public static final String JSON_PROPERTY_CANCELED = "canceled"; - private Boolean canceled; - private boolean canceledDefined = false; - - public static final String JSON_PROPERTY_BODY = "body"; - private MediaBodyDto body; - private boolean bodyDefined = false; - - public static final String JSON_PROPERTY_PARAMETERS = "parameters"; - private ParameterObjDto parameters; - private boolean parametersDefined = false; - - /** Media message */ - public enum TypeEnum { - MT_MEDIA("mt_media"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - TypeEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static TypeEnum fromValue(String value) { - for (TypeEnum b : TypeEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_TYPE = "type"; - private String type; - private boolean typeDefined = false; - - public static final String JSON_PROPERTY_CREATED_AT = "created_at"; - private OffsetDateTime createdAt; - private boolean createdAtDefined = false; - - public static final String JSON_PROPERTY_MODIFIED_AT = "modified_at"; - private OffsetDateTime modifiedAt; - private boolean modifiedAtDefined = false; - - public static final String JSON_PROPERTY_DELIVERY_REPORT = "delivery_report"; - private String deliveryReport; - private boolean deliveryReportDefined = false; - - public static final String JSON_PROPERTY_SEND_AT = "send_at"; - private OffsetDateTime sendAt; - private boolean sendAtDefined = false; - - public static final String JSON_PROPERTY_EXPIRE_AT = "expire_at"; - private OffsetDateTime expireAt; - private boolean expireAtDefined = false; - - public static final String JSON_PROPERTY_CALLBACK_URL = "callback_url"; - private String callbackUrl; - private boolean callbackUrlDefined = false; - - public static final String JSON_PROPERTY_CLIENT_REFERENCE = "client_reference"; - private String clientReference; - private boolean clientReferenceDefined = false; - - public static final String JSON_PROPERTY_FEEDBACK_ENABLED = "feedback_enabled"; - private Boolean feedbackEnabled; - private boolean feedbackEnabledDefined = false; - - public static final String JSON_PROPERTY_STRICT_VALIDATION = "strict_validation"; - private Boolean strictValidation; - private boolean strictValidationDefined = false; - - public MediaResponseDto() {} - - @JsonCreator - public MediaResponseDto( - @JsonProperty(JSON_PROPERTY_ID) String id, - @JsonProperty(JSON_PROPERTY_CANCELED) Boolean canceled, - @JsonProperty(JSON_PROPERTY_TYPE) String type, - @JsonProperty(JSON_PROPERTY_CREATED_AT) OffsetDateTime createdAt, - @JsonProperty(JSON_PROPERTY_MODIFIED_AT) OffsetDateTime modifiedAt) { - this(); - this.id = id; - this.idDefined = true; - this.canceled = canceled; - this.canceledDefined = true; - this.type = type; - this.typeDefined = true; - this.createdAt = createdAt; - this.createdAtDefined = true; - this.modifiedAt = modifiedAt; - this.modifiedAtDefined = true; - } - - /** - * Unique identifier for batch - * - * @return id - */ - @JsonProperty(JSON_PROPERTY_ID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getId() { - return id; - } - - @JsonIgnore - public boolean getIdDefined() { - return idDefined; - } - - public MediaResponseDto to(List to) { - this.to = to; - this.toDefined = true; - return this; - } - - public MediaResponseDto addToItem(String toItem) { - if (this.to == null) { - this.to = new ArrayList<>(); - } - this.toDefined = true; - this.to.add(toItem); - return this; - } - - /** - * List of Phone numbers and group IDs that will receive the batch. [More - * info](https://community.sinch.com/t5/Glossary/MSISDN/ta-p/7628) - * - * @return to - */ - @JsonProperty(JSON_PROPERTY_TO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List getTo() { - return to; - } - - @JsonIgnore - public boolean getToDefined() { - return toDefined; - } - - @JsonProperty(JSON_PROPERTY_TO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setTo(List to) { - this.to = to; - this.toDefined = true; - } - - public MediaResponseDto from(String from) { - this.from = from; - this.fromDefined = true; - return this; - } - - /** - * Sender number. Required if Automatic Default Originator not configured. - * - * @return from - */ - @JsonProperty(JSON_PROPERTY_FROM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getFrom() { - return from; - } - - @JsonIgnore - public boolean getFromDefined() { - return fromDefined; - } - - @JsonProperty(JSON_PROPERTY_FROM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setFrom(String from) { - this.from = from; - this.fromDefined = true; - } - - /** - * Indicates if the batch has been canceled or not. - * - * @return canceled - */ - @JsonProperty(JSON_PROPERTY_CANCELED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getCanceled() { - return canceled; - } - - @JsonIgnore - public boolean getCanceledDefined() { - return canceledDefined; - } - - public MediaResponseDto body(MediaBodyDto body) { - this.body = body; - this.bodyDefined = true; - return this; - } - - /** - * Get body - * - * @return body - */ - @JsonProperty(JSON_PROPERTY_BODY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public MediaBodyDto getBody() { - return body; - } - - @JsonIgnore - public boolean getBodyDefined() { - return bodyDefined; - } - - @JsonProperty(JSON_PROPERTY_BODY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setBody(MediaBodyDto body) { - this.body = body; - this.bodyDefined = true; - } - - public MediaResponseDto parameters(ParameterObjDto parameters) { - this.parameters = parameters; - this.parametersDefined = true; - return this; - } - - /** - * Get parameters - * - * @return parameters - */ - @JsonProperty(JSON_PROPERTY_PARAMETERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public ParameterObjDto getParameters() { - return parameters; - } - - @JsonIgnore - public boolean getParametersDefined() { - return parametersDefined; - } - - @JsonProperty(JSON_PROPERTY_PARAMETERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setParameters(ParameterObjDto parameters) { - this.parameters = parameters; - this.parametersDefined = true; - } - - /** - * Media message - * - * @return type - */ - @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getType() { - return type; - } - - @JsonIgnore - public boolean getTypeDefined() { - return typeDefined; - } - - /** - * Timestamp for when batch was created. YYYY-MM-DDThh:mm:ss.SSSZ format - * - * @return createdAt - */ - @JsonProperty(JSON_PROPERTY_CREATED_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - @JsonIgnore - public boolean getCreatedAtDefined() { - return createdAtDefined; - } - - /** - * Timestamp for when batch was last updated. YYYY-MM-DDThh:mm:ss.SSSZ format - * - * @return modifiedAt - */ - @JsonProperty(JSON_PROPERTY_MODIFIED_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getModifiedAt() { - return modifiedAt; - } - - @JsonIgnore - public boolean getModifiedAtDefined() { - return modifiedAtDefined; - } - - public MediaResponseDto deliveryReport(String deliveryReport) { - this.deliveryReport = deliveryReport; - this.deliveryReportDefined = true; - return this; - } - - /** - * Request delivery report callback. Note that delivery reports can be fetched from the API - * regardless of this setting. - * - * @return deliveryReport - */ - @JsonProperty(JSON_PROPERTY_DELIVERY_REPORT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getDeliveryReport() { - return deliveryReport; - } - - @JsonIgnore - public boolean getDeliveryReportDefined() { - return deliveryReportDefined; - } - - @JsonProperty(JSON_PROPERTY_DELIVERY_REPORT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDeliveryReport(String deliveryReport) { - this.deliveryReport = deliveryReport; - this.deliveryReportDefined = true; - } - - public MediaResponseDto sendAt(OffsetDateTime sendAt) { - this.sendAt = sendAt; - this.sendAtDefined = true; - return this; - } - - /** - * If set in the future the message will be delayed until send_at occurs. Must be before - * `expire_at`. If set in the past messages will be sent immediately. - * YYYY-MM-DDThh:mm:ss.SSSZ format - * - * @return sendAt - */ - @JsonProperty(JSON_PROPERTY_SEND_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getSendAt() { - return sendAt; - } - - @JsonIgnore - public boolean getSendAtDefined() { - return sendAtDefined; - } - - @JsonProperty(JSON_PROPERTY_SEND_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setSendAt(OffsetDateTime sendAt) { - this.sendAt = sendAt; - this.sendAtDefined = true; - } - - public MediaResponseDto expireAt(OffsetDateTime expireAt) { - this.expireAt = expireAt; - this.expireAtDefined = true; - return this; - } - - /** - * If set the system will stop trying to deliver the message at this point. Must be after - * `send_at`. Default and max is 3 days after send_at. YYYY-MM-DDThh:mm:ss.SSSZ format - * - * @return expireAt - */ - @JsonProperty(JSON_PROPERTY_EXPIRE_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getExpireAt() { - return expireAt; - } - - @JsonIgnore - public boolean getExpireAtDefined() { - return expireAtDefined; - } - - @JsonProperty(JSON_PROPERTY_EXPIRE_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setExpireAt(OffsetDateTime expireAt) { - this.expireAt = expireAt; - this.expireAtDefined = true; - } - - public MediaResponseDto callbackUrl(String callbackUrl) { - this.callbackUrl = callbackUrl; - this.callbackUrlDefined = true; - return this; - } - - /** - * Override the default callback URL for this batch. Must be valid URL. - * - * @return callbackUrl - */ - @JsonProperty(JSON_PROPERTY_CALLBACK_URL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCallbackUrl() { - return callbackUrl; - } - - @JsonIgnore - public boolean getCallbackUrlDefined() { - return callbackUrlDefined; - } - - @JsonProperty(JSON_PROPERTY_CALLBACK_URL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCallbackUrl(String callbackUrl) { - this.callbackUrl = callbackUrl; - this.callbackUrlDefined = true; - } - - public MediaResponseDto clientReference(String clientReference) { - this.clientReference = clientReference; - this.clientReferenceDefined = true; - return this; - } - - /** - * The client identifier of a batch message. If set, the identifier will be added in the delivery - * report/callback of this batch - * - * @return clientReference - */ - @JsonProperty(JSON_PROPERTY_CLIENT_REFERENCE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getClientReference() { - return clientReference; - } - - @JsonIgnore - public boolean getClientReferenceDefined() { - return clientReferenceDefined; - } - - @JsonProperty(JSON_PROPERTY_CLIENT_REFERENCE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setClientReference(String clientReference) { - this.clientReference = clientReference; - this.clientReferenceDefined = true; - } - - public MediaResponseDto feedbackEnabled(Boolean feedbackEnabled) { - this.feedbackEnabled = feedbackEnabled; - this.feedbackEnabledDefined = true; - return this; - } - - /** - * If set to true then - * [feedback](/docs/sms/api-reference/sms/tag/Batches/#tag/Batches/operation/deliveryFeedback) is - * expected after successful delivery. - * - * @return feedbackEnabled - */ - @JsonProperty(JSON_PROPERTY_FEEDBACK_ENABLED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getFeedbackEnabled() { - return feedbackEnabled; - } - - @JsonIgnore - public boolean getFeedbackEnabledDefined() { - return feedbackEnabledDefined; - } - - @JsonProperty(JSON_PROPERTY_FEEDBACK_ENABLED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setFeedbackEnabled(Boolean feedbackEnabled) { - this.feedbackEnabled = feedbackEnabled; - this.feedbackEnabledDefined = true; - } - - public MediaResponseDto strictValidation(Boolean strictValidation) { - this.strictValidation = strictValidation; - this.strictValidationDefined = true; - return this; - } - - /** - * Whether or not you want the media included in your message to be checked against [Sinch MMS - * channel best practices](/docs/mms/bestpractices/). If set to true, your message will be - * rejected if it doesn't conform to the listed recommendations, otherwise no validation will - * be performed. - * - * @return strictValidation - */ - @JsonProperty(JSON_PROPERTY_STRICT_VALIDATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getStrictValidation() { - return strictValidation; - } - - @JsonIgnore - public boolean getStrictValidationDefined() { - return strictValidationDefined; - } - - @JsonProperty(JSON_PROPERTY_STRICT_VALIDATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setStrictValidation(Boolean strictValidation) { - this.strictValidation = strictValidation; - this.strictValidationDefined = true; - } - - /** Return true if this MediaResponse object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - MediaResponseDto mediaResponse = (MediaResponseDto) o; - return Objects.equals(this.id, mediaResponse.id) - && Objects.equals(this.to, mediaResponse.to) - && Objects.equals(this.from, mediaResponse.from) - && Objects.equals(this.canceled, mediaResponse.canceled) - && Objects.equals(this.body, mediaResponse.body) - && Objects.equals(this.parameters, mediaResponse.parameters) - && Objects.equals(this.type, mediaResponse.type) - && Objects.equals(this.createdAt, mediaResponse.createdAt) - && Objects.equals(this.modifiedAt, mediaResponse.modifiedAt) - && Objects.equals(this.deliveryReport, mediaResponse.deliveryReport) - && Objects.equals(this.sendAt, mediaResponse.sendAt) - && Objects.equals(this.expireAt, mediaResponse.expireAt) - && Objects.equals(this.callbackUrl, mediaResponse.callbackUrl) - && Objects.equals(this.clientReference, mediaResponse.clientReference) - && Objects.equals(this.feedbackEnabled, mediaResponse.feedbackEnabled) - && Objects.equals(this.strictValidation, mediaResponse.strictValidation); - } - - @Override - public int hashCode() { - return Objects.hash( - id, - to, - from, - canceled, - body, - parameters, - type, - createdAt, - modifiedAt, - deliveryReport, - sendAt, - expireAt, - callbackUrl, - clientReference, - feedbackEnabled, - strictValidation); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class MediaResponseDto {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" to: ").append(toIndentedString(to)).append("\n"); - sb.append(" from: ").append(toIndentedString(from)).append("\n"); - sb.append(" canceled: ").append(toIndentedString(canceled)).append("\n"); - sb.append(" body: ").append(toIndentedString(body)).append("\n"); - sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); - sb.append(" modifiedAt: ").append(toIndentedString(modifiedAt)).append("\n"); - sb.append(" deliveryReport: ").append(toIndentedString(deliveryReport)).append("\n"); - sb.append(" sendAt: ").append(toIndentedString(sendAt)).append("\n"); - sb.append(" expireAt: ").append(toIndentedString(expireAt)).append("\n"); - sb.append(" callbackUrl: ").append(toIndentedString(callbackUrl)).append("\n"); - sb.append(" clientReference: ").append(toIndentedString(clientReference)).append("\n"); - sb.append(" feedbackEnabled: ").append(toIndentedString(feedbackEnabled)).append("\n"); - sb.append(" strictValidation: ").append(toIndentedString(strictValidation)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/MessageDeliveryStatusDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/MessageDeliveryStatusDto.java deleted file mode 100644 index b49b976b6..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/MessageDeliveryStatusDto.java +++ /dev/null @@ -1,223 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.LinkedHashSet; -import java.util.Objects; -import java.util.Set; - -/** Array with status objects. Only status codes with at least one recipient will be listed. */ -@JsonPropertyOrder({ - MessageDeliveryStatusDto.JSON_PROPERTY_CODE, - MessageDeliveryStatusDto.JSON_PROPERTY_COUNT, - MessageDeliveryStatusDto.JSON_PROPERTY_RECIPIENTS, - MessageDeliveryStatusDto.JSON_PROPERTY_STATUS -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class MessageDeliveryStatusDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_CODE = "code"; - private Integer code; - private boolean codeDefined = false; - - public static final String JSON_PROPERTY_COUNT = "count"; - private Integer count; - private boolean countDefined = false; - - public static final String JSON_PROPERTY_RECIPIENTS = "recipients"; - private Set recipients; - private boolean recipientsDefined = false; - - public static final String JSON_PROPERTY_STATUS = "status"; - private String status; - private boolean statusDefined = false; - - public MessageDeliveryStatusDto() {} - - public MessageDeliveryStatusDto code(Integer code) { - this.code = code; - this.codeDefined = true; - return this; - } - - /** - * The detailed status code. - * - * @return code - */ - @JsonProperty(JSON_PROPERTY_CODE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public Integer getCode() { - return code; - } - - @JsonIgnore - public boolean getCodeDefined() { - return codeDefined; - } - - @JsonProperty(JSON_PROPERTY_CODE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setCode(Integer code) { - this.code = code; - this.codeDefined = true; - } - - public MessageDeliveryStatusDto count(Integer count) { - this.count = count; - this.countDefined = true; - return this; - } - - /** - * The number of messages that currently has this code. minimum: 1 - * - * @return count - */ - @JsonProperty(JSON_PROPERTY_COUNT) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public Integer getCount() { - return count; - } - - @JsonIgnore - public boolean getCountDefined() { - return countDefined; - } - - @JsonProperty(JSON_PROPERTY_COUNT) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setCount(Integer count) { - this.count = count; - this.countDefined = true; - } - - public MessageDeliveryStatusDto recipients(Set recipients) { - this.recipients = recipients; - this.recipientsDefined = true; - return this; - } - - public MessageDeliveryStatusDto addRecipientsItem(String recipientsItem) { - if (this.recipients == null) { - this.recipients = new LinkedHashSet<>(); - } - this.recipientsDefined = true; - this.recipients.add(recipientsItem); - return this; - } - - /** - * Only for `full` report. A list of the phone number recipients which messages has this - * status code. - * - * @return recipients - */ - @JsonProperty(JSON_PROPERTY_RECIPIENTS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public Set getRecipients() { - return recipients; - } - - @JsonIgnore - public boolean getRecipientsDefined() { - return recipientsDefined; - } - - @JsonDeserialize(as = LinkedHashSet.class) - @JsonProperty(JSON_PROPERTY_RECIPIENTS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setRecipients(Set recipients) { - this.recipients = recipients; - this.recipientsDefined = true; - } - - public MessageDeliveryStatusDto status(String status) { - this.status = status; - this.statusDefined = true; - return this; - } - - /** - * The simplified status as described in _Delivery Report Statuses_. - * - * @return status - */ - @JsonProperty(JSON_PROPERTY_STATUS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getStatus() { - return status; - } - - @JsonIgnore - public boolean getStatusDefined() { - return statusDefined; - } - - @JsonProperty(JSON_PROPERTY_STATUS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setStatus(String status) { - this.status = status; - this.statusDefined = true; - } - - /** Return true if this MessageDeliveryStatus object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - MessageDeliveryStatusDto messageDeliveryStatus = (MessageDeliveryStatusDto) o; - return Objects.equals(this.code, messageDeliveryStatus.code) - && Objects.equals(this.count, messageDeliveryStatus.count) - && Objects.equals(this.recipients, messageDeliveryStatus.recipients) - && Objects.equals(this.status, messageDeliveryStatus.status); - } - - @Override - public int hashCode() { - return Objects.hash(code, count, recipients, status); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class MessageDeliveryStatusDto {\n"); - sb.append(" code: ").append(toIndentedString(code)).append("\n"); - sb.append(" count: ").append(toIndentedString(count)).append("\n"); - sb.append(" recipients: ").append(toIndentedString(recipients)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ParameterObjDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ParameterObjDto.java deleted file mode 100644 index 4bb1132a3..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ParameterObjDto.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; - -/** - * Contains the parameters that will be used for customizing the message for each recipient. [Click - * here to learn more about - * parameterization](/docs/sms/resources/message-info/message-parameterization). - */ -@JsonPropertyOrder({ - ParameterObjDto.JSON_PROPERTY_LEFT_CURLY_BRACKET_PARAMETER_KEY_RIGHT_CURLY_BRACKET -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class ParameterObjDto extends HashMap { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_LEFT_CURLY_BRACKET_PARAMETER_KEY_RIGHT_CURLY_BRACKET = - "{parameter_key}"; - private ParameterObjParameterKeyDto leftCurlyBracketParameterKeyRightCurlyBracket; - private boolean leftCurlyBracketParameterKeyRightCurlyBracketDefined = false; - - public ParameterObjDto() {} - - public ParameterObjDto leftCurlyBracketParameterKeyRightCurlyBracket( - ParameterObjParameterKeyDto leftCurlyBracketParameterKeyRightCurlyBracket) { - this.leftCurlyBracketParameterKeyRightCurlyBracket = - leftCurlyBracketParameterKeyRightCurlyBracket; - this.leftCurlyBracketParameterKeyRightCurlyBracketDefined = true; - return this; - } - - /** - * Get leftCurlyBracketParameterKeyRightCurlyBracket - * - * @return leftCurlyBracketParameterKeyRightCurlyBracket - */ - @JsonProperty(JSON_PROPERTY_LEFT_CURLY_BRACKET_PARAMETER_KEY_RIGHT_CURLY_BRACKET) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public ParameterObjParameterKeyDto getLeftCurlyBracketParameterKeyRightCurlyBracket() { - return leftCurlyBracketParameterKeyRightCurlyBracket; - } - - @JsonIgnore - public boolean getLeftCurlyBracketParameterKeyRightCurlyBracketDefined() { - return leftCurlyBracketParameterKeyRightCurlyBracketDefined; - } - - @JsonProperty(JSON_PROPERTY_LEFT_CURLY_BRACKET_PARAMETER_KEY_RIGHT_CURLY_BRACKET) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setLeftCurlyBracketParameterKeyRightCurlyBracket( - ParameterObjParameterKeyDto leftCurlyBracketParameterKeyRightCurlyBracket) { - this.leftCurlyBracketParameterKeyRightCurlyBracket = - leftCurlyBracketParameterKeyRightCurlyBracket; - this.leftCurlyBracketParameterKeyRightCurlyBracketDefined = true; - } - - /** - * A container for additional, undeclared properties. This is a holder for any undeclared - * properties as specified with the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. If the property - * does not already exist, create it otherwise replace it. - * - * @param key the name of the property - * @param value the value of the property - * @return self reference - */ - @JsonAnySetter - public ParameterObjDto putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) properties. - * - * @return the additional (undeclared) properties - */ - @JsonAnyGetter - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * Return the additional (undeclared) property with the specified name. - * - * @param key the name of the property - * @return the additional (undeclared) property with the specified name - */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); - } - - /** Return true if this parameterObj object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ParameterObjDto parameterObj = (ParameterObjDto) o; - return Objects.equals( - this.leftCurlyBracketParameterKeyRightCurlyBracket, - parameterObj.leftCurlyBracketParameterKeyRightCurlyBracket) - && Objects.equals(this.additionalProperties, parameterObj.additionalProperties) - && super.equals(o); - } - - @Override - public int hashCode() { - return Objects.hash( - leftCurlyBracketParameterKeyRightCurlyBracket, super.hashCode(), additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ParameterObjDto {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" leftCurlyBracketParameterKeyRightCurlyBracket: ") - .append(toIndentedString(leftCurlyBracketParameterKeyRightCurlyBracket)) - .append("\n"); - sb.append(" additionalProperties: ") - .append(toIndentedString(additionalProperties)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ParameterObjParameterKeyDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ParameterObjParameterKeyDto.java deleted file mode 100644 index 983ee6d93..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ParameterObjParameterKeyDto.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import java.util.Objects; - -/** - * The name of the parameter that will be replaced in the message body. Letters A-Z and a-z, digits - * 0-9 and .-_ allowed. - */ -@JsonPropertyOrder({ - ParameterObjParameterKeyDto.JSON_PROPERTY_LEFT_CURLY_BRACKET_MSISDN_RIGHT_CURLY_BRACKET, - ParameterObjParameterKeyDto.JSON_PROPERTY_DEFAULT -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class ParameterObjParameterKeyDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_LEFT_CURLY_BRACKET_MSISDN_RIGHT_CURLY_BRACKET = - "{msisdn}"; - private String leftCurlyBracketMsisdnRightCurlyBracket; - private boolean leftCurlyBracketMsisdnRightCurlyBracketDefined = false; - - public static final String JSON_PROPERTY_DEFAULT = "default"; - private String _default; - private boolean _defaultDefined = false; - - public ParameterObjParameterKeyDto() {} - - public ParameterObjParameterKeyDto leftCurlyBracketMsisdnRightCurlyBracket( - String leftCurlyBracketMsisdnRightCurlyBracket) { - this.leftCurlyBracketMsisdnRightCurlyBracket = leftCurlyBracketMsisdnRightCurlyBracket; - this.leftCurlyBracketMsisdnRightCurlyBracketDefined = true; - return this; - } - - /** - * The key is the recipient that should have the `parameter_key` replaced with the value - * - * @return leftCurlyBracketMsisdnRightCurlyBracket - */ - @JsonProperty(JSON_PROPERTY_LEFT_CURLY_BRACKET_MSISDN_RIGHT_CURLY_BRACKET) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getLeftCurlyBracketMsisdnRightCurlyBracket() { - return leftCurlyBracketMsisdnRightCurlyBracket; - } - - @JsonIgnore - public boolean getLeftCurlyBracketMsisdnRightCurlyBracketDefined() { - return leftCurlyBracketMsisdnRightCurlyBracketDefined; - } - - @JsonProperty(JSON_PROPERTY_LEFT_CURLY_BRACKET_MSISDN_RIGHT_CURLY_BRACKET) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setLeftCurlyBracketMsisdnRightCurlyBracket( - String leftCurlyBracketMsisdnRightCurlyBracket) { - this.leftCurlyBracketMsisdnRightCurlyBracket = leftCurlyBracketMsisdnRightCurlyBracket; - this.leftCurlyBracketMsisdnRightCurlyBracketDefined = true; - } - - public ParameterObjParameterKeyDto _default(String _default) { - this._default = _default; - this._defaultDefined = true; - return this; - } - - /** - * The fall-back value for omitted recipient phone numbers <a - * href=\"https://community.sinch.com/t5/Glossary/MSISDN/ta-p/7628\" - * target=\"_blank\">MSISDNs</a>. - * - * @return _default - */ - @JsonProperty(JSON_PROPERTY_DEFAULT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getDefault() { - return _default; - } - - @JsonIgnore - public boolean getDefaultDefined() { - return _defaultDefined; - } - - @JsonProperty(JSON_PROPERTY_DEFAULT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDefault(String _default) { - this._default = _default; - this._defaultDefined = true; - } - - /** Return true if this parameterObj__parameter_key_ object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ParameterObjParameterKeyDto parameterObjParameterKey = (ParameterObjParameterKeyDto) o; - return Objects.equals( - this.leftCurlyBracketMsisdnRightCurlyBracket, - parameterObjParameterKey.leftCurlyBracketMsisdnRightCurlyBracket) - && Objects.equals(this._default, parameterObjParameterKey._default); - } - - @Override - public int hashCode() { - return Objects.hash(leftCurlyBracketMsisdnRightCurlyBracket, _default); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ParameterObjParameterKeyDto {\n"); - sb.append(" leftCurlyBracketMsisdnRightCurlyBracket: ") - .append(toIndentedString(leftCurlyBracketMsisdnRightCurlyBracket)) - .append("\n"); - sb.append(" _default: ").append(toIndentedString(_default)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/RecipientDeliveryReportDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/RecipientDeliveryReportDto.java deleted file mode 100644 index e25eab0cf..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/RecipientDeliveryReportDto.java +++ /dev/null @@ -1,584 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonValue; -import java.time.OffsetDateTime; -import java.util.Objects; - -/** RecipientDeliveryReportDto */ -@JsonPropertyOrder({ - RecipientDeliveryReportDto.JSON_PROPERTY_AT, - RecipientDeliveryReportDto.JSON_PROPERTY_BATCH_ID, - RecipientDeliveryReportDto.JSON_PROPERTY_CODE, - RecipientDeliveryReportDto.JSON_PROPERTY_RECIPIENT, - RecipientDeliveryReportDto.JSON_PROPERTY_STATUS, - RecipientDeliveryReportDto.JSON_PROPERTY_TYPE, - RecipientDeliveryReportDto.JSON_PROPERTY_APPLIED_ORIGINATOR, - RecipientDeliveryReportDto.JSON_PROPERTY_CLIENT_REFERENCE, - RecipientDeliveryReportDto.JSON_PROPERTY_ENCODING, - RecipientDeliveryReportDto.JSON_PROPERTY_NUMBER_OF_MESSAGE_PARTS, - RecipientDeliveryReportDto.JSON_PROPERTY_OPERATOR, - RecipientDeliveryReportDto.JSON_PROPERTY_OPERATOR_STATUS_AT -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class RecipientDeliveryReportDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_AT = "at"; - private OffsetDateTime at; - private boolean atDefined = false; - - public static final String JSON_PROPERTY_BATCH_ID = "batch_id"; - private String batchId; - private boolean batchIdDefined = false; - - public static final String JSON_PROPERTY_CODE = "code"; - private Integer code; - private boolean codeDefined = false; - - public static final String JSON_PROPERTY_RECIPIENT = "recipient"; - private String recipient; - private boolean recipientDefined = false; - - public static final String JSON_PROPERTY_STATUS = "status"; - private String status; - private boolean statusDefined = false; - - /** The recipient delivery report type. */ - public enum TypeEnum { - SMS("recipient_delivery_report_sms"), - - MMS("recipient_delivery_report_mms"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - TypeEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static TypeEnum fromValue(String value) { - for (TypeEnum b : TypeEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_TYPE = "type"; - private String type; - private boolean typeDefined = false; - - public static final String JSON_PROPERTY_APPLIED_ORIGINATOR = "applied_originator"; - private String appliedOriginator; - private boolean appliedOriginatorDefined = false; - - public static final String JSON_PROPERTY_CLIENT_REFERENCE = "client_reference"; - private String clientReference; - private boolean clientReferenceDefined = false; - - /** Applied encoding for message. Present only if smart encoding is enabled. */ - public enum EncodingEnum { - GSM("GSM"), - - UNICODE("UNICODE"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - EncodingEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static EncodingEnum fromValue(String value) { - for (EncodingEnum b : EncodingEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_ENCODING = "encoding"; - private String encoding; - private boolean encodingDefined = false; - - public static final String JSON_PROPERTY_NUMBER_OF_MESSAGE_PARTS = "number_of_message_parts"; - private Integer numberOfMessageParts; - private boolean numberOfMessagePartsDefined = false; - - public static final String JSON_PROPERTY_OPERATOR = "operator"; - private String operator; - private boolean operatorDefined = false; - - public static final String JSON_PROPERTY_OPERATOR_STATUS_AT = "operator_status_at"; - private OffsetDateTime operatorStatusAt; - private boolean operatorStatusAtDefined = false; - - public RecipientDeliveryReportDto() {} - - @JsonCreator - public RecipientDeliveryReportDto(@JsonProperty(JSON_PROPERTY_BATCH_ID) String batchId) { - this(); - this.batchId = batchId; - this.batchIdDefined = true; - } - - public RecipientDeliveryReportDto at(OffsetDateTime at) { - this.at = at; - this.atDefined = true; - return this; - } - - /** - * A timestamp of when the Delivery Report was created in the Sinch service. Formatted as - * [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601): `YYYY-MM-DDThh:mm:ss.SSSZ`. - * - * @return at - */ - @JsonProperty(JSON_PROPERTY_AT) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public OffsetDateTime getAt() { - return at; - } - - @JsonIgnore - public boolean getAtDefined() { - return atDefined; - } - - @JsonProperty(JSON_PROPERTY_AT) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setAt(OffsetDateTime at) { - this.at = at; - this.atDefined = true; - } - - /** - * The ID of the batch this delivery report belongs to - * - * @return batchId - */ - @JsonProperty(JSON_PROPERTY_BATCH_ID) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getBatchId() { - return batchId; - } - - @JsonIgnore - public boolean getBatchIdDefined() { - return batchIdDefined; - } - - public RecipientDeliveryReportDto code(Integer code) { - this.code = code; - this.codeDefined = true; - return this; - } - - /** - * The detailed status code. - * - * @return code - */ - @JsonProperty(JSON_PROPERTY_CODE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public Integer getCode() { - return code; - } - - @JsonIgnore - public boolean getCodeDefined() { - return codeDefined; - } - - @JsonProperty(JSON_PROPERTY_CODE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setCode(Integer code) { - this.code = code; - this.codeDefined = true; - } - - public RecipientDeliveryReportDto recipient(String recipient) { - this.recipient = recipient; - this.recipientDefined = true; - return this; - } - - /** - * Phone number that was queried. - * - * @return recipient - */ - @JsonProperty(JSON_PROPERTY_RECIPIENT) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getRecipient() { - return recipient; - } - - @JsonIgnore - public boolean getRecipientDefined() { - return recipientDefined; - } - - @JsonProperty(JSON_PROPERTY_RECIPIENT) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setRecipient(String recipient) { - this.recipient = recipient; - this.recipientDefined = true; - } - - public RecipientDeliveryReportDto status(String status) { - this.status = status; - this.statusDefined = true; - return this; - } - - /** - * The simplified status as described in _Delivery Report Statuses_. - * - * @return status - */ - @JsonProperty(JSON_PROPERTY_STATUS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getStatus() { - return status; - } - - @JsonIgnore - public boolean getStatusDefined() { - return statusDefined; - } - - @JsonProperty(JSON_PROPERTY_STATUS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setStatus(String status) { - this.status = status; - this.statusDefined = true; - } - - public RecipientDeliveryReportDto type(String type) { - this.type = type; - this.typeDefined = true; - return this; - } - - /** - * The recipient delivery report type. - * - * @return type - */ - @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getType() { - return type; - } - - @JsonIgnore - public boolean getTypeDefined() { - return typeDefined; - } - - @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setType(String type) { - this.type = type; - this.typeDefined = true; - } - - public RecipientDeliveryReportDto appliedOriginator(String appliedOriginator) { - this.appliedOriginator = appliedOriginator; - this.appliedOriginatorDefined = true; - return this; - } - - /** - * The default originator used for the recipient this delivery report belongs to, if default - * originator pool configured and no originator set when submitting batch. - * - * @return appliedOriginator - */ - @JsonProperty(JSON_PROPERTY_APPLIED_ORIGINATOR) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getAppliedOriginator() { - return appliedOriginator; - } - - @JsonIgnore - public boolean getAppliedOriginatorDefined() { - return appliedOriginatorDefined; - } - - @JsonProperty(JSON_PROPERTY_APPLIED_ORIGINATOR) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setAppliedOriginator(String appliedOriginator) { - this.appliedOriginator = appliedOriginator; - this.appliedOriginatorDefined = true; - } - - public RecipientDeliveryReportDto clientReference(String clientReference) { - this.clientReference = clientReference; - this.clientReferenceDefined = true; - return this; - } - - /** - * The client identifier of the batch this delivery report belongs to, if set when submitting - * batch. - * - * @return clientReference - */ - @JsonProperty(JSON_PROPERTY_CLIENT_REFERENCE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getClientReference() { - return clientReference; - } - - @JsonIgnore - public boolean getClientReferenceDefined() { - return clientReferenceDefined; - } - - @JsonProperty(JSON_PROPERTY_CLIENT_REFERENCE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setClientReference(String clientReference) { - this.clientReference = clientReference; - this.clientReferenceDefined = true; - } - - public RecipientDeliveryReportDto encoding(String encoding) { - this.encoding = encoding; - this.encodingDefined = true; - return this; - } - - /** - * Applied encoding for message. Present only if smart encoding is enabled. - * - * @return encoding - */ - @JsonProperty(JSON_PROPERTY_ENCODING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getEncoding() { - return encoding; - } - - @JsonIgnore - public boolean getEncodingDefined() { - return encodingDefined; - } - - @JsonProperty(JSON_PROPERTY_ENCODING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setEncoding(String encoding) { - this.encoding = encoding; - this.encodingDefined = true; - } - - public RecipientDeliveryReportDto numberOfMessageParts(Integer numberOfMessageParts) { - this.numberOfMessageParts = numberOfMessageParts; - this.numberOfMessagePartsDefined = true; - return this; - } - - /** - * The number of parts the message was split into. Present only if - * `max_number_of_message_parts` parameter was set. - * - * @return numberOfMessageParts - */ - @JsonProperty(JSON_PROPERTY_NUMBER_OF_MESSAGE_PARTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getNumberOfMessageParts() { - return numberOfMessageParts; - } - - @JsonIgnore - public boolean getNumberOfMessagePartsDefined() { - return numberOfMessagePartsDefined; - } - - @JsonProperty(JSON_PROPERTY_NUMBER_OF_MESSAGE_PARTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setNumberOfMessageParts(Integer numberOfMessageParts) { - this.numberOfMessageParts = numberOfMessageParts; - this.numberOfMessagePartsDefined = true; - } - - public RecipientDeliveryReportDto operator(String operator) { - this.operator = operator; - this.operatorDefined = true; - return this; - } - - /** - * The operator that was used for delivering the message to this recipient, if enabled on the - * account by Sinch. - * - * @return operator - */ - @JsonProperty(JSON_PROPERTY_OPERATOR) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getOperator() { - return operator; - } - - @JsonIgnore - public boolean getOperatorDefined() { - return operatorDefined; - } - - @JsonProperty(JSON_PROPERTY_OPERATOR) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setOperator(String operator) { - this.operator = operator; - this.operatorDefined = true; - } - - public RecipientDeliveryReportDto operatorStatusAt(OffsetDateTime operatorStatusAt) { - this.operatorStatusAt = operatorStatusAt; - this.operatorStatusAtDefined = true; - return this; - } - - /** - * A timestamp extracted from the Delivery Receipt from the originating SMSC. Formatted as - * [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601): `YYYY-MM-DDThh:mm:ss.SSSZ`. - * - * @return operatorStatusAt - */ - @JsonProperty(JSON_PROPERTY_OPERATOR_STATUS_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getOperatorStatusAt() { - return operatorStatusAt; - } - - @JsonIgnore - public boolean getOperatorStatusAtDefined() { - return operatorStatusAtDefined; - } - - @JsonProperty(JSON_PROPERTY_OPERATOR_STATUS_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setOperatorStatusAt(OffsetDateTime operatorStatusAt) { - this.operatorStatusAt = operatorStatusAt; - this.operatorStatusAtDefined = true; - } - - /** Return true if this RecipientDeliveryReport object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - RecipientDeliveryReportDto recipientDeliveryReport = (RecipientDeliveryReportDto) o; - return Objects.equals(this.at, recipientDeliveryReport.at) - && Objects.equals(this.batchId, recipientDeliveryReport.batchId) - && Objects.equals(this.code, recipientDeliveryReport.code) - && Objects.equals(this.recipient, recipientDeliveryReport.recipient) - && Objects.equals(this.status, recipientDeliveryReport.status) - && Objects.equals(this.type, recipientDeliveryReport.type) - && Objects.equals(this.appliedOriginator, recipientDeliveryReport.appliedOriginator) - && Objects.equals(this.clientReference, recipientDeliveryReport.clientReference) - && Objects.equals(this.encoding, recipientDeliveryReport.encoding) - && Objects.equals(this.numberOfMessageParts, recipientDeliveryReport.numberOfMessageParts) - && Objects.equals(this.operator, recipientDeliveryReport.operator) - && Objects.equals(this.operatorStatusAt, recipientDeliveryReport.operatorStatusAt); - } - - @Override - public int hashCode() { - return Objects.hash( - at, - batchId, - code, - recipient, - status, - type, - appliedOriginator, - clientReference, - encoding, - numberOfMessageParts, - operator, - operatorStatusAt); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class RecipientDeliveryReportDto {\n"); - sb.append(" at: ").append(toIndentedString(at)).append("\n"); - sb.append(" batchId: ").append(toIndentedString(batchId)).append("\n"); - sb.append(" code: ").append(toIndentedString(code)).append("\n"); - sb.append(" recipient: ").append(toIndentedString(recipient)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" appliedOriginator: ").append(toIndentedString(appliedOriginator)).append("\n"); - sb.append(" clientReference: ").append(toIndentedString(clientReference)).append("\n"); - sb.append(" encoding: ").append(toIndentedString(encoding)).append("\n"); - sb.append(" numberOfMessageParts: ") - .append(toIndentedString(numberOfMessageParts)) - .append("\n"); - sb.append(" operator: ").append(toIndentedString(operator)).append("\n"); - sb.append(" operatorStatusAt: ").append(toIndentedString(operatorStatusAt)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/RemoveKeywordDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/RemoveKeywordDto.java deleted file mode 100644 index 42efbf532..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/RemoveKeywordDto.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import java.util.Objects; - -/** Keyword to be sent in MO to remove MSISDN to a group */ -@JsonPropertyOrder({ - RemoveKeywordDto.JSON_PROPERTY_FIRST_WORD, - RemoveKeywordDto.JSON_PROPERTY_SECOND_WORD -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class RemoveKeywordDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_FIRST_WORD = "first_word"; - private String firstWord; - private boolean firstWordDefined = false; - - public static final String JSON_PROPERTY_SECOND_WORD = "second_word"; - private String secondWord; - private boolean secondWordDefined = false; - - public RemoveKeywordDto() {} - - public RemoveKeywordDto firstWord(String firstWord) { - this.firstWord = firstWord; - this.firstWordDefined = true; - return this; - } - - /** - * Opt-out keyword like \"LEAVE\" if _auto_update.to_ is dedicated long/short number or - * unique brand keyword like \"Sinch\" if it is a shared short code. - * - * @return firstWord - */ - @JsonProperty(JSON_PROPERTY_FIRST_WORD) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getFirstWord() { - return firstWord; - } - - @JsonIgnore - public boolean getFirstWordDefined() { - return firstWordDefined; - } - - @JsonProperty(JSON_PROPERTY_FIRST_WORD) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setFirstWord(String firstWord) { - this.firstWord = firstWord; - this.firstWordDefined = true; - } - - public RemoveKeywordDto secondWord(String secondWord) { - this.secondWord = secondWord; - this.secondWordDefined = true; - return this; - } - - /** - * Opt-out keyword like \"LEAVE\" if _auto_update.to_ is shared short code. - * - * @return secondWord - */ - @JsonProperty(JSON_PROPERTY_SECOND_WORD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getSecondWord() { - return secondWord; - } - - @JsonIgnore - public boolean getSecondWordDefined() { - return secondWordDefined; - } - - @JsonProperty(JSON_PROPERTY_SECOND_WORD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setSecondWord(String secondWord) { - this.secondWord = secondWord; - this.secondWordDefined = true; - } - - /** Return true if this removeKeyword object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - RemoveKeywordDto removeKeyword = (RemoveKeywordDto) o; - return Objects.equals(this.firstWord, removeKeyword.firstWord) - && Objects.equals(this.secondWord, removeKeyword.secondWord); - } - - @Override - public int hashCode() { - return Objects.hash(firstWord, secondWord); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class RemoveKeywordDto {\n"); - sb.append(" firstWord: ").append(toIndentedString(firstWord)).append("\n"); - sb.append(" secondWord: ").append(toIndentedString(secondWord)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ReplaceGroupRequestDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ReplaceGroupRequestDto.java deleted file mode 100644 index 742c3a488..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/ReplaceGroupRequestDto.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** ReplaceGroupRequestDto */ -@JsonPropertyOrder({ - ReplaceGroupRequestDto.JSON_PROPERTY_MEMBERS, - ReplaceGroupRequestDto.JSON_PROPERTY_NAME -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class ReplaceGroupRequestDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_MEMBERS = "members"; - private List members; - private boolean membersDefined = false; - - public static final String JSON_PROPERTY_NAME = "name"; - private String name; - private boolean nameDefined = false; - - public ReplaceGroupRequestDto() {} - - public ReplaceGroupRequestDto members(List members) { - this.members = members; - this.membersDefined = true; - return this; - } - - public ReplaceGroupRequestDto addMembersItem(String membersItem) { - if (this.members == null) { - this.members = new ArrayList<>(); - } - this.membersDefined = true; - this.members.add(membersItem); - return this; - } - - /** - * The initial members of the group. Constraints: Elements must be phone numbers in <a - * href=\"https://community.sinch.com/t5/Glossary/E-164/ta-p/7537\" - * target=\"_blank\">E.164</a> format MSISDNs. - * - * @return members - */ - @JsonProperty(JSON_PROPERTY_MEMBERS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public List getMembers() { - return members; - } - - @JsonIgnore - public boolean getMembersDefined() { - return membersDefined; - } - - @JsonProperty(JSON_PROPERTY_MEMBERS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setMembers(List members) { - this.members = members; - this.membersDefined = true; - } - - public ReplaceGroupRequestDto name(String name) { - this.name = name; - this.nameDefined = true; - return this; - } - - /** - * Name of group. - * - * @return name - */ - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getName() { - return name; - } - - @JsonIgnore - public boolean getNameDefined() { - return nameDefined; - } - - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setName(String name) { - this.name = name; - this.nameDefined = true; - } - - /** Return true if this ReplaceGroup_request object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ReplaceGroupRequestDto replaceGroupRequest = (ReplaceGroupRequestDto) o; - return Objects.equals(this.members, replaceGroupRequest.members) - && Objects.equals(this.name, replaceGroupRequest.name); - } - - @Override - public int hashCode() { - return Objects.hash(members, name); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ReplaceGroupRequestDto {\n"); - sb.append(" members: ").append(toIndentedString(members)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/SendSMS201ResponseDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/SendSMS201ResponseDto.java deleted file mode 100644 index 0b8445d5a..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/SendSMS201ResponseDto.java +++ /dev/null @@ -1,380 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.MapperFeature; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.deser.std.StdDeserializer; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; -import com.sinch.sdk.core.models.AbstractOpenApiSchema; -import com.sinch.sdk.core.utils.databind.JSONNavigator; -import java.io.IOException; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; - -@JsonDeserialize(using = SendSMS201ResponseDto.SendSMS201ResponseDtoDeserializer.class) -@JsonSerialize(using = SendSMS201ResponseDto.SendSMS201ResponseDtoSerializer.class) -public final class SendSMS201ResponseDto extends AbstractOpenApiSchema { - private static final Logger log = Logger.getLogger(SendSMS201ResponseDto.class.getName()); - - public static final class SendSMS201ResponseDtoSerializer - extends StdSerializer { - private static final long serialVersionUID = 1L; - - public SendSMS201ResponseDtoSerializer(Class t) { - super(t); - } - - public SendSMS201ResponseDtoSerializer() { - this(null); - } - - @Override - public void serialize( - SendSMS201ResponseDto value, JsonGenerator jgen, SerializerProvider provider) - throws IOException, JsonProcessingException { - jgen.writeObject(value.getActualInstance()); - } - } - - public static final class SendSMS201ResponseDtoDeserializer - extends StdDeserializer { - - private static final long serialVersionUID = 1L; - - public SendSMS201ResponseDtoDeserializer() { - this(SendSMS201ResponseDto.class); - } - - public SendSMS201ResponseDtoDeserializer(Class vc) { - super(vc); - } - - @Override - public SendSMS201ResponseDto deserialize(JsonParser jp, DeserializationContext ctxt) - throws IOException, JsonProcessingException { - JsonNode tree = jp.readValueAsTree(); - Object deserialized = null; - SendSMS201ResponseDto newSendSMS201ResponseDto = new SendSMS201ResponseDto(); - Map result2 = - tree.traverse(jp.getCodec()).readValueAs(new TypeReference>() {}); - String discriminatorValue = (String) result2.get("type"); - switch (discriminatorValue) { - case "BinaryResponse": - deserialized = tree.traverse(jp.getCodec()).readValueAs(BinaryResponseDto.class); - newSendSMS201ResponseDto.setActualInstance(deserialized); - return newSendSMS201ResponseDto; - case "MediaResponse": - deserialized = tree.traverse(jp.getCodec()).readValueAs(MediaResponseDto.class); - newSendSMS201ResponseDto.setActualInstance(deserialized); - return newSendSMS201ResponseDto; - case "TextResponse": - deserialized = tree.traverse(jp.getCodec()).readValueAs(TextResponseDto.class); - newSendSMS201ResponseDto.setActualInstance(deserialized); - return newSendSMS201ResponseDto; - case "mt_binary": - deserialized = tree.traverse(jp.getCodec()).readValueAs(BinaryResponseDto.class); - newSendSMS201ResponseDto.setActualInstance(deserialized); - return newSendSMS201ResponseDto; - case "mt_media": - deserialized = tree.traverse(jp.getCodec()).readValueAs(MediaResponseDto.class); - newSendSMS201ResponseDto.setActualInstance(deserialized); - return newSendSMS201ResponseDto; - case "mt_text": - deserialized = tree.traverse(jp.getCodec()).readValueAs(TextResponseDto.class); - newSendSMS201ResponseDto.setActualInstance(deserialized); - return newSendSMS201ResponseDto; - default: - log.log( - Level.WARNING, - String.format( - "Failed to lookup discriminator value `%s` for SendSMS201ResponseDto. Possible" - + " values: BinaryResponse MediaResponse TextResponse mt_binary mt_media" - + " mt_text", - discriminatorValue)); - } - - boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); - int match = 0; - JsonToken token = tree.traverse(jp.getCodec()).nextToken(); - // deserialize BinaryResponseDto - try { - boolean attemptParsing = true; - // ensure that we respect type coercion as set on the client ObjectMapper - if (BinaryResponseDto.class.equals(Integer.class) - || BinaryResponseDto.class.equals(Long.class) - || BinaryResponseDto.class.equals(Float.class) - || BinaryResponseDto.class.equals(Double.class) - || BinaryResponseDto.class.equals(Boolean.class) - || BinaryResponseDto.class.equals(String.class)) { - attemptParsing = typeCoercion; - if (!attemptParsing) { - attemptParsing |= - ((BinaryResponseDto.class.equals(Integer.class) - || BinaryResponseDto.class.equals(Long.class)) - && token == JsonToken.VALUE_NUMBER_INT); - attemptParsing |= - ((BinaryResponseDto.class.equals(Float.class) - || BinaryResponseDto.class.equals(Double.class)) - && token == JsonToken.VALUE_NUMBER_FLOAT); - attemptParsing |= - (BinaryResponseDto.class.equals(Boolean.class) - && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); - attemptParsing |= - (BinaryResponseDto.class.equals(String.class) && token == JsonToken.VALUE_STRING); - } - } - if (attemptParsing) { - deserialized = tree.traverse(jp.getCodec()).readValueAs(BinaryResponseDto.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 'BinaryResponseDto'"); - } - } catch (Exception e) { - // deserialization failed, continue - log.log(Level.FINER, "Input data does not match schema 'BinaryResponseDto'", e); - } - - // deserialize MediaResponseDto - try { - boolean attemptParsing = true; - // ensure that we respect type coercion as set on the client ObjectMapper - if (MediaResponseDto.class.equals(Integer.class) - || MediaResponseDto.class.equals(Long.class) - || MediaResponseDto.class.equals(Float.class) - || MediaResponseDto.class.equals(Double.class) - || MediaResponseDto.class.equals(Boolean.class) - || MediaResponseDto.class.equals(String.class)) { - attemptParsing = typeCoercion; - if (!attemptParsing) { - attemptParsing |= - ((MediaResponseDto.class.equals(Integer.class) - || MediaResponseDto.class.equals(Long.class)) - && token == JsonToken.VALUE_NUMBER_INT); - attemptParsing |= - ((MediaResponseDto.class.equals(Float.class) - || MediaResponseDto.class.equals(Double.class)) - && token == JsonToken.VALUE_NUMBER_FLOAT); - attemptParsing |= - (MediaResponseDto.class.equals(Boolean.class) - && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); - attemptParsing |= - (MediaResponseDto.class.equals(String.class) && token == JsonToken.VALUE_STRING); - } - } - if (attemptParsing) { - deserialized = tree.traverse(jp.getCodec()).readValueAs(MediaResponseDto.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 'MediaResponseDto'"); - } - } catch (Exception e) { - // deserialization failed, continue - log.log(Level.FINER, "Input data does not match schema 'MediaResponseDto'", e); - } - - // deserialize TextResponseDto - try { - boolean attemptParsing = true; - // ensure that we respect type coercion as set on the client ObjectMapper - if (TextResponseDto.class.equals(Integer.class) - || TextResponseDto.class.equals(Long.class) - || TextResponseDto.class.equals(Float.class) - || TextResponseDto.class.equals(Double.class) - || TextResponseDto.class.equals(Boolean.class) - || TextResponseDto.class.equals(String.class)) { - attemptParsing = typeCoercion; - if (!attemptParsing) { - attemptParsing |= - ((TextResponseDto.class.equals(Integer.class) - || TextResponseDto.class.equals(Long.class)) - && token == JsonToken.VALUE_NUMBER_INT); - attemptParsing |= - ((TextResponseDto.class.equals(Float.class) - || TextResponseDto.class.equals(Double.class)) - && token == JsonToken.VALUE_NUMBER_FLOAT); - attemptParsing |= - (TextResponseDto.class.equals(Boolean.class) - && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); - attemptParsing |= - (TextResponseDto.class.equals(String.class) && token == JsonToken.VALUE_STRING); - } - } - if (attemptParsing) { - deserialized = tree.traverse(jp.getCodec()).readValueAs(TextResponseDto.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 'TextResponseDto'"); - } - } catch (Exception e) { - // deserialization failed, continue - log.log(Level.FINER, "Input data does not match schema 'TextResponseDto'", e); - } - - if (match == 1) { - SendSMS201ResponseDto ret = new SendSMS201ResponseDto(); - ret.setActualInstance(deserialized); - return ret; - } - throw new IOException( - String.format( - "Failed deserialization for SendSMS201ResponseDto: %d classes match result, expected" - + " 1", - match)); - } - - /** Handle deserialization of the 'null' value. */ - @Override - public SendSMS201ResponseDto getNullValue(DeserializationContext ctxt) - throws JsonMappingException { - throw new JsonMappingException(ctxt.getParser(), "SendSMS201ResponseDto cannot be null"); - } - } - - // store a list of schema names defined in oneOf - public static final Map> schemas = new HashMap<>(); - - public SendSMS201ResponseDto() { - super("oneOf", Boolean.FALSE); - } - - public SendSMS201ResponseDto(BinaryResponseDto o) { - super("oneOf", Boolean.FALSE); - setActualInstance(o); - } - - public SendSMS201ResponseDto(MediaResponseDto o) { - super("oneOf", Boolean.FALSE); - setActualInstance(o); - } - - public SendSMS201ResponseDto(TextResponseDto o) { - super("oneOf", Boolean.FALSE); - setActualInstance(o); - } - - static { - schemas.put("BinaryResponseDto", BinaryResponseDto.class); - schemas.put("MediaResponseDto", MediaResponseDto.class); - schemas.put("TextResponseDto", TextResponseDto.class); - JSONNavigator.registerDescendants( - SendSMS201ResponseDto.class, Collections.unmodifiableMap(schemas)); - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("BinaryResponse", BinaryResponseDto.class); - mappings.put("MediaResponse", MediaResponseDto.class); - mappings.put("TextResponse", TextResponseDto.class); - mappings.put("mt_binary", BinaryResponseDto.class); - mappings.put("mt_media", MediaResponseDto.class); - mappings.put("mt_text", TextResponseDto.class); - mappings.put("SendSMS_201_response", SendSMS201ResponseDto.class); - JSONNavigator.registerDiscriminator(SendSMS201ResponseDto.class, "type", mappings); - } - - @Override - public Map> getSchemas() { - return SendSMS201ResponseDto.schemas; - } - - /** - * Set the instance that matches the oneOf child schema, check the instance parameter is valid - * against the oneOf child schemas: BinaryResponseDto, MediaResponseDto, TextResponseDto - * - *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a - * composed schema (allOf, anyOf, oneOf). - */ - @Override - public void setActualInstance(Object instance) { - if (JSONNavigator.isInstanceOf(BinaryResponseDto.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - - if (JSONNavigator.isInstanceOf(MediaResponseDto.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - - if (JSONNavigator.isInstanceOf(TextResponseDto.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - - throw new RuntimeException( - "Invalid instance type. Must be BinaryResponseDto, MediaResponseDto, TextResponseDto"); - } - - /** - * Get the actual instance, which can be the following: BinaryResponseDto, MediaResponseDto, - * TextResponseDto - * - * @return The actual instance (BinaryResponseDto, MediaResponseDto, TextResponseDto) - */ - @Override - public Object getActualInstance() { - return super.getActualInstance(); - } - - /** - * Get the actual instance of `BinaryResponseDto`. If the actual instance is not - * `BinaryResponseDto`, the ClassCastException will be thrown. - * - * @return The actual instance of `BinaryResponseDto` - * @throws ClassCastException if the instance is not `BinaryResponseDto` - */ - public BinaryResponseDto getBinaryResponseDto() throws ClassCastException { - return (BinaryResponseDto) super.getActualInstance(); - } - - /** - * Get the actual instance of `MediaResponseDto`. If the actual instance is not - * `MediaResponseDto`, the ClassCastException will be thrown. - * - * @return The actual instance of `MediaResponseDto` - * @throws ClassCastException if the instance is not `MediaResponseDto` - */ - public MediaResponseDto getMediaResponseDto() throws ClassCastException { - return (MediaResponseDto) super.getActualInstance(); - } - - /** - * Get the actual instance of `TextResponseDto`. If the actual instance is not `TextResponseDto`, - * the ClassCastException will be thrown. - * - * @return The actual instance of `TextResponseDto` - * @throws ClassCastException if the instance is not `TextResponseDto` - */ - public TextResponseDto getTextResponseDto() throws ClassCastException { - return (TextResponseDto) super.getActualInstance(); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/SendSMSRequestDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/SendSMSRequestDto.java deleted file mode 100644 index 9f98ae6f8..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/SendSMSRequestDto.java +++ /dev/null @@ -1,376 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.MapperFeature; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.deser.std.StdDeserializer; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; -import com.sinch.sdk.core.models.AbstractOpenApiSchema; -import com.sinch.sdk.core.utils.databind.JSONNavigator; -import java.io.IOException; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; - -@JsonDeserialize(using = SendSMSRequestDto.SendSMSRequestDtoDeserializer.class) -@JsonSerialize(using = SendSMSRequestDto.SendSMSRequestDtoSerializer.class) -public final class SendSMSRequestDto extends AbstractOpenApiSchema { - private static final Logger log = Logger.getLogger(SendSMSRequestDto.class.getName()); - - public static final class SendSMSRequestDtoSerializer extends StdSerializer { - private static final long serialVersionUID = 1L; - - public SendSMSRequestDtoSerializer(Class t) { - super(t); - } - - public SendSMSRequestDtoSerializer() { - this(null); - } - - @Override - public void serialize(SendSMSRequestDto value, JsonGenerator jgen, SerializerProvider provider) - throws IOException, JsonProcessingException { - jgen.writeObject(value.getActualInstance()); - } - } - - public static final class SendSMSRequestDtoDeserializer - extends StdDeserializer { - - private static final long serialVersionUID = 1L; - - public SendSMSRequestDtoDeserializer() { - this(SendSMSRequestDto.class); - } - - public SendSMSRequestDtoDeserializer(Class vc) { - super(vc); - } - - @Override - public SendSMSRequestDto deserialize(JsonParser jp, DeserializationContext ctxt) - throws IOException, JsonProcessingException { - JsonNode tree = jp.readValueAsTree(); - Object deserialized = null; - SendSMSRequestDto newSendSMSRequestDto = new SendSMSRequestDto(); - Map result2 = - tree.traverse(jp.getCodec()).readValueAs(new TypeReference>() {}); - String discriminatorValue = (String) result2.get("type"); - switch (discriminatorValue) { - case "BinaryRequest": - deserialized = tree.traverse(jp.getCodec()).readValueAs(BinaryRequestDto.class); - newSendSMSRequestDto.setActualInstance(deserialized); - return newSendSMSRequestDto; - case "MediaRequest": - deserialized = tree.traverse(jp.getCodec()).readValueAs(MediaRequestDto.class); - newSendSMSRequestDto.setActualInstance(deserialized); - return newSendSMSRequestDto; - case "TextRequest": - deserialized = tree.traverse(jp.getCodec()).readValueAs(TextRequestDto.class); - newSendSMSRequestDto.setActualInstance(deserialized); - return newSendSMSRequestDto; - case "mt_binary": - deserialized = tree.traverse(jp.getCodec()).readValueAs(BinaryRequestDto.class); - newSendSMSRequestDto.setActualInstance(deserialized); - return newSendSMSRequestDto; - case "mt_media": - deserialized = tree.traverse(jp.getCodec()).readValueAs(MediaRequestDto.class); - newSendSMSRequestDto.setActualInstance(deserialized); - return newSendSMSRequestDto; - case "mt_text": - deserialized = tree.traverse(jp.getCodec()).readValueAs(TextRequestDto.class); - newSendSMSRequestDto.setActualInstance(deserialized); - return newSendSMSRequestDto; - default: - log.log( - Level.WARNING, - String.format( - "Failed to lookup discriminator value `%s` for SendSMSRequestDto. Possible" - + " values: BinaryRequest MediaRequest TextRequest mt_binary mt_media" - + " mt_text", - discriminatorValue)); - } - - boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); - int match = 0; - JsonToken token = tree.traverse(jp.getCodec()).nextToken(); - // deserialize BinaryRequestDto - try { - boolean attemptParsing = true; - // ensure that we respect type coercion as set on the client ObjectMapper - if (BinaryRequestDto.class.equals(Integer.class) - || BinaryRequestDto.class.equals(Long.class) - || BinaryRequestDto.class.equals(Float.class) - || BinaryRequestDto.class.equals(Double.class) - || BinaryRequestDto.class.equals(Boolean.class) - || BinaryRequestDto.class.equals(String.class)) { - attemptParsing = typeCoercion; - if (!attemptParsing) { - attemptParsing |= - ((BinaryRequestDto.class.equals(Integer.class) - || BinaryRequestDto.class.equals(Long.class)) - && token == JsonToken.VALUE_NUMBER_INT); - attemptParsing |= - ((BinaryRequestDto.class.equals(Float.class) - || BinaryRequestDto.class.equals(Double.class)) - && token == JsonToken.VALUE_NUMBER_FLOAT); - attemptParsing |= - (BinaryRequestDto.class.equals(Boolean.class) - && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); - attemptParsing |= - (BinaryRequestDto.class.equals(String.class) && token == JsonToken.VALUE_STRING); - } - } - if (attemptParsing) { - deserialized = tree.traverse(jp.getCodec()).readValueAs(BinaryRequestDto.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 'BinaryRequestDto'"); - } - } catch (Exception e) { - // deserialization failed, continue - log.log(Level.FINER, "Input data does not match schema 'BinaryRequestDto'", e); - } - - // deserialize MediaRequestDto - try { - boolean attemptParsing = true; - // ensure that we respect type coercion as set on the client ObjectMapper - if (MediaRequestDto.class.equals(Integer.class) - || MediaRequestDto.class.equals(Long.class) - || MediaRequestDto.class.equals(Float.class) - || MediaRequestDto.class.equals(Double.class) - || MediaRequestDto.class.equals(Boolean.class) - || MediaRequestDto.class.equals(String.class)) { - attemptParsing = typeCoercion; - if (!attemptParsing) { - attemptParsing |= - ((MediaRequestDto.class.equals(Integer.class) - || MediaRequestDto.class.equals(Long.class)) - && token == JsonToken.VALUE_NUMBER_INT); - attemptParsing |= - ((MediaRequestDto.class.equals(Float.class) - || MediaRequestDto.class.equals(Double.class)) - && token == JsonToken.VALUE_NUMBER_FLOAT); - attemptParsing |= - (MediaRequestDto.class.equals(Boolean.class) - && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); - attemptParsing |= - (MediaRequestDto.class.equals(String.class) && token == JsonToken.VALUE_STRING); - } - } - if (attemptParsing) { - deserialized = tree.traverse(jp.getCodec()).readValueAs(MediaRequestDto.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 'MediaRequestDto'"); - } - } catch (Exception e) { - // deserialization failed, continue - log.log(Level.FINER, "Input data does not match schema 'MediaRequestDto'", e); - } - - // deserialize TextRequestDto - try { - boolean attemptParsing = true; - // ensure that we respect type coercion as set on the client ObjectMapper - if (TextRequestDto.class.equals(Integer.class) - || TextRequestDto.class.equals(Long.class) - || TextRequestDto.class.equals(Float.class) - || TextRequestDto.class.equals(Double.class) - || TextRequestDto.class.equals(Boolean.class) - || TextRequestDto.class.equals(String.class)) { - attemptParsing = typeCoercion; - if (!attemptParsing) { - attemptParsing |= - ((TextRequestDto.class.equals(Integer.class) - || TextRequestDto.class.equals(Long.class)) - && token == JsonToken.VALUE_NUMBER_INT); - attemptParsing |= - ((TextRequestDto.class.equals(Float.class) - || TextRequestDto.class.equals(Double.class)) - && token == JsonToken.VALUE_NUMBER_FLOAT); - attemptParsing |= - (TextRequestDto.class.equals(Boolean.class) - && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); - attemptParsing |= - (TextRequestDto.class.equals(String.class) && token == JsonToken.VALUE_STRING); - } - } - if (attemptParsing) { - deserialized = tree.traverse(jp.getCodec()).readValueAs(TextRequestDto.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 'TextRequestDto'"); - } - } catch (Exception e) { - // deserialization failed, continue - log.log(Level.FINER, "Input data does not match schema 'TextRequestDto'", e); - } - - if (match == 1) { - SendSMSRequestDto ret = new SendSMSRequestDto(); - ret.setActualInstance(deserialized); - return ret; - } - throw new IOException( - String.format( - "Failed deserialization for SendSMSRequestDto: %d classes match result, expected 1", - match)); - } - - /** Handle deserialization of the 'null' value. */ - @Override - public SendSMSRequestDto getNullValue(DeserializationContext ctxt) throws JsonMappingException { - throw new JsonMappingException(ctxt.getParser(), "SendSMSRequestDto cannot be null"); - } - } - - // store a list of schema names defined in oneOf - public static final Map> schemas = new HashMap<>(); - - public SendSMSRequestDto() { - super("oneOf", Boolean.FALSE); - } - - public SendSMSRequestDto(BinaryRequestDto o) { - super("oneOf", Boolean.FALSE); - setActualInstance(o); - } - - public SendSMSRequestDto(MediaRequestDto o) { - super("oneOf", Boolean.FALSE); - setActualInstance(o); - } - - public SendSMSRequestDto(TextRequestDto o) { - super("oneOf", Boolean.FALSE); - setActualInstance(o); - } - - static { - schemas.put("BinaryRequestDto", BinaryRequestDto.class); - schemas.put("MediaRequestDto", MediaRequestDto.class); - schemas.put("TextRequestDto", TextRequestDto.class); - JSONNavigator.registerDescendants( - SendSMSRequestDto.class, Collections.unmodifiableMap(schemas)); - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("BinaryRequest", BinaryRequestDto.class); - mappings.put("MediaRequest", MediaRequestDto.class); - mappings.put("TextRequest", TextRequestDto.class); - mappings.put("mt_binary", BinaryRequestDto.class); - mappings.put("mt_media", MediaRequestDto.class); - mappings.put("mt_text", TextRequestDto.class); - mappings.put("SendSMS_request", SendSMSRequestDto.class); - JSONNavigator.registerDiscriminator(SendSMSRequestDto.class, "type", mappings); - } - - @Override - public Map> getSchemas() { - return SendSMSRequestDto.schemas; - } - - /** - * Set the instance that matches the oneOf child schema, check the instance parameter is valid - * against the oneOf child schemas: BinaryRequestDto, MediaRequestDto, TextRequestDto - * - *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a - * composed schema (allOf, anyOf, oneOf). - */ - @Override - public void setActualInstance(Object instance) { - if (JSONNavigator.isInstanceOf(BinaryRequestDto.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - - if (JSONNavigator.isInstanceOf(MediaRequestDto.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - - if (JSONNavigator.isInstanceOf(TextRequestDto.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - - throw new RuntimeException( - "Invalid instance type. Must be BinaryRequestDto, MediaRequestDto, TextRequestDto"); - } - - /** - * Get the actual instance, which can be the following: BinaryRequestDto, MediaRequestDto, - * TextRequestDto - * - * @return The actual instance (BinaryRequestDto, MediaRequestDto, TextRequestDto) - */ - @Override - public Object getActualInstance() { - return super.getActualInstance(); - } - - /** - * Get the actual instance of `BinaryRequestDto`. If the actual instance is not - * `BinaryRequestDto`, the ClassCastException will be thrown. - * - * @return The actual instance of `BinaryRequestDto` - * @throws ClassCastException if the instance is not `BinaryRequestDto` - */ - public BinaryRequestDto getBinaryRequestDto() throws ClassCastException { - return (BinaryRequestDto) super.getActualInstance(); - } - - /** - * Get the actual instance of `MediaRequestDto`. If the actual instance is not `MediaRequestDto`, - * the ClassCastException will be thrown. - * - * @return The actual instance of `MediaRequestDto` - * @throws ClassCastException if the instance is not `MediaRequestDto` - */ - public MediaRequestDto getMediaRequestDto() throws ClassCastException { - return (MediaRequestDto) super.getActualInstance(); - } - - /** - * Get the actual instance of `TextRequestDto`. If the actual instance is not `TextRequestDto`, - * the ClassCastException will be thrown. - * - * @return The actual instance of `TextRequestDto` - * @throws ClassCastException if the instance is not `TextRequestDto` - */ - public TextRequestDto getTextRequestDto() throws ClassCastException { - return (TextRequestDto) super.getActualInstance(); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/TextRequestDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/TextRequestDto.java deleted file mode 100644 index 168674d7b..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/TextRequestDto.java +++ /dev/null @@ -1,724 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonValue; -import java.time.OffsetDateTime; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** TextRequestDto */ -@JsonPropertyOrder({ - TextRequestDto.JSON_PROPERTY_TO, - TextRequestDto.JSON_PROPERTY_BODY, - TextRequestDto.JSON_PROPERTY_FROM, - TextRequestDto.JSON_PROPERTY_PARAMETERS, - TextRequestDto.JSON_PROPERTY_TYPE, - TextRequestDto.JSON_PROPERTY_DELIVERY_REPORT, - TextRequestDto.JSON_PROPERTY_SEND_AT, - TextRequestDto.JSON_PROPERTY_EXPIRE_AT, - TextRequestDto.JSON_PROPERTY_CALLBACK_URL, - TextRequestDto.JSON_PROPERTY_CLIENT_REFERENCE, - TextRequestDto.JSON_PROPERTY_FEEDBACK_ENABLED, - TextRequestDto.JSON_PROPERTY_FLASH_MESSAGE, - TextRequestDto.JSON_PROPERTY_TRUNCATE_CONCAT, - TextRequestDto.JSON_PROPERTY_MAX_NUMBER_OF_MESSAGE_PARTS, - TextRequestDto.JSON_PROPERTY_FROM_TON, - TextRequestDto.JSON_PROPERTY_FROM_NPI -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class TextRequestDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_TO = "to"; - private List to; - private boolean toDefined = false; - - public static final String JSON_PROPERTY_BODY = "body"; - private String body; - private boolean bodyDefined = false; - - public static final String JSON_PROPERTY_FROM = "from"; - private String from; - private boolean fromDefined = false; - - public static final String JSON_PROPERTY_PARAMETERS = "parameters"; - private ParameterObjDto parameters; - private boolean parametersDefined = false; - - /** Regular SMS */ - public enum TypeEnum { - MT_TEXT("mt_text"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - TypeEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static TypeEnum fromValue(String value) { - for (TypeEnum b : TypeEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_TYPE = "type"; - private String type; - private boolean typeDefined = false; - - public static final String JSON_PROPERTY_DELIVERY_REPORT = "delivery_report"; - private String deliveryReport; - private boolean deliveryReportDefined = false; - - public static final String JSON_PROPERTY_SEND_AT = "send_at"; - private OffsetDateTime sendAt; - private boolean sendAtDefined = false; - - public static final String JSON_PROPERTY_EXPIRE_AT = "expire_at"; - private OffsetDateTime expireAt; - private boolean expireAtDefined = false; - - public static final String JSON_PROPERTY_CALLBACK_URL = "callback_url"; - private String callbackUrl; - private boolean callbackUrlDefined = false; - - public static final String JSON_PROPERTY_CLIENT_REFERENCE = "client_reference"; - private String clientReference; - private boolean clientReferenceDefined = false; - - public static final String JSON_PROPERTY_FEEDBACK_ENABLED = "feedback_enabled"; - private Boolean feedbackEnabled; - private boolean feedbackEnabledDefined = false; - - public static final String JSON_PROPERTY_FLASH_MESSAGE = "flash_message"; - private Boolean flashMessage; - private boolean flashMessageDefined = false; - - public static final String JSON_PROPERTY_TRUNCATE_CONCAT = "truncate_concat"; - private Boolean truncateConcat; - private boolean truncateConcatDefined = false; - - public static final String JSON_PROPERTY_MAX_NUMBER_OF_MESSAGE_PARTS = - "max_number_of_message_parts"; - private Integer maxNumberOfMessageParts; - private boolean maxNumberOfMessagePartsDefined = false; - - public static final String JSON_PROPERTY_FROM_TON = "from_ton"; - private Integer fromTon; - private boolean fromTonDefined = false; - - public static final String JSON_PROPERTY_FROM_NPI = "from_npi"; - private Integer fromNpi; - private boolean fromNpiDefined = false; - - public TextRequestDto() {} - - public TextRequestDto to(List to) { - this.to = to; - this.toDefined = true; - return this; - } - - public TextRequestDto addToItem(String toItem) { - if (this.to == null) { - this.to = new ArrayList<>(); - } - this.toDefined = true; - this.to.add(toItem); - return this; - } - - /** - * List of Phone numbers and group IDs that will receive the batch. <a - * href=\"https://community.sinch.com/t5/Glossary/MSISDN/ta-p/7628\" - * target=\"_blank\">More info</a> - * - * @return to - */ - @JsonProperty(JSON_PROPERTY_TO) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public List getTo() { - return to; - } - - @JsonIgnore - public boolean getToDefined() { - return toDefined; - } - - @JsonProperty(JSON_PROPERTY_TO) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setTo(List to) { - this.to = to; - this.toDefined = true; - } - - public TextRequestDto body(String body) { - this.body = body; - this.bodyDefined = true; - return this; - } - - /** - * The message content - * - * @return body - */ - @JsonProperty(JSON_PROPERTY_BODY) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getBody() { - return body; - } - - @JsonIgnore - public boolean getBodyDefined() { - return bodyDefined; - } - - @JsonProperty(JSON_PROPERTY_BODY) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setBody(String body) { - this.body = body; - this.bodyDefined = true; - } - - public TextRequestDto from(String from) { - this.from = from; - this.fromDefined = true; - return this; - } - - /** - * Sender number. Must be valid phone number, short code or alphanumeric. Required if Automatic - * Default Originator not configured. - * - * @return from - */ - @JsonProperty(JSON_PROPERTY_FROM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getFrom() { - return from; - } - - @JsonIgnore - public boolean getFromDefined() { - return fromDefined; - } - - @JsonProperty(JSON_PROPERTY_FROM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setFrom(String from) { - this.from = from; - this.fromDefined = true; - } - - public TextRequestDto parameters(ParameterObjDto parameters) { - this.parameters = parameters; - this.parametersDefined = true; - return this; - } - - /** - * Get parameters - * - * @return parameters - */ - @JsonProperty(JSON_PROPERTY_PARAMETERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public ParameterObjDto getParameters() { - return parameters; - } - - @JsonIgnore - public boolean getParametersDefined() { - return parametersDefined; - } - - @JsonProperty(JSON_PROPERTY_PARAMETERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setParameters(ParameterObjDto parameters) { - this.parameters = parameters; - this.parametersDefined = true; - } - - public TextRequestDto type(String type) { - this.type = type; - this.typeDefined = true; - return this; - } - - /** - * Regular SMS - * - * @return type - */ - @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getType() { - return type; - } - - @JsonIgnore - public boolean getTypeDefined() { - return typeDefined; - } - - @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setType(String type) { - this.type = type; - this.typeDefined = true; - } - - public TextRequestDto deliveryReport(String deliveryReport) { - this.deliveryReport = deliveryReport; - this.deliveryReportDefined = true; - return this; - } - - /** - * Request delivery report callback. Note that delivery reports can be fetched from the API - * regardless of this setting. - * - * @return deliveryReport - */ - @JsonProperty(JSON_PROPERTY_DELIVERY_REPORT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getDeliveryReport() { - return deliveryReport; - } - - @JsonIgnore - public boolean getDeliveryReportDefined() { - return deliveryReportDefined; - } - - @JsonProperty(JSON_PROPERTY_DELIVERY_REPORT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDeliveryReport(String deliveryReport) { - this.deliveryReport = deliveryReport; - this.deliveryReportDefined = true; - } - - public TextRequestDto sendAt(OffsetDateTime sendAt) { - this.sendAt = sendAt; - this.sendAtDefined = true; - return this; - } - - /** - * If set in the future, the message will be delayed until `send_at` occurs. Must be - * before `expire_at`. If set in the past, messages will be sent immediately. Formatted - * as [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601): `YYYY-MM-DDThh:mm:ss.SSSZ`. - * - * @return sendAt - */ - @JsonProperty(JSON_PROPERTY_SEND_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getSendAt() { - return sendAt; - } - - @JsonIgnore - public boolean getSendAtDefined() { - return sendAtDefined; - } - - @JsonProperty(JSON_PROPERTY_SEND_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setSendAt(OffsetDateTime sendAt) { - this.sendAt = sendAt; - this.sendAtDefined = true; - } - - public TextRequestDto expireAt(OffsetDateTime expireAt) { - this.expireAt = expireAt; - this.expireAtDefined = true; - return this; - } - - /** - * If set, the system will stop trying to deliver the message at this point. Must be after - * `send_at`. Default and max is 3 days after `send_at`. Formatted as - * [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601): `YYYY-MM-DDThh:mm:ss.SSSZ`. - * - * @return expireAt - */ - @JsonProperty(JSON_PROPERTY_EXPIRE_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getExpireAt() { - return expireAt; - } - - @JsonIgnore - public boolean getExpireAtDefined() { - return expireAtDefined; - } - - @JsonProperty(JSON_PROPERTY_EXPIRE_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setExpireAt(OffsetDateTime expireAt) { - this.expireAt = expireAt; - this.expireAtDefined = true; - } - - public TextRequestDto callbackUrl(String callbackUrl) { - this.callbackUrl = callbackUrl; - this.callbackUrlDefined = true; - return this; - } - - /** - * Override the *default* callback URL for this batch. Must be a valid URL. Learn how to set a - * default callback URL <a - * href=\"https://community.sinch.com/t5/SMS/How-do-I-assign-a-callback-URL-to-an-SMS-service-plan/ta-p/8414\" - * target=\"_blank\">here</a>. - * - * @return callbackUrl - */ - @JsonProperty(JSON_PROPERTY_CALLBACK_URL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCallbackUrl() { - return callbackUrl; - } - - @JsonIgnore - public boolean getCallbackUrlDefined() { - return callbackUrlDefined; - } - - @JsonProperty(JSON_PROPERTY_CALLBACK_URL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCallbackUrl(String callbackUrl) { - this.callbackUrl = callbackUrl; - this.callbackUrlDefined = true; - } - - public TextRequestDto clientReference(String clientReference) { - this.clientReference = clientReference; - this.clientReferenceDefined = true; - return this; - } - - /** - * The client identifier of a batch message. If set, the identifier will be added in the delivery - * report/callback of this batch - * - * @return clientReference - */ - @JsonProperty(JSON_PROPERTY_CLIENT_REFERENCE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getClientReference() { - return clientReference; - } - - @JsonIgnore - public boolean getClientReferenceDefined() { - return clientReferenceDefined; - } - - @JsonProperty(JSON_PROPERTY_CLIENT_REFERENCE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setClientReference(String clientReference) { - this.clientReference = clientReference; - this.clientReferenceDefined = true; - } - - public TextRequestDto feedbackEnabled(Boolean feedbackEnabled) { - this.feedbackEnabled = feedbackEnabled; - this.feedbackEnabledDefined = true; - return this; - } - - /** - * If set to `true`, then - * [feedback](/docs/sms/api-reference/sms/tag/Batches/#tag/Batches/operation/deliveryFeedback) is - * expected after successful delivery. - * - * @return feedbackEnabled - */ - @JsonProperty(JSON_PROPERTY_FEEDBACK_ENABLED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getFeedbackEnabled() { - return feedbackEnabled; - } - - @JsonIgnore - public boolean getFeedbackEnabledDefined() { - return feedbackEnabledDefined; - } - - @JsonProperty(JSON_PROPERTY_FEEDBACK_ENABLED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setFeedbackEnabled(Boolean feedbackEnabled) { - this.feedbackEnabled = feedbackEnabled; - this.feedbackEnabledDefined = true; - } - - public TextRequestDto flashMessage(Boolean flashMessage) { - this.flashMessage = flashMessage; - this.flashMessageDefined = true; - return this; - } - - /** - * Shows message on screen without user interaction while not saving the message to the inbox. - * - * @return flashMessage - */ - @JsonProperty(JSON_PROPERTY_FLASH_MESSAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getFlashMessage() { - return flashMessage; - } - - @JsonIgnore - public boolean getFlashMessageDefined() { - return flashMessageDefined; - } - - @JsonProperty(JSON_PROPERTY_FLASH_MESSAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setFlashMessage(Boolean flashMessage) { - this.flashMessage = flashMessage; - this.flashMessageDefined = true; - } - - public TextRequestDto truncateConcat(Boolean truncateConcat) { - this.truncateConcat = truncateConcat; - this.truncateConcatDefined = true; - return this; - } - - /** - * If set to `true` the message will be shortened when exceeding one part. - * - * @return truncateConcat - */ - @JsonProperty(JSON_PROPERTY_TRUNCATE_CONCAT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getTruncateConcat() { - return truncateConcat; - } - - @JsonIgnore - public boolean getTruncateConcatDefined() { - return truncateConcatDefined; - } - - @JsonProperty(JSON_PROPERTY_TRUNCATE_CONCAT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setTruncateConcat(Boolean truncateConcat) { - this.truncateConcat = truncateConcat; - this.truncateConcatDefined = true; - } - - public TextRequestDto maxNumberOfMessageParts(Integer maxNumberOfMessageParts) { - this.maxNumberOfMessageParts = maxNumberOfMessageParts; - this.maxNumberOfMessagePartsDefined = true; - return this; - } - - /** - * Message will be dispatched only if it is not split to more parts than Max Number of Message - * Parts minimum: 1 - * - * @return maxNumberOfMessageParts - */ - @JsonProperty(JSON_PROPERTY_MAX_NUMBER_OF_MESSAGE_PARTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getMaxNumberOfMessageParts() { - return maxNumberOfMessageParts; - } - - @JsonIgnore - public boolean getMaxNumberOfMessagePartsDefined() { - return maxNumberOfMessagePartsDefined; - } - - @JsonProperty(JSON_PROPERTY_MAX_NUMBER_OF_MESSAGE_PARTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setMaxNumberOfMessageParts(Integer maxNumberOfMessageParts) { - this.maxNumberOfMessageParts = maxNumberOfMessageParts; - this.maxNumberOfMessagePartsDefined = true; - } - - public TextRequestDto fromTon(Integer fromTon) { - this.fromTon = fromTon; - this.fromTonDefined = true; - return this; - } - - /** - * The type of number for the sender number. Use to override the automatic detection. minimum: 0 - * maximum: 6 - * - * @return fromTon - */ - @JsonProperty(JSON_PROPERTY_FROM_TON) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getFromTon() { - return fromTon; - } - - @JsonIgnore - public boolean getFromTonDefined() { - return fromTonDefined; - } - - @JsonProperty(JSON_PROPERTY_FROM_TON) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setFromTon(Integer fromTon) { - this.fromTon = fromTon; - this.fromTonDefined = true; - } - - public TextRequestDto fromNpi(Integer fromNpi) { - this.fromNpi = fromNpi; - this.fromNpiDefined = true; - return this; - } - - /** - * Number Plan Indicator for the sender number. Use to override the automatic detection. minimum: - * 0 maximum: 18 - * - * @return fromNpi - */ - @JsonProperty(JSON_PROPERTY_FROM_NPI) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getFromNpi() { - return fromNpi; - } - - @JsonIgnore - public boolean getFromNpiDefined() { - return fromNpiDefined; - } - - @JsonProperty(JSON_PROPERTY_FROM_NPI) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setFromNpi(Integer fromNpi) { - this.fromNpi = fromNpi; - this.fromNpiDefined = true; - } - - /** Return true if this TextRequest object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - TextRequestDto textRequest = (TextRequestDto) o; - return Objects.equals(this.to, textRequest.to) - && Objects.equals(this.body, textRequest.body) - && Objects.equals(this.from, textRequest.from) - && Objects.equals(this.parameters, textRequest.parameters) - && Objects.equals(this.type, textRequest.type) - && Objects.equals(this.deliveryReport, textRequest.deliveryReport) - && Objects.equals(this.sendAt, textRequest.sendAt) - && Objects.equals(this.expireAt, textRequest.expireAt) - && Objects.equals(this.callbackUrl, textRequest.callbackUrl) - && Objects.equals(this.clientReference, textRequest.clientReference) - && Objects.equals(this.feedbackEnabled, textRequest.feedbackEnabled) - && Objects.equals(this.flashMessage, textRequest.flashMessage) - && Objects.equals(this.truncateConcat, textRequest.truncateConcat) - && Objects.equals(this.maxNumberOfMessageParts, textRequest.maxNumberOfMessageParts) - && Objects.equals(this.fromTon, textRequest.fromTon) - && Objects.equals(this.fromNpi, textRequest.fromNpi); - } - - @Override - public int hashCode() { - return Objects.hash( - to, - body, - from, - parameters, - type, - deliveryReport, - sendAt, - expireAt, - callbackUrl, - clientReference, - feedbackEnabled, - flashMessage, - truncateConcat, - maxNumberOfMessageParts, - fromTon, - fromNpi); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class TextRequestDto {\n"); - sb.append(" to: ").append(toIndentedString(to)).append("\n"); - sb.append(" body: ").append(toIndentedString(body)).append("\n"); - sb.append(" from: ").append(toIndentedString(from)).append("\n"); - sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" deliveryReport: ").append(toIndentedString(deliveryReport)).append("\n"); - sb.append(" sendAt: ").append(toIndentedString(sendAt)).append("\n"); - sb.append(" expireAt: ").append(toIndentedString(expireAt)).append("\n"); - sb.append(" callbackUrl: ").append(toIndentedString(callbackUrl)).append("\n"); - sb.append(" clientReference: ").append(toIndentedString(clientReference)).append("\n"); - sb.append(" feedbackEnabled: ").append(toIndentedString(feedbackEnabled)).append("\n"); - sb.append(" flashMessage: ").append(toIndentedString(flashMessage)).append("\n"); - sb.append(" truncateConcat: ").append(toIndentedString(truncateConcat)).append("\n"); - sb.append(" maxNumberOfMessageParts: ") - .append(toIndentedString(maxNumberOfMessageParts)) - .append("\n"); - sb.append(" fromTon: ").append(toIndentedString(fromTon)).append("\n"); - sb.append(" fromNpi: ").append(toIndentedString(fromNpi)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/TextResponseDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/TextResponseDto.java deleted file mode 100644 index ccb4671fa..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/TextResponseDto.java +++ /dev/null @@ -1,825 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonValue; -import java.time.OffsetDateTime; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** TextResponseDto */ -@JsonPropertyOrder({ - TextResponseDto.JSON_PROPERTY_ID, - TextResponseDto.JSON_PROPERTY_TO, - TextResponseDto.JSON_PROPERTY_FROM, - TextResponseDto.JSON_PROPERTY_CANCELED, - TextResponseDto.JSON_PROPERTY_PARAMETERS, - TextResponseDto.JSON_PROPERTY_BODY, - TextResponseDto.JSON_PROPERTY_TYPE, - TextResponseDto.JSON_PROPERTY_CREATED_AT, - TextResponseDto.JSON_PROPERTY_MODIFIED_AT, - TextResponseDto.JSON_PROPERTY_DELIVERY_REPORT, - TextResponseDto.JSON_PROPERTY_SEND_AT, - TextResponseDto.JSON_PROPERTY_EXPIRE_AT, - TextResponseDto.JSON_PROPERTY_CALLBACK_URL, - TextResponseDto.JSON_PROPERTY_CLIENT_REFERENCE, - TextResponseDto.JSON_PROPERTY_FEEDBACK_ENABLED, - TextResponseDto.JSON_PROPERTY_FLASH_MESSAGE, - TextResponseDto.JSON_PROPERTY_TRUNCATE_CONCAT, - TextResponseDto.JSON_PROPERTY_MAX_NUMBER_OF_MESSAGE_PARTS, - TextResponseDto.JSON_PROPERTY_FROM_TON, - TextResponseDto.JSON_PROPERTY_FROM_NPI -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class TextResponseDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_ID = "id"; - private String id; - private boolean idDefined = false; - - public static final String JSON_PROPERTY_TO = "to"; - private List to; - private boolean toDefined = false; - - public static final String JSON_PROPERTY_FROM = "from"; - private String from; - private boolean fromDefined = false; - - public static final String JSON_PROPERTY_CANCELED = "canceled"; - private Boolean canceled; - private boolean canceledDefined = false; - - public static final String JSON_PROPERTY_PARAMETERS = "parameters"; - private ParameterObjDto parameters; - private boolean parametersDefined = false; - - public static final String JSON_PROPERTY_BODY = "body"; - private String body; - private boolean bodyDefined = false; - - /** Regular SMS */ - public enum TypeEnum { - MT_TEXT("mt_text"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - TypeEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static TypeEnum fromValue(String value) { - for (TypeEnum b : TypeEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_TYPE = "type"; - private String type; - private boolean typeDefined = false; - - public static final String JSON_PROPERTY_CREATED_AT = "created_at"; - private OffsetDateTime createdAt; - private boolean createdAtDefined = false; - - public static final String JSON_PROPERTY_MODIFIED_AT = "modified_at"; - private OffsetDateTime modifiedAt; - private boolean modifiedAtDefined = false; - - public static final String JSON_PROPERTY_DELIVERY_REPORT = "delivery_report"; - private String deliveryReport; - private boolean deliveryReportDefined = false; - - public static final String JSON_PROPERTY_SEND_AT = "send_at"; - private OffsetDateTime sendAt; - private boolean sendAtDefined = false; - - public static final String JSON_PROPERTY_EXPIRE_AT = "expire_at"; - private OffsetDateTime expireAt; - private boolean expireAtDefined = false; - - public static final String JSON_PROPERTY_CALLBACK_URL = "callback_url"; - private String callbackUrl; - private boolean callbackUrlDefined = false; - - public static final String JSON_PROPERTY_CLIENT_REFERENCE = "client_reference"; - private String clientReference; - private boolean clientReferenceDefined = false; - - public static final String JSON_PROPERTY_FEEDBACK_ENABLED = "feedback_enabled"; - private Boolean feedbackEnabled; - private boolean feedbackEnabledDefined = false; - - public static final String JSON_PROPERTY_FLASH_MESSAGE = "flash_message"; - private Boolean flashMessage; - private boolean flashMessageDefined = false; - - public static final String JSON_PROPERTY_TRUNCATE_CONCAT = "truncate_concat"; - private Boolean truncateConcat; - private boolean truncateConcatDefined = false; - - public static final String JSON_PROPERTY_MAX_NUMBER_OF_MESSAGE_PARTS = - "max_number_of_message_parts"; - private Integer maxNumberOfMessageParts; - private boolean maxNumberOfMessagePartsDefined = false; - - public static final String JSON_PROPERTY_FROM_TON = "from_ton"; - private Integer fromTon; - private boolean fromTonDefined = false; - - public static final String JSON_PROPERTY_FROM_NPI = "from_npi"; - private Integer fromNpi; - private boolean fromNpiDefined = false; - - public TextResponseDto() {} - - @JsonCreator - public TextResponseDto( - @JsonProperty(JSON_PROPERTY_ID) String id, - @JsonProperty(JSON_PROPERTY_CANCELED) Boolean canceled, - @JsonProperty(JSON_PROPERTY_TYPE) String type, - @JsonProperty(JSON_PROPERTY_CREATED_AT) OffsetDateTime createdAt, - @JsonProperty(JSON_PROPERTY_MODIFIED_AT) OffsetDateTime modifiedAt) { - this(); - this.id = id; - this.idDefined = true; - this.canceled = canceled; - this.canceledDefined = true; - this.type = type; - this.typeDefined = true; - this.createdAt = createdAt; - this.createdAtDefined = true; - this.modifiedAt = modifiedAt; - this.modifiedAtDefined = true; - } - - /** - * Unique identifier for batch - * - * @return id - */ - @JsonProperty(JSON_PROPERTY_ID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getId() { - return id; - } - - @JsonIgnore - public boolean getIdDefined() { - return idDefined; - } - - public TextResponseDto to(List to) { - this.to = to; - this.toDefined = true; - return this; - } - - public TextResponseDto addToItem(String toItem) { - if (this.to == null) { - this.to = new ArrayList<>(); - } - this.toDefined = true; - this.to.add(toItem); - return this; - } - - /** - * List of Phone numbers and group IDs that will receive the batch. [More - * info](https://community.sinch.com/t5/Glossary/MSISDN/ta-p/7628) - * - * @return to - */ - @JsonProperty(JSON_PROPERTY_TO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List getTo() { - return to; - } - - @JsonIgnore - public boolean getToDefined() { - return toDefined; - } - - @JsonProperty(JSON_PROPERTY_TO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setTo(List to) { - this.to = to; - this.toDefined = true; - } - - public TextResponseDto from(String from) { - this.from = from; - this.fromDefined = true; - return this; - } - - /** - * Sender number. Must be valid phone number, short code or alphanumeric. Required if Automatic - * Default Originator not configured. - * - * @return from - */ - @JsonProperty(JSON_PROPERTY_FROM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getFrom() { - return from; - } - - @JsonIgnore - public boolean getFromDefined() { - return fromDefined; - } - - @JsonProperty(JSON_PROPERTY_FROM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setFrom(String from) { - this.from = from; - this.fromDefined = true; - } - - /** - * Indicates if the batch has been canceled or not. - * - * @return canceled - */ - @JsonProperty(JSON_PROPERTY_CANCELED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getCanceled() { - return canceled; - } - - @JsonIgnore - public boolean getCanceledDefined() { - return canceledDefined; - } - - public TextResponseDto parameters(ParameterObjDto parameters) { - this.parameters = parameters; - this.parametersDefined = true; - return this; - } - - /** - * Get parameters - * - * @return parameters - */ - @JsonProperty(JSON_PROPERTY_PARAMETERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public ParameterObjDto getParameters() { - return parameters; - } - - @JsonIgnore - public boolean getParametersDefined() { - return parametersDefined; - } - - @JsonProperty(JSON_PROPERTY_PARAMETERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setParameters(ParameterObjDto parameters) { - this.parameters = parameters; - this.parametersDefined = true; - } - - public TextResponseDto body(String body) { - this.body = body; - this.bodyDefined = true; - return this; - } - - /** - * The message content - * - * @return body - */ - @JsonProperty(JSON_PROPERTY_BODY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getBody() { - return body; - } - - @JsonIgnore - public boolean getBodyDefined() { - return bodyDefined; - } - - @JsonProperty(JSON_PROPERTY_BODY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setBody(String body) { - this.body = body; - this.bodyDefined = true; - } - - /** - * Regular SMS - * - * @return type - */ - @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getType() { - return type; - } - - @JsonIgnore - public boolean getTypeDefined() { - return typeDefined; - } - - /** - * Timestamp for when batch was created. Formatted as - * [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601):`YYYY-MM-DDThh:mm:ss.SSSZ`. - * - * @return createdAt - */ - @JsonProperty(JSON_PROPERTY_CREATED_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - @JsonIgnore - public boolean getCreatedAtDefined() { - return createdAtDefined; - } - - /** - * Timestamp for when batch was last updated. Formatted as - * [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601):`YYYY-MM-DDThh:mm:ss.SSSZ`. - * - * @return modifiedAt - */ - @JsonProperty(JSON_PROPERTY_MODIFIED_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getModifiedAt() { - return modifiedAt; - } - - @JsonIgnore - public boolean getModifiedAtDefined() { - return modifiedAtDefined; - } - - public TextResponseDto deliveryReport(String deliveryReport) { - this.deliveryReport = deliveryReport; - this.deliveryReportDefined = true; - return this; - } - - /** - * Request delivery report callback. Note that delivery reports can be fetched from the API - * regardless of this setting. - * - * @return deliveryReport - */ - @JsonProperty(JSON_PROPERTY_DELIVERY_REPORT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getDeliveryReport() { - return deliveryReport; - } - - @JsonIgnore - public boolean getDeliveryReportDefined() { - return deliveryReportDefined; - } - - @JsonProperty(JSON_PROPERTY_DELIVERY_REPORT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDeliveryReport(String deliveryReport) { - this.deliveryReport = deliveryReport; - this.deliveryReportDefined = true; - } - - public TextResponseDto sendAt(OffsetDateTime sendAt) { - this.sendAt = sendAt; - this.sendAtDefined = true; - return this; - } - - /** - * If set in the future, the message will be delayed until `send_at` occurs. Must be - * before `expire_at`. If set in the past, messages will be sent immediately. Formatted - * as [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601): `YYYY-MM-DDThh:mm:ss.SSSZ`. - * - * @return sendAt - */ - @JsonProperty(JSON_PROPERTY_SEND_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getSendAt() { - return sendAt; - } - - @JsonIgnore - public boolean getSendAtDefined() { - return sendAtDefined; - } - - @JsonProperty(JSON_PROPERTY_SEND_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setSendAt(OffsetDateTime sendAt) { - this.sendAt = sendAt; - this.sendAtDefined = true; - } - - public TextResponseDto expireAt(OffsetDateTime expireAt) { - this.expireAt = expireAt; - this.expireAtDefined = true; - return this; - } - - /** - * If set, the system will stop trying to deliver the message at this point. Must be after - * `send_at`. Default and max is 3 days after `send_at`. Formatted as - * [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601): `YYYY-MM-DDThh:mm:ss.SSSZ`. - * - * @return expireAt - */ - @JsonProperty(JSON_PROPERTY_EXPIRE_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getExpireAt() { - return expireAt; - } - - @JsonIgnore - public boolean getExpireAtDefined() { - return expireAtDefined; - } - - @JsonProperty(JSON_PROPERTY_EXPIRE_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setExpireAt(OffsetDateTime expireAt) { - this.expireAt = expireAt; - this.expireAtDefined = true; - } - - public TextResponseDto callbackUrl(String callbackUrl) { - this.callbackUrl = callbackUrl; - this.callbackUrlDefined = true; - return this; - } - - /** - * Override the default callback URL for this batch. Must be valid URL. - * - * @return callbackUrl - */ - @JsonProperty(JSON_PROPERTY_CALLBACK_URL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCallbackUrl() { - return callbackUrl; - } - - @JsonIgnore - public boolean getCallbackUrlDefined() { - return callbackUrlDefined; - } - - @JsonProperty(JSON_PROPERTY_CALLBACK_URL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCallbackUrl(String callbackUrl) { - this.callbackUrl = callbackUrl; - this.callbackUrlDefined = true; - } - - public TextResponseDto clientReference(String clientReference) { - this.clientReference = clientReference; - this.clientReferenceDefined = true; - return this; - } - - /** - * The client identifier of a batch message. If set, the identifier will be added in the delivery - * report/callback of this batch - * - * @return clientReference - */ - @JsonProperty(JSON_PROPERTY_CLIENT_REFERENCE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getClientReference() { - return clientReference; - } - - @JsonIgnore - public boolean getClientReferenceDefined() { - return clientReferenceDefined; - } - - @JsonProperty(JSON_PROPERTY_CLIENT_REFERENCE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setClientReference(String clientReference) { - this.clientReference = clientReference; - this.clientReferenceDefined = true; - } - - public TextResponseDto feedbackEnabled(Boolean feedbackEnabled) { - this.feedbackEnabled = feedbackEnabled; - this.feedbackEnabledDefined = true; - return this; - } - - /** - * If set to `true`, then - * [feedback](/docs/sms/api-reference/sms/tag/Batches/#tag/Batches/operation/deliveryFeedback) is - * expected after successful delivery. - * - * @return feedbackEnabled - */ - @JsonProperty(JSON_PROPERTY_FEEDBACK_ENABLED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getFeedbackEnabled() { - return feedbackEnabled; - } - - @JsonIgnore - public boolean getFeedbackEnabledDefined() { - return feedbackEnabledDefined; - } - - @JsonProperty(JSON_PROPERTY_FEEDBACK_ENABLED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setFeedbackEnabled(Boolean feedbackEnabled) { - this.feedbackEnabled = feedbackEnabled; - this.feedbackEnabledDefined = true; - } - - public TextResponseDto flashMessage(Boolean flashMessage) { - this.flashMessage = flashMessage; - this.flashMessageDefined = true; - return this; - } - - /** - * Shows message on screen without user interaction while not saving the message to the inbox. - * - * @return flashMessage - */ - @JsonProperty(JSON_PROPERTY_FLASH_MESSAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getFlashMessage() { - return flashMessage; - } - - @JsonIgnore - public boolean getFlashMessageDefined() { - return flashMessageDefined; - } - - @JsonProperty(JSON_PROPERTY_FLASH_MESSAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setFlashMessage(Boolean flashMessage) { - this.flashMessage = flashMessage; - this.flashMessageDefined = true; - } - - public TextResponseDto truncateConcat(Boolean truncateConcat) { - this.truncateConcat = truncateConcat; - this.truncateConcatDefined = true; - return this; - } - - /** - * If set to `true` the message will be shortened when exceeding one part. - * - * @return truncateConcat - */ - @JsonProperty(JSON_PROPERTY_TRUNCATE_CONCAT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getTruncateConcat() { - return truncateConcat; - } - - @JsonIgnore - public boolean getTruncateConcatDefined() { - return truncateConcatDefined; - } - - @JsonProperty(JSON_PROPERTY_TRUNCATE_CONCAT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setTruncateConcat(Boolean truncateConcat) { - this.truncateConcat = truncateConcat; - this.truncateConcatDefined = true; - } - - public TextResponseDto maxNumberOfMessageParts(Integer maxNumberOfMessageParts) { - this.maxNumberOfMessageParts = maxNumberOfMessageParts; - this.maxNumberOfMessagePartsDefined = true; - return this; - } - - /** - * Message will be dispatched only if it is not split to more parts than Max Number of Message - * Parts minimum: 1 - * - * @return maxNumberOfMessageParts - */ - @JsonProperty(JSON_PROPERTY_MAX_NUMBER_OF_MESSAGE_PARTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getMaxNumberOfMessageParts() { - return maxNumberOfMessageParts; - } - - @JsonIgnore - public boolean getMaxNumberOfMessagePartsDefined() { - return maxNumberOfMessagePartsDefined; - } - - @JsonProperty(JSON_PROPERTY_MAX_NUMBER_OF_MESSAGE_PARTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setMaxNumberOfMessageParts(Integer maxNumberOfMessageParts) { - this.maxNumberOfMessageParts = maxNumberOfMessageParts; - this.maxNumberOfMessagePartsDefined = true; - } - - public TextResponseDto fromTon(Integer fromTon) { - this.fromTon = fromTon; - this.fromTonDefined = true; - return this; - } - - /** - * The type of number for the sender number. Use to override the automatic detection. minimum: 0 - * maximum: 6 - * - * @return fromTon - */ - @JsonProperty(JSON_PROPERTY_FROM_TON) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getFromTon() { - return fromTon; - } - - @JsonIgnore - public boolean getFromTonDefined() { - return fromTonDefined; - } - - @JsonProperty(JSON_PROPERTY_FROM_TON) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setFromTon(Integer fromTon) { - this.fromTon = fromTon; - this.fromTonDefined = true; - } - - public TextResponseDto fromNpi(Integer fromNpi) { - this.fromNpi = fromNpi; - this.fromNpiDefined = true; - return this; - } - - /** - * Number Plan Indicator for the sender number. Use to override the automatic detection. minimum: - * 0 maximum: 18 - * - * @return fromNpi - */ - @JsonProperty(JSON_PROPERTY_FROM_NPI) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getFromNpi() { - return fromNpi; - } - - @JsonIgnore - public boolean getFromNpiDefined() { - return fromNpiDefined; - } - - @JsonProperty(JSON_PROPERTY_FROM_NPI) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setFromNpi(Integer fromNpi) { - this.fromNpi = fromNpi; - this.fromNpiDefined = true; - } - - /** Return true if this TextResponse object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - TextResponseDto textResponse = (TextResponseDto) o; - return Objects.equals(this.id, textResponse.id) - && Objects.equals(this.to, textResponse.to) - && Objects.equals(this.from, textResponse.from) - && Objects.equals(this.canceled, textResponse.canceled) - && Objects.equals(this.parameters, textResponse.parameters) - && Objects.equals(this.body, textResponse.body) - && Objects.equals(this.type, textResponse.type) - && Objects.equals(this.createdAt, textResponse.createdAt) - && Objects.equals(this.modifiedAt, textResponse.modifiedAt) - && Objects.equals(this.deliveryReport, textResponse.deliveryReport) - && Objects.equals(this.sendAt, textResponse.sendAt) - && Objects.equals(this.expireAt, textResponse.expireAt) - && Objects.equals(this.callbackUrl, textResponse.callbackUrl) - && Objects.equals(this.clientReference, textResponse.clientReference) - && Objects.equals(this.feedbackEnabled, textResponse.feedbackEnabled) - && Objects.equals(this.flashMessage, textResponse.flashMessage) - && Objects.equals(this.truncateConcat, textResponse.truncateConcat) - && Objects.equals(this.maxNumberOfMessageParts, textResponse.maxNumberOfMessageParts) - && Objects.equals(this.fromTon, textResponse.fromTon) - && Objects.equals(this.fromNpi, textResponse.fromNpi); - } - - @Override - public int hashCode() { - return Objects.hash( - id, - to, - from, - canceled, - parameters, - body, - type, - createdAt, - modifiedAt, - deliveryReport, - sendAt, - expireAt, - callbackUrl, - clientReference, - feedbackEnabled, - flashMessage, - truncateConcat, - maxNumberOfMessageParts, - fromTon, - fromNpi); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class TextResponseDto {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" to: ").append(toIndentedString(to)).append("\n"); - sb.append(" from: ").append(toIndentedString(from)).append("\n"); - sb.append(" canceled: ").append(toIndentedString(canceled)).append("\n"); - sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); - sb.append(" body: ").append(toIndentedString(body)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); - sb.append(" modifiedAt: ").append(toIndentedString(modifiedAt)).append("\n"); - sb.append(" deliveryReport: ").append(toIndentedString(deliveryReport)).append("\n"); - sb.append(" sendAt: ").append(toIndentedString(sendAt)).append("\n"); - sb.append(" expireAt: ").append(toIndentedString(expireAt)).append("\n"); - sb.append(" callbackUrl: ").append(toIndentedString(callbackUrl)).append("\n"); - sb.append(" clientReference: ").append(toIndentedString(clientReference)).append("\n"); - sb.append(" feedbackEnabled: ").append(toIndentedString(feedbackEnabled)).append("\n"); - sb.append(" flashMessage: ").append(toIndentedString(flashMessage)).append("\n"); - sb.append(" truncateConcat: ").append(toIndentedString(truncateConcat)).append("\n"); - sb.append(" maxNumberOfMessageParts: ") - .append(toIndentedString(maxNumberOfMessageParts)) - .append("\n"); - sb.append(" fromTon: ").append(toIndentedString(fromTon)).append("\n"); - sb.append(" fromNpi: ").append(toIndentedString(fromNpi)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/UpdateBatchMessageRequestDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/UpdateBatchMessageRequestDto.java deleted file mode 100644 index ba713b132..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/UpdateBatchMessageRequestDto.java +++ /dev/null @@ -1,395 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.MapperFeature; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.deser.std.StdDeserializer; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; -import com.sinch.sdk.core.models.AbstractOpenApiSchema; -import com.sinch.sdk.core.utils.databind.JSONNavigator; -import java.io.IOException; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; - -@JsonDeserialize( - using = UpdateBatchMessageRequestDto.UpdateBatchMessageRequestDtoDeserializer.class) -@JsonSerialize(using = UpdateBatchMessageRequestDto.UpdateBatchMessageRequestDtoSerializer.class) -public final class UpdateBatchMessageRequestDto extends AbstractOpenApiSchema { - private static final Logger log = Logger.getLogger(UpdateBatchMessageRequestDto.class.getName()); - - public static final class UpdateBatchMessageRequestDtoSerializer - extends StdSerializer { - private static final long serialVersionUID = 1L; - - public UpdateBatchMessageRequestDtoSerializer(Class t) { - super(t); - } - - public UpdateBatchMessageRequestDtoSerializer() { - this(null); - } - - @Override - public void serialize( - UpdateBatchMessageRequestDto value, JsonGenerator jgen, SerializerProvider provider) - throws IOException, JsonProcessingException { - jgen.writeObject(value.getActualInstance()); - } - } - - public static final class UpdateBatchMessageRequestDtoDeserializer - extends StdDeserializer { - - private static final long serialVersionUID = 1L; - - public UpdateBatchMessageRequestDtoDeserializer() { - this(UpdateBatchMessageRequestDto.class); - } - - public UpdateBatchMessageRequestDtoDeserializer(Class vc) { - super(vc); - } - - @Override - public UpdateBatchMessageRequestDto deserialize(JsonParser jp, DeserializationContext ctxt) - throws IOException, JsonProcessingException { - JsonNode tree = jp.readValueAsTree(); - Object deserialized = null; - UpdateBatchMessageRequestDto newUpdateBatchMessageRequestDto = - new UpdateBatchMessageRequestDto(); - Map result2 = - tree.traverse(jp.getCodec()).readValueAs(new TypeReference>() {}); - String discriminatorValue = (String) result2.get("type"); - switch (discriminatorValue) { - case "ApiUpdateBinaryMtMessage": - deserialized = - tree.traverse(jp.getCodec()).readValueAs(ApiUpdateBinaryMtMessageDto.class); - newUpdateBatchMessageRequestDto.setActualInstance(deserialized); - return newUpdateBatchMessageRequestDto; - case "ApiUpdateMmsMtMessage": - deserialized = tree.traverse(jp.getCodec()).readValueAs(ApiUpdateMmsMtMessageDto.class); - newUpdateBatchMessageRequestDto.setActualInstance(deserialized); - return newUpdateBatchMessageRequestDto; - case "ApiUpdateTextMtMessage": - deserialized = tree.traverse(jp.getCodec()).readValueAs(ApiUpdateTextMtMessageDto.class); - newUpdateBatchMessageRequestDto.setActualInstance(deserialized); - return newUpdateBatchMessageRequestDto; - case "mt_binary": - deserialized = - tree.traverse(jp.getCodec()).readValueAs(ApiUpdateBinaryMtMessageDto.class); - newUpdateBatchMessageRequestDto.setActualInstance(deserialized); - return newUpdateBatchMessageRequestDto; - case "mt_media": - deserialized = tree.traverse(jp.getCodec()).readValueAs(ApiUpdateMmsMtMessageDto.class); - newUpdateBatchMessageRequestDto.setActualInstance(deserialized); - return newUpdateBatchMessageRequestDto; - case "mt_text": - deserialized = tree.traverse(jp.getCodec()).readValueAs(ApiUpdateTextMtMessageDto.class); - newUpdateBatchMessageRequestDto.setActualInstance(deserialized); - return newUpdateBatchMessageRequestDto; - default: - log.log( - Level.WARNING, - String.format( - "Failed to lookup discriminator value `%s` for UpdateBatchMessageRequestDto." - + " Possible values: ApiUpdateBinaryMtMessage ApiUpdateMmsMtMessage" - + " ApiUpdateTextMtMessage mt_binary mt_media mt_text", - discriminatorValue)); - } - - boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); - int match = 0; - JsonToken token = tree.traverse(jp.getCodec()).nextToken(); - // deserialize ApiUpdateBinaryMtMessageDto - try { - boolean attemptParsing = true; - // ensure that we respect type coercion as set on the client ObjectMapper - if (ApiUpdateBinaryMtMessageDto.class.equals(Integer.class) - || ApiUpdateBinaryMtMessageDto.class.equals(Long.class) - || ApiUpdateBinaryMtMessageDto.class.equals(Float.class) - || ApiUpdateBinaryMtMessageDto.class.equals(Double.class) - || ApiUpdateBinaryMtMessageDto.class.equals(Boolean.class) - || ApiUpdateBinaryMtMessageDto.class.equals(String.class)) { - attemptParsing = typeCoercion; - if (!attemptParsing) { - attemptParsing |= - ((ApiUpdateBinaryMtMessageDto.class.equals(Integer.class) - || ApiUpdateBinaryMtMessageDto.class.equals(Long.class)) - && token == JsonToken.VALUE_NUMBER_INT); - attemptParsing |= - ((ApiUpdateBinaryMtMessageDto.class.equals(Float.class) - || ApiUpdateBinaryMtMessageDto.class.equals(Double.class)) - && token == JsonToken.VALUE_NUMBER_FLOAT); - attemptParsing |= - (ApiUpdateBinaryMtMessageDto.class.equals(Boolean.class) - && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); - attemptParsing |= - (ApiUpdateBinaryMtMessageDto.class.equals(String.class) - && token == JsonToken.VALUE_STRING); - } - } - if (attemptParsing) { - deserialized = - tree.traverse(jp.getCodec()).readValueAs(ApiUpdateBinaryMtMessageDto.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 'ApiUpdateBinaryMtMessageDto'"); - } - } catch (Exception e) { - // deserialization failed, continue - log.log(Level.FINER, "Input data does not match schema 'ApiUpdateBinaryMtMessageDto'", e); - } - - // deserialize ApiUpdateMmsMtMessageDto - try { - boolean attemptParsing = true; - // ensure that we respect type coercion as set on the client ObjectMapper - if (ApiUpdateMmsMtMessageDto.class.equals(Integer.class) - || ApiUpdateMmsMtMessageDto.class.equals(Long.class) - || ApiUpdateMmsMtMessageDto.class.equals(Float.class) - || ApiUpdateMmsMtMessageDto.class.equals(Double.class) - || ApiUpdateMmsMtMessageDto.class.equals(Boolean.class) - || ApiUpdateMmsMtMessageDto.class.equals(String.class)) { - attemptParsing = typeCoercion; - if (!attemptParsing) { - attemptParsing |= - ((ApiUpdateMmsMtMessageDto.class.equals(Integer.class) - || ApiUpdateMmsMtMessageDto.class.equals(Long.class)) - && token == JsonToken.VALUE_NUMBER_INT); - attemptParsing |= - ((ApiUpdateMmsMtMessageDto.class.equals(Float.class) - || ApiUpdateMmsMtMessageDto.class.equals(Double.class)) - && token == JsonToken.VALUE_NUMBER_FLOAT); - attemptParsing |= - (ApiUpdateMmsMtMessageDto.class.equals(Boolean.class) - && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); - attemptParsing |= - (ApiUpdateMmsMtMessageDto.class.equals(String.class) - && token == JsonToken.VALUE_STRING); - } - } - if (attemptParsing) { - deserialized = tree.traverse(jp.getCodec()).readValueAs(ApiUpdateMmsMtMessageDto.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 'ApiUpdateMmsMtMessageDto'"); - } - } catch (Exception e) { - // deserialization failed, continue - log.log(Level.FINER, "Input data does not match schema 'ApiUpdateMmsMtMessageDto'", e); - } - - // deserialize ApiUpdateTextMtMessageDto - try { - boolean attemptParsing = true; - // ensure that we respect type coercion as set on the client ObjectMapper - if (ApiUpdateTextMtMessageDto.class.equals(Integer.class) - || ApiUpdateTextMtMessageDto.class.equals(Long.class) - || ApiUpdateTextMtMessageDto.class.equals(Float.class) - || ApiUpdateTextMtMessageDto.class.equals(Double.class) - || ApiUpdateTextMtMessageDto.class.equals(Boolean.class) - || ApiUpdateTextMtMessageDto.class.equals(String.class)) { - attemptParsing = typeCoercion; - if (!attemptParsing) { - attemptParsing |= - ((ApiUpdateTextMtMessageDto.class.equals(Integer.class) - || ApiUpdateTextMtMessageDto.class.equals(Long.class)) - && token == JsonToken.VALUE_NUMBER_INT); - attemptParsing |= - ((ApiUpdateTextMtMessageDto.class.equals(Float.class) - || ApiUpdateTextMtMessageDto.class.equals(Double.class)) - && token == JsonToken.VALUE_NUMBER_FLOAT); - attemptParsing |= - (ApiUpdateTextMtMessageDto.class.equals(Boolean.class) - && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); - attemptParsing |= - (ApiUpdateTextMtMessageDto.class.equals(String.class) - && token == JsonToken.VALUE_STRING); - } - } - if (attemptParsing) { - deserialized = tree.traverse(jp.getCodec()).readValueAs(ApiUpdateTextMtMessageDto.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 'ApiUpdateTextMtMessageDto'"); - } - } catch (Exception e) { - // deserialization failed, continue - log.log(Level.FINER, "Input data does not match schema 'ApiUpdateTextMtMessageDto'", e); - } - - if (match == 1) { - UpdateBatchMessageRequestDto ret = new UpdateBatchMessageRequestDto(); - ret.setActualInstance(deserialized); - return ret; - } - throw new IOException( - String.format( - "Failed deserialization for UpdateBatchMessageRequestDto: %d classes match result," - + " expected 1", - match)); - } - - /** Handle deserialization of the 'null' value. */ - @Override - public UpdateBatchMessageRequestDto getNullValue(DeserializationContext ctxt) - throws JsonMappingException { - throw new JsonMappingException( - ctxt.getParser(), "UpdateBatchMessageRequestDto cannot be null"); - } - } - - // store a list of schema names defined in oneOf - public static final Map> schemas = new HashMap<>(); - - public UpdateBatchMessageRequestDto() { - super("oneOf", Boolean.FALSE); - } - - public UpdateBatchMessageRequestDto(ApiUpdateBinaryMtMessageDto o) { - super("oneOf", Boolean.FALSE); - setActualInstance(o); - } - - public UpdateBatchMessageRequestDto(ApiUpdateMmsMtMessageDto o) { - super("oneOf", Boolean.FALSE); - setActualInstance(o); - } - - public UpdateBatchMessageRequestDto(ApiUpdateTextMtMessageDto o) { - super("oneOf", Boolean.FALSE); - setActualInstance(o); - } - - static { - schemas.put("ApiUpdateBinaryMtMessageDto", ApiUpdateBinaryMtMessageDto.class); - schemas.put("ApiUpdateMmsMtMessageDto", ApiUpdateMmsMtMessageDto.class); - schemas.put("ApiUpdateTextMtMessageDto", ApiUpdateTextMtMessageDto.class); - JSONNavigator.registerDescendants( - UpdateBatchMessageRequestDto.class, Collections.unmodifiableMap(schemas)); - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("ApiUpdateBinaryMtMessage", ApiUpdateBinaryMtMessageDto.class); - mappings.put("ApiUpdateMmsMtMessage", ApiUpdateMmsMtMessageDto.class); - mappings.put("ApiUpdateTextMtMessage", ApiUpdateTextMtMessageDto.class); - mappings.put("mt_binary", ApiUpdateBinaryMtMessageDto.class); - mappings.put("mt_media", ApiUpdateMmsMtMessageDto.class); - mappings.put("mt_text", ApiUpdateTextMtMessageDto.class); - mappings.put("UpdateBatchMessage_request", UpdateBatchMessageRequestDto.class); - JSONNavigator.registerDiscriminator(UpdateBatchMessageRequestDto.class, "type", mappings); - } - - @Override - public Map> getSchemas() { - return UpdateBatchMessageRequestDto.schemas; - } - - /** - * Set the instance that matches the oneOf child schema, check the instance parameter is valid - * against the oneOf child schemas: ApiUpdateBinaryMtMessageDto, ApiUpdateMmsMtMessageDto, - * ApiUpdateTextMtMessageDto - * - *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a - * composed schema (allOf, anyOf, oneOf). - */ - @Override - public void setActualInstance(Object instance) { - if (JSONNavigator.isInstanceOf( - ApiUpdateBinaryMtMessageDto.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - - if (JSONNavigator.isInstanceOf( - ApiUpdateMmsMtMessageDto.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - - if (JSONNavigator.isInstanceOf( - ApiUpdateTextMtMessageDto.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - - throw new RuntimeException( - "Invalid instance type. Must be ApiUpdateBinaryMtMessageDto, ApiUpdateMmsMtMessageDto," - + " ApiUpdateTextMtMessageDto"); - } - - /** - * Get the actual instance, which can be the following: ApiUpdateBinaryMtMessageDto, - * ApiUpdateMmsMtMessageDto, ApiUpdateTextMtMessageDto - * - * @return The actual instance (ApiUpdateBinaryMtMessageDto, ApiUpdateMmsMtMessageDto, - * ApiUpdateTextMtMessageDto) - */ - @Override - public Object getActualInstance() { - return super.getActualInstance(); - } - - /** - * Get the actual instance of `ApiUpdateBinaryMtMessageDto`. If the actual instance is not - * `ApiUpdateBinaryMtMessageDto`, the ClassCastException will be thrown. - * - * @return The actual instance of `ApiUpdateBinaryMtMessageDto` - * @throws ClassCastException if the instance is not `ApiUpdateBinaryMtMessageDto` - */ - public ApiUpdateBinaryMtMessageDto getApiUpdateBinaryMtMessageDto() throws ClassCastException { - return (ApiUpdateBinaryMtMessageDto) super.getActualInstance(); - } - - /** - * Get the actual instance of `ApiUpdateMmsMtMessageDto`. If the actual instance is not - * `ApiUpdateMmsMtMessageDto`, the ClassCastException will be thrown. - * - * @return The actual instance of `ApiUpdateMmsMtMessageDto` - * @throws ClassCastException if the instance is not `ApiUpdateMmsMtMessageDto` - */ - public ApiUpdateMmsMtMessageDto getApiUpdateMmsMtMessageDto() throws ClassCastException { - return (ApiUpdateMmsMtMessageDto) super.getActualInstance(); - } - - /** - * Get the actual instance of `ApiUpdateTextMtMessageDto`. If the actual instance is not - * `ApiUpdateTextMtMessageDto`, the ClassCastException will be thrown. - * - * @return The actual instance of `ApiUpdateTextMtMessageDto` - * @throws ClassCastException if the instance is not `ApiUpdateTextMtMessageDto` - */ - public ApiUpdateTextMtMessageDto getApiUpdateTextMtMessageDto() throws ClassCastException { - return (ApiUpdateTextMtMessageDto) super.getActualInstance(); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/UpdateGroupRequestAutoUpdateAddDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/UpdateGroupRequestAutoUpdateAddDto.java deleted file mode 100644 index d2554e5a0..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/UpdateGroupRequestAutoUpdateAddDto.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import java.util.Objects; - -/** UpdateGroupRequestAutoUpdateAddDto */ -@JsonPropertyOrder({ - UpdateGroupRequestAutoUpdateAddDto.JSON_PROPERTY_FIRST_WORD, - UpdateGroupRequestAutoUpdateAddDto.JSON_PROPERTY_SECOND_WORD -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class UpdateGroupRequestAutoUpdateAddDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_FIRST_WORD = "first_word"; - private String firstWord; - private boolean firstWordDefined = false; - - public static final String JSON_PROPERTY_SECOND_WORD = "second_word"; - private String secondWord; - private boolean secondWordDefined = false; - - public UpdateGroupRequestAutoUpdateAddDto() {} - - public UpdateGroupRequestAutoUpdateAddDto firstWord(String firstWord) { - this.firstWord = firstWord; - this.firstWordDefined = true; - return this; - } - - /** - * Keyword to be sent in <a - * href=\"https://community.sinch.com/t5/Glossary/MO-Mobile-Originated/ta-p/7618\" - * target=\"_blank\">MO</a> to add phone number to a group opt-in keyword - * like \"JOIN\". If `auto_update.to` is dedicated long/short number or unique - * brand keyword like \"Sinch\" if it is a shared short code. Constraints: Must be one - * word. - * - * @return firstWord - */ - @JsonProperty(JSON_PROPERTY_FIRST_WORD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getFirstWord() { - return firstWord; - } - - @JsonIgnore - public boolean getFirstWordDefined() { - return firstWordDefined; - } - - @JsonProperty(JSON_PROPERTY_FIRST_WORD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setFirstWord(String firstWord) { - this.firstWord = firstWord; - this.firstWordDefined = true; - } - - public UpdateGroupRequestAutoUpdateAddDto secondWord(String secondWord) { - this.secondWord = secondWord; - this.secondWordDefined = true; - return this; - } - - /** - * Opt-in keyword like \"JOIN\" if auto_update.to is shared short code. Constraints: - * Must be one word. - * - * @return secondWord - */ - @JsonProperty(JSON_PROPERTY_SECOND_WORD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getSecondWord() { - return secondWord; - } - - @JsonIgnore - public boolean getSecondWordDefined() { - return secondWordDefined; - } - - @JsonProperty(JSON_PROPERTY_SECOND_WORD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setSecondWord(String secondWord) { - this.secondWord = secondWord; - this.secondWordDefined = true; - } - - /** Return true if this UpdateGroup_request_auto_update_add object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UpdateGroupRequestAutoUpdateAddDto updateGroupRequestAutoUpdateAdd = - (UpdateGroupRequestAutoUpdateAddDto) o; - return Objects.equals(this.firstWord, updateGroupRequestAutoUpdateAdd.firstWord) - && Objects.equals(this.secondWord, updateGroupRequestAutoUpdateAdd.secondWord); - } - - @Override - public int hashCode() { - return Objects.hash(firstWord, secondWord); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateGroupRequestAutoUpdateAddDto {\n"); - sb.append(" firstWord: ").append(toIndentedString(firstWord)).append("\n"); - sb.append(" secondWord: ").append(toIndentedString(secondWord)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/UpdateGroupRequestAutoUpdateDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/UpdateGroupRequestAutoUpdateDto.java deleted file mode 100644 index f5a081e3e..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/UpdateGroupRequestAutoUpdateDto.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import java.util.Objects; - -/** UpdateGroupRequestAutoUpdateDto */ -@JsonPropertyOrder({ - UpdateGroupRequestAutoUpdateDto.JSON_PROPERTY_TO, - UpdateGroupRequestAutoUpdateDto.JSON_PROPERTY_ADD, - UpdateGroupRequestAutoUpdateDto.JSON_PROPERTY_REMOVE -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class UpdateGroupRequestAutoUpdateDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_TO = "to"; - private String to; - private boolean toDefined = false; - - public static final String JSON_PROPERTY_ADD = "add"; - private UpdateGroupRequestAutoUpdateAddDto add; - private boolean addDefined = false; - - public static final String JSON_PROPERTY_REMOVE = "remove"; - private UpdateGroupRequestAutoUpdateRemoveDto remove; - private boolean removeDefined = false; - - public UpdateGroupRequestAutoUpdateDto() {} - - public UpdateGroupRequestAutoUpdateDto to(String to) { - this.to = to; - this.toDefined = true; - return this; - } - - /** - * Short code or long number addressed in <a - * href=\"https://community.sinch.com/t5/Glossary/MO-Mobile-Originated/ta-p/7618\" - * target=\"_blank\">MO</a>. Constraints: Must be a valid phone number or - * short code. - * - * @return to - */ - @JsonProperty(JSON_PROPERTY_TO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getTo() { - return to; - } - - @JsonIgnore - public boolean getToDefined() { - return toDefined; - } - - @JsonProperty(JSON_PROPERTY_TO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setTo(String to) { - this.to = to; - this.toDefined = true; - } - - public UpdateGroupRequestAutoUpdateDto add(UpdateGroupRequestAutoUpdateAddDto add) { - this.add = add; - this.addDefined = true; - return this; - } - - /** - * Get add - * - * @return add - */ - @JsonProperty(JSON_PROPERTY_ADD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public UpdateGroupRequestAutoUpdateAddDto getAdd() { - return add; - } - - @JsonIgnore - public boolean getAddDefined() { - return addDefined; - } - - @JsonProperty(JSON_PROPERTY_ADD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setAdd(UpdateGroupRequestAutoUpdateAddDto add) { - this.add = add; - this.addDefined = true; - } - - public UpdateGroupRequestAutoUpdateDto remove(UpdateGroupRequestAutoUpdateRemoveDto remove) { - this.remove = remove; - this.removeDefined = true; - return this; - } - - /** - * Get remove - * - * @return remove - */ - @JsonProperty(JSON_PROPERTY_REMOVE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public UpdateGroupRequestAutoUpdateRemoveDto getRemove() { - return remove; - } - - @JsonIgnore - public boolean getRemoveDefined() { - return removeDefined; - } - - @JsonProperty(JSON_PROPERTY_REMOVE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setRemove(UpdateGroupRequestAutoUpdateRemoveDto remove) { - this.remove = remove; - this.removeDefined = true; - } - - /** Return true if this UpdateGroup_request_auto_update object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UpdateGroupRequestAutoUpdateDto updateGroupRequestAutoUpdate = - (UpdateGroupRequestAutoUpdateDto) o; - return Objects.equals(this.to, updateGroupRequestAutoUpdate.to) - && Objects.equals(this.add, updateGroupRequestAutoUpdate.add) - && Objects.equals(this.remove, updateGroupRequestAutoUpdate.remove); - } - - @Override - public int hashCode() { - return Objects.hash(to, add, remove); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateGroupRequestAutoUpdateDto {\n"); - sb.append(" to: ").append(toIndentedString(to)).append("\n"); - sb.append(" add: ").append(toIndentedString(add)).append("\n"); - sb.append(" remove: ").append(toIndentedString(remove)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/UpdateGroupRequestAutoUpdateRemoveDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/UpdateGroupRequestAutoUpdateRemoveDto.java deleted file mode 100644 index f0b42e69f..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/UpdateGroupRequestAutoUpdateRemoveDto.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import java.util.Objects; - -/** Keyword to be sent in MO to remove from a group. */ -@JsonPropertyOrder({ - UpdateGroupRequestAutoUpdateRemoveDto.JSON_PROPERTY_FIRST_WORD, - UpdateGroupRequestAutoUpdateRemoveDto.JSON_PROPERTY_SECOND_WORD -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class UpdateGroupRequestAutoUpdateRemoveDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_FIRST_WORD = "first_word"; - private String firstWord; - private boolean firstWordDefined = false; - - public static final String JSON_PROPERTY_SECOND_WORD = "second_word"; - private String secondWord; - private boolean secondWordDefined = false; - - public UpdateGroupRequestAutoUpdateRemoveDto() {} - - public UpdateGroupRequestAutoUpdateRemoveDto firstWord(String firstWord) { - this.firstWord = firstWord; - this.firstWordDefined = true; - return this; - } - - /** - * Opt-out keyword. For example, \"LEAVE\" if `auto_update.to` is a dedicated - * long/short number or a unique brand keyword like \"Sinch\" (if it is a shared short - * code). Constraints: Must be one word. - * - * @return firstWord - */ - @JsonProperty(JSON_PROPERTY_FIRST_WORD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getFirstWord() { - return firstWord; - } - - @JsonIgnore - public boolean getFirstWordDefined() { - return firstWordDefined; - } - - @JsonProperty(JSON_PROPERTY_FIRST_WORD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setFirstWord(String firstWord) { - this.firstWord = firstWord; - this.firstWordDefined = true; - } - - public UpdateGroupRequestAutoUpdateRemoveDto secondWord(String secondWord) { - this.secondWord = secondWord; - this.secondWordDefined = true; - return this; - } - - /** - * Opt-out keyword. For example, \"LEAVE\" if `auto_update.to` is a shared - * short code. Constraints: Must be one word. - * - * @return secondWord - */ - @JsonProperty(JSON_PROPERTY_SECOND_WORD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getSecondWord() { - return secondWord; - } - - @JsonIgnore - public boolean getSecondWordDefined() { - return secondWordDefined; - } - - @JsonProperty(JSON_PROPERTY_SECOND_WORD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setSecondWord(String secondWord) { - this.secondWord = secondWord; - this.secondWordDefined = true; - } - - /** Return true if this UpdateGroup_request_auto_update_remove object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UpdateGroupRequestAutoUpdateRemoveDto updateGroupRequestAutoUpdateRemove = - (UpdateGroupRequestAutoUpdateRemoveDto) o; - return Objects.equals(this.firstWord, updateGroupRequestAutoUpdateRemove.firstWord) - && Objects.equals(this.secondWord, updateGroupRequestAutoUpdateRemove.secondWord); - } - - @Override - public int hashCode() { - return Objects.hash(firstWord, secondWord); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateGroupRequestAutoUpdateRemoveDto {\n"); - sb.append(" firstWord: ").append(toIndentedString(firstWord)).append("\n"); - sb.append(" secondWord: ").append(toIndentedString(secondWord)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/UpdateGroupRequestDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/UpdateGroupRequestDto.java deleted file mode 100644 index 6c6788478..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/dto/v1/UpdateGroupRequestDto.java +++ /dev/null @@ -1,308 +0,0 @@ -/* - * API Overview | Sinch - * Sinch SMS API is one of the easiest APIs we offer and enables you to add fast and reliable global SMS to your applications. Send single messages, scheduled batch messages, use available message templates and more. - * - * The version of the OpenAPI document: v1 - * Contact: Support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** UpdateGroupRequestDto */ -@JsonPropertyOrder({ - UpdateGroupRequestDto.JSON_PROPERTY_NAME, - UpdateGroupRequestDto.JSON_PROPERTY_ADD, - UpdateGroupRequestDto.JSON_PROPERTY_REMOVE, - UpdateGroupRequestDto.JSON_PROPERTY_ADD_FROM_GROUP, - UpdateGroupRequestDto.JSON_PROPERTY_REMOVE_FROM_GROUP, - UpdateGroupRequestDto.JSON_PROPERTY_AUTO_UPDATE -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class UpdateGroupRequestDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_NAME = "name"; - private String name; - private boolean nameDefined = false; - - public static final String JSON_PROPERTY_ADD = "add"; - private List add; - private boolean addDefined = false; - - public static final String JSON_PROPERTY_REMOVE = "remove"; - private List remove; - private boolean removeDefined = false; - - public static final String JSON_PROPERTY_ADD_FROM_GROUP = "add_from_group"; - private String addFromGroup; - private boolean addFromGroupDefined = false; - - public static final String JSON_PROPERTY_REMOVE_FROM_GROUP = "remove_from_group"; - private String removeFromGroup; - private boolean removeFromGroupDefined = false; - - public static final String JSON_PROPERTY_AUTO_UPDATE = "auto_update"; - private UpdateGroupRequestAutoUpdateDto autoUpdate; - private boolean autoUpdateDefined = false; - - public UpdateGroupRequestDto() {} - - public UpdateGroupRequestDto name(String name) { - this.name = name; - this.nameDefined = true; - return this; - } - - /** - * The name of the group. Omitting `name` from the JSON body will leave the name - * unchanged. To remove an existing name set, name explicitly to the JSON value `null`. - * - * @return name - */ - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getName() { - return name; - } - - @JsonIgnore - public boolean getNameDefined() { - return nameDefined; - } - - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setName(String name) { - this.name = name; - this.nameDefined = true; - } - - public UpdateGroupRequestDto add(List add) { - this.add = add; - this.addDefined = true; - return this; - } - - public UpdateGroupRequestDto addAddItem(String addItem) { - if (this.add == null) { - this.add = new ArrayList<>(); - } - this.addDefined = true; - this.add.add(addItem); - return this; - } - - /** - * Add a list of phone numbers (MSISDNs) to this group. The phone numbers are a strings within an - * array and must be in <a - * href=\"https://community.sinch.com/t5/Glossary/E-164/ta-p/7537\" - * target=\"_blank\">E.164 format</a>. - * - * @return add - */ - @JsonProperty(JSON_PROPERTY_ADD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List getAdd() { - return add; - } - - @JsonIgnore - public boolean getAddDefined() { - return addDefined; - } - - @JsonProperty(JSON_PROPERTY_ADD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setAdd(List add) { - this.add = add; - this.addDefined = true; - } - - public UpdateGroupRequestDto remove(List remove) { - this.remove = remove; - this.removeDefined = true; - return this; - } - - public UpdateGroupRequestDto addRemoveItem(String removeItem) { - if (this.remove == null) { - this.remove = new ArrayList<>(); - } - this.removeDefined = true; - this.remove.add(removeItem); - return this; - } - - /** - * Remove a list of phone numbers (MSISDNs) to this group.The phone numbers are a strings within - * an array and must be in <a - * href=\"https://community.sinch.com/t5/Glossary/E-164/ta-p/7537\" - * target=\"_blank\">E.164 format</a>. - * - * @return remove - */ - @JsonProperty(JSON_PROPERTY_REMOVE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List getRemove() { - return remove; - } - - @JsonIgnore - public boolean getRemoveDefined() { - return removeDefined; - } - - @JsonProperty(JSON_PROPERTY_REMOVE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setRemove(List remove) { - this.remove = remove; - this.removeDefined = true; - } - - public UpdateGroupRequestDto addFromGroup(String addFromGroup) { - this.addFromGroup = addFromGroup; - this.addFromGroupDefined = true; - return this; - } - - /** - * Copy the members from the another group into this group. Constraints: Must be valid group ID - * - * @return addFromGroup - */ - @JsonProperty(JSON_PROPERTY_ADD_FROM_GROUP) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getAddFromGroup() { - return addFromGroup; - } - - @JsonIgnore - public boolean getAddFromGroupDefined() { - return addFromGroupDefined; - } - - @JsonProperty(JSON_PROPERTY_ADD_FROM_GROUP) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setAddFromGroup(String addFromGroup) { - this.addFromGroup = addFromGroup; - this.addFromGroupDefined = true; - } - - public UpdateGroupRequestDto removeFromGroup(String removeFromGroup) { - this.removeFromGroup = removeFromGroup; - this.removeFromGroupDefined = true; - return this; - } - - /** - * Remove the members in a specified group from this group. Constraints: Must be valid group ID - * - * @return removeFromGroup - */ - @JsonProperty(JSON_PROPERTY_REMOVE_FROM_GROUP) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getRemoveFromGroup() { - return removeFromGroup; - } - - @JsonIgnore - public boolean getRemoveFromGroupDefined() { - return removeFromGroupDefined; - } - - @JsonProperty(JSON_PROPERTY_REMOVE_FROM_GROUP) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setRemoveFromGroup(String removeFromGroup) { - this.removeFromGroup = removeFromGroup; - this.removeFromGroupDefined = true; - } - - public UpdateGroupRequestDto autoUpdate(UpdateGroupRequestAutoUpdateDto autoUpdate) { - this.autoUpdate = autoUpdate; - this.autoUpdateDefined = true; - return this; - } - - /** - * Get autoUpdate - * - * @return autoUpdate - */ - @JsonProperty(JSON_PROPERTY_AUTO_UPDATE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public UpdateGroupRequestAutoUpdateDto getAutoUpdate() { - return autoUpdate; - } - - @JsonIgnore - public boolean getAutoUpdateDefined() { - return autoUpdateDefined; - } - - @JsonProperty(JSON_PROPERTY_AUTO_UPDATE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setAutoUpdate(UpdateGroupRequestAutoUpdateDto autoUpdate) { - this.autoUpdate = autoUpdate; - this.autoUpdateDefined = true; - } - - /** Return true if this UpdateGroup_request object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UpdateGroupRequestDto updateGroupRequest = (UpdateGroupRequestDto) o; - return Objects.equals(this.name, updateGroupRequest.name) - && Objects.equals(this.add, updateGroupRequest.add) - && Objects.equals(this.remove, updateGroupRequest.remove) - && Objects.equals(this.addFromGroup, updateGroupRequest.addFromGroup) - && Objects.equals(this.removeFromGroup, updateGroupRequest.removeFromGroup) - && Objects.equals(this.autoUpdate, updateGroupRequest.autoUpdate); - } - - @Override - public int hashCode() { - return Objects.hash(name, add, remove, addFromGroup, removeFromGroup, autoUpdate); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateGroupRequestDto {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" add: ").append(toIndentedString(add)).append("\n"); - sb.append(" remove: ").append(toIndentedString(remove)).append("\n"); - sb.append(" addFromGroup: ").append(toIndentedString(addFromGroup)).append("\n"); - sb.append(" removeFromGroup: ").append(toIndentedString(removeFromGroup)).append("\n"); - sb.append(" autoUpdate: ").append(toIndentedString(autoUpdate)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/BinaryResponseDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/BinaryResponseDtoTest.java deleted file mode 100644 index 404545cf2..000000000 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/BinaryResponseDtoTest.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.adelean.inject.resources.junit.jupiter.GivenJsonResource; -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.BaseTest; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.assertj.core.api.Assertions; -import org.json.JSONException; -import org.junit.jupiter.api.Test; -import org.skyscreamer.jsonassert.JSONAssert; - -@TestWithResources -class BinaryResponseDtoTest extends BaseTest { - @GivenJsonResource("/domains/sms/v1/batches/response/BinaryResponseDto.json") - BinaryResponseDto loadedDto; - - @GivenTextResource("/domains/sms/v1/batches/response/BinaryResponseDto.json") - String jsonStringDto; - - BinaryResponseDto dto = - new BinaryResponseDto( - "01FC66621XXXXX119Z8PMV1QPQ", - false, - OffsetDateTime.parse("2019-08-24T14:15:22Z"), - OffsetDateTime.parse("2019-08-24T14:17:22Z")) - .body("Hi ${name} ({an identifier}) ! How are you?") - .callbackUrl("callback url") - .clientReference("myReference") - .deliveryReport("none") - .expireAt(OffsetDateTime.parse("2019-08-24T14:21:22Z")) - .feedbackEnabled(false) - .flashMessage(true) - .from("+15551231234") - .fromTon(6) - .fromNpi(18) - .maxNumberOfMessageParts(1) - .sendAt(OffsetDateTime.parse("2019-08-24T14:19:22Z")) - .to(Arrays.asList("+15551231234", "+15551256344")) - .truncateConcat(true) - .type("mt_binary") - .udh("foo udh"); - - @Test - void deserialize() { - - BinaryResponseDto expected = dto; - - Assertions.assertThat(loadedDto).usingRecursiveComparison().isEqualTo(expected); - } - - @Test - void serialize() throws JsonProcessingException, JSONException { - - String serializedString = objectMapper.writeValueAsString(dto); - - JSONAssert.assertEquals(jsonStringDto, serializedString, true); - } -} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/DeliveryReportBatchDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/DeliveryReportBatchDtoTest.java deleted file mode 100644 index fb2a8863d..000000000 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/DeliveryReportBatchDtoTest.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.adelean.inject.resources.junit.jupiter.GivenJsonResource; -import com.adelean.inject.resources.junit.jupiter.TestWithResources; -import com.sinch.sdk.BaseTest; -import java.util.Collections; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -@TestWithResources -public class DeliveryReportBatchDtoTest extends BaseTest { - - @GivenJsonResource("/domains/sms/v1/deliveryreports/BatchDeliveryReportSMSDto.json") - DeliveryReportDto deliveryReportBatchSMSDto; - - @GivenJsonResource("/domains/sms/v1/deliveryreports/BatchDeliveryReportMMSDto.json") - DeliveryReportDto deliveryReportBatchMMSDto; - - public static DeliveryReportDto deliveryReportBatchSMS = - new DeliveryReportDto("01FC66621XXXXX119Z8PMV1QPQ") - .type("delivery_report_sms") - .statuses( - Collections.singletonList( - new MessageDeliveryStatusDto() - .code(0) - .count(1) - .addRecipientsItem("44231235674") - .status("Delivered"))) - .totalMessageCount(1) - .clientReference("a client reference"); - - public static DeliveryReportDto deliveryReportBatchMMS = - new DeliveryReportDto("01FC66621XXXXX119Z8PMV1QPQ") - .type("delivery_report_mms") - .statuses( - Collections.singletonList( - new MessageDeliveryStatusDto() - .code(0) - .count(1) - .addRecipientsItem("44231235674") - .status("Delivered"))) - .totalMessageCount(1) - .clientReference("a client reference"); - - @Test - void deserializeDeliveryReportBatchSMS() { - Assertions.assertThat(deliveryReportBatchSMS) - .usingRecursiveComparison() - .isEqualTo(deliveryReportBatchSMSDto); - } - - @Test - void deserializeDeliveryReportBatchMMS() { - Assertions.assertThat(deliveryReportBatchMMS) - .usingRecursiveComparison() - .isEqualTo(deliveryReportBatchMMSDto); - } -} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/DeliveryReportRecipientDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/DeliveryReportRecipientDtoTest.java deleted file mode 100644 index c83f8e41a..000000000 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/DeliveryReportRecipientDtoTest.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.adelean.inject.resources.junit.jupiter.GivenJsonResource; -import com.adelean.inject.resources.junit.jupiter.TestWithResources; -import com.sinch.sdk.BaseTest; -import java.time.OffsetDateTime; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -@TestWithResources -public class DeliveryReportRecipientDtoTest extends BaseTest { - - @GivenJsonResource("/domains/sms/v1/deliveryreports/RecipientDeliveryReportSMSDto.json") - RecipientDeliveryReportDto deliveryReportRecipientSMSDto; - - @GivenJsonResource("/domains/sms/v1/deliveryreports/RecipientDeliveryReportMMSDto.json") - RecipientDeliveryReportDto deliveryReportRecipientMMSDto; - - public static RecipientDeliveryReportDto deliveryReportRecipientSMS = - new RecipientDeliveryReportDto("01FC66621XXXXX119Z8PMV1QPQ") - .type("recipient_delivery_report_sms") - .clientReference("client reference") - .at(OffsetDateTime.parse("2022-08-30T08:16:08.930Z")) - .code(401) - .recipient("+44231235674") - .status("Dispatched") - .appliedOriginator("applied originator") - .encoding("encoding") - .numberOfMessageParts(123) - .operator("operator") - .operatorStatusAt(OffsetDateTime.parse("2022-08-30T08:16:08.150Z")); - - public static RecipientDeliveryReportDto deliveryReportRecipientMMS = - new RecipientDeliveryReportDto("01FC66621XXXXX119Z8PMV1QPQ") - .type("recipient_delivery_report_mms") - .clientReference("client reference") - .at(OffsetDateTime.parse("2022-08-30T08:16:08.930Z")) - .code(401) - .recipient("+44231235674") - .status("Dispatched") - .appliedOriginator("applied originator") - .encoding("encoding") - .numberOfMessageParts(123) - .operator("operator") - .operatorStatusAt(OffsetDateTime.parse("2022-08-30T08:16:08.150Z")); - - @Test - void deserializeDeliveryReportRecipientSMS() { - Assertions.assertThat(deliveryReportRecipientSMS) - .usingRecursiveComparison() - .isEqualTo(deliveryReportRecipientSMSDto); - } - - @Test - void deserializeDeliveryReportRecipientMMS() { - Assertions.assertThat(deliveryReportRecipientMMS) - .usingRecursiveComparison() - .isEqualTo(deliveryReportRecipientMMSDto); - } -} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/DryRunResponseDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/DryRunResponseDtoTest.java deleted file mode 100644 index c17327964..000000000 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/DryRunResponseDtoTest.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.adelean.inject.resources.junit.jupiter.GivenJsonResource; -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.BaseTest; -import com.sinch.sdk.core.TestHelpers; -import java.util.Collections; -import org.json.JSONException; -import org.junit.jupiter.api.Test; -import org.skyscreamer.jsonassert.JSONAssert; - -@TestWithResources -class DryRunResponseDtoTest extends BaseTest { - - @GivenJsonResource("/domains/sms/v1/batches/response/DryRunResponseDto.json") - DryRun200ResponseDto loadedDto; - - @GivenTextResource("/domains/sms/v1/batches/response/DryRunResponseDto.json") - String jsonStringDto; - - DryRun200ResponseDto dto = - new DryRun200ResponseDto() - .numberOfRecipients(123) - .numberOfMessages(456) - .perRecipient( - Collections.singletonList( - new DryRun200ResponsePerRecipientInnerDto() - .recipient("recipient string") - .numberOfParts(1) - .body("body string") - .encoding("encoding string"))); - - @Test - void deserialize() { - - TestHelpers.recursiveEquals(loadedDto, dto); - } - - @Test - void serialize() throws JsonProcessingException, JSONException { - - String serializedString = objectMapper.writeValueAsString(dto); - - JSONAssert.assertEquals(jsonStringDto, serializedString, true); - } -} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/GroupResponseDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/GroupResponseDtoTest.java deleted file mode 100644 index 84a2f4510..000000000 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/GroupResponseDtoTest.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.adelean.inject.resources.junit.jupiter.GivenJsonResource; -import com.adelean.inject.resources.junit.jupiter.TestWithResources; -import com.sinch.sdk.BaseTest; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashSet; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -@TestWithResources -class GroupResponseDtoTest extends BaseTest { - - @GivenJsonResource("/domains/sms/v1/groups/GroupDto.json") - CreateGroupResponseDto createGroupResponseDto; - - Integer size = 2; - OffsetDateTime createdAt = OffsetDateTime.parse("2019-08-24T14:15:22Z"); - OffsetDateTime modifiedAt = OffsetDateTime.parse("2019-08-24T14:15:44Z"); - CreateGroupResponseDto groupResponse = - new CreateGroupResponseDto(size, createdAt, modifiedAt) - .id("01FC66621XXXXX119Z8PMV1QPU") - .name("My new customers") - .childGroups( - new HashSet<>( - Arrays.asList("01FC66621XXXXX119Z8PMV1AHY", "01FC66621XXXXX119Z8PMV1A00"))) - .autoUpdate( - new GroupAutoUpdateDto() - .to("15551231234") - .add( - new AddKeywordDto() - .firstWord("Add 1st keyword") - .secondWord("Add 2nd keyword")) - .remove( - new RemoveKeywordDto() - .firstWord("remove 1st keyword") - .secondWord("remove 2nd keyword"))); - - @Test - void deserializeGroup() { - - Assertions.assertThat(createGroupResponseDto) - .usingRecursiveComparison() - .isEqualTo(groupResponse); - } -} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/InboundDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/InboundDtoTest.java deleted file mode 100644 index 5829d054b..000000000 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/InboundDtoTest.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.adelean.inject.resources.junit.jupiter.GivenJsonResource; -import com.adelean.inject.resources.junit.jupiter.TestWithResources; -import com.sinch.sdk.BaseTest; -import java.time.OffsetDateTime; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -@TestWithResources -class InboundDtoTest extends BaseTest { - - @GivenJsonResource("/domains/sms/v1/inbounds/InboundBinaryDto.json") - InboundDto loadedBinaryMessage; - - @GivenJsonResource("/domains/sms/v1/inbounds/InboundTextDto.json") - InboundDto loadedTextMessage; - - MOBinaryDto binaryDTO = - new MOBinaryDto("mo_binary") - .from("+11203494390") - .id("01FC66621XXXXX119Z8PMV1QPA") - .receivedAt(OffsetDateTime.parse("2019-08-24T14:17:22Z")) - .to("11203453453") - .body("a body") - .clientReference("a client reference") - .operatorId("35000") - .sentAt(OffsetDateTime.parse("2019-08-24T14:15:22Z")) - .udh("foo udh"); - - MOTextDto textDTO = - new MOTextDto("mo_text") - .from("+11203494390") - .id("01FC66621XXXXX119Z8PMV1QPA") - .receivedAt(OffsetDateTime.parse("2019-08-24T14:17:22Z")) - .to("11203453453") - .body("a body") - .clientReference("a client reference") - .operatorId("35000") - .sentAt(OffsetDateTime.parse("2019-08-24T14:15:22Z")); - - InboundDto expectedBinaryMessageDto = new InboundDto(binaryDTO); - - InboundDto expectedTextMessageDto = new InboundDto(textDTO); - - @Test - void deserializeBinaryMessage() { - - Assertions.assertThat(loadedBinaryMessage) - .usingRecursiveComparison() - .isEqualTo(expectedBinaryMessageDto); - } - - @Test - void deserializeTextMessage() { - - Assertions.assertThat(loadedTextMessage) - .usingRecursiveComparison() - .isEqualTo(expectedTextMessageDto); - } -} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/MOBinaryDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/MOBinaryDtoTest.java deleted file mode 100644 index 80b24fb3c..000000000 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/MOBinaryDtoTest.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.adelean.inject.resources.junit.jupiter.GivenJsonResource; -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.BaseTest; -import java.time.OffsetDateTime; -import org.assertj.core.api.Assertions; -import org.json.JSONException; -import org.junit.jupiter.api.Test; -import org.skyscreamer.jsonassert.JSONAssert; - -@TestWithResources -public class MOBinaryDtoTest extends BaseTest { - - @GivenJsonResource("/domains/sms/v1/inbounds/InboundBinaryDto.json") - MOBinaryDto loadedDto; - - @GivenTextResource("/domains/sms/v1/inbounds/InboundBinaryDto.json") - String jsonStringDto; - - public static MOBinaryDto dto = - new MOBinaryDto(MOBinaryDto.TypeEnum.MO_BINARY.getValue()) - .from("+11203494390") - .id("01FC66621XXXXX119Z8PMV1QPA") - .receivedAt(OffsetDateTime.parse("2019-08-24T14:17:22Z")) - .to("11203453453") - .body("a body") - .clientReference("a client reference") - .operatorId("35000") - .sentAt(OffsetDateTime.parse("2019-08-24T14:15:22Z")) - .udh("foo udh"); - - @Test - void deserialize() { - - MOBinaryDto expected = dto; - - Assertions.assertThat(loadedDto).usingRecursiveComparison().isEqualTo(expected); - } - - @Test - void serialize() throws JsonProcessingException, JSONException { - - String serializedString = objectMapper.writeValueAsString(dto); - - JSONAssert.assertEquals(jsonStringDto, serializedString, true); - } -} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/MOTextDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/MOTextDtoTest.java deleted file mode 100644 index 94bc2ae8a..000000000 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/MOTextDtoTest.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.adelean.inject.resources.junit.jupiter.GivenJsonResource; -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.BaseTest; -import java.time.OffsetDateTime; -import org.assertj.core.api.Assertions; -import org.json.JSONException; -import org.junit.jupiter.api.Test; -import org.skyscreamer.jsonassert.JSONAssert; - -@TestWithResources -public class MOTextDtoTest extends BaseTest { - - @GivenJsonResource("/domains/sms/v1/inbounds/InboundTextDto.json") - MOTextDto loadedDto; - - @GivenTextResource("/domains/sms/v1/inbounds/InboundTextDto.json") - String jsonStringDto; - - public static MOTextDto dto = - new MOTextDto(MOTextDto.TypeEnum.MO_TEXT.getValue()) - .from("+11203494390") - .id("01FC66621XXXXX119Z8PMV1QPA") - .receivedAt(OffsetDateTime.parse("2019-08-24T14:17:22Z")) - .to("11203453453") - .body("a body") - .clientReference("a client reference") - .operatorId("35000") - .sentAt(OffsetDateTime.parse("2019-08-24T14:15:22Z")); - - @Test - void deserialize() { - - MOTextDto expected = dto; - - Assertions.assertThat(loadedDto).usingRecursiveComparison().isEqualTo(expected); - } - - @Test - void serialize() throws JsonProcessingException, JSONException { - - String serializedString = objectMapper.writeValueAsString(dto); - - JSONAssert.assertEquals(jsonStringDto, serializedString, true); - } -} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/MediaResponseDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/MediaResponseDtoTest.java deleted file mode 100644 index 57bf262d8..000000000 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/MediaResponseDtoTest.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.adelean.inject.resources.junit.jupiter.GivenJsonResource; -import com.adelean.inject.resources.junit.jupiter.TestWithResources; -import com.sinch.sdk.BaseTest; -import java.time.OffsetDateTime; -import java.util.AbstractMap; -import java.util.Arrays; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -@TestWithResources -class MediaResponseDtoTest extends BaseTest { - @GivenJsonResource("/domains/sms/v1/batches/response/MediaResponseDto.json") - MediaResponseDto loadedDto; - - ParameterObjDto parameterObjDto = new ParameterObjDto(); - - MediaResponseDto mediaDTO = - new MediaResponseDto( - "01FC66621XXXXX119Z8PMV1QPQ", - false, - "mt_media", - OffsetDateTime.parse("2019-08-24T14:14:22Z"), - OffsetDateTime.parse("2019-08-24T14:15:22Z")) - .body( - new MediaBodyDto() - .url( - "https://en.wikipedia.org/wiki/Sinch_(company)#/media/File:Sinch_LockUp_RGB.png") - .message("Hi ${name} ({an identifier}) ! How are you?")) - .callbackUrl("callback url") - .clientReference("client reference") - .deliveryReport("summary") - .expireAt(OffsetDateTime.parse("2019-08-24T14:17:22Z")) - .feedbackEnabled(false) - .from("+15551231234") - .parameters(parameterObjDto) - .sendAt(OffsetDateTime.parse("2019-08-24T14:16:22Z")) - .to(Arrays.asList("+15551231234", "+15551256344")) - .strictValidation(true); - - @Test - void deserialize() { - - Assertions.assertThat(loadedDto).usingRecursiveComparison().isEqualTo(mediaDTO); - } - - @BeforeEach - void setUp() { - parameterObjDto.put( - "an identifier", - Stream.of( - new AbstractMap.SimpleEntry<>("15551231234", "an identifier value for 15551231234"), - new AbstractMap.SimpleEntry<>("15551256344", "an identifier value for 15551256344")) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))); - - parameterObjDto.put( - "name", - Stream.of( - new AbstractMap.SimpleEntry<>("15551231234", "name value for 15551231234"), - new AbstractMap.SimpleEntry<>("15551256344", "name value for 15551256344"), - new AbstractMap.SimpleEntry<>( - ParameterObjParameterKeyDto.JSON_PROPERTY_DEFAULT, "default value")) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))); - } -} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/SendSMSRequestDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/SendSMSRequestDtoTest.java deleted file mode 100644 index d9caae8a5..000000000 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/SendSMSRequestDtoTest.java +++ /dev/null @@ -1,146 +0,0 @@ -package com.sinch.sdk.domains.sms.models.dto.v1; - -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.BaseTest; -import java.time.OffsetDateTime; -import java.util.AbstractMap; -import java.util.Arrays; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.json.JSONException; -import org.junit.jupiter.api.Test; -import org.skyscreamer.jsonassert.JSONAssert; - -@TestWithResources -class SendSMSRequestDtoTest extends BaseTest { - @GivenTextResource("/domains/sms/v1/BinaryRequestDto.json") - String jsonRequestBinaryDto; - - @GivenTextResource("/domains/sms/v1/batches/request/TextRequestDto.json") - String jsonRequestTextDto; - - @GivenTextResource("/domains/sms/v1/MediaRequestDto.json") - String jsonRequestMediaDto; - - @Test - void serializeBinaryRequestDto() throws JsonProcessingException, JSONException { - - BinaryRequestDto binaryRequestDTO = - new BinaryRequestDto() - .to(Arrays.asList("+15551231234", "+15551256344")) - .body("Hi ${name} ({an identifier}) ! How are you?") - .udh("foo udh") - .from("+15551231234") - .type("mt_binary") - .deliveryReport("none") - .sendAt(OffsetDateTime.parse("2019-08-24T14:19:22Z")) - .expireAt(OffsetDateTime.parse("2019-08-24T14:21:22Z")) - .callbackUrl("callback url") - .clientReference("myReference") - .feedbackEnabled(false) - .flashMessage(true) - .truncateConcat(true) - .maxNumberOfMessageParts(1) - .fromTon(6) - .fromNpi(18); - SendSMSRequestDto sendSMSRequestDto = new SendSMSRequestDto(binaryRequestDTO); - - String serializedString = objectMapper.writeValueAsString(sendSMSRequestDto); - - JSONAssert.assertEquals(jsonRequestBinaryDto, serializedString, true); - } - - @Test - void serializeTextRequestDto() throws JsonProcessingException, JSONException { - - ParameterObjDto parameterObjDto = new ParameterObjDto(); - parameterObjDto.put( - "an identifier", - Stream.of( - new AbstractMap.SimpleEntry<>("15551231234", "an identifier value for 15551231234"), - new AbstractMap.SimpleEntry<>("15551256344", "an identifier value for 15551256344")) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))); - - parameterObjDto.put( - "name", - Stream.of( - new AbstractMap.SimpleEntry<>("15551231234", "name value for 15551231234"), - new AbstractMap.SimpleEntry<>("15551256344", "name value for 15551256344"), - new AbstractMap.SimpleEntry<>( - ParameterObjParameterKeyDto.JSON_PROPERTY_DEFAULT, "default value")) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))); - - TextRequestDto textRequestDTO = - new TextRequestDto() - .to(Arrays.asList("+15551231234", "+15551256344")) - .body("Hi ${name} ({an identifier}) ! How are you?") - .from("+15551231234") - .type("mt_text") - .deliveryReport("none") - .sendAt(OffsetDateTime.parse("2019-08-24T14:19:22Z")) - .expireAt(OffsetDateTime.parse("2019-08-24T14:21:22Z")) - .callbackUrl("callback url") - .clientReference("myReference") - .feedbackEnabled(false) - .flashMessage(true) - .truncateConcat(true) - .maxNumberOfMessageParts(1) - .fromTon(6) - .fromNpi(18) - .parameters(parameterObjDto); - - SendSMSRequestDto sendSMSRequestDto = new SendSMSRequestDto(textRequestDTO); - - String serializedString = objectMapper.writeValueAsString(sendSMSRequestDto); - - JSONAssert.assertEquals(jsonRequestTextDto, serializedString, true); - } - - @Test - void serializeMediaRequestDto() throws JsonProcessingException, JSONException { - - ParameterObjDto parameterObjDto = new ParameterObjDto(); - parameterObjDto.put( - "an identifier", - Stream.of( - new AbstractMap.SimpleEntry<>("15551231234", "an identifier value for 15551231234"), - new AbstractMap.SimpleEntry<>("15551256344", "an identifier value for 15551256344")) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))); - - parameterObjDto.put( - "name", - Stream.of( - new AbstractMap.SimpleEntry<>("15551231234", "name value for 15551231234"), - new AbstractMap.SimpleEntry<>("15551256344", "name value for 15551256344"), - new AbstractMap.SimpleEntry<>( - ParameterObjParameterKeyDto.JSON_PROPERTY_DEFAULT, "default value")) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))); - - MediaRequestDto mediaRequestDTO = - new MediaRequestDto("mt_media") - .to(Arrays.asList("+15551231234", "+15551256344")) - .body( - new MediaBodyDto() - .url( - "https://en.wikipedia.org/wiki/Sinch_(company)#/media/File:Sinch_LockUp_RGB.png") - .message("Hi ${name} ({an identifier}) ! How are you?")) - .from("+15551231234") - .deliveryReport("summary") - .sendAt(OffsetDateTime.parse("2019-08-24T14:16:22Z")) - .expireAt(OffsetDateTime.parse("2019-08-24T14:17:22Z")) - .callbackUrl("callback url") - .clientReference("client reference") - .feedbackEnabled(false) - .strictValidation(true) - .parameters(parameterObjDto); - - SendSMSRequestDto sendSMSRequestDto = new SendSMSRequestDto(mediaRequestDTO); - - String serializedString = objectMapper.writeValueAsString(sendSMSRequestDto); - - JSONAssert.assertEquals(jsonRequestMediaDto, serializedString, true); - } -} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/SendSMSResponseDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/SendSMSResponseDtoTest.java deleted file mode 100644 index 949037f15..000000000 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/SendSMSResponseDtoTest.java +++ /dev/null @@ -1,138 +0,0 @@ -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.adelean.inject.resources.junit.jupiter.GivenJsonResource; -import com.adelean.inject.resources.junit.jupiter.TestWithResources; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.sinch.sdk.BaseTest; -import java.time.OffsetDateTime; -import java.util.AbstractMap; -import java.util.Arrays; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -@TestWithResources -class SendSMSResponseDtoTest extends BaseTest { - - @GivenJsonResource("/domains/sms/v1/batches/response/BinaryResponseDto.json") - SendSMS201ResponseDto loadedBinary; - - @GivenJsonResource("/domains/sms/v1/batches/response/TextResponseDto.json") - SendSMS201ResponseDto loadedText; - - @GivenJsonResource("/domains/sms/v1/batches/response/MediaResponseDto.json") - SendSMS201ResponseDto loadedMedia; - - ParameterObjDto parameterObjDto = new ParameterObjDto(); - - BinaryResponseDto binaryDTO = - new BinaryResponseDto( - "01FC66621XXXXX119Z8PMV1QPQ", - false, - OffsetDateTime.parse("2019-08-24T14:15:22Z"), - OffsetDateTime.parse("2019-08-24T14:17:22Z")) - .body("Hi ${name} ({an identifier}) ! How are you?") - .callbackUrl("callback url") - .clientReference("myReference") - .deliveryReport("none") - .expireAt(OffsetDateTime.parse("2019-08-24T14:21:22Z")) - .feedbackEnabled(false) - .flashMessage(true) - .from("+15551231234") - .fromTon(6) - .fromNpi(18) - .maxNumberOfMessageParts(1) - .sendAt(OffsetDateTime.parse("2019-08-24T14:19:22Z")) - .to(Arrays.asList("+15551231234", "+15551256344")) - .truncateConcat(true) - .type("mt_binary") - .udh("foo udh"); - - TextResponseDto textDTO = - new TextResponseDto( - "01FC66621XXXXX119Z8PMV1QPQ", - false, - "mt_text", - OffsetDateTime.parse("2019-08-24T14:15:22Z"), - OffsetDateTime.parse("2019-08-24T14:17:22Z")) - .body("Hi ${name} ({an identifier}) ! How are you?") - .callbackUrl("callback url") - .clientReference("myReference") - .deliveryReport("none") - .expireAt(OffsetDateTime.parse("2019-08-24T14:21:22Z")) - .feedbackEnabled(false) - .flashMessage(true) - .from("+15551231234") - .fromTon(6) - .fromNpi(18) - .maxNumberOfMessageParts(1) - .parameters(parameterObjDto) - .sendAt(OffsetDateTime.parse("2019-08-24T14:19:22Z")) - .to(Arrays.asList("+15551231234", "+15551256344")) - .truncateConcat(true); - SendSMS201ResponseDto expectedTextDto = new SendSMS201ResponseDto(textDTO); - MediaResponseDto mediaDTO = - new MediaResponseDto( - "01FC66621XXXXX119Z8PMV1QPQ", - false, - "mt_media", - OffsetDateTime.parse("2019-08-24T14:14:22Z"), - OffsetDateTime.parse("2019-08-24T14:15:22Z")) - .body( - new MediaBodyDto() - .url( - "https://en.wikipedia.org/wiki/Sinch_(company)#/media/File:Sinch_LockUp_RGB.png") - .message("Hi ${name} ({an identifier}) ! How are you?")) - .callbackUrl("callback url") - .clientReference("client reference") - .deliveryReport("summary") - .expireAt(OffsetDateTime.parse("2019-08-24T14:17:22Z")) - .feedbackEnabled(false) - .from("+15551231234") - .parameters(parameterObjDto) - .sendAt(OffsetDateTime.parse("2019-08-24T14:16:22Z")) - .to(Arrays.asList("+15551231234", "+15551256344")) - .strictValidation(true); - SendSMS201ResponseDto expectedMediaDto = new SendSMS201ResponseDto(mediaDTO); - SendSMS201ResponseDto expectedBinaryDto = new SendSMS201ResponseDto(binaryDTO); - - @Test - void deserializeBinaryMessage() throws JsonProcessingException { - - Assertions.assertThat(loadedBinary).usingRecursiveComparison().isEqualTo(expectedBinaryDto); - } - - @Test - void deserializeTextMessage() throws JsonProcessingException { - - Assertions.assertThat(loadedText).usingRecursiveComparison().isEqualTo(expectedTextDto); - } - - @Test - void deserializeMediaMessage() throws JsonProcessingException { - - Assertions.assertThat(loadedMedia).usingRecursiveComparison().isEqualTo(expectedMediaDto); - } - - @BeforeEach - void setUp() { - parameterObjDto.put( - "an identifier", - Stream.of( - new AbstractMap.SimpleEntry<>("15551231234", "an identifier value for 15551231234"), - new AbstractMap.SimpleEntry<>("15551256344", "an identifier value for 15551256344")) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))); - - parameterObjDto.put( - "name", - Stream.of( - new AbstractMap.SimpleEntry<>("15551231234", "name value for 15551231234"), - new AbstractMap.SimpleEntry<>("15551256344", "name value for 15551256344"), - new AbstractMap.SimpleEntry<>( - ParameterObjParameterKeyDto.JSON_PROPERTY_DEFAULT, "default value")) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))); - } -} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/TextResponseDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/TextResponseDtoTest.java deleted file mode 100644 index debea95fa..000000000 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/TextResponseDtoTest.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.sinch.sdk.domains.sms.models.dto.v1; - -import com.adelean.inject.resources.junit.jupiter.GivenJsonResource; -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.BaseTest; -import java.time.OffsetDateTime; -import java.util.AbstractMap; -import java.util.Arrays; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.assertj.core.api.Assertions; -import org.json.JSONException; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.skyscreamer.jsonassert.JSONAssert; - -@TestWithResources -class TextResponseDtoTest extends BaseTest { - @GivenJsonResource("/domains/sms/v1/batches/response/TextResponseDto.json") - TextResponseDto loadedDto; - - @GivenTextResource("/domains/sms/v1/batches/response/TextResponseDto.json") - String jsonStringDto; - - ParameterObjDto parameterObjDto = new ParameterObjDto(); - - TextResponseDto dto = - new TextResponseDto( - "01FC66621XXXXX119Z8PMV1QPQ", - false, - TextResponseDto.TypeEnum.MT_TEXT.getValue(), - OffsetDateTime.parse("2019-08-24T14:15:22Z"), - OffsetDateTime.parse("2019-08-24T14:17:22Z")) - .body("Hi ${name} ({an identifier}) ! How are you?") - .callbackUrl("callback url") - .clientReference("myReference") - .deliveryReport("none") - .expireAt(OffsetDateTime.parse("2019-08-24T14:21:22Z")) - .feedbackEnabled(false) - .flashMessage(true) - .from("+15551231234") - .fromTon(6) - .fromNpi(18) - .maxNumberOfMessageParts(1) - .parameters(parameterObjDto) - .sendAt(OffsetDateTime.parse("2019-08-24T14:19:22Z")) - .to(Arrays.asList("+15551231234", "+15551256344")) - .truncateConcat(true); - - @Test - void deserialize() { - - TextResponseDto expected = dto; - - Assertions.assertThat(loadedDto).usingRecursiveComparison().isEqualTo(expected); - } - - @Test - void serialize() throws JsonProcessingException, JSONException { - - String serializedString = objectMapper.writeValueAsString(dto); - - JSONAssert.assertEquals(jsonStringDto, serializedString, true); - } - - @BeforeEach - void setUp() { - parameterObjDto.put( - "an identifier", - Stream.of( - new AbstractMap.SimpleEntry<>("15551231234", "an identifier value for 15551231234"), - new AbstractMap.SimpleEntry<>("15551256344", "an identifier value for 15551256344")) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))); - - parameterObjDto.put( - "name", - Stream.of( - new AbstractMap.SimpleEntry<>("15551231234", "name value for 15551231234"), - new AbstractMap.SimpleEntry<>("15551256344", "name value for 15551256344"), - new AbstractMap.SimpleEntry<>( - ParameterObjParameterKeyDto.JSON_PROPERTY_DEFAULT, "default value")) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))); - } -} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/UpdateSMSRequestDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/UpdateSMSRequestDtoTest.java deleted file mode 100644 index 27e7fb007..000000000 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/dto/v1/UpdateSMSRequestDtoTest.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.sinch.sdk.domains.sms.models.dto.v1; - -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.BaseTest; -import java.time.OffsetDateTime; -import java.util.AbstractMap; -import java.util.Arrays; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.json.JSONException; -import org.junit.jupiter.api.Test; -import org.skyscreamer.jsonassert.JSONAssert; - -@TestWithResources -class UpdateSMSRequestDtoTest extends BaseTest { - @GivenTextResource("/domains/sms/v1/UpdateSMSBinaryRequestDto.json") - String jsonRequestBinaryDto; - - @GivenTextResource("/domains/sms/v1/UpdateSMSTextRequestDto.json") - String jsonRequestTextDto; - - @GivenTextResource("/domains/sms/v1/UpdateSMSMediaRequestDto.json") - String jsonRequestMediaDto; - - @Test - void serializeBinaryRequestDto() throws JsonProcessingException, JSONException { - - ApiUpdateBinaryMtMessageDto binaryRequestDTO = - new ApiUpdateBinaryMtMessageDto() - .toAdd(Arrays.asList("+15551231234", "+15987365412")) - .toRemove(Arrays.asList("+0123456789", "+9876543210")) - .body("Hi ${name} ({an identifier}) ! How are you?") - .udh("foo udh") - .from("+15551231234") - .type("mt_binary") - .deliveryReport("full") - .sendAt(OffsetDateTime.parse("2019-08-24T14:19:22Z")) - .expireAt(OffsetDateTime.parse("2019-08-24T14:21:22Z")) - .callbackUrl("callback url"); - UpdateBatchMessageRequestDto sendSMSRequestDto = - new UpdateBatchMessageRequestDto(binaryRequestDTO); - - String serializedString = objectMapper.writeValueAsString(sendSMSRequestDto); - - JSONAssert.assertEquals(jsonRequestBinaryDto, serializedString, true); - } - - @Test - void serializeTextRequestDto() throws JsonProcessingException, JSONException { - - ParameterObjDto parameterObjDto = new ParameterObjDto(); - parameterObjDto.put( - "an identifier", - Stream.of( - new AbstractMap.SimpleEntry<>("15551231234", "an identifier value for 15551231234"), - new AbstractMap.SimpleEntry<>("15551256344", "an identifier value for 15551256344")) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))); - - parameterObjDto.put( - "name", - Stream.of( - new AbstractMap.SimpleEntry<>("15551231234", "name value for 15551231234"), - new AbstractMap.SimpleEntry<>("15551256344", "name value for 15551256344"), - new AbstractMap.SimpleEntry<>( - ParameterObjParameterKeyDto.JSON_PROPERTY_DEFAULT, "default value")) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))); - - ApiUpdateTextMtMessageDto textRequestDTO = - new ApiUpdateTextMtMessageDto() - .toAdd(Arrays.asList("+15551231234", "+15551256344")) - .body("Hi ${name} ({an identifier}) ! How are you?") - .from("+15551231234") - .type("mt_text") - .deliveryReport("none") - .sendAt(OffsetDateTime.parse("2019-08-24T14:19:22Z")) - .expireAt(OffsetDateTime.parse("2019-08-24T14:21:22Z")) - .callbackUrl("callback url") - .parameters(parameterObjDto); - - UpdateBatchMessageRequestDto sendSMSRequestDto = - new UpdateBatchMessageRequestDto(textRequestDTO); - - String serializedString = objectMapper.writeValueAsString(sendSMSRequestDto); - - JSONAssert.assertEquals(jsonRequestTextDto, serializedString, true); - } - - @Test - void serializeMediaRequestDto() throws JsonProcessingException, JSONException { - - ParameterObjDto parameterObjDto = new ParameterObjDto(); - parameterObjDto.put( - "an identifier", - Stream.of( - new AbstractMap.SimpleEntry<>("15551231234", "an identifier value for 15551231234"), - new AbstractMap.SimpleEntry<>("15551256344", "an identifier value for 15551256344")) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))); - - parameterObjDto.put( - "name", - Stream.of( - new AbstractMap.SimpleEntry<>("15551231234", "name value for 15551231234"), - new AbstractMap.SimpleEntry<>("15551256344", "name value for 15551256344"), - new AbstractMap.SimpleEntry<>( - ParameterObjParameterKeyDto.JSON_PROPERTY_DEFAULT, "default value")) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))); - - ApiUpdateMmsMtMessageDto mediaRequestDTO = - new ApiUpdateMmsMtMessageDto() - .type("mt_media") - .toRemove(Arrays.asList("+15551231234", "+15551256344")) - .body( - new MediaBodyDto() - .url( - "https://en.wikipedia.org/wiki/Sinch_(company)#/media/File:Sinch_LockUp_RGB.png") - .message("Hi ${name} ({an identifier}) ! How are you?")) - .from("+15551231234") - .deliveryReport("summary") - .sendAt(OffsetDateTime.parse("2019-08-24T14:16:22Z")) - .expireAt(OffsetDateTime.parse("2019-08-24T14:17:22Z")) - .callbackUrl("callback url") - .strictValidation(true) - .parameters(parameterObjDto); - - UpdateBatchMessageRequestDto sendSMSRequestDto = - new UpdateBatchMessageRequestDto(mediaRequestDTO); - - String serializedString = objectMapper.writeValueAsString(sendSMSRequestDto); - - JSONAssert.assertEquals(jsonRequestMediaDto, serializedString, true); - } -} diff --git a/pom.xml b/pom.xml index b044c2469..0b9354230 100644 --- a/pom.xml +++ b/pom.xml @@ -142,11 +142,6 @@ **/mailgun/models/v1/response/GenericResponse.java - com/sinch/sdk/domains/sms/BatchesService.java - com/sinch/sdk/domains/sms/DeliveryReportsService.java - com/sinch/sdk/domains/sms/GroupsService.java - com/sinch/sdk/domains/sms/InboundsService.java - com/sinch/sdk/domains/sms/WebHooksService.java com/sinch/sdk/domains/verification/models/*.java com/sinch/sdk/domains/verification/VerificationsService.java @@ -327,7 +322,6 @@ com.sinch.sdk.e2e.domains.mailgun.v1.MailgunIT com.sinch.sdk.e2e.domains.numbers.v1.NumbersIT com.sinch.sdk.e2e.domains.conversation.ConversationIT - com.sinch.sdk.e2e.domains.sms.v0.SmsIT com.sinch.sdk.e2e.domains.sms.v1.SmsIT com.sinch.sdk.e2e.domains.voice.v0.VoiceIT com.sinch.sdk.e2e.domains.voice.v1.VoiceIT From 069beb37ca91ce187a11775aa1780add328af37b Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier Date: Tue, 22 Jul 2025 12:33:46 +0200 Subject: [PATCH 004/122] feat (Numbers): Enum naming change --- MIGRATION-GUIDE.md | 73 ++++++++++--------- .../numbers/models/v1/SmsErrorCode.java | 4 +- .../numbers/models/v1/errors/BadRequest.java | 4 +- .../models/v1/errors/BadRequestImpl.java | 2 +- .../models/v1/webhooks/NumberEvent.java | 4 +- pom.xml | 6 -- 6 files changed, 46 insertions(+), 47 deletions(-) diff --git a/MIGRATION-GUIDE.md b/MIGRATION-GUIDE.md index 55920b943..1d45adcde 100644 --- a/MIGRATION-GUIDE.md +++ b/MIGRATION-GUIDE.md @@ -14,52 +14,57 @@ This guide lists all removed classes and interfaces from V1 and how to migrate t ##### Common models | Old class | New class | |-----------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| models.ActiveNumber | [com.sinch.sdk.domains.numbers.models.v1.ActiveNumber](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/ActiveNumber.html) | -| models.AvailableNumber | [com.sinch.sdk.domains.numbers.models.v1.response/AvailableNumber](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/response/AvailableNumber.html) | -| models.CallbackConfiguration | [com.sinch.sdk.domains.numbers.models.v1.response/CallbackConfigurationResponse](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/response/CallbackConfigurationResponse.html) | -| models.Capability | [com.sinch.sdk.domains.numbers.models.v1.Capability](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/Capability.html) | -| models.Money | [com.sinch.sdk.domains.numbers.models.v1.Money](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/Money.html) | -| models.NumberPattern | [com.sinch.sdk.domains.numbers.models.v1.request.SearchPattern](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/SearchPattern.html) | -| models.NumberType | [com.sinch.sdk.domains.numbers.models.v1.NumberType](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/NumberType.html) | -| models.OrderBy | [com.sinch.sdk.domains.numbers.models.v1.request.OrderBy](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/OrderBy.html) | -| models.ProvisioningStatus | [com.sinch.sdk.domains.numbers.models.v1.ProvisioningStatus](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/ProvisioningStatus.html) | -| models.Region | Part of [com.sinch.sdk.domains.numbers.models.v1.regions.available.AvailableRegion](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/regions/available/AvailableRegion.html) | -| models.SMSConfiguration | [com.sinch.sdk.domains.numbers.models.v1.SmsConfiguration](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/SmsConfiguration.html) | -| models.ScheduledSmsProvisioning | [com.sinch.sdk.domains.numbers.models.v1.ScheduledSmsProvisioning](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/ScheduledSmsProvisioning.html) | -| models.ScheduledVoiceProvisioning | [com.sinch.sdk.domains.numbers.models.v1.request/ScheduledVoiceProvisioning](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/ScheduledVoiceProvisioning.html) | -| models.SearchPattern | [com.sinch.sdk.domains.numbers.models.v1.request/SearchPosition](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/SearchPosition.html) | -| models.SmsErrorCode | [com.sinch.sdk.domains.numbers.models.v1.SmsErrorCode](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/SmsErrorCode.html) | -| models.VoiceConfiguration | [com.sinch.sdk.domains.numbers.models.v1.VoiceConfiguration](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/VoiceConfiguration.html) | +| models.ActiveNumber | [com.sinch.sdk.domains.numbers.models.v1.ActiveNumber](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/ActiveNumber.html) | +| models.AvailableNumber | [com.sinch.sdk.domains.numbers.models.v1.response/AvailableNumber](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/response/AvailableNumber.html) | +| models.CallbackConfiguration | [com.sinch.sdk.domains.numbers.models.v1.response/CallbackConfigurationResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/response/CallbackConfigurationResponse.html) | +| models.Capability | [com.sinch.sdk.domains.numbers.models.v1.Capability](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/Capability.html) | +| models.Money | [com.sinch.sdk.domains.numbers.models.v1.Money](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/Money.html) | +| models.NumberPattern | [com.sinch.sdk.domains.numbers.models.v1.request.SearchPattern](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/SearchPattern.html) | +| models.NumberType | [com.sinch.sdk.domains.numbers.models.v1.NumberType](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/NumberType.html) | +| models.OrderBy | [com.sinch.sdk.domains.numbers.models.v1.request.OrderBy](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/OrderBy.html) | +| models.ProvisioningStatus | [com.sinch.sdk.domains.numbers.models.v1.ProvisioningStatus](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/ProvisioningStatus.html) | +| models.Region | Part of [com.sinch.sdk.domains.numbers.models.v1.regions.available.AvailableRegion](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/regions/available/AvailableRegion.html) | +| models.SMSConfiguration | [com.sinch.sdk.domains.numbers.models.v1.SmsConfiguration](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/SmsConfiguration.html) | +| models.ScheduledSmsProvisioning | [com.sinch.sdk.domains.numbers.models.v1.ScheduledSmsProvisioning](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/ScheduledSmsProvisioning.html) | +| models.ScheduledVoiceProvisioning | [com.sinch.sdk.domains.numbers.models.v1.request/ScheduledVoiceProvisioning](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/ScheduledVoiceProvisioning.html) | +| models.SearchPattern | [com.sinch.sdk.domains.numbers.models.v1.request/SearchPosition](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/SearchPosition.html) | +| models.SmsErrorCode | [com.sinch.sdk.domains.numbers.models.v1.SmsErrorCode](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/SmsErrorCode.html) | +| models.VoiceConfiguration | [com.sinch.sdk.domains.numbers.models.v1.VoiceConfiguration](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/VoiceConfiguration.html) | + +| Old enum | New enum | +|---------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| SmsErrorCode.EXCEEDED_10DLC_LIMIT | [com.sinch.sdk.domains.numbers.models.v1.SmsErrorCode.EXCEEDED_10_DLC_LIMIT](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/SmsErrorCode.htmll#EXCEEDED_10_DLC_LIMIT) | +| NumberEvent.EXCEEDED_10DLC_LIMIT | [com.sinch.sdk.domains.numbers.models.v1.webhooks.NumbersEvent.EXCEEDED_10_DLC_LIMIT](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/webhooks/NumberEvent.FailureCodeEnum.html#EXCEEDED_10_DLC_LIMIT) | ##### Active Numbers | Old class | New class | |-----------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| models.requests.ActiveNumberListRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumbersListQueryParameters](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/ActiveNumbersListQueryParameters.html) | -| models.requests.ActiveNumberUpdateRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumberUpdateRequest](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/ActiveNumberUpdateRequest.html) | -| models.requests.ActiveNumberUpdateSMSConfigurationRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.SmsConfiguration](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/SmsConfiguration.html) | -| models.requests.ActiveNumberUpdateVoiceConfigurationRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.VoiceConfiguration](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/VoiceConfiguration.html) | -| models.responses.ActiveNumberListResponse.java | [com.sinch.sdk.domains.numbers.models.v1.response.ActiveNumberListResponse](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/response/ActiveNumberListResponse.html) | +| models.requests.ActiveNumberListRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumbersListQueryParameters](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/ActiveNumbersListQueryParameters.html) | +| models.requests.ActiveNumberUpdateRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumberUpdateRequest](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/ActiveNumberUpdateRequest.html) | +| models.requests.ActiveNumberUpdateSMSConfigurationRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.SmsConfiguration](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/SmsConfiguration.html) | +| models.requests.ActiveNumberUpdateVoiceConfigurationRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.VoiceConfiguration](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/VoiceConfiguration.html) | +| models.responses.ActiveNumberListResponse.java | [com.sinch.sdk.domains.numbers.models.v1.response.ActiveNumberListResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/response/ActiveNumberListResponse.html) | ##### Available Numbers | Old class | New class | |---------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| models.requests.AvailableNumberListAllRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumbersListQueryParameters](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/AvailableNumbersListQueryParameters.html) | -| models.requests.AvailableNumberRentAnyRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentAnyRequest](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/AvailableNumberRentAnyRequest.html) | -| models.requests.AvailableNumberRentRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentRequest](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/AvailableNumberRentRequest.html) | -| models.responses.AvailableNumberListResponse | [com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumberListResponse](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/response/AvailableNumberListResponse.html) | -| models.requests.RentSMSConfigurationRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.SmsConfiguration](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/SmsConfiguration.html) | -| models.requests.RentVoiceConfigurationRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.VoiceConfiguration](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/VoiceConfiguration.html) | +| models.requests.AvailableNumberListAllRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumbersListQueryParameters](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/AvailableNumbersListQueryParameters.html) | +| models.requests.AvailableNumberRentAnyRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentAnyRequest](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/AvailableNumberRentAnyRequest.html) | +| models.requests.AvailableNumberRentRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentRequest](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/AvailableNumberRentRequest.html) | +| models.responses.AvailableNumberListResponse | [com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumberListResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/response/AvailableNumberListResponse.html) | +| models.requests.RentSMSConfigurationRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.SmsConfiguration](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/SmsConfiguration.html) | +| models.requests.RentVoiceConfigurationRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.VoiceConfiguration](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/VoiceConfiguration.html) | ##### Regions | Old class | New class | |---------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| models.requests.AvailableRegionListAllRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.regions.request.AvailableRegionsListQueryParameters](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/regions/request/AvailableRegionsListQueryParameters.html) | -| models.responses.AvailableRegionListResponse | [com.sinch.sdk.domains.numbers.models.v1.regions.available.response.AvailableRegionListResponse](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/regions/available/response/AvailableRegionListResponse.html) | +| models.requests.AvailableRegionListAllRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.regions.request.AvailableRegionsListQueryParameters](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/regions/request/AvailableRegionsListQueryParameters.html) | +| models.responses.AvailableRegionListResponse | [com.sinch.sdk.domains.numbers.models.v1.regions.available.response.AvailableRegionListResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/regions/available/response/AvailableRegionListResponse.html) | ##### Callbacks configuration | Old class | New class | |----------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| models.requests.CallbackConfigurationUpdateRequest | [com.sinch.sdk.domains.numbers.models.v1.callbacks.request.CallbackConfigurationUpdateRequest](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/callbacks/request/CallbackConfigurationUpdateRequest.html) | +| models.requests.CallbackConfigurationUpdateRequest | [com.sinch.sdk.domains.numbers.models.v1.callbacks.request.CallbackConfigurationUpdateRequest](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/callbacks/request/CallbackConfigurationUpdateRequest.html) | ##### Webhooks | Old class | New class | @@ -71,13 +76,13 @@ This guide lists all removed classes and interfaces from V1 and how to migrate t #### Replacement APIs -Use the new versioned API under v1().numbers() to get access to [NumbersService](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/NumbersService.html): [`sinchClient.numbers.v1()`](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0./com/sinch/sdk/domains/numbers/NumbersService.html#v1()) +Use the new versioned API under v1().numbers() to get access to [NumbersService](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/NumbersService.html): [`sinchClient.numbers.v1()`](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0./com/sinch/sdk/domains/numbers/NumbersService.html#v1()) | Old interface | New Equivalent in `numbers().v1()` | |---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------| -| active() | [Direct access from v1()](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/NumbersService.html) | -| available() | [Direct access from v1()](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/NumbersService.html) | -| regions() | [v1().regions()](https://www.javadoc.io/static/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/AvailableRegionsService.html) | +| active() | [Direct access from v1()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/NumbersService.html) | +| available() | [Direct access from v1()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/NumbersService.html) | +| regions() | [v1().regions()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/AvailableRegionsService.html) | | callback() | [v1().callback()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/CallbackConfigurationService.html) | | webhook() | [v1().webhooks()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/WebHooksService.html) | diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/SmsErrorCode.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/SmsErrorCode.java index 015baed0a..f68cbee68 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/SmsErrorCode.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/SmsErrorCode.java @@ -28,7 +28,7 @@ public class SmsErrorCode extends EnumDynamic { new SmsErrorCode("CAMPAIGN_NOT_AVAILABLE"); /** Exceeded the 10DLC limit. */ - public static final SmsErrorCode EXCEEDED_10DLC_LIMIT = new SmsErrorCode("EXCEEDED_10DLC_LIMIT"); + public static final SmsErrorCode EXCEEDED_10_DLC_LIMIT = new SmsErrorCode("EXCEEDED_10DLC_LIMIT"); /** Failed to provision the number. */ public static final SmsErrorCode NUMBER_PROVISIONING_FAILED = @@ -82,7 +82,7 @@ public class SmsErrorCode extends EnumDynamic { SMS_PROVISIONING_FAILED, CAMPAIGN_PROVISIONING_FAILED, CAMPAIGN_NOT_AVAILABLE, - EXCEEDED_10DLC_LIMIT, + EXCEEDED_10_DLC_LIMIT, NUMBER_PROVISIONING_FAILED, PARTNER_SERVICE_UNAVAILABLE, CAMPAIGN_PENDING_ACCEPTANCE, diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/errors/BadRequest.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/errors/BadRequest.java index b38da94a3..d852e6610 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/errors/BadRequest.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/errors/BadRequest.java @@ -23,10 +23,10 @@ public interface BadRequest { /** Gets or Sets type */ public class TypeEnum extends EnumDynamic { - public static final TypeEnum BADREQUEST = new TypeEnum("BadRequest"); + public static final TypeEnum BAD_REQUEST = new TypeEnum("BadRequest"); private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>(TypeEnum.class, TypeEnum::new, Arrays.asList(BADREQUEST)); + new EnumSupportDynamic<>(TypeEnum.class, TypeEnum::new, Arrays.asList(BAD_REQUEST)); private TypeEnum(String value) { super(value); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/errors/BadRequestImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/errors/BadRequestImpl.java index f43e364d3..653644bc5 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/errors/BadRequestImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/errors/BadRequestImpl.java @@ -98,7 +98,7 @@ private String toIndentedString(Object o) { @JsonPOJOBuilder(withPrefix = "set") static class Builder implements BadRequest.Builder { - OptionalValue type = OptionalValue.of(TypeEnum.BADREQUEST); + OptionalValue type = OptionalValue.of(TypeEnum.BAD_REQUEST); OptionalValue> fieldViolations = OptionalValue.empty(); @JsonProperty(JSON_PROPERTY_FIELD_VIOLATIONS) diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/webhooks/NumberEvent.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/webhooks/NumberEvent.java index 8524ea5ec..ce7517181 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/webhooks/NumberEvent.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/webhooks/NumberEvent.java @@ -149,7 +149,7 @@ public static String valueOf(StatusEnum e) { public class FailureCodeEnum extends EnumDynamic { public static final FailureCodeEnum CAMPAIGN_NOT_AVAILABLE = new FailureCodeEnum("CAMPAIGN_NOT_AVAILABLE"); - public static final FailureCodeEnum EXCEEDED_10DLC_LIMIT = + public static final FailureCodeEnum EXCEEDED_10_DLC_LIMIT = new FailureCodeEnum("EXCEEDED_10DLC_LIMIT"); public static final FailureCodeEnum NUMBER_PROVISIONING_FAILED = new FailureCodeEnum("NUMBER_PROVISIONING_FAILED"); @@ -181,7 +181,7 @@ public class FailureCodeEnum extends EnumDynamic { FailureCodeEnum::new, Arrays.asList( CAMPAIGN_NOT_AVAILABLE, - EXCEEDED_10DLC_LIMIT, + EXCEEDED_10_DLC_LIMIT, NUMBER_PROVISIONING_FAILED, PARTNER_SERVICE_UNAVAILABLE, CAMPAIGN_PENDING_ACCEPTANCE, diff --git a/pom.xml b/pom.xml index b044c2469..b8fa86186 100644 --- a/pom.xml +++ b/pom.xml @@ -152,12 +152,6 @@ com/sinch/sdk/domains/verification/VerificationsService.java com/sinch/sdk/domains/verification/VerificationStatusService.java com/sinch/sdk/domains/verification/WebHooksService.java - com/sinch/sdk/domains/numbers/models/*.java - com/sinch/sdk/domains/numbers/ActiveNumberService.java - com/sinch/sdk/domains/numbers/AvailableNumberService.java - com/sinch/sdk/domains/numbers/AvailableRegionService.java - com/sinch/sdk/domains/numbers/CallbackConfigurationService.java - com/sinch/sdk/domains/numbers/WebHooksService.java com/sinch/sdk/domains/voice/models/*.java com/sinch/sdk/domains/voice/models/requests/*.java com/sinch/sdk/domains/voice/models/response/*.java From 96059144b398502fd6531ab89a683a68a2b6d0b5 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier Date: Tue, 22 Jul 2025 15:35:15 +0200 Subject: [PATCH 005/122] feat (Voice): Remove Voice deprecated features --- MIGRATION-GUIDE.md | 159 ++++++-- .../domains/voice/ApplicationsService.java | 88 ----- .../sdk/domains/voice/CalloutsService.java | 77 ---- .../sinch/sdk/domains/voice/CallsService.java | 68 ---- .../sdk/domains/voice/ConferencesService.java | 85 ----- .../sinch/sdk/domains/voice/VoiceService.java | 50 --- .../sdk/domains/voice/WebHooksService.java | 73 ---- .../voice/adapters/ApplicationsService.java | 41 --- .../voice/adapters/CalloutsService.java | 39 -- .../domains/voice/adapters/CallsService.java | 30 -- .../voice/adapters/ConferencesService.java | 39 -- .../domains/voice/adapters/VoiceService.java | 46 --- .../voice/adapters/WebHooksService.java | 33 -- .../converters/ApplicationsDtoConverter.java | 129 ------- .../converters/CalloutsDtoConverter.java | 149 -------- .../converters/CallsDtoConverter.java | 31 -- .../converters/CapabilityDtoConverter.java | 14 - .../converters/ConferencesDtoConverter.java | 50 --- .../converters/ControlDtoConverter.java | 38 -- .../converters/DestinationDtoConverter.java | 103 ------ .../converters/DomainTypeDtoConverter.java | 21 -- .../DualToneMultiFrequencyDtoConverter.java | 13 - .../E164PhoneNumberDtoConverter.java | 20 -- .../converters/NumberTypeDtoConverter.java | 14 - .../converters/PriceDtoConverter.java | 13 - .../converters/SVAMLActionDtoConverter.java | 287 --------------- .../SVAMLInstructionDtoConverter.java | 164 --------- .../converters/WebhooksEventDtoConverter.java | 191 ---------- .../models/ApplicationAssignedNumber.java | 116 ------ .../domains/voice/models/ApplicationURL.java | 91 ----- .../sdk/domains/voice/models/CallLegType.java | 42 --- .../domains/voice/models/CallReasonType.java | 53 --- .../domains/voice/models/CallResultType.java | 39 -- .../domains/voice/models/CallbackUrls.java | 63 ---- .../domains/voice/models/CapabilityType.java | 41 --- .../voice/models/ConferenceDtfmOptions.java | 106 ------ .../sdk/domains/voice/models/Destination.java | 10 - .../voice/models/DestinationNumber.java | 72 ---- .../voice/models/DestinationNumberType.java | 36 -- .../domains/voice/models/DestinationSip.java | 43 --- .../domains/voice/models/DestinationUser.java | 43 --- .../sdk/domains/voice/models/DomainType.java | 40 --- .../domains/voice/models/DtfmModeType.java | 51 --- .../domains/voice/models/MusicOnHoldType.java | 43 --- .../voice/models/NumberInformation.java | 141 -------- .../sdk/domains/voice/models/NumberType.java | 38 -- .../sinch/sdk/domains/voice/models/Price.java | 54 --- .../domains/voice/models/TransportType.java | 40 --- ...cationsAssignNumbersRequestParameters.java | 133 ------- .../requests/CalloutRequestParameters.java | 131 ------- .../CalloutRequestParametersConference.java | 330 ----------------- .../CalloutRequestParametersCustom.java | 184 ---------- .../requests/CalloutRequestParametersTTS.java | 273 -------------- ...onferenceManageParticipantCommandType.java | 51 --- ...nceManageParticipantRequestParameters.java | 77 ---- .../voice/models/requests/Control.java | 8 - .../voice/models/requests/ControlUrl.java | 39 -- .../voice/models/requests/package-info.java | 6 - .../models/response/AssignedNumbers.java | 65 ---- .../models/response/CallInformation.java | 338 ------------------ .../voice/models/response/CallStatusType.java | 35 -- .../response/ConferenceParticipant.java | 149 -------- .../voice/models/response/QueryNumber.java | 55 --- .../voice/models/response/package-info.java | 6 - .../domains/voice/models/svaml/Action.java | 25 -- .../models/svaml/ActionConnectConference.java | 82 ----- .../voice/models/svaml/ActionConnectMxp.java | 67 ---- .../voice/models/svaml/ActionConnectPstn.java | 183 ---------- .../voice/models/svaml/ActionConnectSip.java | 146 -------- .../voice/models/svaml/ActionContinue.java | 22 -- .../voice/models/svaml/ActionHangUp.java | 22 -- .../voice/models/svaml/ActionPark.java | 97 ----- .../voice/models/svaml/ActionRunMenu.java | 112 ------ .../svaml/AnsweringMachineDetection.java | 34 -- .../voice/models/svaml/IndicationType.java | 112 ------ .../voice/models/svaml/Instruction.java | 19 - .../voice/models/svaml/InstructionAnswer.java | 27 -- .../models/svaml/InstructionPlayFiles.java | 65 ---- .../voice/models/svaml/InstructionSay.java | 63 ---- .../models/svaml/InstructionSendDtfm.java | 45 --- .../models/svaml/InstructionSetCookie.java | 62 ---- .../svaml/InstructionStartRecording.java | 44 --- .../svaml/InstructionStopRecording.java | 27 -- .../sdk/domains/voice/models/svaml/Menu.java | 153 -------- .../voice/models/svaml/MenuOption.java | 53 --- .../voice/models/svaml/MenuOptionAction.java | 33 -- .../models/svaml/MenuOptionActionType.java | 43 --- .../voice/models/svaml/SVAMLControl.java | 93 ----- .../models/svaml/StartRecordingOptions.java | 107 ------ .../models/svaml/TranscriptionOptions.java | 51 --- .../voice/models/svaml/package-info.java | 8 - .../ConnectPstnAnsweringMachineDetection.java | 39 -- ...nectPstnAnsweringMachineDetectionImpl.java | 37 -- .../svaml/action/MenuOptionActionFactory.java | 1 - ...redCallEventAnsweringMachineDetection.java | 33 -- ...allEventAnsweringMachineDetectionImpl.java | 8 - .../models/v1/webhooks/package-info.java | 6 - .../voice/models/webhooks/AmdAnswer.java | 88 ----- .../models/webhooks/AmdAnswerReasonType.java | 42 --- .../models/webhooks/AmdAnswerStatusType.java | 44 --- .../models/webhooks/AnsweredCallEvent.java | 72 ---- .../voice/models/webhooks/CallEvent.java | 69 ---- .../models/webhooks/DisconnectCallEvent.java | 229 ------------ .../models/webhooks/IncomingCallEvent.java | 285 --------------- .../voice/models/webhooks/MenuInputType.java | 50 --- .../voice/models/webhooks/MenuResult.java | 85 ----- .../webhooks/MenuResultInputMethodType.java | 38 -- .../voice/models/webhooks/NotifyEvent.java | 81 ----- .../models/webhooks/PromptInputEvent.java | 95 ----- .../voice/models/webhooks/WebhooksEvent.java | 64 ---- .../voice/models/webhooks/package-info.java | 6 - .../api/v1/adapters/BatchesServiceTest.java | 2 +- .../adapters/DeliveryReportsServiceTest.java | 2 +- .../api/v1/adapters/GroupsServiceTest.java | 2 +- .../api/v1/adapters/InboundsServiceTest.java | 2 +- .../adapters/ApplicationsServiceTest.java | 110 ------ .../voice/adapters/CalloutsServiceTest.java | 81 ----- .../voice/adapters/CallsServiceTest.java | 83 ----- .../adapters/ConferencesServiceTest.java | 120 ------- .../voice/adapters/VoiceServiceTest.java | 4 - .../ApplicationsDtoConverterTest.java | 110 ------ .../converters/CalloutsDtoConverterTest.java | 94 ----- .../converters/CallsDtoConverterTest.java | 62 ---- .../ConferencesDtoConverterTest.java | 44 --- .../SVAMLActionDtoConverterTest.java | 183 ---------- .../SVAMLInstructionDtoConverterTest.java | 107 ------ .../WebhooksEventDtoConverterTest.java | 141 -------- .../v1/adapters}/PaginationFillerHelper.java | 2 +- ...alloutRequestParametersConferenceTest.java | 112 ------ .../CalloutRequestParametersCustomTest.java | 108 ------ .../CalloutRequestParametersTTSTest.java | 88 ----- ...anageParticipantRequestParametersTest.java | 29 -- .../models/svaml/MenuOptionActionTest.java | 29 -- .../voice/models/svaml/SVAMLControlTest.java | 30 -- .../domains/voice/v0/ApplicationsSteps.java | 159 -------- .../e2e/domains/voice/v0/CalloutsSteps.java | 159 -------- .../sdk/e2e/domains/voice/v0/CallsSteps.java | 134 ------- .../e2e/domains/voice/v0/ConferenceSteps.java | 126 ------- .../sdk/e2e/domains/voice/v0/VoiceIT.java | 16 - .../domains/voice/v0/WebhooksEventsSteps.java | 291 --------------- .../com/mycompany/app/WebhookController.java | 9 +- .../com/mycompany/app/WebhookService.java | 16 +- .../v1/callouts/CalloutRequestDtoTest.java | 7 +- .../action/SvamlActionConnectPstnTest.java | 6 +- .../v1/webhooks/VoiceWebhookEventTest.java | 21 -- pom.xml | 11 - 146 files changed, 160 insertions(+), 10614 deletions(-) delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/ApplicationsService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/CalloutsService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/CallsService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/ConferencesService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/WebHooksService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/adapters/ApplicationsService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/adapters/CalloutsService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/adapters/CallsService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/adapters/ConferencesService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/adapters/WebHooksService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/adapters/converters/ApplicationsDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/adapters/converters/CalloutsDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/adapters/converters/CallsDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/adapters/converters/CapabilityDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/adapters/converters/ConferencesDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/adapters/converters/ControlDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/adapters/converters/DestinationDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/adapters/converters/DomainTypeDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/adapters/converters/DualToneMultiFrequencyDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/adapters/converters/E164PhoneNumberDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/adapters/converters/NumberTypeDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/adapters/converters/PriceDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/adapters/converters/SVAMLActionDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/adapters/converters/SVAMLInstructionDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/adapters/converters/WebhooksEventDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/ApplicationAssignedNumber.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/ApplicationURL.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/CallLegType.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/CallReasonType.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/CallResultType.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/CallbackUrls.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/CapabilityType.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/ConferenceDtfmOptions.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/Destination.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/DestinationNumber.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/DestinationNumberType.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/DestinationSip.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/DestinationUser.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/DomainType.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/DtfmModeType.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/MusicOnHoldType.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/NumberInformation.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/NumberType.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/Price.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/TransportType.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/requests/ApplicationsAssignNumbersRequestParameters.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/requests/CalloutRequestParameters.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/requests/CalloutRequestParametersConference.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/requests/CalloutRequestParametersCustom.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/requests/CalloutRequestParametersTTS.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/requests/ConferenceManageParticipantCommandType.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/requests/ConferenceManageParticipantRequestParameters.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/requests/Control.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/requests/ControlUrl.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/requests/package-info.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/response/AssignedNumbers.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/response/CallInformation.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/response/CallStatusType.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/response/ConferenceParticipant.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/response/QueryNumber.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/response/package-info.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/svaml/Action.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/svaml/ActionConnectConference.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/svaml/ActionConnectMxp.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/svaml/ActionConnectPstn.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/svaml/ActionConnectSip.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/svaml/ActionContinue.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/svaml/ActionHangUp.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/svaml/ActionPark.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/svaml/ActionRunMenu.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/svaml/AnsweringMachineDetection.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/svaml/IndicationType.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/svaml/Instruction.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/svaml/InstructionAnswer.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/svaml/InstructionPlayFiles.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/svaml/InstructionSay.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/svaml/InstructionSendDtfm.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/svaml/InstructionSetCookie.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/svaml/InstructionStartRecording.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/svaml/InstructionStopRecording.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/svaml/Menu.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/svaml/MenuOption.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/svaml/MenuOptionAction.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/svaml/MenuOptionActionType.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/svaml/SVAMLControl.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/svaml/StartRecordingOptions.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/svaml/TranscriptionOptions.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/svaml/package-info.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/ConnectPstnAnsweringMachineDetection.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/ConnectPstnAnsweringMachineDetectionImpl.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/AnsweredCallEventAnsweringMachineDetection.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/AnsweredCallEventAnsweringMachineDetectionImpl.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/package-info.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/webhooks/AmdAnswer.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/webhooks/AmdAnswerReasonType.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/webhooks/AmdAnswerStatusType.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/webhooks/AnsweredCallEvent.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/webhooks/CallEvent.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/webhooks/DisconnectCallEvent.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/webhooks/IncomingCallEvent.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/webhooks/MenuInputType.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/webhooks/MenuResult.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/webhooks/MenuResultInputMethodType.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/webhooks/NotifyEvent.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/webhooks/PromptInputEvent.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/webhooks/WebhooksEvent.java delete mode 100644 client/src/main/com/sinch/sdk/domains/voice/models/webhooks/package-info.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/voice/adapters/ApplicationsServiceTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/voice/adapters/CalloutsServiceTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/voice/adapters/CallsServiceTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/voice/adapters/ConferencesServiceTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/voice/adapters/VoiceServiceTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/voice/adapters/converters/ApplicationsDtoConverterTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/voice/adapters/converters/CalloutsDtoConverterTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/voice/adapters/converters/CallsDtoConverterTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/voice/adapters/converters/ConferencesDtoConverterTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/voice/adapters/converters/SVAMLActionDtoConverterTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/voice/adapters/converters/SVAMLInstructionDtoConverterTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/voice/adapters/converters/WebhooksEventDtoConverterTest.java rename client/src/test/java/com/sinch/sdk/domains/{ => voice/api/v1/adapters}/PaginationFillerHelper.java (93%) delete mode 100644 client/src/test/java/com/sinch/sdk/domains/voice/models/requests/CalloutRequestParametersConferenceTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/voice/models/requests/CalloutRequestParametersCustomTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/voice/models/requests/CalloutRequestParametersTTSTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/voice/models/requests/ConferenceManageParticipantRequestParametersTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/voice/models/svaml/MenuOptionActionTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/voice/models/svaml/SVAMLControlTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/ApplicationsSteps.java delete mode 100644 client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/CalloutsSteps.java delete mode 100644 client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/CallsSteps.java delete mode 100644 client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/ConferenceSteps.java delete mode 100644 client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/VoiceIT.java delete mode 100644 client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/WebhooksEventsSteps.java diff --git a/MIGRATION-GUIDE.md b/MIGRATION-GUIDE.md index 36c12a6ca..ab85d8772 100644 --- a/MIGRATION-GUIDE.md +++ b/MIGRATION-GUIDE.md @@ -12,8 +12,8 @@ This guide lists all removed classes and interfaces from V1 and how to migrate t #### Replacement models ##### Common models -| Old class | New class | -|-----------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Old class | New class | +|-----------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | models.ActiveNumber | [com.sinch.sdk.domains.numbers.models.v1.ActiveNumber](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/ActiveNumber.html) | | models.AvailableNumber | [com.sinch.sdk.domains.numbers.models.v1.response/AvailableNumber](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/response/AvailableNumber.html) | | models.CallbackConfiguration | [com.sinch.sdk.domains.numbers.models.v1.response/CallbackConfigurationResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/response/CallbackConfigurationResponse.html) | @@ -37,8 +37,8 @@ This guide lists all removed classes and interfaces from V1 and how to migrate t | NumberEvent.EXCEEDED_10DLC_LIMIT | [com.sinch.sdk.domains.numbers.models.v1.webhooks.NumbersEvent.EXCEEDED_10_DLC_LIMIT](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/webhooks/NumberEvent.FailureCodeEnum.html#EXCEEDED_10_DLC_LIMIT) | ##### Active Numbers -| Old class | New class | -|-----------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Old class | New class | +|-----------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | models.requests.ActiveNumberListRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumbersListQueryParameters](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/ActiveNumbersListQueryParameters.html) | | models.requests.ActiveNumberUpdateRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumberUpdateRequest](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/ActiveNumberUpdateRequest.html) | | models.requests.ActiveNumberUpdateSMSConfigurationRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.SmsConfiguration](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/SmsConfiguration.html) | @@ -46,8 +46,8 @@ This guide lists all removed classes and interfaces from V1 and how to migrate t | models.responses.ActiveNumberListResponse.java | [com.sinch.sdk.domains.numbers.models.v1.response.ActiveNumberListResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/response/ActiveNumberListResponse.html) | ##### Available Numbers -| Old class | New class | -|---------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Old class | New class | +|---------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | models.requests.AvailableNumberListAllRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumbersListQueryParameters](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/AvailableNumbersListQueryParameters.html) | | models.requests.AvailableNumberRentAnyRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentAnyRequest](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/AvailableNumberRentAnyRequest.html) | | models.requests.AvailableNumberRentRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentRequest](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/AvailableNumberRentRequest.html) | @@ -56,15 +56,15 @@ This guide lists all removed classes and interfaces from V1 and how to migrate t | models.requests.RentVoiceConfigurationRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.VoiceConfiguration](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/VoiceConfiguration.html) | ##### Regions -| Old class | New class | -|---------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Old class | New class | +|---------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | models.requests.AvailableRegionListAllRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.regions.request.AvailableRegionsListQueryParameters](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/regions/request/AvailableRegionsListQueryParameters.html) | | models.responses.AvailableRegionListResponse | [com.sinch.sdk.domains.numbers.models.v1.regions.available.response.AvailableRegionListResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/regions/available/response/AvailableRegionListResponse.html) | ##### Callbacks configuration -| Old class | New class | -|----------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| models.requests.CallbackConfigurationUpdateRequest | [com.sinch.sdk.domains.numbers.models.v1.callbacks.request.CallbackConfigurationUpdateRequest](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/callbacks/request/CallbackConfigurationUpdateRequest.html) | +| Old class | New class | +|----------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| models.requests.CallbackConfigurationUpdateRequest | [com.sinch.sdk.domains.numbers.models.v1.callbacks.request.CallbackConfigurationUpdateRequest](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/callbacks/request/CallbackConfigurationUpdateRequest.html) | ##### Webhooks | Old class | New class | @@ -76,13 +76,13 @@ This guide lists all removed classes and interfaces from V1 and how to migrate t #### Replacement APIs -Use the new versioned API under v1().numbers() to get access to [NumbersService](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/NumbersService.html): [`sinchClient.numbers.v1()`](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0./com/sinch/sdk/domains/numbers/NumbersService.html#v1()) +Use the new versioned API under `numbers().v1()` to get access to [NumbersService](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/NumbersService.html): [`sinchClient.numbers().v1()`](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0./com/sinch/sdk/domains/numbers/NumbersService.html#v1()) | Old interface | New Equivalent in `numbers().v1()` | |---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------| -| active() | [Direct access from v1()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/NumbersService.html) | -| available() | [Direct access from v1()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/NumbersService.html) | -| regions() | [v1().regions()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/AvailableRegionsService.html) | +| active() | [Direct access from v1()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/NumbersService.html) | +| available() | [Direct access from v1()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/NumbersService.html) | +| regions() | [v1().regions()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/AvailableRegionsService.html) | | callback() | [v1().callback()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/CallbackConfigurationService.html) | | webhook() | [v1().webhooks()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/WebHooksService.html) | @@ -110,7 +110,7 @@ Use the new versioned API under v1().numbers() to get access to [NumbersService] | models/requests/UpdateSmsBatchBinaryRequest | [com.sinch.sdk.domains.sms.models.v1.batches.request.UpdateBinaryRequest](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/batches/request/UpdateBinaryRequest.html) | | models/requests/UpdateSmsBatchMediaRequest | [com.sinch.sdk.domains.sms.models.v1.batches.request.UpdateMediaRequest](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/batches/request/UpdateMediaRequest.html) | | models/requests/UpdateSmsBatchTextRequest | [com.sinch.sdk.domains.sms.models.v1.batches.request.UpdateTextRequest](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/batches/request/UpdateTextRequest.html) | -| models/responses/BatchesListResponse | [com.sinch.sdk.domains.sms.models.v1.batches.response.ListBatchesResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/batches/response/ListBatchesResponse.html) | +| models/responses/BatchesListResponse | [com.sinch.sdk.domains.sms.models.v1.batches.response.ListBatchesResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/batches/response/ListBatchesResponse.html) | ##### Delivery Reports | Old class | New class | @@ -155,13 +155,13 @@ Use the new versioned API under v1().numbers() to get access to [NumbersService] | models/responses/InboundsListResponse | [com.sinch.sdk.domains.sms.models.v1.inbounds.response.ListInboundsResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/inbounds/response/ListInboundsResponse.html) | ##### Webhooks -| Old class | New class | -|--------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| models/webhooks/WebhooksEvent | [com.sinch.sdk.domains.sms.models.v1.webhooks.SmsEvent](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/webhooks/SmsEvent.html) | +| Old class | New class | +|-------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| models/webhooks/WebhooksEvent | [com.sinch.sdk.domains.sms.models.v1.webhooks.SmsEvent](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/webhooks/SmsEvent.html) | #### Replacement APIs -Use the new versioned API under `v1().sms()` to get access to [SMSService](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/api/v1/SMSService.html): [`sinchClient.sms.v1()`](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0./com/sinch/sdk/domains/sms/SMSService.html#v1()) +Use the new versioned API under `sms().v1()` to get access to [SMSService](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/api/v1/SMSService.html): [`sinchClient.sms().v1()`](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0./com/sinch/sdk/domains/sms/SMSService.html#v1()) | Old interface | New Equivalent in `sms().v1()` | |-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------| @@ -170,3 +170,122 @@ Use the new versioned API under `v1().sms()` to get access to [SMSService](https | groups() | [v1().groups()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/api/v1/GroupsService.html) | | inbounds() | [v1().inbounds()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/api/v1/InboundsService.html) | | webHooks() | [v1().webhooks()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/api/v1/WebHooksService.html) | + +### [`Voice`](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/package-summary.html) + +#### Replacement models + +##### Destination +| Old class | New class | +|------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| models/Destination | [com.sinch.sdk.domains.voice.models.v1.destination.Destination](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/destination/Destination.html) | +| models/DestinationNumber | [com.sinch.sdk.domains.voice.models.v1.destination.DestinationSip](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/destination/DestinationSip.html) or [com.sinch.sdk.domains.voice.models.v1.destination.DestinationPstn](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/destination/DestinationPstn.html) | +| models/DestinationNumberType | N/A | +| models/DestinationSip | [com.sinch.sdk.domains.voice.models.v1.destination.DestinationSip](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/destination/DestinationSip.html) | +| models/DestinationUser | [com.sinch.sdk.domains.voice.models.v1.destination.DestinationMxp](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/destination/DestinationMxp.html) | + +##### Applications +| Old class | New class | +|------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| models/ApplicationAssignedNumber | [com.sinch.sdk.domains.voice.models.v1.applications.response](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/applications/response/OwnedNumberInformation.html) | +| models/response/AssignedNumbers | [com.sinch.sdk.domains.voice.models.v1.applications.response.OwnedNumbersResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/applications/response/OwnedNumbersResponse.html) | +| models/CallbackUrls | [com.sinch.sdk.domains.voice.models.v1.applications.Callbacks](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/applications/Callbacks.html) | +| models/ApplicationURL | [com.sinch.sdk.domains.voice.models.v1.applications.CallbacksUrl](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/applications/CallbacksUrl.html) | +| models/NumberInformation | [com.sinch.sdk.domains.voice.models.v1.applications.response.QueryNumberInformation](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/applications/response/QueryNumberInformation.html) | +| models/response/QueryNumber | [com.sinch.sdk.domains.voice.models.v1.applications.response.QueryNumberResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/applications/response/QueryNumberResponse.html) | +| models/requests/ApplicationsAssignNumbersRequestParameters | [com.sinch.sdk.domains.voice.models.v1.applications.request.UpdateNumbersRequest](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/applications/request/UpdateNumbersRequest.html) | +| models/NumberType | N/A | +| models/CapabilityType | [com.sinch.sdk.domains.voice.models.v1.applications.Capability](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/applications/Capability.html) | + +##### Callouts +| Old class | New class | +|----------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| models/requests/CalloutRequestParameters | [com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequest](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/callouts/request/CalloutRequest.html) | +| models/requests/CalloutRequestParametersConference | [com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequestConference](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/callouts/request/CalloutRequestConference.html) | +| models/requests/CalloutRequestParametersCustom | [com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequestCustom](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/callouts/request/CalloutRequestCustom.html) | +| models/requests/CalloutRequestParametersTTS | [com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequestTTS](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/callouts/request/CalloutRequestTTS.html) | + +##### Calls +| Old class | New class | +|---------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| models/CallLegType | [com.sinch.sdk.domains.voice.models.v1.calls.request.CallLeg](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/calls/request/CallLeg.html) | +| models/response/CallInformation | [com.sinch.sdk.domains.voice.models.v1.calls.response.CallInformation](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/calls/response/CallInformation.html) | +| models/response/CallStatusType | [com.sinch.sdk.domains.voice.models.v1.calls.response.CallInformation.StatusEnum](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/calls/response/CallInformation.StatusEnum.html) | +| models/CallResultType | [com.sinch.sdk.domains.voice.models.v1.calls.response.CallResult](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/calls/response/CallResult.html) | +| models/CallReasonType | [com.sinch.sdk.domains.voice.models.v1.calls.response.CallInformation.ReasonEnum](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/calls/response/CallInformation.ReasonEnum.html) | +| models/DomainType | [com.sinch.sdk.domains.voice.models.v1.calls.response.CallInformation.DomainEnum](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/calls/response/CallInformation.DomainEnum.html) | + +##### Conferences +| Old class | New class | +|--------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| models/requests/ConferenceManageParticipantCommandType | [com.sinch.sdk.domains.voice.models.v1.conferences.request.ManageConferenceParticipantRequest.CommandEnum](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/conferences/request/ManageConferenceParticipantRequest.CommandEnum.html) | +| models/requests/ConferenceManageParticipantRequestParameters | [com.sinch.sdk.domains.voice.models.v1.conferences.request.ManageConferenceParticipantRequest](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/conferences/request/ManageConferenceParticipantRequest.html) | +| models/ConferenceDtfmOptions | [com.sinch.sdk.domains.voice.models.v1.conferences.ConferenceDtmfOptions](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/conferences/ConferenceDtmfOptions.html) | +| models/MusicOnHoldType | [com.sinch.sdk.domains.voice.models.v1.MusicOnHold](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/MusicOnHold.html) | +| models/DtfmModeType | [com.sinch.sdk.domains.voice.models.v1.conferences.ConferenceDtmfOptions.ModeEnum](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/conferences/ConferenceDtmfOptions.ModeEnum.html) | +| models/response/ConferenceParticipant | [com.sinch.sdk.domains.voice.models.v1.conferences.ConferenceParticipant](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/conferences/ConferenceParticipant.html) | + +##### Svaml +| Old class | New class | +|-------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| models/requests/Control | [com.sinch.sdk.domains.voice.models.v1.svaml.Control](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/svaml/Control.html) | +| models/svaml/SVAMLControl | [com.sinch.sdk.domains.voice.models.v1.svaml.SvamlControl](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/svaml/SvamlControl.html) | +| models/requests/ControlUrl | [com.sinch.sdk.domains.voice.models.v1.svaml.ControlUrl](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/svaml/ControlUrl.html) | +| models/svaml/Action | [com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlAction](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlAction.html) | +| models/svaml/ActionConnectConference | [com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionConnectConference](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectConference.html) | +| models/svaml/ActionConnectMxp | [com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionConnectMxp](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectMxp.html) | +| models/svaml/ActionConnectPstn | [com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionConnectPstn](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectPstn.html) | +| models/svaml/ActionConnectSip | [com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionConnectSip](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectSip.html) | +| models/svaml/ActionContinue | [com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionContinue](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionContinue.html) | +| models/svaml/ActionHangUp | [com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionHangup](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionHangup.html) | +| models/svaml/ActionPark | [com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionPark](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionPark.html) | +| models/svaml/ActionRunMenu | [com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionRunMenu](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionRunMenu.html) | +| models/svaml/AnsweringMachineDetection | [com.sinch.sdk.domains.voice.models.v1.svaml.action.AnsweringMachineDetectionQuery](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/svaml/action/AnsweringMachineDetectionQuery.html) | +| models/svaml/IndicationType | [com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionConnectPstn.IndicationsEnum](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectPstn.IndicationsEnum.html) | +| models/TransportType | [com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionConnectSip.TransportEnum](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectSip.TransportEnum.html) | +| models/svaml/Menu | [com.sinch.sdk.domains.voice.models.v1.svaml.action.Menu](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/svaml/action/Menu.html) | +| models/svaml/MenuOption | [com.sinch.sdk.domains.voice.models.v1.svaml.action.MenuOption](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/svaml/action/MenuOption.html) | +| models/svaml/MenuOptionAction | see [com.sinch.sdk.domains.voice.models.v1.svaml.action.MenuOptionActionFactory](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/svaml/action/MenuOptionActionFactory.html) | +| models/svaml/MenuOptionActionType | [com.sinch.sdk.domains.voice.models.v1.svaml.action.MenuOptionActionFactory.MenuOptionActionType](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/svaml/action/MenuOptionActionFactory.MenuOptionActionType.html) | +| models/v1/svaml/action/ConnectPstnAnsweringMachineDetection | [com.sinch.sdk.domains.voice.models.v1.svaml.action.AnsweringMachineDetectionQuery](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/svaml/action/AnsweringMachineDetectionQuery.html) | +| models/svaml/Instruction | [com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstruction](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstruction.html) | +| models/svaml/InstructionAnswer | [com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionAnswer](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionAnswer.html) | +| models/svaml/InstructionPlayFiles | [com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionPlayFiles](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionPlayFiles.html) | +| models/svaml/InstructionSay | [com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionSay](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionSay.html) | +| models/svaml/InstructionSendDtfm | [com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionSendDtmf](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionSendDtmf.html) | +| models/svaml/InstructionSetCookie | [com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionSetCookie](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionSetCookie.html) | +| models/svaml/InstructionStartRecording | [com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionStartRecording](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionStartRecording.html) | +| models/svaml/InstructionStopRecording | [com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionStopRecording](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionStopRecording.html) | +| models/svaml/StartRecordingOptions | [com.sinch.sdk.domains.voice.models.v1.svaml.instruction.StartRecordingOptions](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/StartRecordingOptions.html) | +| models/svaml/TranscriptionOptions | [com.sinch.sdk.domains.voice.models.v1.svaml.instruction.TranscriptionOptions](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/TranscriptionOptions.html) | + +##### Webhooks +| Old class | New class | +|---------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| models/v1/webhooks/AnsweredCallEventAnsweringMachineDetection | [com.sinch.sdk.domains.voice.models.v1.webhooks.AnsweringMachineDetection](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/webhooks/AnsweringMachineDetection.html) | +| models/webhooks/AmdAnswer | [com.sinch.sdk.domains.voice.models.v1.webhooks.AnsweringMachineDetection](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/webhooks/AnsweringMachineDetection.html) | +| models/webhooks/AmdAnswerReasonType | [com.sinch.sdk.domains.voice.models.v1.webhooks.AnsweringMachineDetection.ReasonEnum](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/webhooks/AnsweringMachineDetection.ReasonEnum.html) | +| models/webhooks/AmdAnswerStatusType | [com.sinch.sdk.domains.voice.models.v1.webhooks.AnsweringMachineDetection.StatusEnum](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/webhooks/AnsweringMachineDetection.StatusEnum.html) | +| models/webhooks/AnsweredCallEvent | [com.sinch.sdk.domains.voice.models.v1.webhooks.AnsweredCallEvent](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/webhooks/AnsweredCallEvent.html) | +| models/webhooks/CallEvent | [com.sinch.sdk.domains.voice.models.v1.webhooks.VoiceWebhookCallEvent](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/webhooks/VoiceWebhookCallEvent.html) | +| models/webhooks/DisconnectCallEvent | [com.sinch.sdk.domains.voice.models.v1.webhooks.DisconnectedCallEvent](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/webhooks/DisconnectedCallEvent.html) | +| models/webhooks/IncomingCallEvent | [com.sinch.sdk.domains.voice.models.v1.webhooks.IncomingCallEvent](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/webhooks/IncomingCallEvent.html) | +| models/webhooks/MenuInputType | [com.sinch.sdk.domains.voice.models.v1.webhooks.MenuResult.TypeEnum](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/webhooks/MenuResult.TypeEnum.html) | +| models/webhooks/MenuResult | [com.sinch.sdk.domains.voice.models.v1.webhooks.MenuResult](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/webhooks/MenuResult.html) | +| models/webhooks/MenuResultInputMethodType | [com.sinch.sdk.domains.voice.models.v1.webhooks.MenuResult.InputMethodEnum](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/webhooks/MenuResult.InputMethodEnum.html) | +| models/webhooks/NotifyEvent | [com.sinch.sdk.domains.voice.models.v1.webhooks.NotificationEvent](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/webhooks/NotificationEvent.html) | +| models/webhooks/PromptInputEvent | [com.sinch.sdk.domains.voice.models.v1.webhooks.PromptInputEvent](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/webhooks/PromptInputEvent.html) | +| models/webhooks/WebhooksEvent | [com.sinch.sdk.domains.voice.models.v1.webhooks.VoiceWebhookEvent](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/models/v1/webhooks/VoiceWebhookEvent.html) | + + +#### Replacement APIs + +Use the new versioned API under `voice().v1()` to get access to [VoiceService](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/api/v1/VoiceService.html): [`sinchClient.voice().v1()`](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0./com/sinch/sdk/domains/voice/VoiceService.html#v1()) + +| Old interface | New Equivalent in `voice().v1()` | +|----------------|--------------------------------------------------------------------------------------------------------------------------------------------------| +| applications() | [v1().applications()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/api/v1/ApplicationsService.html) | +| callouts() | [v1().callouts()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/api/v1/CalloutsService.html) | +| calls() | [v1().calls()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/api/v1/CallsService.html) | +| conferences() | [v1().conferences()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/api/v1/ConferencesService.html) | +| webhooks() | [v1().webhooks()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/api/v1/WebHooksService.html) | diff --git a/client/src/main/com/sinch/sdk/domains/voice/ApplicationsService.java b/client/src/main/com/sinch/sdk/domains/voice/ApplicationsService.java deleted file mode 100644 index 0dcb9fd75..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/ApplicationsService.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.sinch.sdk.domains.voice; - -import com.sinch.sdk.domains.voice.models.CallbackUrls; -import com.sinch.sdk.domains.voice.models.NumberInformation; -import com.sinch.sdk.domains.voice.models.requests.ApplicationsAssignNumbersRequestParameters; -import com.sinch.sdk.domains.voice.models.response.AssignedNumbers; -import com.sinch.sdk.domains.voice.models.v1.applications.Callbacks; -import com.sinch.sdk.domains.voice.models.v1.applications.request.UnAssignNumberRequest; -import com.sinch.sdk.domains.voice.models.v1.applications.request.UpdateNumbersRequest; -import com.sinch.sdk.models.E164PhoneNumber; - -/** - * You can use the API to manage features of applications in your project. - * - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.voice.api.v1.ApplicationsService} instead. - */ -@Deprecated -public interface ApplicationsService { - - /** - * Get information about your numbers. - * - *

It returns a list of numbers that you own, as well as their capability (voice or SMS). For - * the ones that are assigned to an app, it returns the application key of the app. - * - * @return Your numbers - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.voice.api.v1.ApplicationsService#listNumbers()} - * instead. - */ - @Deprecated - AssignedNumbers listNumbers(); - - /** - * Returns any callback URLs configured for the specified application - * - * @param applicationKey The unique identifying key of the application - * @return Assigned callback to application - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.voice.api.v1.ApplicationsService#getCallbackUrls(String)} instead. - */ - @Deprecated - CallbackUrls getCallbackUrls(String applicationKey); - - /** - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.voice.api.v1.ApplicationsService#updateCallbackUrls(String, - * Callbacks)} instead. - */ - @Deprecated - void updateCallbackUrls(String applicationKey, CallbackUrls parameters); - - /** - * @deprecated use {@link - * com.sinch.sdk.domains.voice.api.v1.ApplicationsService#queryNumber(String)} instead. - */ - @Deprecated - NumberInformation queryNumber(E164PhoneNumber number); - - /** - * Update or assign a list of numbers to an application. - * - * @param parameters Request parameters - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.voice.api.v1.ApplicationsService#assignNumbers(UpdateNumbersRequest)} - * instead. - */ - @Deprecated - void assignNumbers(ApplicationsAssignNumbersRequestParameters parameters); - - /** - * Un-assign a number from an application. - * - * @param phoneNumber The phone number - * @param applicationKey Indicates the application where the number was assigned. - *

If empty, the application key that is used to authenticate - * @deprecated use {@link - * com.sinch.sdk.domains.voice.api.v1.ApplicationsService#unassignNumber(UnAssignNumberRequest)} - * instead. - * @since 1.0 - */ - @Deprecated - public void unassignNumber(E164PhoneNumber phoneNumber, String applicationKey); -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/CalloutsService.java b/client/src/main/com/sinch/sdk/domains/voice/CalloutsService.java deleted file mode 100644 index 8944637bd..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/CalloutsService.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.sinch.sdk.domains.voice; - -import com.sinch.sdk.domains.voice.models.requests.CalloutRequestParameters; -import com.sinch.sdk.domains.voice.models.requests.CalloutRequestParametersConference; -import com.sinch.sdk.domains.voice.models.requests.CalloutRequestParametersCustom; -import com.sinch.sdk.domains.voice.models.requests.CalloutRequestParametersTTS; -import com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequest; -import com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequestConference; -import com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequestCustom; -import com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequestTTS; - -/** - * A callout is a call made to a phone number or app using the API. - * - * @see https://developers.sinch.com/docs/voice/api-reference/voice/tag/Callouts - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.voice.api.v1.CalloutsService} instead. - */ -@Deprecated -public interface CalloutsService { - - /** - * The text-to-speech callout calls a phone number and plays a synthesized text messages or - * pre-recorded sound files. - * - * @param parameters Text to speech parameters - * @return The returned call identifier (callId) - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.voice.api.v1.CalloutsService#textToSpeech(CalloutRequestTTS)} - * instead. - */ - @Deprecated - String textToSpeech(CalloutRequestParametersTTS parameters); - - /** - * The conference callout calls a phone number or a user. When the call is answered, it's - * connected to a conference room. - * - * @param parameters Conference parameters - * @return The returned call identifier (callId) - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.voice.api.v1.CalloutsService#conference(CalloutRequestConference)} - * instead. - */ - @Deprecated - String conference(CalloutRequestParametersConference parameters); - - /** - * The custom callout, the server initiates a call from the servers that can be controlled by - * specifying how the call should progress at each call event. - * - * @param parameters Custom parameters - * @return The returned call identifier (callId) - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.voice.api.v1.CalloutsService#custom(CalloutRequestCustom)} instead. - */ - @Deprecated - String custom(CalloutRequestParametersCustom parameters); - - /** - * Makes a call out to a phone number. The types of callouts currently supported are conference - * callouts, text-to-speech callouts, and custom callouts. The custom callout is the most - * flexible, but text-to-speech and conference callouts are more convenient. - * - * @param parameters Callout type to be performed - * @return The returned call identifier (callId) - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.voice.api.v1.CalloutsService#call(CalloutRequest)} - * instead. - */ - @Deprecated - String call(CalloutRequestParameters parameters); -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/CallsService.java b/client/src/main/com/sinch/sdk/domains/voice/CallsService.java deleted file mode 100644 index ec9a2d58f..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/CallsService.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.sinch.sdk.domains.voice; - -import com.sinch.sdk.domains.voice.models.CallLegType; -import com.sinch.sdk.domains.voice.models.response.CallInformation; -import com.sinch.sdk.domains.voice.models.svaml.SVAMLControl; -import com.sinch.sdk.domains.voice.models.v1.calls.request.CallLeg; -import com.sinch.sdk.domains.voice.models.v1.svaml.SvamlControl; - -/** - * Using the Calls service, you can manage on-going calls or retrieve information about a call. - * - * @see https://developers.sinch.com/docs/voice/api-reference/voice/tag/Calls - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.voice.api.v1.CallsService} instead. - */ -@Deprecated -public interface CallsService { - - /** - * You can retrieve information about an ongoing or completed call using a call ID. You can find - * the call ID of an ongoing call by viewing the response object from a callout request. You can - * find the call ID of a completed call by looking at your call logs in your Sinch Dashboard. - * - *

Note: You can only use this method for calls that terminate to PSTN or SIP networks from an - * In-app call. - * - * @param callId The unique identifier of the call. This value is generated by the system - * @return Information about the call - * @deprecated use {@link com.sinch.sdk.domains.voice.api.v1.CallsService#get(String)} instead. - */ - @Deprecated - CallInformation get(String callId); - - /** - * This method is used to manage ongoing, connected calls. This method uses SVAML in the request - * body to perform various tasks related to the call. For more information about SVAML, see the - * Callback API documentation. - * - *

Note: You can only use this method for calls that terminate to PSTN or SIP networks from an - * In-app call. - * - * @param callId The unique identifier of the call. This value is generated by the system - * @param parameters Tasks to be used related to this call - * @deprecated use {@link com.sinch.sdk.domains.voice.api.v1.CallsService#update(String, - * SvamlControl)} instead. - */ - @Deprecated - void update(String callId, SVAMLControl parameters); - - /** - * This method is used to manage ongoing, connected calls. This method is only used when using the - * PlayFiles and Say instructions in the request body. This method uses SVAML in the request body - * to perform various tasks related to the call. For more information about SVAML, see the - * Callback API documentation. - * - *

Note: You can only use this method for calls that terminate to PSTN or SIP networks from an - * In-app call. - * - * @param callId The unique identifier of the call. This value is generated by the system - * @param parameters Tasks to be used related to this call - * @deprecated use {@link - * com.sinch.sdk.domains.voice.api.v1.CallsService#manageWithCallLeg(String, CallLeg, - * SvamlControl)} instead. - */ - @Deprecated - void manageWithCallLeg(String callId, CallLegType callLeg, SVAMLControl parameters); -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/ConferencesService.java b/client/src/main/com/sinch/sdk/domains/voice/ConferencesService.java deleted file mode 100644 index aee8aef8c..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/ConferencesService.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.sinch.sdk.domains.voice; - -import com.sinch.sdk.domains.voice.models.requests.CalloutRequestParametersConference; -import com.sinch.sdk.domains.voice.models.requests.ConferenceManageParticipantRequestParameters; -import com.sinch.sdk.domains.voice.models.response.ConferenceParticipant; -import com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequestConference; -import com.sinch.sdk.domains.voice.models.v1.conferences.request.ManageConferenceParticipantRequest; -import java.util.Collection; - -/** - * Using the Conferences endpoint, you can perform tasks like retrieving information about an - * on-going conference, muting or unmuting participants, or removing participants from a conference. - * - * @see https://developers.sinch.com/docs/voice/api-reference/voice/tag/Conferences - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.voice.api.v1.ConferencesService} instead. - */ -@Deprecated -public interface ConferencesService { - - /** - * Calls a phone number or a user to join a conference. When the call is answered, it's connected - * to a conference room. - * - * @param parameters Conference parameters - * @return The returned call identifier (callId) - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.voice.api.v1.ConferencesService#call(CalloutRequestConference)} - * instead. - */ - @Deprecated - String call(CalloutRequestParametersConference parameters); - - /** - * Returns information about a conference that matches the provided conference ID. - * - * @param conferenceId The unique identifier of the conference. The user sets this value. - * @return The list of participants joined the conference - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.voice.api.v1.ConferencesService#get(String)} - * instead. - */ - @Deprecated - Collection get(String conferenceId); - - /** - * Removes all participants from a conference - * - * @param conferenceId The unique identifier of the conference. The user sets this value. - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.voice.api.v1.ConferencesService#kickAll(String)} - * instead. - */ - @Deprecated - void kickAll(String conferenceId); - - /** - * Remove a specified conference participant from a specified conference - * - * @param conferenceId The unique identifier of the conference. The user sets this value. - * @param callId The unique identifier of the call. This value is generated by the system - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.voice.api.v1.ConferencesService#kickParticipant(String, String)} - * instead. - */ - @Deprecated - void kickParticipant(String conferenceId, String callId); - - /** - * Manages conference participant in a specified conference: - * - * @param conferenceId The unique identifier of the conference. The user sets this value. - * @param callId The unique identifier of the call. This value is generated by the system - * @param parameters Parameters to manage participant - * @deprecated use {@link - * com.sinch.sdk.domains.voice.api.v1.ConferencesService#manageParticipant(String, String, - * ManageConferenceParticipantRequest)} instead. - */ - @Deprecated - void manageParticipant( - String conferenceId, String callId, ConferenceManageParticipantRequestParameters parameters); -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/VoiceService.java b/client/src/main/com/sinch/sdk/domains/voice/VoiceService.java index 7235c4e90..3f386380f 100644 --- a/client/src/main/com/sinch/sdk/domains/voice/VoiceService.java +++ b/client/src/main/com/sinch/sdk/domains/voice/VoiceService.java @@ -17,54 +17,4 @@ public interface VoiceService { * @since 1.1 */ com.sinch.sdk.domains.voice.api.v1.VoiceService v1(); - - /** - * Callouts Service instance - * - * @return service instance for project - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.voice.api.v1.VoiceService#callouts()} instead. - */ - @Deprecated - CalloutsService callouts(); - - /** - * Conference Service instance - * - * @return service instance for project - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.voice.api.v1.VoiceService#conferences()} instead. - */ - @Deprecated - ConferencesService conferences(); - - /** - * Calls Service instance - * - * @return service instance for project - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.voice.api.v1.VoiceService#calls()} instead. - */ - @Deprecated - CallsService calls(); - - /** - * Applications Service instance - * - * @return service instance for project - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.voice.api.v1.VoiceService#applications()} instead. - */ - @Deprecated - ApplicationsService applications(); - - /** - * Webhooks helpers instance - * - * @return instance service related to webhooks helpers - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.voice.api.v1.VoiceService#webhooks()} instead. - */ - @Deprecated - WebHooksService webhooks(); } diff --git a/client/src/main/com/sinch/sdk/domains/voice/WebHooksService.java b/client/src/main/com/sinch/sdk/domains/voice/WebHooksService.java deleted file mode 100644 index 16c7c7557..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/WebHooksService.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.sinch.sdk.domains.voice; - -import com.sinch.sdk.core.exceptions.ApiMappingException; -import com.sinch.sdk.domains.voice.models.svaml.SVAMLControl; -import com.sinch.sdk.domains.voice.models.v1.svaml.SvamlControl; -import com.sinch.sdk.domains.voice.models.webhooks.WebhooksEvent; -import java.util.Map; - -/** - * Webhooks service - * - * @see https://developers.sinch.com/docs/voice/api-reference/voice/tag/Callbacks/ - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.voice.api.v1.WebHooksService} instead. - */ -@Deprecated -public interface WebHooksService { - - /** - * The Sinch Platform can initiate callback requests to a URL you define (Callback URL) on request - * and result events. All callback requests are signed using your Application key and secret pair - * found on your dashboard. The signature is included in the Authorization header of the request - * - *

By using following function, you can ensure authentication according to received payload - * from your backend - * - * @param method The HTTP method used ot handle the callback - * @param path The path to you backend endpoint used for callback - * @param headers Received headers - * @param jsonPayload Received payload - * @return Is authentication is validated (true) or not (false) - *

see https://developers.sinch.com/docs/voice/api-reference/authentication/callback-signed-request/ - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.voice.api.v1.WebHooksService#validateAuthenticationHeader(String, - * String, Map, String)} instead. - */ - @Deprecated - boolean validateAuthenticatedRequest( - String method, String path, Map headers, String jsonPayload); - - /** - * This function can be called to deserialize received payload onto callback onto proper java - * Voice event class - * - * @param jsonPayload Received payload to be deserialized - * @return The Voice event instance class - *

see https://developers.sinch.com/docs/voice/api-reference/voice/tag/Callbacks/ - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.voice.api.v1.WebHooksService#parseEvent(String)} - * instead. - */ - @Deprecated - WebhooksEvent unserializeWebhooksEvent(String jsonPayload) throws ApiMappingException; - - /** - * This function can be called to serialize a Voice response to be sent as JSON - * - * @param response The response to be serialized - * @return The JSON string to be sent - *

see https://developers.sinch.com/docs/voice/api-reference/voice/tag/Callbacks/ - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.voice.api.v1.WebHooksService#serializeResponse(SvamlControl)} - * instead. - */ - @Deprecated - String serializeWebhooksResponse(SVAMLControl response) throws ApiMappingException; -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/adapters/ApplicationsService.java b/client/src/main/com/sinch/sdk/domains/voice/adapters/ApplicationsService.java deleted file mode 100644 index 5ad7b1189..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/adapters/ApplicationsService.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.sinch.sdk.domains.voice.adapters; - -import com.sinch.sdk.domains.voice.adapters.converters.ApplicationsDtoConverter; -import com.sinch.sdk.domains.voice.models.CallbackUrls; -import com.sinch.sdk.domains.voice.models.NumberInformation; -import com.sinch.sdk.domains.voice.models.requests.ApplicationsAssignNumbersRequestParameters; -import com.sinch.sdk.domains.voice.models.response.AssignedNumbers; -import com.sinch.sdk.models.E164PhoneNumber; - -public class ApplicationsService implements com.sinch.sdk.domains.voice.ApplicationsService { - - private final com.sinch.sdk.domains.voice.api.v1.ApplicationsService v1; - - public ApplicationsService(com.sinch.sdk.domains.voice.api.v1.ApplicationsService v1) { - this.v1 = v1; - } - - public AssignedNumbers listNumbers() { - return ApplicationsDtoConverter.convert(v1.listNumbers()); - } - - public CallbackUrls getCallbackUrls(String applicationKey) { - return ApplicationsDtoConverter.convert(v1.getCallbackUrls(applicationKey)); - } - - public void updateCallbackUrls(String applicationKey, CallbackUrls parameters) { - v1.updateCallbackUrls(applicationKey, ApplicationsDtoConverter.convert(parameters)); - } - - public NumberInformation queryNumber(E164PhoneNumber number) { - return ApplicationsDtoConverter.convert(v1.queryNumber(number.stringValue())); - } - - public void assignNumbers(ApplicationsAssignNumbersRequestParameters parameters) { - v1.assignNumbers(ApplicationsDtoConverter.convert(parameters)); - } - - public void unassignNumber(E164PhoneNumber phoneNumber, String applicationKey) { - v1.unassignNumber(ApplicationsDtoConverter.convert(phoneNumber, applicationKey)); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/adapters/CalloutsService.java b/client/src/main/com/sinch/sdk/domains/voice/adapters/CalloutsService.java deleted file mode 100644 index d8c844801..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/adapters/CalloutsService.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.sinch.sdk.domains.voice.adapters; - -import com.sinch.sdk.domains.voice.adapters.converters.CalloutsDtoConverter; -import com.sinch.sdk.domains.voice.models.requests.CalloutRequestParameters; -import com.sinch.sdk.domains.voice.models.requests.CalloutRequestParametersConference; -import com.sinch.sdk.domains.voice.models.requests.CalloutRequestParametersCustom; -import com.sinch.sdk.domains.voice.models.requests.CalloutRequestParametersTTS; -import com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequestConference; -import com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequestCustom; -import com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequestTTS; - -public class CalloutsService implements com.sinch.sdk.domains.voice.CalloutsService { - - private final com.sinch.sdk.domains.voice.api.v1.CalloutsService v1; - - public CalloutsService(com.sinch.sdk.domains.voice.api.v1.CalloutsService v1) { - this.v1 = v1; - } - - public String textToSpeech(CalloutRequestParametersTTS parameters) { - - return v1.textToSpeech((CalloutRequestTTS) CalloutsDtoConverter.convert(parameters)); - } - - public String conference(CalloutRequestParametersConference parameters) { - - return v1.conference((CalloutRequestConference) CalloutsDtoConverter.convert(parameters)); - } - - public String custom(CalloutRequestParametersCustom parameters) { - - return v1.custom((CalloutRequestCustom) CalloutsDtoConverter.convert(parameters)); - } - - public String call(CalloutRequestParameters parameters) { - - return v1.call(CalloutsDtoConverter.convert(parameters)); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/adapters/CallsService.java b/client/src/main/com/sinch/sdk/domains/voice/adapters/CallsService.java deleted file mode 100644 index 7742f210b..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/adapters/CallsService.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.sinch.sdk.domains.voice.adapters; - -import com.sinch.sdk.domains.voice.adapters.converters.CallsDtoConverter; -import com.sinch.sdk.domains.voice.adapters.converters.ControlDtoConverter; -import com.sinch.sdk.domains.voice.models.CallLegType; -import com.sinch.sdk.domains.voice.models.response.CallInformation; -import com.sinch.sdk.domains.voice.models.svaml.SVAMLControl; -import com.sinch.sdk.domains.voice.models.v1.calls.request.CallLeg; - -public class CallsService implements com.sinch.sdk.domains.voice.CallsService { - - private final com.sinch.sdk.domains.voice.api.v1.CallsService v1; - - public CallsService(com.sinch.sdk.domains.voice.api.v1.CallsService v1) { - this.v1 = v1; - } - - public CallInformation get(String callId) { - return CallsDtoConverter.convert(v1.get(callId)); - } - - public void update(String callId, SVAMLControl parameters) { - v1.update(callId, ControlDtoConverter.convertControl(parameters)); - } - - public void manageWithCallLeg(String callId, CallLegType callLeg, SVAMLControl parameters) { - v1.manageWithCallLeg( - callId, CallLeg.from(callLeg.value()), ControlDtoConverter.convertControl(parameters)); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/adapters/ConferencesService.java b/client/src/main/com/sinch/sdk/domains/voice/adapters/ConferencesService.java deleted file mode 100644 index f1801d432..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/adapters/ConferencesService.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.sinch.sdk.domains.voice.adapters; - -import com.sinch.sdk.domains.voice.adapters.converters.CalloutsDtoConverter; -import com.sinch.sdk.domains.voice.adapters.converters.ConferencesDtoConverter; -import com.sinch.sdk.domains.voice.models.requests.CalloutRequestParametersConference; -import com.sinch.sdk.domains.voice.models.requests.ConferenceManageParticipantRequestParameters; -import com.sinch.sdk.domains.voice.models.response.ConferenceParticipant; -import com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequestConference; -import java.util.Collection; - -public class ConferencesService implements com.sinch.sdk.domains.voice.ConferencesService { - - private final com.sinch.sdk.domains.voice.api.v1.ConferencesService v1; - - public ConferencesService(com.sinch.sdk.domains.voice.api.v1.ConferencesService v1) { - this.v1 = v1; - } - - public String call(CalloutRequestParametersConference parameters) { - return v1.call((CalloutRequestConference) CalloutsDtoConverter.convert(parameters)); - } - - public Collection get(String conferenceId) { - return ConferencesDtoConverter.convert(v1.get(conferenceId)); - } - - public void kickAll(String conferenceId) { - v1.kickAll(conferenceId); - } - - public void kickParticipant(String conferenceId, String callId) { - v1.kickParticipant(conferenceId, callId); - } - - public void manageParticipant( - String conferenceId, String callId, ConferenceManageParticipantRequestParameters parameters) { - v1.manageParticipant(conferenceId, callId, ConferencesDtoConverter.convert(parameters)); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/adapters/VoiceService.java b/client/src/main/com/sinch/sdk/domains/voice/adapters/VoiceService.java index b541ff0c9..21af4dc0f 100644 --- a/client/src/main/com/sinch/sdk/domains/voice/adapters/VoiceService.java +++ b/client/src/main/com/sinch/sdk/domains/voice/adapters/VoiceService.java @@ -1,21 +1,12 @@ package com.sinch.sdk.domains.voice.adapters; import com.sinch.sdk.core.http.HttpClient; -import com.sinch.sdk.domains.voice.ApplicationsService; -import com.sinch.sdk.domains.voice.CalloutsService; -import com.sinch.sdk.domains.voice.WebHooksService; import com.sinch.sdk.models.ApplicationCredentials; import com.sinch.sdk.models.VoiceContext; import java.util.function.Supplier; public class VoiceService implements com.sinch.sdk.domains.voice.VoiceService { - private CalloutsService callouts; - private ConferencesService conferences; - private CallsService calls; - private ApplicationsService applications; - private WebHooksService webhooks; - private final com.sinch.sdk.domains.voice.api.v1.VoiceService v1; public VoiceService( @@ -28,43 +19,6 @@ public VoiceService( credentials, context, httpClientSupplier); } - public CalloutsService callouts() { - if (null == this.callouts) { - this.callouts = new com.sinch.sdk.domains.voice.adapters.CalloutsService(v1().callouts()); - } - return this.callouts; - } - - public ConferencesService conferences() { - if (null == this.conferences) { - this.conferences = - new com.sinch.sdk.domains.voice.adapters.ConferencesService(v1.conferences()); - } - return this.conferences; - } - - public CallsService calls() { - if (null == this.calls) { - this.calls = new com.sinch.sdk.domains.voice.adapters.CallsService(v1.calls()); - } - return this.calls; - } - - public ApplicationsService applications() { - if (null == this.applications) { - this.applications = - new com.sinch.sdk.domains.voice.adapters.ApplicationsService(v1.applications()); - } - return this.applications; - } - - public WebHooksService webhooks() { - if (null == this.webhooks) { - this.webhooks = new com.sinch.sdk.domains.voice.adapters.WebHooksService(v1.webhooks()); - } - return this.webhooks; - } - public com.sinch.sdk.domains.voice.api.v1.VoiceService v1() { return this.v1; } diff --git a/client/src/main/com/sinch/sdk/domains/voice/adapters/WebHooksService.java b/client/src/main/com/sinch/sdk/domains/voice/adapters/WebHooksService.java deleted file mode 100644 index aee3781e3..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/adapters/WebHooksService.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.sinch.sdk.domains.voice.adapters; - -import com.sinch.sdk.core.exceptions.ApiMappingException; -import com.sinch.sdk.domains.voice.adapters.converters.ControlDtoConverter; -import com.sinch.sdk.domains.voice.adapters.converters.WebhooksEventDtoConverter; -import com.sinch.sdk.domains.voice.models.svaml.SVAMLControl; -import com.sinch.sdk.domains.voice.models.webhooks.WebhooksEvent; -import java.util.Map; - -public class WebHooksService implements com.sinch.sdk.domains.voice.WebHooksService { - - private final com.sinch.sdk.domains.voice.api.v1.WebHooksService v1; - - public WebHooksService(com.sinch.sdk.domains.voice.api.v1.WebHooksService v1) { - this.v1 = v1; - } - - public boolean validateAuthenticatedRequest( - String method, String path, Map headers, String jsonPayload) { - - return v1.validateAuthenticationHeader(method, path, headers, jsonPayload); - } - - @Override - public WebhooksEvent unserializeWebhooksEvent(String jsonPayload) throws ApiMappingException { - return WebhooksEventDtoConverter.convert(v1.parseEvent(jsonPayload)); - } - - @Override - public String serializeWebhooksResponse(SVAMLControl response) throws ApiMappingException { - return v1.serializeResponse(ControlDtoConverter.convertControl(response)); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/ApplicationsDtoConverter.java b/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/ApplicationsDtoConverter.java deleted file mode 100644 index ff6708b3f..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/ApplicationsDtoConverter.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.sinch.sdk.domains.voice.adapters.converters; - -import com.sinch.sdk.domains.common.adapters.converters.EnumDynamicConverter; -import com.sinch.sdk.domains.voice.models.ApplicationAssignedNumber; -import com.sinch.sdk.domains.voice.models.ApplicationURL; -import com.sinch.sdk.domains.voice.models.CallbackUrls; -import com.sinch.sdk.domains.voice.models.NumberInformation; -import com.sinch.sdk.domains.voice.models.requests.ApplicationsAssignNumbersRequestParameters; -import com.sinch.sdk.domains.voice.models.response.AssignedNumbers; -import com.sinch.sdk.domains.voice.models.v1.applications.Callbacks; -import com.sinch.sdk.domains.voice.models.v1.applications.CallbacksUrl; -import com.sinch.sdk.domains.voice.models.v1.applications.Capability; -import com.sinch.sdk.domains.voice.models.v1.applications.request.UnAssignNumberRequest; -import com.sinch.sdk.domains.voice.models.v1.applications.request.UpdateNumbersRequest; -import com.sinch.sdk.domains.voice.models.v1.applications.response.OwnedNumberInformation; -import com.sinch.sdk.domains.voice.models.v1.applications.response.OwnedNumbersResponse; -import com.sinch.sdk.domains.voice.models.v1.applications.response.QueryNumberInformation; -import com.sinch.sdk.domains.voice.models.v1.applications.response.QueryNumberResponse; -import com.sinch.sdk.models.E164PhoneNumber; -import java.util.List; -import java.util.stream.Collectors; - -public class ApplicationsDtoConverter { - - public static AssignedNumbers convert(OwnedNumbersResponse dto) { - if (null == dto) { - return null; - } - List list = dto.getNumbers(); - if (null == list) { - return null; - } - return AssignedNumbers.builder() - .setNumbers( - list.stream().map(ApplicationsDtoConverter::convert).collect(Collectors.toList())) - .build(); - } - - public static CallbackUrls convert(Callbacks dto) { - if (null == dto) { - return null; - } - - return CallbackUrls.builder().setUrl(convert(dto.getUrl())).build(); - } - - public static Callbacks convert(CallbackUrls client) { - if (null == client || null == client.getUrl()) { - return null; - } - return Callbacks.builder() - .setUrl( - CallbacksUrl.builder() - .setPrimary(client.getUrl().getPrimary()) - .setFallback(client.getUrl().getFallback()) - .build()) - .build(); - } - - public static NumberInformation convert(QueryNumberResponse dto) { - if (null == dto) { - return null; - } - NumberInformation.Builder builder = NumberInformation.builder(); - QueryNumberInformation item = dto.getNumber(); - if (null == item) { - return builder.build(); - } - - return builder - .setCountryId(item.getCountryId()) - .setNumberType(NumberTypeDtoConverter.convert(item.getNumberType())) - .setNormalizedNumber(E164PhoneNumberDtoConverter.convert(item.getNormalizedNumber())) - .setRestricted(item.getRestricted()) - .setRate(PriceDtoConverter.convert(item.getRate())) - .build(); - } - - public static UpdateNumbersRequest convert(ApplicationsAssignNumbersRequestParameters client) { - if (null == client) { - return null; - } - UpdateNumbersRequest.Builder dto = UpdateNumbersRequest.builder(); - client - .getNumbers() - .ifPresent( - f -> - dto.setNumbers( - f.stream().map(E164PhoneNumber::stringValue).collect(Collectors.toList()))); - client.getApplicationKey().ifPresent(dto::setApplicationKey); - client - .getCapability() - .ifPresent(f -> dto.setCapability(Capability.from(EnumDynamicConverter.convert(f)))); - return dto.build(); - } - - public static UnAssignNumberRequest convert(E164PhoneNumber phoneNumber, String applicationKey) { - - UnAssignNumberRequest.Builder dto = UnAssignNumberRequest.builder(); - if (null != phoneNumber) { - dto.setNumber(phoneNumber.stringValue()); - } - dto.setApplicationKey(applicationKey); - return dto.build(); - } - - private static ApplicationURL convert(CallbacksUrl dto) { - if (null == dto) { - return null; - } - - return ApplicationURL.builder() - .setPrimary(dto.getPrimary()) - .setFallback(dto.getFallback()) - .build(); - } - - private static ApplicationAssignedNumber convert(OwnedNumberInformation dto) { - if (null == dto) { - return null; - } - - return ApplicationAssignedNumber.builder() - .setNumber(E164PhoneNumberDtoConverter.convert(dto.getNumber())) - .setApplicationKey(dto.getApplicationKey()) - .setCapability(CapabilityDtoConverter.convert(dto.getCapability())) - .build(); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/CalloutsDtoConverter.java b/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/CalloutsDtoConverter.java deleted file mode 100644 index 8c3af8186..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/CalloutsDtoConverter.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.sinch.sdk.domains.voice.adapters.converters; - -import com.sinch.sdk.domains.common.adapters.converters.EnumDynamicConverter; -import com.sinch.sdk.domains.voice.models.ConferenceDtfmOptions; -import com.sinch.sdk.domains.voice.models.requests.CalloutRequestParameters; -import com.sinch.sdk.domains.voice.models.requests.CalloutRequestParametersConference; -import com.sinch.sdk.domains.voice.models.requests.CalloutRequestParametersCustom; -import com.sinch.sdk.domains.voice.models.requests.CalloutRequestParametersTTS; -import com.sinch.sdk.domains.voice.models.v1.Domain; -import com.sinch.sdk.domains.voice.models.v1.MusicOnHold; -import com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequest; -import com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequestConference; -import com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequestCustom; -import com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequestTTS; -import com.sinch.sdk.domains.voice.models.v1.callouts.response.CalloutResponse; -import com.sinch.sdk.domains.voice.models.v1.conferences.ConferenceDtmfOptions; -import com.sinch.sdk.domains.voice.models.v1.destination.Destination; -import com.sinch.sdk.domains.voice.models.v1.destination.DestinationConference; -import com.sinch.sdk.domains.voice.models.v1.destination.DestinationCustom; -import com.sinch.sdk.domains.voice.models.v1.destination.DestinationTextToSpeech; -import com.sinch.sdk.models.DualToneMultiFrequency; -import java.util.logging.Logger; - -public class CalloutsDtoConverter { - - private static final Logger LOGGER = Logger.getLogger(CalloutsDtoConverter.class.getName()); - - public static CalloutRequest convert(CalloutRequestParameters client) { - - if (client instanceof CalloutRequestParametersConference) { - CalloutRequestParametersConference parameters = (CalloutRequestParametersConference) client; - return convert(parameters); - } else if (client instanceof CalloutRequestParametersTTS) { - CalloutRequestParametersTTS parameters = (CalloutRequestParametersTTS) client; - return convert(parameters); - } else if (client instanceof CalloutRequestParametersCustom) { - CalloutRequestParametersCustom parameters = (CalloutRequestParametersCustom) client; - return convert(parameters); - } - return null; - } - - public static String convert(CalloutResponse dto) { - if (null == dto) { - return null; - } - return dto.getCallId(); - } - - private static CalloutRequestConference convert(CalloutRequestParametersConference client) { - - CalloutRequestConference.Builder dto = CalloutRequestConference.builder(); - - client - .getDestination() - .ifPresent( - f -> { - Destination destination = DestinationDtoConverter.convert(f); - if (destination instanceof DestinationConference) { - dto.setDestination((DestinationConference) destination); - return; - } - LOGGER.severe(String.format("Unexpected class: %s", f)); - }); - client.getCli().ifPresent(f -> dto.setCli(f.stringValue())); - client.getDtfm().ifPresent(f -> dto.setDtmf(DualToneMultiFrequency.valueOf(f.stringValue()))); - client.getCustom().ifPresent(dto::setCustom); - - client.getConferenceId().ifPresent(dto::setConferenceId); - client.getDtfmOptions().ifPresent(f -> dto.setConferenceDtmfOptions(convert(f))); - - client.getMaxDuration().ifPresent(dto::setMaxDuration); - client.getEnableAce().ifPresent(dto::setEnableAce); - client.getEnableDice().ifPresent(dto::setEnableDice); - client.getEnablePie().ifPresent(dto::setEnablePie); - client.getLocale().ifPresent(dto::setLocale); - client.getGreeting().ifPresent(dto::setGreeting); - client - .getMusicOnHold() - .ifPresent(f -> dto.setMusicOnHold(MusicOnHold.from(EnumDynamicConverter.convert(f)))); - client.getDomain().ifPresent(f -> dto.setDomain(Domain.from(EnumDynamicConverter.convert(f)))); - - return dto.build(); - } - - private static CalloutRequestTTS convert(CalloutRequestParametersTTS client) { - - CalloutRequestTTS.Builder dto = CalloutRequestTTS.builder(); - - client - .getDestination() - .ifPresent( - f -> { - Destination destination = DestinationDtoConverter.convert(f); - if (destination instanceof DestinationTextToSpeech) { - dto.setDestination((DestinationTextToSpeech) destination); - return; - } - LOGGER.severe(String.format("Unexpected class: %s", f)); - }); - client.getCli().ifPresent(f -> dto.setCli(f.stringValue())); - client.getDtfm().ifPresent(f -> dto.setDtmf(DualToneMultiFrequency.valueOf(f.stringValue()))); - client.getCustom().ifPresent(dto::setCustom); - client.getEnableAce().ifPresent(dto::setEnableAce); - client.getEnableDice().ifPresent(dto::setEnableDice); - client.getEnablePie().ifPresent(dto::setEnablePie); - client.getLocale().ifPresent(dto::setLocale); - client.getDomain().ifPresent(f -> dto.setDomain(Domain.from(EnumDynamicConverter.convert(f)))); - client.getText().ifPresent(dto::setText); - client.getPrompts().ifPresent(dto::setPrompts); - return dto.build(); - } - - private static CalloutRequestCustom convert(CalloutRequestParametersCustom client) { - - CalloutRequestCustom.Builder dto = CalloutRequestCustom.builder(); - - client - .getDestination() - .ifPresent( - f -> { - Destination destination = DestinationDtoConverter.convert(f); - if (destination instanceof DestinationCustom) { - dto.setDestination((DestinationCustom) destination); - return; - } - LOGGER.severe(String.format("Unexpected class: %s", f)); - }); - client.getCli().ifPresent(f -> dto.setCli(f.stringValue())); - client.getDtfm().ifPresent(f -> dto.setDtmf(DualToneMultiFrequency.valueOf(f.stringValue()))); - client.getCustom().ifPresent(dto::setCustom); - client.getMaxDuration().ifPresent(dto::setMaxDuration); - client.getIce().ifPresent(f -> dto.setIce(ControlDtoConverter.convertControl(f))); - client.getAce().ifPresent(f -> dto.setAce(ControlDtoConverter.convertControl(f))); - client.getPie().ifPresent(f -> dto.setPie(ControlDtoConverter.convertControl(f))); - return dto.build(); - } - - private static ConferenceDtmfOptions convert(ConferenceDtfmOptions client) { - ConferenceDtmfOptions.Builder dto = ConferenceDtmfOptions.builder(); - client - .getMode() - .ifPresent( - f -> dto.setMode(ConferenceDtmfOptions.ModeEnum.from(EnumDynamicConverter.convert(f)))); - client.getMaxDigits().ifPresent(dto::setMaxDigits); - client.getTimeoutMills().ifPresent(dto::setTimeoutMills); - return dto.build(); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/CallsDtoConverter.java b/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/CallsDtoConverter.java deleted file mode 100644 index 1e013b120..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/CallsDtoConverter.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.sinch.sdk.domains.voice.adapters.converters; - -import com.sinch.sdk.domains.voice.models.CallReasonType; -import com.sinch.sdk.domains.voice.models.CallResultType; -import com.sinch.sdk.domains.voice.models.DomainType; -import com.sinch.sdk.domains.voice.models.response.CallInformation; -import com.sinch.sdk.domains.voice.models.response.CallStatusType; - -public class CallsDtoConverter { - - public static CallInformation convert( - com.sinch.sdk.domains.voice.models.v1.calls.response.CallInformation dto) { - if (null == dto) { - return null; - } - return CallInformation.builder() - .setFrom(DestinationDtoConverter.convert(dto.getFrom())) - .setTo(DestinationDtoConverter.convert(dto.getTo())) - .setDomain(null != dto.getDomain() ? DomainType.from(dto.getDomain().value()) : null) - .setCallId(dto.getCallId()) - .setDuration(dto.getDuration()) - .setStatus(null != dto.getStatus() ? CallStatusType.from(dto.getStatus().value()) : null) - .setResult(null != dto.getResult() ? CallResultType.from(dto.getResult().value()) : null) - .setReason(null != dto.getReason() ? CallReasonType.from(dto.getReason().value()) : null) - .setTimeStamp(null != dto.getTimestamp() ? dto.getTimestamp() : null) - .setCustom(null != dto.getCustom() ? dto.getCustom() : null) - .setUserRate(PriceDtoConverter.convert(dto.getUserRate())) - .setDebit(PriceDtoConverter.convert(dto.getDebit())) - .build(); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/CapabilityDtoConverter.java b/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/CapabilityDtoConverter.java deleted file mode 100644 index 3b8d265bc..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/CapabilityDtoConverter.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.sinch.sdk.domains.voice.adapters.converters; - -import com.sinch.sdk.domains.voice.models.CapabilityType; -import com.sinch.sdk.domains.voice.models.v1.applications.Capability; - -public class CapabilityDtoConverter { - - public static CapabilityType convert(Capability dto) { - if (null == dto) { - return null; - } - return CapabilityType.from(dto.value()); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/ConferencesDtoConverter.java b/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/ConferencesDtoConverter.java deleted file mode 100644 index 775bb4af9..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/ConferencesDtoConverter.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.sinch.sdk.domains.voice.adapters.converters; - -import com.sinch.sdk.domains.common.adapters.converters.EnumDynamicConverter; -import com.sinch.sdk.domains.voice.models.requests.ConferenceManageParticipantRequestParameters; -import com.sinch.sdk.domains.voice.models.response.ConferenceParticipant; -import com.sinch.sdk.domains.voice.models.v1.MusicOnHold; -import com.sinch.sdk.domains.voice.models.v1.conferences.request.ManageConferenceParticipantRequest; -import com.sinch.sdk.domains.voice.models.v1.conferences.request.ManageConferenceParticipantRequest.CommandEnum; -import com.sinch.sdk.domains.voice.models.v1.conferences.response.GetConferenceInfoResponse; -import java.util.Collection; -import java.util.List; -import java.util.stream.Collectors; - -public class ConferencesDtoConverter { - - public static Collection convert(GetConferenceInfoResponse dto) { - if (null == dto) { - return null; - } - List list = - dto.getParticipants(); - - return list.stream().map(ConferencesDtoConverter::convert).collect(Collectors.toList()); - } - - private static ConferenceParticipant convert( - com.sinch.sdk.domains.voice.models.v1.conferences.ConferenceParticipant dto) { - - return ConferenceParticipant.builder() - .setCli(dto.getCli()) - .setId(dto.getId()) - .setDuration(dto.getDuration()) - .setMuted(dto.getMuted()) - .setOnhold(dto.getOnHold()) - .build(); - } - - public static ManageConferenceParticipantRequest convert( - ConferenceManageParticipantRequestParameters client) { - - ManageConferenceParticipantRequest.Builder dto = ManageConferenceParticipantRequest.builder(); - client - .getCommand() - .ifPresent(f -> dto.setCommand(CommandEnum.from(EnumDynamicConverter.convert(f)))); - client - .getMusicOnHold() - .ifPresent(f -> dto.setMusicOnHold(MusicOnHold.from(EnumDynamicConverter.convert(f)))); - return dto.build(); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/ControlDtoConverter.java b/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/ControlDtoConverter.java deleted file mode 100644 index 3f1fa2bf4..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/ControlDtoConverter.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.sinch.sdk.domains.voice.adapters.converters; - -import com.sinch.sdk.domains.voice.models.requests.Control; -import com.sinch.sdk.domains.voice.models.requests.ControlUrl; -import com.sinch.sdk.domains.voice.models.svaml.SVAMLControl; -import com.sinch.sdk.domains.voice.models.v1.svaml.SvamlControl; - -public class ControlDtoConverter { - - public static com.sinch.sdk.domains.voice.models.v1.svaml.SvamlControl convertControl( - SVAMLControl _client) { - return (com.sinch.sdk.domains.voice.models.v1.svaml.SvamlControl) - convertControl((Control) _client); - } - - public static com.sinch.sdk.domains.voice.models.v1.svaml.Control convertControl( - Control _client) { - if (null == _client) { - return null; - } - - if (_client instanceof SVAMLControl) { - SVAMLControl client = (SVAMLControl) _client; - SvamlControl.Builder dto = SvamlControl.builder(); - client - .getInstructions() - .ifPresent(f -> dto.setInstructions(SVAMLInstructionDtoConverter.convert(f))); - client.getAction().ifPresent(f -> dto.setAction(SVAMLActionDtoConverter.convert(f))); - return dto.build(); - } - - if (_client instanceof ControlUrl) { - ControlUrl client = (ControlUrl) _client; - return com.sinch.sdk.domains.voice.models.v1.svaml.ControlUrl.from(client.getURL()); - } - return null; - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/DestinationDtoConverter.java b/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/DestinationDtoConverter.java deleted file mode 100644 index 143bb3196..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/DestinationDtoConverter.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.sinch.sdk.domains.voice.adapters.converters; - -import com.sinch.sdk.domains.voice.models.DestinationNumber; -import com.sinch.sdk.domains.voice.models.DestinationNumberType; -import com.sinch.sdk.domains.voice.models.DestinationSip; -import com.sinch.sdk.domains.voice.models.DestinationUser; -import com.sinch.sdk.domains.voice.models.v1.calls.response.CallInformationFrom; -import com.sinch.sdk.domains.voice.models.v1.calls.response.CallInformationTo; -import com.sinch.sdk.domains.voice.models.v1.destination.Destination; -import com.sinch.sdk.domains.voice.models.v1.destination.DestinationDid; -import com.sinch.sdk.domains.voice.models.v1.destination.DestinationMxp; -import com.sinch.sdk.domains.voice.models.v1.destination.DestinationPstn; -import com.sinch.sdk.models.E164PhoneNumber; -import java.util.logging.Logger; - -public class DestinationDtoConverter { - - private static final Logger LOGGER = Logger.getLogger(DestinationDtoConverter.class.getName()); - - public static Destination convert(com.sinch.sdk.domains.voice.models.Destination client) { - - if (null == client) { - return null; - } - - if (client instanceof DestinationNumber) { - DestinationNumber destination = (DestinationNumber) client; - if (DestinationNumberType.DID.equals(destination.getType())) { - return DestinationDid.from( - null != destination.getPhoneNumber() - ? destination.getPhoneNumber().stringValue() - : null); - } - if (DestinationNumberType.PSTN.equals(destination.getType())) { - return DestinationPstn.from( - null != destination.getPhoneNumber() - ? destination.getPhoneNumber().stringValue() - : null); - } - LOGGER.severe(String.format("Unexpected type '%s': %s", destination.getType(), client)); - return null; - } - - if (client instanceof DestinationUser) { - return DestinationMxp.from(((DestinationUser) client).getUserName()); - } - - if (client instanceof DestinationSip) { - return com.sinch.sdk.domains.voice.models.v1.destination.DestinationSip.from( - ((DestinationSip) client).getSIPAddress()); - } - - LOGGER.severe(String.format("Unexpected class '%s': '%s'", client.getClass(), client)); - return null; - } - - public static com.sinch.sdk.domains.voice.models.Destination convert(Destination dto) { - if (null == dto) { - return null; - } - if (dto instanceof DestinationPstn) { - return new DestinationNumber( - E164PhoneNumber.valueOf(((DestinationPstn) dto).getEndpoint()), - DestinationNumberType.PSTN); - } - if (dto instanceof DestinationMxp) { - return new DestinationUser(((DestinationMxp) dto).getEndpoint()); - } - if (dto instanceof com.sinch.sdk.domains.voice.models.v1.destination.DestinationSip) { - return new DestinationSip( - ((com.sinch.sdk.domains.voice.models.v1.destination.DestinationSip) dto).getEndpoint()); - } - if (dto instanceof DestinationDid) { - return new DestinationNumber( - E164PhoneNumber.valueOf(((DestinationDid) dto).getEndpoint()), DestinationNumberType.DID); - } - - LOGGER.severe(String.format("Unexpected class '%s'", dto)); - return null; - } - - public static com.sinch.sdk.domains.voice.models.Destination convert(CallInformationFrom dto) { - if (null == dto) { - return null; - } - if (!(dto instanceof Destination)) { - LOGGER.severe(String.format("Unexpected class '%s'", dto)); - return null; - } - return convert((Destination) dto); - } - - public static com.sinch.sdk.domains.voice.models.Destination convert(CallInformationTo dto) { - if (null == dto) { - return null; - } - if (!(dto instanceof Destination)) { - LOGGER.severe(String.format("Unexpected class '%s'", dto)); - return null; - } - return convert((Destination) dto); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/DomainTypeDtoConverter.java b/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/DomainTypeDtoConverter.java deleted file mode 100644 index 7de97808e..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/DomainTypeDtoConverter.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.sinch.sdk.domains.voice.adapters.converters; - -import com.sinch.sdk.domains.voice.models.DomainType; -import com.sinch.sdk.domains.voice.models.v1.Domain; - -public class DomainTypeDtoConverter { - - public static DomainType convert(String dto) { - if (null == dto) { - return null; - } - return DomainType.from(dto.toLowerCase()); - } - - public static DomainType convert(Domain dto) { - if (null == dto) { - return null; - } - return DomainType.from(dto.value().toLowerCase()); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/DualToneMultiFrequencyDtoConverter.java b/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/DualToneMultiFrequencyDtoConverter.java deleted file mode 100644 index 163c18456..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/DualToneMultiFrequencyDtoConverter.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.sinch.sdk.domains.voice.adapters.converters; - -import com.sinch.sdk.models.DualToneMultiFrequency; - -public class DualToneMultiFrequencyDtoConverter { - - public static String convert(DualToneMultiFrequency client) { - if (null == client) { - return null; - } - return client.stringValue(); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/E164PhoneNumberDtoConverter.java b/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/E164PhoneNumberDtoConverter.java deleted file mode 100644 index 5b3205b70..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/E164PhoneNumberDtoConverter.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.sinch.sdk.domains.voice.adapters.converters; - -import com.sinch.sdk.models.E164PhoneNumber; - -public class E164PhoneNumberDtoConverter { - - public static String convert(E164PhoneNumber client) { - if (null == client) { - return null; - } - return client.stringValue(); - } - - public static E164PhoneNumber convert(String dto) { - if (null == dto) { - return null; - } - return E164PhoneNumber.valueOf(dto); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/NumberTypeDtoConverter.java b/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/NumberTypeDtoConverter.java deleted file mode 100644 index f446da50d..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/NumberTypeDtoConverter.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.sinch.sdk.domains.voice.adapters.converters; - -import com.sinch.sdk.domains.voice.models.NumberType; -import com.sinch.sdk.domains.voice.models.v1.applications.response.QueryNumberInformation.NumberTypeEnum; - -public class NumberTypeDtoConverter { - - public static NumberType convert(NumberTypeEnum dto) { - if (null == dto) { - return null; - } - return NumberType.from(dto.value()); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/PriceDtoConverter.java b/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/PriceDtoConverter.java deleted file mode 100644 index caa4a7cb0..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/PriceDtoConverter.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.sinch.sdk.domains.voice.adapters.converters; - -import com.sinch.sdk.domains.voice.models.Price; - -public class PriceDtoConverter { - - public static Price convert(com.sinch.sdk.domains.voice.models.v1.Price dto) { - if (null == dto) { - return Price.builder().build(); - } - return Price.builder().setCurrencyId(dto.getCurrencyId()).setAmount(dto.getAmount()).build(); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/SVAMLActionDtoConverter.java b/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/SVAMLActionDtoConverter.java deleted file mode 100644 index 60a88ead7..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/SVAMLActionDtoConverter.java +++ /dev/null @@ -1,287 +0,0 @@ -package com.sinch.sdk.domains.voice.adapters.converters; - -import com.sinch.sdk.core.utils.Pair; -import com.sinch.sdk.domains.common.adapters.converters.EnumDynamicConverter; -import com.sinch.sdk.domains.voice.models.ConferenceDtfmOptions; -import com.sinch.sdk.domains.voice.models.svaml.Action; -import com.sinch.sdk.domains.voice.models.svaml.ActionConnectConference; -import com.sinch.sdk.domains.voice.models.svaml.ActionConnectMxp; -import com.sinch.sdk.domains.voice.models.svaml.ActionConnectPstn; -import com.sinch.sdk.domains.voice.models.svaml.ActionConnectSip; -import com.sinch.sdk.domains.voice.models.svaml.ActionContinue; -import com.sinch.sdk.domains.voice.models.svaml.ActionHangUp; -import com.sinch.sdk.domains.voice.models.svaml.ActionPark; -import com.sinch.sdk.domains.voice.models.svaml.ActionRunMenu; -import com.sinch.sdk.domains.voice.models.svaml.AnsweringMachineDetection; -import com.sinch.sdk.domains.voice.models.svaml.MenuOptionAction; -import com.sinch.sdk.domains.voice.models.v1.MusicOnHold; -import com.sinch.sdk.domains.voice.models.v1.conferences.ConferenceDtmfOptions; -import com.sinch.sdk.domains.voice.models.v1.destination.Destination; -import com.sinch.sdk.domains.voice.models.v1.destination.DestinationMxp; -import com.sinch.sdk.domains.voice.models.v1.destination.DestinationSip; -import com.sinch.sdk.domains.voice.models.v1.svaml.action.CallHeader; -import com.sinch.sdk.domains.voice.models.v1.svaml.action.ConnectPstnAnsweringMachineDetection; -import com.sinch.sdk.domains.voice.models.v1.svaml.action.Menu; -import com.sinch.sdk.domains.voice.models.v1.svaml.action.MenuOption; -import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlAction; -import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionConnectConference; -import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionConnectMxp; -import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionConnectPstn; -import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionConnectPstn.IndicationsEnum; -import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionConnectSip; -import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionConnectSip.TransportEnum; -import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionContinue; -import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionHangup; -import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionPark; -import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionRunMenu; -import java.util.Collection; -import java.util.List; -import java.util.logging.Logger; -import java.util.stream.Collectors; - -public class SVAMLActionDtoConverter { - private static final Logger LOGGER = Logger.getLogger(SVAMLActionDtoConverter.class.getName()); - - public static SvamlAction convert(Action client) { - if (null == client) { - return null; - } - - SvamlAction convertedDto = null; - if (client instanceof ActionConnectConference) { - ActionConnectConference typedClient = (ActionConnectConference) client; - convertedDto = convertAction(typedClient); - } else if (client instanceof ActionConnectMxp) { - ActionConnectMxp typedClient = (ActionConnectMxp) client; - convertedDto = convertAction(typedClient); - } else if (client instanceof ActionConnectPstn) { - ActionConnectPstn typedClient = (ActionConnectPstn) client; - convertedDto = convertAction(typedClient); - } else if (client instanceof ActionConnectSip) { - ActionConnectSip typedClient = (ActionConnectSip) client; - convertedDto = convertAction(typedClient); - } else if (client instanceof ActionContinue) { - ActionContinue typedClient = (ActionContinue) client; - convertedDto = convertAction(typedClient); - } else if (client instanceof ActionHangUp) { - ActionHangUp typedClient = (ActionHangUp) client; - convertedDto = convertAction(typedClient); - } else if (client instanceof ActionPark) { - ActionPark typedClient = (ActionPark) client; - convertedDto = convertAction(typedClient); - } else if (client instanceof ActionRunMenu) { - ActionRunMenu typedClient = (ActionRunMenu) client; - convertedDto = convertAction(typedClient); - } else { - LOGGER.severe(String.format("Unexpected class '%s'", client.getClass())); - } - - return convertedDto; - } - - private static SvamlActionConnectConference convertAction(ActionConnectConference client) { - if (null == client) { - return null; - } - SvamlActionConnectConference.Builder dto = SvamlActionConnectConference.builder(); - client.getConferenceId().ifPresent(dto::setConferenceId); - client - .getMusicOnHold() - .ifPresent(f -> dto.setMusicOnHold(MusicOnHold.from(EnumDynamicConverter.convert(f)))); - client.getDtfmOptions().ifPresent(f -> dto.setConferenceDtmfOptions(convert(f))); - return dto.build(); - } - - private static SvamlActionConnectMxp convertAction(ActionConnectMxp client) { - if (null == client) { - return null; - } - SvamlActionConnectMxp.Builder dto = SvamlActionConnectMxp.builder(); - client - .getDestination() - .ifPresent( - f -> { - Destination destination = DestinationDtoConverter.convert(f); - if (!(destination instanceof DestinationMxp)) { - LOGGER.severe(String.format("Unexpected class '%s'", destination)); - return; - } - dto.setDestination((DestinationMxp) destination); - }); - client.getCallheaders().ifPresent(f -> dto.setCallheaders(convertHeaderCollection(f))); - return dto.build(); - } - - private static SvamlActionConnectPstn convertAction(ActionConnectPstn client) { - if (null == client) { - return null; - } - SvamlActionConnectPstn.Builder dto = SvamlActionConnectPstn.builder(); - client.getNumber().ifPresent(f -> dto.setNumber(E164PhoneNumberDtoConverter.convert(f))); - client.getLocale().ifPresent(dto::setLocale); - client.getMaxDuration().ifPresent(dto::setMaxDuration); - client.getDialTimeout().ifPresent(dto::setDialTimeout); - client.getCli().ifPresent(dto::setCli); - client.getSuppressCallbacks().ifPresent(dto::setSuppressCallbacks); - client.getDualToneMultiFrequency().ifPresent(dto::setDtmf); - client - .getIndications() - .ifPresent(f -> dto.setIndications(IndicationsEnum.from(EnumDynamicConverter.convert(f)))); - client.getAnsweringMachineDetection().ifPresent(f -> dto.setAmd(convert(f))); - return dto.build(); - } - - private static SvamlActionConnectSip convertAction(ActionConnectSip client) { - if (null == client) { - return null; - } - SvamlActionConnectSip.Builder dto = SvamlActionConnectSip.builder(); - client - .getDestination() - .ifPresent( - f -> { - Destination destination = DestinationDtoConverter.convert(f); - if (!(destination instanceof DestinationSip)) { - LOGGER.severe(String.format("Unexpected class '%s'", destination)); - return; - } - dto.setDestination((DestinationSip) destination); - }); - client.getMaxDuration().ifPresent(dto::setMaxDuration); - client.getCli().ifPresent(dto::setCli); - client - .getTransport() - .ifPresent(f -> dto.setTransport(TransportEnum.from(EnumDynamicConverter.convert(f)))); - client.getSuppressCallbacks().ifPresent(dto::setSuppressCallbacks); - client.getCallHeaders().ifPresent(f -> dto.setCallHeaders(convertHeaderCollection(f))); - client - .getMusicOnHold() - .ifPresent(f -> dto.setMusicOnHold(MusicOnHold.from(EnumDynamicConverter.convert(f)))); - return dto.build(); - } - - private static SvamlActionContinue convertAction(ActionContinue client) { - if (null == client) { - return null; - } - return SvamlActionContinue.DEFAULT; - } - - private static SvamlActionHangup convertAction(ActionHangUp client) { - if (null == client) { - return null; - } - return SvamlActionHangup.DEFAULT; - } - - private static SvamlActionPark convertAction(ActionPark client) { - if (null == client) { - return null; - } - SvamlActionPark.Builder dto = SvamlActionPark.builder(); - client.getLocale().ifPresent(dto::setLocale); - client.getIntroPrompt().ifPresent(dto::setIntroPrompt); - client.getHoldPrompt().ifPresent(dto::setHoldPrompt); - client.getMaxDuration().ifPresent(dto::setMaxDuration); - - return dto.build(); - } - - private static SvamlActionRunMenu convertAction(ActionRunMenu client) { - if (null == client) { - return null; - } - SvamlActionRunMenu.Builder dto = SvamlActionRunMenu.builder(); - client.getBarge().ifPresent(dto::setBarge); - client.getLocale().ifPresent(dto::setLocale); - client.getMainMenu().ifPresent(dto::setMainMenu); - client.getEnableVoice().ifPresent(dto::setEnableVoice); - client.getMenus().ifPresent(f -> dto.setMenus(convertMenuCollection(f))); - return dto.build(); - } - - private static ConferenceDtmfOptions convert(ConferenceDtfmOptions client) { - if (null == client) { - return null; - } - ConferenceDtmfOptions.Builder builder = ConferenceDtmfOptions.builder(); - client - .getMode() - .ifPresent( - f -> - builder.setMode( - ConferenceDtmfOptions.ModeEnum.from(EnumDynamicConverter.convert(f)))); - client.getMaxDigits().ifPresent(builder::setMaxDigits); - client.getTimeoutMills().ifPresent(builder::setTimeoutMills); - return builder.build(); - } - - private static List convertHeaderCollection(Collection> client) { - if (null == client) { - return null; - } - return client.stream() - .map(f -> CallHeader.builder().setKey(f.getLeft()).setValue(f.getRight()).build()) - .collect(Collectors.toList()); - } - - private static ConnectPstnAnsweringMachineDetection convert(AnsweringMachineDetection client) { - if (null == client) { - return null; - } - - ConnectPstnAnsweringMachineDetection.Builder dto = - ConnectPstnAnsweringMachineDetection.builder(); - - client.getEnabled().ifPresent(dto::setEnabled); - return dto.build(); - } - - private static List

convertMenuCollection( - Collection client) { - if (null == client) { - return null; - } - return client.stream().map(SVAMLActionDtoConverter::convert).collect(Collectors.toList()); - } - - private static Menu convert(com.sinch.sdk.domains.voice.models.svaml.Menu client) { - if (null == client) { - return null; - } - Menu.Builder dto = Menu.builder(); - - client.getId().ifPresent(dto::setId); - client.getMainPrompt().ifPresent(dto::setMainPrompt); - client.getRepeatPrompt().ifPresent(dto::setRepeatPrompt); - client.getRepeats().ifPresent(dto::setRepeats); - client.getMaxDigits().ifPresent(dto::setMaxDigits); - client.getTimeoutMills().ifPresent(dto::setTimeoutMills); - client.getMaxTimeoutMills().ifPresent(dto::setMaxTimeoutMills); - client.getOptions().ifPresent(f -> dto.setOptions(convertMenuOptionCollection(f))); - return dto.build(); - } - - private static List convertMenuOptionCollection( - Collection client) { - if (null == client) { - return null; - } - return client.stream() - .map( - f -> { - MenuOption.Builder dto = MenuOption.builder(); - f.getAction().ifPresent(f2 -> dto.setAction(convert(f2))); - f.getDtfm().ifPresent(dto::setDtmf); - return dto.build(); - }) - .collect(Collectors.toList()); - } - - private static String convert(MenuOptionAction client) { - if (null == client || null == client.getType()) { - return null; - } - return String.format("%s(%s)", client.getType().value(), client.getId()); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/SVAMLInstructionDtoConverter.java b/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/SVAMLInstructionDtoConverter.java deleted file mode 100644 index 0a1b95f10..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/SVAMLInstructionDtoConverter.java +++ /dev/null @@ -1,164 +0,0 @@ -package com.sinch.sdk.domains.voice.adapters.converters; - -import com.sinch.sdk.domains.voice.models.svaml.Instruction; -import com.sinch.sdk.domains.voice.models.svaml.InstructionAnswer; -import com.sinch.sdk.domains.voice.models.svaml.InstructionPlayFiles; -import com.sinch.sdk.domains.voice.models.svaml.InstructionSay; -import com.sinch.sdk.domains.voice.models.svaml.InstructionSendDtfm; -import com.sinch.sdk.domains.voice.models.svaml.InstructionSetCookie; -import com.sinch.sdk.domains.voice.models.svaml.InstructionStartRecording; -import com.sinch.sdk.domains.voice.models.svaml.InstructionStopRecording; -import com.sinch.sdk.domains.voice.models.svaml.StartRecordingOptions; -import com.sinch.sdk.domains.voice.models.svaml.TranscriptionOptions; -import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstruction; -import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionAnswer; -import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionPlayFiles; -import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionSay; -import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionSendDtmf; -import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionSetCookie; -import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionStartRecording; -import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionStopRecording; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.logging.Logger; -import java.util.stream.Collectors; - -public class SVAMLInstructionDtoConverter { - - private static final Logger LOGGER = - Logger.getLogger(SVAMLInstructionDtoConverter.class.getName()); - - public static List convert(Collection instructions) { - if (null == instructions) { - return null; - } - return instructions.stream() - .map(SVAMLInstructionDtoConverter::convertInstruction) - .collect(Collectors.toList()); - } - - private static SvamlInstruction convertInstruction(Instruction client) { - if (null == client) { - return null; - } - - SvamlInstruction convertedDto = null; - if (client instanceof InstructionAnswer) { - InstructionAnswer typedClient = (InstructionAnswer) client; - convertedDto = convert(typedClient); - } else if (client instanceof InstructionPlayFiles) { - InstructionPlayFiles typedClient = (InstructionPlayFiles) client; - convertedDto = convert(typedClient); - } else if (client instanceof InstructionSay) { - InstructionSay typedClient = (InstructionSay) client; - convertedDto = convert(typedClient); - } else if (client instanceof InstructionSendDtfm) { - InstructionSendDtfm typedClient = (InstructionSendDtfm) client; - convertedDto = convert(typedClient); - } else if (client instanceof InstructionSetCookie) { - InstructionSetCookie typedClient = (InstructionSetCookie) client; - convertedDto = convert(typedClient); - } else if (client instanceof InstructionStartRecording) { - InstructionStartRecording typedClient = (InstructionStartRecording) client; - convertedDto = convert(typedClient); - } else if (client instanceof InstructionStopRecording) { - InstructionStopRecording typedClient = (InstructionStopRecording) client; - convertedDto = convert(typedClient); - } else { - LOGGER.severe(String.format("Unexpected class '%s'", client.getClass())); - } - - return convertedDto; - } - - private static SvamlInstructionAnswer convert(InstructionAnswer client) { - if (null == client) { - return null; - } - return SvamlInstructionAnswer.DEFAULT; - } - - private static SvamlInstructionPlayFiles convert(InstructionPlayFiles client) { - if (null == client) { - return null; - } - SvamlInstructionPlayFiles.Builder dto = SvamlInstructionPlayFiles.builder(); - client.getIds().ifPresent(f -> dto.setIds(new ArrayList<>(f))); - client.getLocale().ifPresent(dto::setLocale); - return dto.build(); - } - - private static SvamlInstructionSay convert(InstructionSay client) { - if (null == client) { - return null; - } - SvamlInstructionSay.Builder dto = SvamlInstructionSay.builder(); - client.getText().ifPresent(dto::setText); - client.getLocale().ifPresent(dto::setLocale); - return dto.build(); - } - - private static SvamlInstructionSendDtmf convert(InstructionSendDtfm client) { - if (null == client) { - return null; - } - SvamlInstructionSendDtmf.Builder dto = SvamlInstructionSendDtmf.builder(); - client.getTDtfm().ifPresent(f -> dto.setValue(f.stringValue())); - return dto.build(); - } - - private static SvamlInstructionSetCookie convert(InstructionSetCookie client) { - if (null == client) { - return null; - } - SvamlInstructionSetCookie.Builder dto = SvamlInstructionSetCookie.builder(); - dto.setKey(client.getKey()); - dto.setValue(client.getValue()); - return dto.build(); - } - - private static SvamlInstructionStartRecording convert(InstructionStartRecording client) { - if (null == client) { - return null; - } - SvamlInstructionStartRecording.Builder dto = SvamlInstructionStartRecording.builder(); - client.getOptions().ifPresent(f -> dto.setOptions(convert(f))); - return dto.build(); - } - - private static SvamlInstructionStopRecording convert(InstructionStopRecording client) { - if (null == client) { - return null; - } - return SvamlInstructionStopRecording.DEFAULT; - } - - private static com.sinch.sdk.domains.voice.models.v1.svaml.instruction.StartRecordingOptions - convert(StartRecordingOptions client) { - if (null == client) { - return null; - } - com.sinch.sdk.domains.voice.models.v1.svaml.instruction.StartRecordingOptions.Builder dto = - com.sinch.sdk.domains.voice.models.v1.svaml.instruction.StartRecordingOptions.builder(); - - client.getDestinationUrl().ifPresent(dto::setDestinationUrl); - client.getCredentials().ifPresent(dto::setCredentials); - client.getFormat().ifPresent(dto::setFormat); - client.getNotificationEvents().ifPresent(dto::setNotificationEvents); - client.getTranscriptionOptions().ifPresent(f -> dto.setTranscriptionOptions(convert(f))); - return dto.build(); - } - - private static com.sinch.sdk.domains.voice.models.v1.svaml.instruction.TranscriptionOptions - convert(TranscriptionOptions client) { - if (null == client) { - return null; - } - com.sinch.sdk.domains.voice.models.v1.svaml.instruction.TranscriptionOptions.Builder dto = - com.sinch.sdk.domains.voice.models.v1.svaml.instruction.TranscriptionOptions.builder(); - client.getEnabled().ifPresent(dto::setEnabled); - client.getLocale().ifPresent(dto::setLocale); - return dto.build(); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/WebhooksEventDtoConverter.java b/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/WebhooksEventDtoConverter.java deleted file mode 100644 index 84a680585..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/adapters/converters/WebhooksEventDtoConverter.java +++ /dev/null @@ -1,191 +0,0 @@ -package com.sinch.sdk.domains.voice.adapters.converters; - -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.core.utils.Pair; -import com.sinch.sdk.domains.voice.models.CallReasonType; -import com.sinch.sdk.domains.voice.models.CallResultType; -import com.sinch.sdk.domains.voice.models.v1.svaml.action.CallHeader; -import com.sinch.sdk.domains.voice.models.v1.webhooks.AnsweringMachineDetection; -import com.sinch.sdk.domains.voice.models.v1.webhooks.DisconnectedCallEvent; -import com.sinch.sdk.domains.voice.models.v1.webhooks.NotificationEvent; -import com.sinch.sdk.domains.voice.models.v1.webhooks.VoiceWebhookEvent; -import com.sinch.sdk.domains.voice.models.webhooks.AmdAnswer; -import com.sinch.sdk.domains.voice.models.webhooks.AmdAnswerReasonType; -import com.sinch.sdk.domains.voice.models.webhooks.AmdAnswerStatusType; -import com.sinch.sdk.domains.voice.models.webhooks.AnsweredCallEvent; -import com.sinch.sdk.domains.voice.models.webhooks.DisconnectCallEvent; -import com.sinch.sdk.domains.voice.models.webhooks.IncomingCallEvent; -import com.sinch.sdk.domains.voice.models.webhooks.MenuInputType; -import com.sinch.sdk.domains.voice.models.webhooks.MenuResult; -import com.sinch.sdk.domains.voice.models.webhooks.MenuResultInputMethodType; -import com.sinch.sdk.domains.voice.models.webhooks.NotifyEvent; -import com.sinch.sdk.domains.voice.models.webhooks.PromptInputEvent; -import com.sinch.sdk.domains.voice.models.webhooks.WebhooksEvent; -import java.util.Collection; -import java.util.List; -import java.util.stream.Collectors; - -public class WebhooksEventDtoConverter { - - public static WebhooksEvent convert(VoiceWebhookEvent dto) { - - if (null == dto) { - return null; - } - - WebhooksEvent.Builder builder; - - if (dto instanceof com.sinch.sdk.domains.voice.models.v1.webhooks.IncomingCallEvent) { - builder = convert((com.sinch.sdk.domains.voice.models.v1.webhooks.IncomingCallEvent) dto); - } else if (dto instanceof DisconnectedCallEvent) { - builder = convert((DisconnectedCallEvent) dto); - } else if (dto instanceof com.sinch.sdk.domains.voice.models.v1.webhooks.AnsweredCallEvent) { - builder = convert((com.sinch.sdk.domains.voice.models.v1.webhooks.AnsweredCallEvent) dto); - } else if (dto instanceof com.sinch.sdk.domains.voice.models.v1.webhooks.PromptInputEvent) { - builder = convert((com.sinch.sdk.domains.voice.models.v1.webhooks.PromptInputEvent) dto); - } else if (dto instanceof NotificationEvent) { - builder = convert((NotificationEvent) dto); - } else { - throw new ApiException("Unexpected event:" + dto); - } - - return builder.setCallId(dto.getCallid()).setVersion(dto.getVersion()).build(); - } - - private static IncomingCallEvent.Builder convert( - com.sinch.sdk.domains.voice.models.v1.webhooks.IncomingCallEvent dto) { - - IncomingCallEvent.Builder builder = IncomingCallEvent.builder(); - if (null == dto) { - return builder; - } - - return builder - .setTimestamp(dto.getTimestamp()) - .setCustom(dto.getCustom()) - .setCallResourceUrl(dto.getCallResourceUrl()) - .setUserRate(PriceDtoConverter.convert(dto.getUserRate())) - .setCli(dto.getCli()) - .setTo(DestinationDtoConverter.convert(dto.getTo())) - .setDomain(DomainTypeDtoConverter.convert(dto.getDomain())) - .setApplicationKey(dto.getApplicationKey()) - .setOriginationType(DomainTypeDtoConverter.convert(dto.getOriginationType())) - .setDuration(dto.getDuration()) - .setRdnis(dto.getRdnis()) - .setCallHeaders(convertHeaderCollection(dto.getCallHeaders())); - } - - private static DisconnectCallEvent.Builder convert( - com.sinch.sdk.domains.voice.models.v1.webhooks.DisconnectedCallEvent dto) { - - DisconnectCallEvent.Builder builder = DisconnectCallEvent.builder(); - if (null == dto) { - return builder; - } - return builder - .setTimestamp(dto.getTimestamp()) - .setCustom(dto.getCustom()) - .setReason(null != dto.getReason() ? CallReasonType.from(dto.getReason().value()) : null) - .setResult(null != dto.getResult() ? CallResultType.from(dto.getResult().value()) : null) - .setDebit(PriceDtoConverter.convert(dto.getDebit())) - .setUserRate(PriceDtoConverter.convert(dto.getUserRate())) - .setTo(DestinationDtoConverter.convert(dto.getTo())) - .setApplicationKey(dto.getApplicationKey()) - .setDuration(dto.getDuration()) - .setFrom(dto.getFrom()); - } - - private static AnsweredCallEvent.Builder convert( - com.sinch.sdk.domains.voice.models.v1.webhooks.AnsweredCallEvent dto) { - - AnsweredCallEvent.Builder builder = AnsweredCallEvent.builder(); - if (null == dto) { - return builder; - } - return builder - .setTimestamp(dto.getTimestamp()) - .setCustom(dto.getCustom()) - .setAmd(convert(dto.getAmd())); - } - - private static PromptInputEvent.Builder convert( - com.sinch.sdk.domains.voice.models.v1.webhooks.PromptInputEvent dto) { - - PromptInputEvent.Builder builder = PromptInputEvent.builder(); - if (null == dto) { - return builder; - } - return builder - .setTimestamp(dto.getTimestamp()) - .setCustom(dto.getCustom()) - .setApplicationKey(dto.getApplicationKey()) - .setCallId(dto.getCallid()) - .setVersion(dto.getVersion()) - .setMenuResult(convert(dto.getMenuResult())); - } - - private static NotifyEvent.Builder convert( - com.sinch.sdk.domains.voice.models.v1.webhooks.NotificationEvent dto) { - - NotifyEvent.Builder builder = NotifyEvent.builder(); - if (null == dto) { - return builder; - } - return builder - .setCustom(dto.getCustom()) - .setCallId(dto.getCallid()) - .setVersion(dto.getVersion()) - .setType(dto.getType()); - } - - private static AmdAnswer convert(AnsweringMachineDetection dto) { - - if (null == dto) { - return null; - } - AmdAnswer.Builder builder = AmdAnswer.builder().setDuration(dto.getDuration()); - - if (null != dto.getReason()) { - builder.setReason(convertReason(dto.getReason().value())); - } - if (null != dto.getStatus()) { - builder.setStatus(convertStatus(dto.getStatus().value())); - } - return builder.build(); - } - - private static AmdAnswerReasonType convertReason(String dto) { - if (null == dto) { - return null; - } - return AmdAnswerReasonType.from(dto); - } - - private static AmdAnswerStatusType convertStatus(String dto) { - if (null == dto) { - return null; - } - return AmdAnswerStatusType.from(dto); - } - - private static Collection> convertHeaderCollection(List dto) { - if (null == dto) { - return null; - } - return dto.stream().map(f -> new Pair<>(f.getKey(), f.getValue())).collect(Collectors.toList()); - } - - private static MenuResult convert(com.sinch.sdk.domains.voice.models.v1.webhooks.MenuResult dto) { - - MenuResult.Builder builder = - MenuResult.builder().setMenuId(dto.getMenuId()).setValue(dto.getValue()); - - if (null != dto.getType()) { - builder.setType(MenuInputType.from(dto.getType().value())); - } - if (null != dto.getInputMethod()) { - builder.setInputMethod(MenuResultInputMethodType.from(dto.getInputMethod().value())); - } - return builder.build(); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/ApplicationAssignedNumber.java b/client/src/main/com/sinch/sdk/domains/voice/models/ApplicationAssignedNumber.java deleted file mode 100644 index b45908dc9..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/ApplicationAssignedNumber.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.sinch.sdk.domains.voice.models; - -import com.sinch.sdk.models.E164PhoneNumber; - -/** Information about your number. */ -public class ApplicationAssignedNumber { - - private final E164PhoneNumber number; - private final String applicationKey; - private final CapabilityType capability; - - private ApplicationAssignedNumber( - E164PhoneNumber number, String applicationKey, CapabilityType capability) { - this.number = number; - this.applicationKey = applicationKey; - this.capability = capability; - } - - /** - * The phone number - * - * @return The phone number - */ - public E164PhoneNumber getNumber() { - return number; - } - - /** - * Indicates the application where the number was assigned. - * - * @return Application key value - */ - public String getApplicationKey() { - return applicationKey; - } - - /** - * Indicates the DID (Direct Inward CapabilityType) capabilityType that was assigned to the chosen - * application. - * - *

Please note that the DID needs to support the selected capabilityType. - * - * @return The capabilityType - */ - public CapabilityType getCapability() { - return capability; - } - - @Override - public String toString() { - return "ApplicationAssignedNumber{" - + "number=" - + number - + ", applicationKey='" - + applicationKey - + '\'' - + ", capabilityType=" - + capability - + '}'; - } - - /** - * Create a builder instance - * - * @return Dedicated builder - */ - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - E164PhoneNumber number; - String applicationKey; - CapabilityType capabilityType; - - /** - * @param number the number value - * @return Current builder - * @see ApplicationAssignedNumber#getNumber() () getter - */ - public Builder setNumber(E164PhoneNumber number) { - this.number = number; - return this; - } - - /** - * @param applicationKey the application key - * @return Current builder - * @see ApplicationAssignedNumber#getApplicationKey() getter - */ - public Builder setApplicationKey(String applicationKey) { - this.applicationKey = applicationKey; - return this; - } - - /** - * @param capabilityType the capabilityType value - * @return Current builder - * @see ApplicationAssignedNumber#getCapability() getter - */ - public Builder setCapability(CapabilityType capabilityType) { - this.capabilityType = capabilityType; - return this; - } - - /** - * Build the instance - * - * @return Built instance - */ - public ApplicationAssignedNumber build() { - return new ApplicationAssignedNumber(number, applicationKey, capabilityType); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/ApplicationURL.java b/client/src/main/com/sinch/sdk/domains/voice/models/ApplicationURL.java deleted file mode 100644 index 07bd679ea..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/ApplicationURL.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.sinch.sdk.domains.voice.models; - -/** primary and if configured fallback callback URLs for an application */ -public class ApplicationURL { - - private final String primary; - private final String fallback; - - private ApplicationURL(String primary, String fallback) { - this.primary = primary; - this.fallback = fallback; - } - - /** - * Primary callback URL for application - * - * @return callback URL value - * @since 1.0 - */ - public String getPrimary() { - return primary; - } - - /** - * Fallback callback URL (returned if configured). - * - *

It is used only if Sinch platform gets a timeout or error from your primary callback URL. - * - * @return callback URL value - * @since 1.0 - */ - public String getFallback() { - return fallback; - } - - @Override - public String toString() { - return "ApplicationURL{" - + "primary='" - + primary - + '\'' - + ", fallback='" - + fallback - + '\'' - + '}'; - } - - /** - * Create a builder instance - * - * @return Dedicated builder - */ - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - String primary; - String fallback; - - /** - * @param primary The primary URL to be used - * @return Current builder - * @see ApplicationURL#getPrimary() getter - */ - public Builder setPrimary(String primary) { - this.primary = primary; - return this; - } - - /** - * @param fallback The fallback URL to be used - * @return Current builder - * @see ApplicationURL#getFallback() () getter - */ - public Builder setFallback(String fallback) { - this.fallback = fallback; - return this; - } - - /** - * Build the instance - * - * @return Built instance - */ - public ApplicationURL build() { - return new ApplicationURL(primary, fallback); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/CallLegType.java b/client/src/main/com/sinch/sdk/domains/voice/models/CallLegType.java deleted file mode 100644 index b87d1c4f4..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/CallLegType.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.sinch.sdk.domains.voice.models; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -/** - * Specifies which part of the call will be managed. This option is used only by the PlayFiles and - * Say instructions to indicate which channel the sound will be played on. Valid options are caller, - * callee or both. If not specified, the default value is caller. - * - *

The callLeg identifier is ignored for calls that are part of a conference and calls initiated - * using the Callout API. - */ -public class CallLegType extends EnumDynamic { - - public static final CallLegType CALLER = new CallLegType("caller"); - public static final CallLegType CALLEE = new CallLegType("callee"); - public static final CallLegType BOTH = new CallLegType("both"); - - /** */ - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - CallLegType.class, CallLegType::new, Arrays.asList(CALLER, CALLEE, BOTH)); - - private CallLegType(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static CallLegType from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(CallLegType e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/CallReasonType.java b/client/src/main/com/sinch/sdk/domains/voice/models/CallReasonType.java deleted file mode 100644 index faed1c979..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/CallReasonType.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.sinch.sdk.domains.voice.models; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -/** Describe the reason why a call ended */ -public class CallReasonType extends EnumDynamic { - - public static final CallReasonType NA = new CallReasonType("N/A"); - public static final CallReasonType TIMEOUT = new CallReasonType("TIMEOUT"); - public static final CallReasonType CALLER_HANGUP = new CallReasonType("CALLERHANGUP"); - public static final CallReasonType CALLEE_HANGUP = new CallReasonType("CALLEEHANGUP"); - public static final CallReasonType BLOCKED = new CallReasonType("BLOCKED"); - public static final CallReasonType NO_CREDIT_PARTNER = new CallReasonType("NOCREDITPARTNER"); - public static final CallReasonType MANAGER_HANGUP = new CallReasonType("MANAGERHANGUP"); - public static final CallReasonType CANCEL = new CallReasonType("CANCEL"); - public static final CallReasonType GENERAL_ERROR = new CallReasonType("GENERALERROR"); - public static final CallReasonType INVALID_SVAMLACTION = new CallReasonType("INVALIDSVAMLACTION"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - CallReasonType.class, - CallReasonType::new, - Arrays.asList( - NA, - TIMEOUT, - CALLER_HANGUP, - CALLEE_HANGUP, - BLOCKED, - NO_CREDIT_PARTNER, - MANAGER_HANGUP, - CANCEL, - GENERAL_ERROR, - INVALID_SVAMLACTION)); - - private CallReasonType(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static CallReasonType from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(CallReasonType e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/CallResultType.java b/client/src/main/com/sinch/sdk/domains/voice/models/CallResultType.java deleted file mode 100644 index 6f311ec91..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/CallResultType.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.sinch.sdk.domains.voice.models; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -/** Describe the result of a call */ -public class CallResultType extends EnumDynamic { - - public static final CallResultType NA = new CallResultType("N/A"); - public static final CallResultType ANSWERED = new CallResultType("ANSWERED"); - public static final CallResultType BUSY = new CallResultType("BUSY"); - public static final CallResultType NOANSWER = new CallResultType("NOANSWER"); - public static final CallResultType FAILED = new CallResultType("FAILED"); - - /** */ - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - CallResultType.class, - CallResultType::new, - Arrays.asList(NA, ANSWERED, BUSY, NOANSWER, FAILED)); - - private CallResultType(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static CallResultType from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(CallResultType e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/CallbackUrls.java b/client/src/main/com/sinch/sdk/domains/voice/models/CallbackUrls.java deleted file mode 100644 index 95f435f5f..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/CallbackUrls.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.sinch.sdk.domains.voice.models; - -/** - * Returns any callback URLs configured for the specified application - * - * @since 1.0 - */ -public class CallbackUrls { - private final ApplicationURL url; - - private CallbackUrls(ApplicationURL url) { - this.url = url; - } - - /** - * Associated application URL - * - * @return The URL - * @since 1.0 - */ - public ApplicationURL getUrl() { - return url; - } - - @Override - public String toString() { - return "CallbackUrls{" + "url=" + url + '}'; - } - - /** - * Create a builder instance - * - * @return Dedicated builder - * @since 1.0 - */ - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - ApplicationURL url; - - /** - * @param url the numbers list - * @return Current builder - * @see CallbackUrls#getUrl() getter - */ - public Builder setUrl(ApplicationURL url) { - this.url = url; - return this; - } - - /** - * Build the instance - * - * @return Built instance - */ - public CallbackUrls build() { - return new CallbackUrls(url); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/CapabilityType.java b/client/src/main/com/sinch/sdk/domains/voice/models/CapabilityType.java deleted file mode 100644 index 4d115ee06..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/CapabilityType.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.sinch.sdk.domains.voice.models; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -/** - * CapabilityType of a phone number - * - *

DID: Direct Inward CapabilityType - * - * @since 1.0 - */ -public final class CapabilityType extends EnumDynamic { - /** The SMS product can use the number. */ - public static final CapabilityType SMS = new CapabilityType("sms"); - - /** The Voice product can use the number. */ - public static final CapabilityType VOICE = new CapabilityType("voice"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - CapabilityType.class, CapabilityType::new, Arrays.asList(SMS, VOICE)); - - private CapabilityType(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static CapabilityType from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(CapabilityType e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/ConferenceDtfmOptions.java b/client/src/main/com/sinch/sdk/domains/voice/models/ConferenceDtfmOptions.java deleted file mode 100644 index 31ce40b75..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/ConferenceDtfmOptions.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.sinch.sdk.domains.voice.models; - -import com.sinch.sdk.core.models.OptionalValue; - -/** - * Options to control how DTMF signals are used by the participant in the conference. For - * information on how to use this feature, read more - * - * @see Using DTMF - * in conferences - */ -public class ConferenceDtfmOptions { - - OptionalValue mode; - OptionalValue maxDigits; - OptionalValue timeoutMills; - - public ConferenceDtfmOptions( - OptionalValue mode, - OptionalValue maxDigits, - OptionalValue timeoutMills) { - this.mode = mode; - this.maxDigits = maxDigits; - this.timeoutMills = timeoutMills; - } - - public OptionalValue getMode() { - return mode; - } - - public OptionalValue getMaxDigits() { - return maxDigits; - } - - public OptionalValue getTimeoutMills() { - return timeoutMills; - } - - @Override - public String toString() { - return "ConferenceDtfmOptions{" - + "mode=" - + mode - + ", maxDigits=" - + maxDigits - + ", timeoutMills=" - + timeoutMills - + '}'; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - OptionalValue mode = OptionalValue.empty(); - OptionalValue maxDigits = OptionalValue.empty(); - OptionalValue timeoutMills = OptionalValue.empty(); - - public Builder() {} - - /** - * Determines what DTMF mode the participant will use in the call. - * - * @param mode DTFM mode - * @return current builder - */ - public Builder setMode(DtfmModeType mode) { - this.mode = OptionalValue.of(mode); - return this; - } - - /** - * The maximum number of accepted digits before sending the collected input via a PIE callback. - * The default value is 1. If the value is greater than 1, the PIE callback is triggered by one - * of the three following events: - * - *

- No additional digit is entered before the timeoutMills timeout period has elapsed. - The - * # character is entered. - The maximum number of digits has been entered. - * - * @param maxDigits Max digits - * @return current builder - */ - public Builder setMaxDigits(Integer maxDigits) { - this.maxDigits = OptionalValue.of(maxDigits); - return this; - } - - /** - * The number of milliseconds that the system will wait between entered digits before triggering - * the PIE callback - * - * @param timeoutMills Timeout in milliseconds - * @return current builder - */ - public Builder setTimeoutMills(Integer timeoutMills) { - this.timeoutMills = OptionalValue.of(timeoutMills); - return this; - } - - public ConferenceDtfmOptions build() { - return new ConferenceDtfmOptions(mode, maxDigits, timeoutMills); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/Destination.java b/client/src/main/com/sinch/sdk/domains/voice/models/Destination.java deleted file mode 100644 index d0f517ed8..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/Destination.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.sinch.sdk.domains.voice.models; - -/** Can be of type number for PSTN endpoints or of type username for data endpoints. */ -public abstract class Destination { - - @Override - public String toString() { - return ""; - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/DestinationNumber.java b/client/src/main/com/sinch/sdk/domains/voice/models/DestinationNumber.java deleted file mode 100644 index f435c1191..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/DestinationNumber.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.sinch.sdk.domains.voice.models; - -import com.sinch.sdk.models.E164PhoneNumber; -import java.util.Objects; - -/** Destination of numbers type */ -public class DestinationNumber extends Destination { - - private final E164PhoneNumber phoneNumber; - private final DestinationNumberType type; - - /** - * Create a destination instance of type PSTN - * - * @param phoneNumber Valid E164 phone number - */ - public DestinationNumber(E164PhoneNumber phoneNumber) { - this(phoneNumber, DestinationNumberType.PSTN); - } - - /** - * Create a destination instance of specified type - * - * @param phoneNumber Valid E164 phone number - * @param type Phone number type - */ - public DestinationNumber(E164PhoneNumber phoneNumber, DestinationNumberType type) { - Objects.requireNonNull(phoneNumber); - this.phoneNumber = phoneNumber; - this.type = type; - } - - public E164PhoneNumber getPhoneNumber() { - return phoneNumber; - } - - public DestinationNumberType getType() { - return type; - } - - @Override - public String toString() { - return "DestinationNumber{" - + "phoneNumber=" - + phoneNumber - + ", type=" - + type - + "} " - + super.toString(); - } - - public static DestinationNumber valueOf(String e164PhoneNumber) { - return new DestinationNumber(E164PhoneNumber.valueOf(e164PhoneNumber)); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DestinationNumber that = (DestinationNumber) o; - return Objects.equals(phoneNumber, that.phoneNumber) && type == that.type; - } - - @Override - public int hashCode() { - return Objects.hash(phoneNumber, type); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/DestinationNumberType.java b/client/src/main/com/sinch/sdk/domains/voice/models/DestinationNumberType.java deleted file mode 100644 index 5ffd8c378..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/DestinationNumberType.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.sinch.sdk.domains.voice.models; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -/** Destination types */ -public class DestinationNumberType extends EnumDynamic { - - /** * Public Switched Telephone Network */ - public static final DestinationNumberType PSTN = new DestinationNumberType("PSTN"); - - /** * Direct Inward Dialing */ - public static final DestinationNumberType DID = new DestinationNumberType("DID"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - DestinationNumberType.class, DestinationNumberType::new, Arrays.asList(PSTN, DID)); - - private DestinationNumberType(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static DestinationNumberType from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(DestinationNumberType e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/DestinationSip.java b/client/src/main/com/sinch/sdk/domains/voice/models/DestinationSip.java deleted file mode 100644 index bd5ceba96..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/DestinationSip.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.sinch.sdk.domains.voice.models; - -import java.util.Objects; - -/** Destination of type SIP */ -public class DestinationSip extends Destination { - private final String sipAddress; - - public DestinationSip(String sipAddress) { - Objects.requireNonNull(sipAddress); - this.sipAddress = sipAddress; - } - - public String getSIPAddress() { - return sipAddress; - } - - @Override - public String toString() { - return "DestinationSip{" + "sipAddress='" + sipAddress + '\'' + "} " + super.toString(); - } - - public static DestinationSip valueOf(String sipAddress) { - return new DestinationSip(sipAddress); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DestinationSip that = (DestinationSip) o; - return Objects.equals(sipAddress, that.sipAddress); - } - - @Override - public int hashCode() { - return Objects.hash(sipAddress); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/DestinationUser.java b/client/src/main/com/sinch/sdk/domains/voice/models/DestinationUser.java deleted file mode 100644 index acf6ae6bf..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/DestinationUser.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.sinch.sdk.domains.voice.models; - -import java.util.Objects; - -/** Destination of type username for data endpoints. */ -public class DestinationUser extends Destination { - private final String userName; - - public DestinationUser(String userName) { - Objects.requireNonNull(userName); - this.userName = userName; - } - - public String getUserName() { - return userName; - } - - @Override - public String toString() { - return "DestinationUser{" + "userName='" + userName + '\'' + "} " + super.toString(); - } - - public static DestinationUser valueOf(String user) { - return new DestinationUser(user); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DestinationUser that = (DestinationUser) o; - return Objects.equals(userName, that.userName); - } - - @Override - public int hashCode() { - return Objects.hash(userName); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/DomainType.java b/client/src/main/com/sinch/sdk/domains/voice/models/DomainType.java deleted file mode 100644 index b5f433c48..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/DomainType.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.sinch.sdk.domains.voice.models; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -/** Domains type */ -public class DomainType extends EnumDynamic { - - /** PSTN endpoint */ - public static final DomainType PSTN = new DomainType("pstn"); - - /** data (app or web) clients */ - public static final DomainType MXP = new DomainType("mxp"); - - /** Conference */ - public static final DomainType CONFERENCE = new DomainType("conference"); - - /** */ - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - DomainType.class, DomainType::new, Arrays.asList(PSTN, MXP, CONFERENCE)); - - private DomainType(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static DomainType from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(DomainType e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/DtfmModeType.java b/client/src/main/com/sinch/sdk/domains/voice/models/DtfmModeType.java deleted file mode 100644 index 11d75e983..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/DtfmModeType.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.sinch.sdk.domains.voice.models; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -/** Determines what DTMF mode the participant will use in the call. */ -public class DtfmModeType extends EnumDynamic { - - /** - * Nothing is done with the participant's DTMF signals. This is the default mode. Any DTMF signals - * that the participant sends can still be heard by all participants, but no action will be - * performed. - */ - public static final DtfmModeType IGNORE = new DtfmModeType("ignore"); - - /** The participant's DTMF signals are forwarded to all other participants in the conference */ - public static final DtfmModeType FORWARD = new DtfmModeType("forward"); - - /** - * The participant's DTMF signals are detected by the conference and sent to your backend server - * using a Prompt Input Event (PIE) callback. - * - * @see Prompt - * Input Event (PIE) - */ - public static final DtfmModeType DETECT = new DtfmModeType("detect"); - - /** */ - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - DtfmModeType.class, DtfmModeType::new, Arrays.asList(IGNORE, FORWARD, DETECT)); - - private DtfmModeType(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static DtfmModeType from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(DtfmModeType e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/MusicOnHoldType.java b/client/src/main/com/sinch/sdk/domains/voice/models/MusicOnHoldType.java deleted file mode 100644 index e4669681b..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/MusicOnHoldType.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.sinch.sdk.domains.voice.models; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -/** Means "music-on-hold." */ -public class MusicOnHoldType extends EnumDynamic { - - /** progress tone */ - public static final MusicOnHoldType RING = new MusicOnHoldType("ring"); - - /** Music file */ - public static final MusicOnHoldType MUSIC1 = new MusicOnHoldType("music1"); - - /** Music file */ - public static final MusicOnHoldType MUSIC2 = new MusicOnHoldType("music2"); - - /** Music file */ - public static final MusicOnHoldType MUSIC3 = new MusicOnHoldType("music3"); - - /** */ - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - MusicOnHoldType.class, MusicOnHoldType::new, Arrays.asList(RING, MUSIC1, MUSIC2, MUSIC3)); - - private MusicOnHoldType(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static MusicOnHoldType from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(MusicOnHoldType e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/NumberInformation.java b/client/src/main/com/sinch/sdk/domains/voice/models/NumberInformation.java deleted file mode 100644 index 38a0f86f5..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/NumberInformation.java +++ /dev/null @@ -1,141 +0,0 @@ -package com.sinch.sdk.domains.voice.models; - -import com.sinch.sdk.models.E164PhoneNumber; - -/** Detailed information about a number */ -public class NumberInformation { - private final String countryId; - private final NumberType numberType; - private final E164PhoneNumber normalizedNumber; - private final Boolean restricted; - private final Price rate; - - public NumberInformation( - String countryId, - NumberType numberType, - E164PhoneNumber normalizedNumber, - Boolean restricted, - Price rate) { - this.countryId = countryId; - this.numberType = numberType; - this.normalizedNumber = normalizedNumber; - this.restricted = restricted; - this.rate = rate; - } - - /** - * The ISO 3166-1 formatted country code - * - * @return Country Id - */ - public String getCountryId() { - return countryId; - } - - /** - * The type of the number - * - * @return Number type - */ - public NumberType getNumberType() { - return numberType; - } - - /** - * The number in E.164 format - * - * @return The number - */ - public E164PhoneNumber getNormalizedNumber() { - return normalizedNumber; - } - - /** - * Concerns whether the number is restricted or not - * - * @return Restricted or not - */ - public Boolean getRestricted() { - return restricted; - } - - /** - * The cost per minute to call the destination number - * - * @return Price - */ - public Price getRate() { - return rate; - } - - @Override - public String toString() { - return "NumberInformation{" - + "countryId='" - + countryId - + '\'' - + ", numberType='" - + numberType - + '\'' - + ", normalizedNumber='" - + normalizedNumber - + '\'' - + ", restricted=" - + restricted - + ", rate=" - + rate - + '}'; - } - - /** - * Create a builder instance - * - * @return Dedicated builder - */ - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - String countryId; - NumberType numberType; - E164PhoneNumber normalizedNumber; - Boolean restricted; - Price rate; - - public Builder setCountryId(String countryId) { - this.countryId = countryId; - return this; - } - - public Builder setNumberType(NumberType numberType) { - this.numberType = numberType; - return this; - } - - public Builder setNormalizedNumber(E164PhoneNumber normalizedNumber) { - this.normalizedNumber = normalizedNumber; - return this; - } - - public Builder setRestricted(Boolean restricted) { - this.restricted = restricted; - return this; - } - - public Builder setRate(Price rate) { - this.rate = rate; - return this; - } - - /** - * Build the instance - * - * @return Built instance - */ - public NumberInformation build() { - return new NumberInformation(countryId, numberType, normalizedNumber, restricted, rate); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/NumberType.java b/client/src/main/com/sinch/sdk/domains/voice/models/NumberType.java deleted file mode 100644 index 566cd4e83..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/NumberType.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.sinch.sdk.domains.voice.models; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -/** - * The type of the number - * - * @since 1.0 - */ -public final class NumberType extends EnumDynamic { - public static final NumberType UNKNOWN = new NumberType("Unknown"); - public static final NumberType FIXED = new NumberType("Fixed"); - public static final NumberType MOBILE = new NumberType("Mobile"); - public static final NumberType OTHER = new NumberType("Other"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - NumberType.class, NumberType::new, Arrays.asList(UNKNOWN, FIXED, MOBILE, OTHER)); - - private NumberType(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static NumberType from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(NumberType e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/Price.java b/client/src/main/com/sinch/sdk/domains/voice/models/Price.java deleted file mode 100644 index c8a04e7b0..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/Price.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.sinch.sdk.domains.voice.models; - -public class Price { - private final String currencyId; - private final Float amount; - - /** - * @param currencyId ISO 4217 currency code - * @param amount The amount - */ - public Price(String currencyId, Float amount) { - this.currencyId = currencyId; - this.amount = amount; - } - - public String getCurrencyId() { - return currencyId; - } - - public Float getAmount() { - return amount; - } - - @Override - public String toString() { - return "Price{" + "currencyId='" + currencyId + '\'' + ", amount=" + amount + '}'; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - String currencyId; - Float amount; - - private Builder() {} - - public Builder setCurrencyId(String currencyId) { - this.currencyId = currencyId; - return this; - } - - public Builder setAmount(Float amount) { - this.amount = amount; - return this; - } - - public Price build() { - return new Price(currencyId, amount); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/TransportType.java b/client/src/main/com/sinch/sdk/domains/voice/models/TransportType.java deleted file mode 100644 index 72019e5e4..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/TransportType.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.sinch.sdk.domains.voice.models; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -/** Transport Protocol type */ -public class TransportType extends EnumDynamic { - - /** User Datagram Protocol */ - public static final TransportType UDP = new TransportType("UDP"); - - /** Transmission Control Protocol */ - public static final TransportType TCP = new TransportType("TCP"); - - /** Transport Layer Security */ - public static final TransportType TLS = new TransportType("TLS"); - - /** */ - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - TransportType.class, TransportType::new, Arrays.asList(UDP, TCP, TLS)); - - private TransportType(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static TransportType from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(TransportType e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/requests/ApplicationsAssignNumbersRequestParameters.java b/client/src/main/com/sinch/sdk/domains/voice/models/requests/ApplicationsAssignNumbersRequestParameters.java deleted file mode 100644 index d4271dec1..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/requests/ApplicationsAssignNumbersRequestParameters.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.sinch.sdk.domains.voice.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.voice.models.CapabilityType; -import com.sinch.sdk.models.E164PhoneNumber; -import java.util.Collection; - -/** - * Request parameters when updating a numbers list - * - * @since 1.0 - */ -public class ApplicationsAssignNumbersRequestParameters { - - private final OptionalValue> numbers; - private final OptionalValue applicationKey; - private final OptionalValue capability; - - private ApplicationsAssignNumbersRequestParameters( - OptionalValue> numbers, - OptionalValue applicationKey, - OptionalValue capability) { - this.numbers = numbers; - this.applicationKey = applicationKey; - this.capability = capability; - } - - /** - * Number list to be edited - * - * @return The numbers list - * @see Builder#setNumbers setter - * @since 1.0 - */ - public OptionalValue> getNumbers() { - return numbers; - } - - /** - * Application key to be assigned to numbers - * - * @return The application key - * @see Builder#setApplicationKey setter - * @since 1.0 - */ - public OptionalValue getApplicationKey() { - return applicationKey; - } - - /** - * Capability to be set - * - * @return The capability - * @see Builder#setCapability setter - * @since 1.0 - */ - public OptionalValue getCapability() { - return capability; - } - - @Override - public String toString() { - return "ApplicationsAssignNumbersRequestParameters{" - + "numbers=" - + numbers - + ", applicationKey='" - + applicationKey - + '\'' - + ", capability=" - + capability - + '}'; - } - - /** - * Create a builder instance - * - * @return Dedicated builder - */ - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - OptionalValue> numbers = OptionalValue.empty(); - OptionalValue applicationKey = OptionalValue.empty(); - OptionalValue capability = OptionalValue.empty(); - - /** - * The phone number list to be updated or assigned to application - * - * @param numbers The phone number list - * @return Current builder - * @since 1.0 - */ - public Builder setNumbers(Collection numbers) { - this.numbers = OptionalValue.of(numbers); - return this; - } - - /** - * Indicates the application where the numbers will be assigned. - * - *

If empty, the application key that is used to authenticate - * - * @param applicationKey The application where the numbers will be assigned - * @return Current builder - * @since 1.0 - */ - public Builder setApplicationKey(String applicationKey) { - this.applicationKey = OptionalValue.of(applicationKey); - return this; - } - - /** - * Indicates the DID capability that needs to be assigned to the chosen application. - * - *

Please note that the DID needs to support the selected capability. - * - * @param capability The capability value - * @return Current builder - * @since 1.0 - */ - public Builder setCapability(CapabilityType capability) { - this.capability = OptionalValue.of(capability); - return this; - } - - public ApplicationsAssignNumbersRequestParameters build() { - return new ApplicationsAssignNumbersRequestParameters(numbers, applicationKey, capability); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/requests/CalloutRequestParameters.java b/client/src/main/com/sinch/sdk/domains/voice/models/requests/CalloutRequestParameters.java deleted file mode 100644 index f17289a96..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/requests/CalloutRequestParameters.java +++ /dev/null @@ -1,131 +0,0 @@ -package com.sinch.sdk.domains.voice.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.voice.models.Destination; -import com.sinch.sdk.models.DualToneMultiFrequency; -import com.sinch.sdk.models.E164PhoneNumber; - -public class CalloutRequestParameters { - private final OptionalValue destination; - private final OptionalValue cli; - private final OptionalValue dtfm; - private final OptionalValue custom; - - protected CalloutRequestParameters( - OptionalValue destination, - OptionalValue cli, - OptionalValue dtfm, - OptionalValue custom) { - - this.destination = destination; - this.cli = cli; - this.dtfm = dtfm; - this.custom = custom; - } - - /** - * Destination getter - * - * @see Builder#setDestination(Destination) - */ - public OptionalValue getDestination() { - return destination; - } - - /** - * Cli getter - * - * @see Builder#setCli(E164PhoneNumber) - */ - public OptionalValue getCli() { - return cli; - } - - /** - * Dual Tone Multi Frequency getter - * - * @see Builder#setDtfm(DualToneMultiFrequency) - */ - public OptionalValue getDtfm() { - return dtfm; - } - - /** - * Custom value getter - * - * @see Builder#setCustom(String) - */ - public OptionalValue getCustom() { - return custom; - } - - @Override - public String toString() { - return "CalloutRequestParameters{" - + "destination=" - + destination - + ", cli=" - + cli - + ", dtfm=" - + dtfm - + ", custom=" - + custom - + '}'; - } - - public static Builder builder() { - return new Builder<>(); - } - - public static class Builder> { - - OptionalValue destination = OptionalValue.empty(); - OptionalValue cli = OptionalValue.empty(); - OptionalValue dtfm = OptionalValue.empty(); - OptionalValue custom = OptionalValue.empty(); - - public Builder() {} - - /** - * @param destination The type of device and number or endpoint to call - * @return current builder - */ - public B setDestination(Destination destination) { - this.destination = OptionalValue.of(destination); - return self(); - } - - /** - * @param cli The number that will be displayed as the incoming caller. To set your own CLI, you - * may use your verified number or your Dashboard number - * @return current builder - */ - public B setCli(E164PhoneNumber cli) { - this.cli = OptionalValue.of(cli); - return self(); - } - - /** - * @param dtfm When the destination picks up, this DTMF tones will be played to the callee. - * @return current builder - */ - public B setDtfm(DualToneMultiFrequency dtfm) { - this.dtfm = OptionalValue.of(dtfm); - return self(); - } - - /** - * @param custom Custom data - * @return current builder - */ - public B setCustom(String custom) { - this.custom = OptionalValue.of(custom); - return self(); - } - - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/requests/CalloutRequestParametersConference.java b/client/src/main/com/sinch/sdk/domains/voice/models/requests/CalloutRequestParametersConference.java deleted file mode 100644 index c90c1445d..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/requests/CalloutRequestParametersConference.java +++ /dev/null @@ -1,330 +0,0 @@ -package com.sinch.sdk.domains.voice.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.voice.models.ConferenceDtfmOptions; -import com.sinch.sdk.domains.voice.models.Destination; -import com.sinch.sdk.domains.voice.models.DomainType; -import com.sinch.sdk.domains.voice.models.MusicOnHoldType; -import com.sinch.sdk.models.DualToneMultiFrequency; -import com.sinch.sdk.models.E164PhoneNumber; - -/** - * The conference callout calls a phone number or a user. When the call is answered, it's connected - * to a conference room - */ -public class CalloutRequestParametersConference extends CalloutRequestParameters { - - private final OptionalValue conferenceId; - private final OptionalValue dtfmOptions; - private final OptionalValue maxDuration; - private final OptionalValue enableAce; - private final OptionalValue enableDice; - private final OptionalValue enablePie; - private final OptionalValue locale; - private final OptionalValue greeting; - private final OptionalValue musicOnHold; - private final OptionalValue domain; - - private CalloutRequestParametersConference( - OptionalValue destination, - OptionalValue cli, - OptionalValue dtfm, - OptionalValue custom, - OptionalValue conferenceId, - OptionalValue dtfmOptions, - OptionalValue maxDuration, - OptionalValue enableAce, - OptionalValue enableDice, - OptionalValue enablePie, - OptionalValue locale, - OptionalValue greeting, - OptionalValue musicOnHold, - OptionalValue domain) { - super(destination, cli, dtfm, custom); - - this.conferenceId = conferenceId; - this.dtfmOptions = dtfmOptions; - this.maxDuration = maxDuration; - this.enableAce = enableAce; - this.enableDice = enableDice; - this.enablePie = enablePie; - this.locale = locale; - this.greeting = greeting; - this.musicOnHold = musicOnHold; - this.domain = domain; - } - - /** - * @see Builder#setConferenceId(String) - */ - public OptionalValue getConferenceId() { - return conferenceId; - } - - /** - * @see Builder#setDtfm(DualToneMultiFrequency) - */ - public OptionalValue getDtfmOptions() { - return dtfmOptions; - } - - /** - * @see Builder#setMaxDuration(Integer) - */ - public OptionalValue getMaxDuration() { - return maxDuration; - } - - /** - * @see Builder#setEnableAce(Boolean) - */ - public OptionalValue getEnableAce() { - return enableAce; - } - - /** - * @see Builder#setEnableDice(Boolean) - */ - public OptionalValue getEnableDice() { - return enableDice; - } - - /** - * @see Builder#setEnablePie(Boolean) - */ - public OptionalValue getEnablePie() { - return enablePie; - } - - /** - * @see Builder#setLocale(String) - */ - public OptionalValue getLocale() { - return locale; - } - - /** - * @see Builder#setGreeting(String) - */ - public OptionalValue getGreeting() { - return greeting; - } - - /** - * @see Builder#setMusicOnHold(MusicOnHoldType) (MusicOnHoldType) - */ - public OptionalValue getMusicOnHold() { - return musicOnHold; - } - - /** - * @see Builder#setDomain(DomainType) - */ - public OptionalValue getDomain() { - return domain; - } - - @Override - public String toString() { - return "CalloutRequestParametersConference{" - + "conferenceId='" - + conferenceId - + '\'' - + ", dtfmOptions=" - + dtfmOptions - + ", maxDuration=" - + maxDuration - + ", enableAce=" - + enableAce - + ", enableDice=" - + enableDice - + ", enablePie=" - + enablePie - + ", locale='" - + locale - + '\'' - + ", greeting='" - + greeting - + '\'' - + ", musicOnHold=" - + musicOnHold - + ", domain=" - + domain - + "} " - + super.toString(); - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder extends CalloutRequestParameters.Builder { - - OptionalValue conferenceId = OptionalValue.empty(); - OptionalValue dtfmOptions = OptionalValue.empty(); - OptionalValue maxDuration = OptionalValue.empty(); - OptionalValue enableAce = OptionalValue.empty(); - OptionalValue enableDice = OptionalValue.empty(); - OptionalValue enablePie = OptionalValue.empty(); - OptionalValue locale = OptionalValue.empty(); - OptionalValue greeting = OptionalValue.empty(); - OptionalValue musicOnHold = OptionalValue.empty(); - OptionalValue domain = OptionalValue.empty(); - - public Builder() { - super(); - } - - /** - * The conferenceId of the conference to which you want the callee to join. * If the * - * conferenceId doesn't exist a conference room will be created. - * - * @param conferenceId The conference value - * @return current builder - */ - public Builder setConferenceId(String conferenceId) { - this.conferenceId = OptionalValue.of(conferenceId); - return self(); - } - - /** - * Define Dual Tone Multi Frequency options to control how DTMF signals are used by the - * participant in the conference - * - * @param dtfmOptions DTFM definition - * @return current builder - */ - public Builder setDtfmOptions(ConferenceDtfmOptions dtfmOptions) { - this.dtfmOptions = OptionalValue.of(dtfmOptions); - return self(); - } - - /** - * The maximum amount of time in seconds that the call will last. - * - * @param maxDuration Max duration value - * @return current builder - */ - public Builder setMaxDuration(Integer maxDuration) { - this.maxDuration = OptionalValue.of(maxDuration); - return self(); - } - - /** - * If enableAce is set to true and the application has a callback URL specified, you will - * receive an ACE callback when the call is answered. When the callback is received, your - * platform must respond with a svamlet containing the connectConf action in order to add the - * call to a conference or create the conference if it's the first call. If it's set to false, - * no ACE event will be sent to your backend. Note if the call is towards an InApp destination - * type: username, then no ACE will be issued when the call is connected, even if enableAce is - * present in the callout request. - * - * @param enableAce is enabled or not - * @return current builder - */ - public Builder setEnableAce(Boolean enableAce) { - this.enableAce = OptionalValue.of(enableAce); - return self(); - } - - /** - * If enableDice is set to true and the application has a callback URL specified, you will - * receive a DiCE callback when the call is disconnected. If it's set to false, no DiCE event - * will be sent to your backend. Note if the call is towards an InApp destination type: - * username, then no DICE will be issued at the end of the call, even if enableDice is present - * in the callout request. - * - * @param enableDice is enabled or not - * @return current builder - */ - public Builder setEnableDice(Boolean enableDice) { - this.enableDice = OptionalValue.of(enableDice); - return self(); - } - - /** - * If enablePie is set to true and the application has a callback URL specified, you will - * receive a PIE callback after a runMenu action, with the information of the action that the - * user took. If it's set to false, no PIE event will be sent to your backend. - * - * @param enablePie is enabled or not - * @return current builder - */ - public Builder setEnablePie(Boolean enablePie) { - this.enablePie = OptionalValue.of(enablePie); - return self(); - } - - /** - * The voice and language you want to use for the prompts. This can either be defined by the ISO - * 639 locale and language code or by specifying a particular voice. - * - * @see Supported - * languages and voices are detailed here - * @param locale The locale to be used - * @return current builder - */ - public Builder setLocale(String locale) { - this.locale = OptionalValue.of(locale); - return self(); - } - - /** - * Set the text that will be spoken as a greeting. - * - * @param greeting the text value - * @return current builder - */ - public Builder setGreeting(String greeting) { - this.greeting = OptionalValue.of(greeting); - return self(); - } - - /** - * Means "music-on-hold." It's an optional parameter that specifies what the first participant - * should listen to while they're alone in the conference, waiting for other participants to - * join. - * - * @param musicOnHold The music-on-hold to be used - * @return current builder - */ - public Builder setMusicOnHold(MusicOnHoldType musicOnHold) { - this.musicOnHold = OptionalValue.of(musicOnHold); - return self(); - } - - /** - * Domain related call - * - * @param domain Domain to be used - * @return current builder - */ - public Builder setDomain(DomainType domain) { - this.domain = OptionalValue.of(domain); - return self(); - } - - public CalloutRequestParametersConference build() { - return new CalloutRequestParametersConference( - destination, - cli, - dtfm, - custom, - conferenceId, - dtfmOptions, - maxDuration, - enableAce, - enableDice, - enablePie, - locale, - greeting, - musicOnHold, - domain); - } - - @Override - protected Builder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/requests/CalloutRequestParametersCustom.java b/client/src/main/com/sinch/sdk/domains/voice/models/requests/CalloutRequestParametersCustom.java deleted file mode 100644 index 30d1ef180..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/requests/CalloutRequestParametersCustom.java +++ /dev/null @@ -1,184 +0,0 @@ -package com.sinch.sdk.domains.voice.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.voice.models.Destination; -import com.sinch.sdk.domains.voice.models.requests.CalloutRequestParametersConference.Builder; -import com.sinch.sdk.models.DualToneMultiFrequency; -import com.sinch.sdk.models.E164PhoneNumber; - -/** - * The custom callout, the server initiates a call from the servers that can be controlled by - * specifying how the call should progress at each call event. - */ -public class CalloutRequestParametersCustom extends CalloutRequestParameters { - - private final OptionalValue maxDuration; - private final OptionalValue ice; - private final OptionalValue ace; - private final OptionalValue pie; - - private CalloutRequestParametersCustom( - OptionalValue destination, - OptionalValue cli, - OptionalValue dtfm, - OptionalValue custom, - OptionalValue maxDuration, - OptionalValue ice, - OptionalValue ace, - OptionalValue pie) { - super(destination, cli, dtfm, custom); - - this.maxDuration = maxDuration; - this.ice = ice; - this.ace = ace; - this.pie = pie; - } - - /** - * See builder - * - * @see Builder#setMaxDuration(Integer) - */ - public OptionalValue getMaxDuration() { - return maxDuration; - } - - /** - * See builder - * - * @see Builder#setIce(Control) - */ - public OptionalValue getIce() { - return ice; - } - - /** - * See builder - * - * @see Builder#setAce(Control) - */ - public OptionalValue getAce() { - return ace; - } - - /** - * See builder - * - * @see Builder#setPie(Control) - */ - public OptionalValue getPie() { - return pie; - } - - @Override - public String toString() { - return "CalloutRequestParametersCustom{" - + "maxDuration=" - + maxDuration - + ", ice='" - + ice - + '\'' - + ", ace='" - + ace - + '\'' - + ", pie='" - + pie - + '\'' - + "} " - + super.toString(); - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder extends CalloutRequestParameters.Builder { - - OptionalValue maxDuration = OptionalValue.empty(); - OptionalValue ice = OptionalValue.empty(); - OptionalValue ace = OptionalValue.empty(); - OptionalValue pie = OptionalValue.empty(); - - public Builder() { - super(); - } - - /** - * The maximum amount of time in seconds that the call will last. - * - * @param maxDuration Max duration value - * @return current builder - */ - public Builder setMaxDuration(Integer maxDuration) { - this.maxDuration = OptionalValue.of(maxDuration); - return self(); - } - - /** - * You can use inline SVAML to replace a - * callback URL when using custom callouts. - * - *

Ensure that the JSON object is escaped correctly - * - *

If inline ICE SVAML is passed, exclude cli and destination properties from the - * customCallout request body. Example: - * "{\"action\": {\"name\": \"RunMenu\",\"locale\": \"en-US\",\"menus\": [{\"id\": \"main\",\"mainPrompt\": \"#tts[ Welcome to the main menu. Press 1 for a callback or 2 for a cancel<\/speak>]\",\"timeoutMills\": 5000,\"options\": [ {\"dtmf\": \"1\",\"action\": \"return(callback)\"}, {\"dtmf\": \"2\",\"action\": \"return(cancel)\"}]}]}}"" - * - * - * @param ice The Incoming Call Event value - * @return current builder - */ - public Builder setIce(Control ice) { - this.ice = OptionalValue.of(ice); - return self(); - } - - /** - * You can use inline SVAML to replace a - * callback URL when using custom callouts. - * - *

Ensure that the JSON object is escaped correctly Example: - * "{\"action\":{\"name\":\"connectPstn\",\"number\":\"46000000001\",\"maxDuration\":90}}" - * - * - * @param ace The Answered Call Event value - * @return current builder - */ - public Builder setAce(Control ace) { - this.ace = OptionalValue.of(ace); - return self(); - } - - /** - * Note: PIE callbacks are not available for DATA Calls; only PSTN and SIP calls. - * - *

You can use inline SVAML to replace a - * callback URL when using custom callouts. - * - *

Ensure that the JSON object is escaped correctly. A PIE event will contain a value chosen - * from an IVR choice. Usually a PIE event wil contain a URL to a callback sever that will - * receive the choice and be able to parse it. This could result in further SVAML or some other - * application logic function. - * - * @param pie Prompt Input Event value - * @return current builder - */ - public Builder setPie(Control pie) { - this.pie = OptionalValue.of(pie); - return self(); - } - - public CalloutRequestParametersCustom build() { - return new CalloutRequestParametersCustom( - destination, cli, dtfm, custom, maxDuration, ice, ace, pie); - } - - @Override - protected Builder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/requests/CalloutRequestParametersTTS.java b/client/src/main/com/sinch/sdk/domains/voice/models/requests/CalloutRequestParametersTTS.java deleted file mode 100644 index fe6dee04a..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/requests/CalloutRequestParametersTTS.java +++ /dev/null @@ -1,273 +0,0 @@ -package com.sinch.sdk.domains.voice.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.voice.models.Destination; -import com.sinch.sdk.domains.voice.models.DomainType; -import com.sinch.sdk.domains.voice.models.requests.CalloutRequestParametersCustom.Builder; -import com.sinch.sdk.models.DualToneMultiFrequency; -import com.sinch.sdk.models.E164PhoneNumber; - -/** - * The text-to-speech callout calls a phone number and plays a synthesized text messages or - * pre-recorded sound files. - */ -public class CalloutRequestParametersTTS extends CalloutRequestParameters { - - private final OptionalValue enableAce; - private final OptionalValue enableDice; - private final OptionalValue enablePie; - private final OptionalValue locale; - private final OptionalValue text; - private final OptionalValue prompts; - private final OptionalValue domain; - - private CalloutRequestParametersTTS( - OptionalValue destination, - OptionalValue cli, - OptionalValue dtfm, - OptionalValue custom, - OptionalValue enableAce, - OptionalValue enableDice, - OptionalValue enablePie, - OptionalValue locale, - OptionalValue domain, - OptionalValue text, - OptionalValue prompts) { - super(destination, cli, dtfm, custom); - - this.enableAce = enableAce; - this.enableDice = enableDice; - this.enablePie = enablePie; - this.locale = locale; - this.text = text; - this.prompts = prompts; - this.domain = domain; - } - - /** - * @see Builder#setEnableAce(Boolean) - */ - public OptionalValue getEnableAce() { - return enableAce; - } - - /** - * @see Builder#setEnableDice(Boolean) - */ - public OptionalValue getEnableDice() { - return enableDice; - } - - /** - * @see Builder#setEnablePie(Boolean) - */ - public OptionalValue getEnablePie() { - return enablePie; - } - - /** - * @see Builder#setLocale(String) - */ - public OptionalValue getLocale() { - return locale; - } - - /** - * @see Builder#setDomain(DomainType) - */ - public OptionalValue getDomain() { - return domain; - } - - /** - * @see Builder#setText(String) - */ - public OptionalValue getText() { - return text; - } - - /** - * @see Builder#setPrompts(String) - */ - public OptionalValue getPrompts() { - return prompts; - } - - @Override - public String toString() { - return "CalloutRequestParametersTTS{" - + "enableAce=" - + enableAce - + ", enableDice=" - + enableDice - + ", enablePie=" - + enablePie - + ", locale='" - + locale - + '\'' - + ", text='" - + text - + '\'' - + ", prompts='" - + prompts - + '\'' - + ", domain=" - + domain - + "} " - + super.toString(); - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder extends CalloutRequestParameters.Builder { - - OptionalValue enableAce = OptionalValue.empty(); - OptionalValue enableDice = OptionalValue.empty(); - OptionalValue enablePie = OptionalValue.empty(); - OptionalValue locale = OptionalValue.empty(); - OptionalValue domain = OptionalValue.empty(); - OptionalValue text = OptionalValue.empty(); - OptionalValue prompts = OptionalValue.empty(); - - public Builder() { - super(); - } - - /** - * If enableAce is set to true and the application has a callback URL specified, you will - * receive an ACE callback when the call is answered. When the callback is received, your - * platform must respond with a svamlet containing the connectConf action in order to add the - * call to a conference or create the conference if it's the first call. If it's set to false, - * no ACE event will be sent to your backend. Note if the call is towards an InApp destination - * type: username, then no ACE will be issued when the call is connected, even if enableAce is - * present in the callout request. - * - * @param enableAce set if enabled or not - * @return current builder - */ - public Builder setEnableAce(Boolean enableAce) { - this.enableAce = OptionalValue.of(enableAce); - return self(); - } - - /** - * If enableDice is set to true and the application has a callback URL specified, you will - * receive a DiCE callback when the call is disconnected. If it's set to false, no DiCE event - * will be sent to your backend. Note if the call is towards an InApp destination type: - * username, then no DICE will be issued at the end of the call, even if enableDice is present - * in the callout request. - * - * @param enableDice set if enabled or not - * @return current builder - */ - public Builder setEnableDice(Boolean enableDice) { - this.enableDice = OptionalValue.of(enableDice); - return self(); - } - - /** - * If enablePie is set to true and the application has a callback URL specified, you will - * receive a PIE callback after a runMenu action, with the information of the action that the - * user took. If it's set to false, no PIE event will be sent to your backend. - * - * @param enablePie set if enabled or not - * @return current builder - */ - public Builder setEnablePie(Boolean enablePie) { - this.enablePie = OptionalValue.of(enablePie); - return self(); - } - - /** - * The voice and language you want to use for the prompts. This can either be defined by the ISO - * 639 locale and language code or by specifying a particular voice. - * - * @see Supported - * languages and voices are detailed here - * @param locale The locale to be used - * @return current builder - */ - public Builder setLocale(String locale) { - this.locale = OptionalValue.of(locale); - return self(); - } - - /** - * @param domain Domain value to be used - * @return current builder - */ - public Builder setDomain(DomainType domain) { - this.domain = OptionalValue.of(domain); - return self(); - } - - /** - * Every application's default maximum characters allowed in text-to-speech is 600 characters. - * Contact support if you wish this limit to be changed. - * - * @param text The text that will be spoken in the text-to-speech message - * @return current builder - */ - public Builder setText(String text) { - this.text = OptionalValue.of(text); - return self(); - } - - /** - * An advanced alternative to using text. - * - *

- *
TTS Text To Speech - *
The equivalent of text but within the prompt property. - *

Example: #tts[Hello from Sinch] - *

TTS with SSML Text To Speech with Speech Synthesis Markup Language (SSML) - *
This is an XML-based markup language for assisting the generation of synthetic speech - * in the Web and other applications. AWS Polly supports a sub-set of SSML. This allows us - * to use SSML-enhanced text for additional control over how Polly generates speech from - * the text. Details and examples of supported tags @link are here - *
Externally hosted media - *
Provide a URL to your own hosted media. Please check @link here - * to read about audio content type and usage limits. - *
- * - *

Every application's default maximum allowed in TTS or TTS SSML is 600 characters. Contact - * support if you wish this limit to be changed. Several prompts can be used, separated by a - * semi-colon ; - * - *

Example: - * #tts[Hello from Sinch];#ssml[<speak><break time="250ms"/>Have a great day!</speak>] - * - * - * @param prompts The text to be used - * @return current builder - */ - public Builder setPrompts(String prompts) { - this.prompts = OptionalValue.of(prompts); - return self(); - } - - public CalloutRequestParametersTTS build() { - return new CalloutRequestParametersTTS( - destination, - cli, - dtfm, - custom, - enableAce, - enableDice, - enablePie, - locale, - domain, - text, - prompts); - } - - @Override - protected Builder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/requests/ConferenceManageParticipantCommandType.java b/client/src/main/com/sinch/sdk/domains/voice/models/requests/ConferenceManageParticipantCommandType.java deleted file mode 100644 index 7aad144ce..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/requests/ConferenceManageParticipantCommandType.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.sinch.sdk.domains.voice.models.requests; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -/** Action to apply on conference participant" */ -public class ConferenceManageParticipantCommandType - extends EnumDynamic { - - /** Mutes participant */ - public static final ConferenceManageParticipantCommandType MUTE = - new ConferenceManageParticipantCommandType("mute"); - - /** Unmutes participant */ - public static final ConferenceManageParticipantCommandType UNMUTE = - new ConferenceManageParticipantCommandType("unmute"); - - /** Puts participant on hold */ - public static final ConferenceManageParticipantCommandType ONHOLD = - new ConferenceManageParticipantCommandType("onhold"); - - /** Returns participant to conference */ - public static final ConferenceManageParticipantCommandType RESUME = - new ConferenceManageParticipantCommandType("resume"); - - /** */ - private static final EnumSupportDynamic - ENUM_SUPPORT = - new EnumSupportDynamic<>( - ConferenceManageParticipantCommandType.class, - ConferenceManageParticipantCommandType::new, - Arrays.asList(MUTE, UNMUTE, ONHOLD, RESUME)); - - private ConferenceManageParticipantCommandType(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static ConferenceManageParticipantCommandType from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(ConferenceManageParticipantCommandType e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/requests/ConferenceManageParticipantRequestParameters.java b/client/src/main/com/sinch/sdk/domains/voice/models/requests/ConferenceManageParticipantRequestParameters.java deleted file mode 100644 index af8d27d8f..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/requests/ConferenceManageParticipantRequestParameters.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.sinch.sdk.domains.voice.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.voice.models.MusicOnHoldType; - -/** Use to configure conference participant settings */ -public class ConferenceManageParticipantRequestParameters { - - private final OptionalValue command; - private final OptionalValue musicOnHold; - - private ConferenceManageParticipantRequestParameters( - OptionalValue command, - OptionalValue musicOnHold) { - this.command = command; - this.musicOnHold = musicOnHold; - } - - /** - * @see Builder#setCommand(ConferenceManageParticipantCommandType) - */ - public OptionalValue getCommand() { - return command; - } - - /** - * @see Builder#setMusicOnHold(MusicOnHoldType) (MusicOnHoldType) - */ - public OptionalValue getMusicOnHold() { - return musicOnHold; - } - - @Override - public String toString() { - return "ConferenceManageParticipantRequestParameters{" - + "command=" - + command - + ", musicOnHold=" - + musicOnHold - + '}'; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - OptionalValue command = OptionalValue.empty(); - OptionalValue musicOnHold = OptionalValue.empty(); - - /** - * @param command Action to apply on conference participant. - * @return current builder - */ - public Builder setCommand(ConferenceManageParticipantCommandType command) { - this.command = OptionalValue.of(command); - return this; - } - - /** - * @param musicOnHold If this optional parameter is included, plays music to the first - * participant in a conference while they're alone and waiting for other participants to - * join. If musicOnHold isn't specified, the user will only hear silence while alone in the - * conference. This property is only available to use with the onhold command. - * @return current builder - */ - public Builder setMusicOnHold(MusicOnHoldType musicOnHold) { - this.musicOnHold = OptionalValue.of(musicOnHold); - return this; - } - - public ConferenceManageParticipantRequestParameters build() { - return new ConferenceManageParticipantRequestParameters(command, musicOnHold); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/requests/Control.java b/client/src/main/com/sinch/sdk/domains/voice/models/requests/Control.java deleted file mode 100644 index c3ed0483f..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/requests/Control.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.sinch.sdk.domains.voice.models.requests; - -/** - * Base class related to a control - * - *

Could be a URL or a SVAML control object - */ -public abstract class Control {} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/requests/ControlUrl.java b/client/src/main/com/sinch/sdk/domains/voice/models/requests/ControlUrl.java deleted file mode 100644 index 8f38600f8..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/requests/ControlUrl.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.sinch.sdk.domains.voice.models.requests; - -/** - * Control URL used during a custom callout - * - * @see Custom - * Callout Description - */ -public class ControlUrl extends Control { - - private final String URL; - - private ControlUrl(String URL) { - this.URL = URL; - } - - /** - * @see #from(String) - */ - public String getURL() { - return URL; - } - - @Override - public String toString() { - return "ControlUrl{" + "URL='" + URL + '\'' + "} " + super.toString(); - } - - /** - * Create a Custom URL instance from String - * - * @param URL URL representation - * @return A newly created instance - */ - public static ControlUrl from(String URL) { - return new ControlUrl(URL); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/requests/package-info.java b/client/src/main/com/sinch/sdk/domains/voice/models/requests/package-info.java deleted file mode 100644 index cbb964438..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/requests/package-info.java +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Voice API requests related models - * - * @since 1.0 - */ -package com.sinch.sdk.domains.voice.models.requests; diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/response/AssignedNumbers.java b/client/src/main/com/sinch/sdk/domains/voice/models/response/AssignedNumbers.java deleted file mode 100644 index 03438ba00..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/response/AssignedNumbers.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.sinch.sdk.domains.voice.models.response; - -import com.sinch.sdk.domains.voice.models.ApplicationAssignedNumber; -import java.util.Collection; - -/** - * Get information about your numbers. It returns a list of numbers that you own, as well as their - * capability (voice or SMS). For the ones that are assigned to an app, it returns the application - * key of the app - */ -public class AssignedNumbers { - - private final Collection numbers; - - private AssignedNumbers(Collection numbers) { - this.numbers = numbers; - } - - /** - * Associated application numbers - * - * @return The numbers list - */ - public Collection getNumbers() { - return numbers; - } - - @Override - public String toString() { - return "AssignedNumbers{" + "numbers=" + numbers + '}'; - } - - /** - * Create a builder instance - * - * @return Dedicated builder - */ - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - Collection numbers; - - /** - * @param numbers the numbers list - * @return Current builder - * @see AssignedNumbers#getNumbers() getter - */ - public Builder setNumbers(Collection numbers) { - this.numbers = numbers; - return this; - } - - /** - * Build the instance - * - * @return Built instance - */ - public AssignedNumbers build() { - return new AssignedNumbers(numbers); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/response/CallInformation.java b/client/src/main/com/sinch/sdk/domains/voice/models/response/CallInformation.java deleted file mode 100644 index 7bb1d9f27..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/response/CallInformation.java +++ /dev/null @@ -1,338 +0,0 @@ -package com.sinch.sdk.domains.voice.models.response; - -import com.sinch.sdk.domains.voice.models.CallReasonType; -import com.sinch.sdk.domains.voice.models.CallResultType; -import com.sinch.sdk.domains.voice.models.Destination; -import com.sinch.sdk.domains.voice.models.DomainType; -import com.sinch.sdk.domains.voice.models.Price; -import java.time.Instant; - -/** Information related to a specific call */ -public class CallInformation { - private final Destination from; - private final Destination to; - private final DomainType domain; - private final String callId; - private final Integer duration; - private final CallStatusType status; - private final CallResultType result; - private final CallReasonType reason; - private final Instant timeStamp; - private final String custom; - private final Price userRate; - private final Price debit; - - private CallInformation( - Destination from, - Destination to, - DomainType domain, - String callId, - Integer duration, - CallStatusType status, - CallResultType result, - CallReasonType reason, - Instant timeStamp, - String custom, - Price userRate, - Price debit) { - this.from = from; - this.to = to; - this.domain = domain; - this.callId = callId; - this.duration = duration; - this.status = status; - this.result = result; - this.reason = reason; - this.timeStamp = timeStamp; - this.custom = custom; - this.userRate = userRate; - this.debit = debit; - } - - /** - * The caller information - * - * @return Destination instance describing caller - */ - public Destination getFrom() { - return from; - } - - /** - * The callee information - * - * @return Destination instance describing callee - */ - public Destination getTo() { - return to; - } - - /** - * The domain type - * - * @return Domain type - */ - public DomainType getDomain() { - return domain; - } - - /** - * The unique identifier of the call - * - * @return Call identifier - */ - public String getCallId() { - return callId; - } - - /** - * The duration of the call in seconds - * - * @return Call duration - */ - public Integer getDuration() { - return duration; - } - - /** - * The status of the call. - * - * @return Call status - */ - public CallStatusType getStatus() { - return status; - } - - /** - * Contains the result of a call. - * - * @return Call result - */ - public CallResultType getResult() { - return result; - } - - /** - * Contains the reason why a call ended - * - * @return Call ended reason - */ - public CallReasonType getReason() { - return reason; - } - - /** - * The date and time of the call - * - * @return Date time information related to call - */ - public Instant getTimeStamp() { - return timeStamp; - } - - /** - * Custom data passed onto callout - * - * @return The custom data value - */ - public String getCustom() { - return custom; - } - - /** - * The rate per minute that was charged for the call. - * - * @return Price information - */ - public Price getUserRate() { - return userRate; - } - - /** - * The total amount charged for the call - * - * @return Price information - */ - public Price getDebit() { - return debit; - } - - @Override - public String toString() { - return "CallInformation{" - + "from='" - + from - + '\'' - + ", to='" - + to - + '\'' - + ", domain=" - + domain - + ", callId='" - + callId - + '\'' - + ", duration=" - + duration - + ", status=" - + status - + ", result=" - + result - + ", reason=" - + reason - + ", timeStamp=" - + timeStamp - + ", custom='" - + custom - + '\'' - + ", userRate='" - + userRate - + '\'' - + ", debit='" - + debit - + '\'' - + '}'; - } - - /** - * Create a builder instance - * - * @return Dedicated builder - */ - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - Destination from; - Destination to; - DomainType domain; - String callId; - Integer duration; - CallStatusType status; - CallResultType result; - CallReasonType reason; - Instant timeStamp; - String custom; - Price userRate; - Price debit; - - /** - * @see CallInformation#getFrom getter - * @return Current builder - */ - public Builder setFrom(Destination from) { - this.from = from; - return this; - } - - /** - * @see CallInformation#getTo() getter - * @return Current builder - */ - public Builder setTo(Destination to) { - this.to = to; - return this; - } - - /** - * @see CallInformation#getDomain() getter - * @return Current builder - */ - public Builder setDomain(DomainType domain) { - this.domain = domain; - return this; - } - - /** - * @see CallInformation#getCallId() getter - * @return Current builder - */ - public Builder setCallId(String callId) { - this.callId = callId; - return this; - } - - /** - * @see CallInformation#getDuration() getter - * @return Current builder - */ - public Builder setDuration(Integer duration) { - this.duration = duration; - return this; - } - - /** - * @see CallInformation#getStatus() getter - * @return Current builder - */ - public Builder setStatus(CallStatusType status) { - this.status = status; - return this; - } - - /** - * @see CallInformation#getResult() getter - * @return Current builder - */ - public Builder setResult(CallResultType result) { - this.result = result; - return this; - } - - /** - * @see CallInformation#getReason() getter - * @return Current builder - */ - public Builder setReason(CallReasonType reason) { - this.reason = reason; - return this; - } - - /** - * @see CallInformation#getTimeStamp() getter - * @return Current builder - */ - public Builder setTimeStamp(Instant timeStamp) { - this.timeStamp = timeStamp; - return this; - } - - /** - * @see CallInformation#getCustom() getter - * @return Current builder - */ - public Builder setCustom(String custom) { - this.custom = custom; - return this; - } - - /** - * @see CallInformation#getUserRate() getter - * @return Current builder - */ - public Builder setUserRate(Price userRate) { - this.userRate = userRate; - return this; - } - - /** - * @see CallInformation#getDebit() getter - * @return Current builder - */ - public Builder setDebit(Price debit) { - this.debit = debit; - return this; - } - - /** - * Build the instance - * - * @return Built instance - */ - public CallInformation build() { - return new CallInformation( - from, to, domain, callId, duration, status, result, reason, timeStamp, custom, userRate, - debit); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/response/CallStatusType.java b/client/src/main/com/sinch/sdk/domains/voice/models/response/CallStatusType.java deleted file mode 100644 index 1c6530b62..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/response/CallStatusType.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.sinch.sdk.domains.voice.models.response; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -/** The status of a call */ -public class CallStatusType extends EnumDynamic { - - public static final CallStatusType ONGOING = new CallStatusType("ONGOING"); - - public static final CallStatusType FINAL = new CallStatusType("FINAL"); - - /** */ - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - CallStatusType.class, CallStatusType::new, Arrays.asList(ONGOING, FINAL)); - - private CallStatusType(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static CallStatusType from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(CallStatusType e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/response/ConferenceParticipant.java b/client/src/main/com/sinch/sdk/domains/voice/models/response/ConferenceParticipant.java deleted file mode 100644 index bba3bd92a..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/response/ConferenceParticipant.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.sinch.sdk.domains.voice.models.response; - -/** Information about a conference's participant */ -public class ConferenceParticipant { - private final String cli; - private final String id; - private final Integer duration; - private final Boolean muted; - private final Boolean onhold; - - private ConferenceParticipant( - String cli, String id, Integer duration, Boolean muted, Boolean onhold) { - this.cli = cli; - this.id = id; - this.duration = duration; - this.muted = muted; - this.onhold = onhold; - } - - /** - * The phone number of the PSTN participant that was connected in the conference, or whatever was - * passed as CLI for data originated/terminated calls. - * - * @return The value - */ - public String getCli() { - return cli; - } - - /** - * The callId of the call leg that the participant joined the conference. - * - * @return Uniq identifier related toi the call - */ - public String getId() { - return id; - } - - /** - * The number of seconds that the participant has been connected to the conference - * - * @return Duration value - */ - public Integer getDuration() { - return duration; - } - - /** - * Is participant is muted or not - * - * @return Muted state - */ - public Boolean getMuted() { - return muted; - } - - /** - * Is participant is on hold or not - * - * @return The on hold state - */ - public Boolean getOnhold() { - return onhold; - } - - @Override - public String toString() { - return "ConferenceParticipant{" - + "cli='" - + cli - + '\'' - + ", id='" - + id - + '\'' - + ", duration=" - + duration - + ", muted=" - + muted - + ", onhold=" - + onhold - + '}'; - } - - /** - * Create a builder instance - * - * @return Dedicated builder - */ - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - String cli; - String id; - Integer duration; - Boolean muted; - Boolean onhold; - - /** - * @see ConferenceParticipant#getCli() getter - * @return Current builder - */ - public Builder setCli(String cli) { - this.cli = cli; - return this; - } - - /** - * @see ConferenceParticipant#getId() getter - * @return Current builder - */ - public Builder setId(String id) { - this.id = id; - return this; - } - - /** - * @see ConferenceParticipant#getDuration() getter - * @return Current builder - */ - public Builder setDuration(Integer duration) { - this.duration = duration; - return this; - } - - /** - * @see ConferenceParticipant#getMuted() getter - * @return Current builder - */ - public Builder setMuted(Boolean muted) { - this.muted = muted; - return this; - } - - /** - * @see ConferenceParticipant#getOnhold() getter - * @return Current builder - */ - public Builder setOnhold(Boolean onhold) { - this.onhold = onhold; - return this; - } - - public ConferenceParticipant build() { - return new ConferenceParticipant(cli, id, duration, muted, onhold); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/response/QueryNumber.java b/client/src/main/com/sinch/sdk/domains/voice/models/response/QueryNumber.java deleted file mode 100644 index d9d96f224..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/response/QueryNumber.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.sinch.sdk.domains.voice.models.response; - -import com.sinch.sdk.domains.voice.models.NumberInformation; - -/** Information related to a number */ -public class QueryNumber { - - private final NumberInformation numberInformation; - - public QueryNumber(NumberInformation numberInformation) { - this.numberInformation = numberInformation; - } - - /** - * Get information details about number - * - * @return Information details - */ - public NumberInformation getNumberInformation() { - return numberInformation; - } - - @Override - public String toString() { - return "QueryNumber{" + "numberInformation=" + numberInformation + '}'; - } - - /** - * Create a builder instance - * - * @return Dedicated builder - */ - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - NumberInformation numberInformation; - - public Builder setNumberInformation(NumberInformation numberInformation) { - this.numberInformation = numberInformation; - return this; - } - - /** - * Build the instance - * - * @return Built instance - */ - public QueryNumber build() { - return new QueryNumber(numberInformation); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/response/package-info.java b/client/src/main/com/sinch/sdk/domains/voice/models/response/package-info.java deleted file mode 100644 index c104a0ff0..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/response/package-info.java +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Voice API specific responses related models - * - * @since 1.0 - */ -package com.sinch.sdk.domains.voice.models.response; diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/Action.java b/client/src/main/com/sinch/sdk/domains/voice/models/svaml/Action.java deleted file mode 100644 index f1aa461d6..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/Action.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.sinch.sdk.domains.voice.models.svaml; - -/** Base class for SVAML Action */ -public abstract class Action { - - @Override - public String toString() { - return ""; - } - - public abstract static class Builder> { - - /** - * Build the instance - * - * @return Built instance - */ - public abstract Action build(); - - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/ActionConnectConference.java b/client/src/main/com/sinch/sdk/domains/voice/models/svaml/ActionConnectConference.java deleted file mode 100644 index 849befc34..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/ActionConnectConference.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.sinch.sdk.domains.voice.models.svaml; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.voice.models.ConferenceDtfmOptions; -import com.sinch.sdk.domains.voice.models.MusicOnHoldType; - -public class ActionConnectConference extends Action { - - private final OptionalValue conferenceId; - private final OptionalValue dtfmOptions; - private final OptionalValue musicOnHold; - - private ActionConnectConference( - OptionalValue conferenceId, - OptionalValue dtfmOptions, - OptionalValue musicOnHold) { - this.conferenceId = conferenceId; - this.dtfmOptions = dtfmOptions; - this.musicOnHold = musicOnHold; - } - - public OptionalValue getConferenceId() { - return conferenceId; - } - - public OptionalValue getDtfmOptions() { - return dtfmOptions; - } - - public OptionalValue getMusicOnHold() { - return musicOnHold; - } - - @Override - public String toString() { - return "ActionConnectConference{" - + "conferenceId='" - + conferenceId - + '\'' - + ", dtfmOptions=" - + dtfmOptions - + ", musicOnHold=" - + musicOnHold - + "} " - + super.toString(); - } - - public static Builder builder() { - return new Builder<>(); - } - - public static class Builder> { - - OptionalValue conferenceId = OptionalValue.empty(); - OptionalValue dtfmOptions = OptionalValue.empty(); - OptionalValue musicOnHold = OptionalValue.empty(); - - public Builder setConferenceId(String conferenceId) { - this.conferenceId = OptionalValue.of(conferenceId); - return this; - } - - public Builder setDtfmOptions(ConferenceDtfmOptions dtfmOptions) { - this.dtfmOptions = OptionalValue.of(dtfmOptions); - return this; - } - - public Builder setMusicOnHold(MusicOnHoldType musicOnHold) { - this.musicOnHold = OptionalValue.of(musicOnHold); - return this; - } - - public ActionConnectConference build() { - return new ActionConnectConference(conferenceId, dtfmOptions, musicOnHold); - } - - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/ActionConnectMxp.java b/client/src/main/com/sinch/sdk/domains/voice/models/svaml/ActionConnectMxp.java deleted file mode 100644 index c7c9308d0..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/ActionConnectMxp.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.sinch.sdk.domains.voice.models.svaml; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.core.utils.Pair; -import com.sinch.sdk.domains.voice.models.Destination; -import java.util.Collection; - -public class ActionConnectMxp extends Action { - - private final OptionalValue destination; - private final OptionalValue>> callheaders; - - private ActionConnectMxp( - OptionalValue destination, - OptionalValue>> callheaders) { - this.destination = destination; - this.callheaders = callheaders; - } - - public OptionalValue getDestination() { - return destination; - } - - public OptionalValue>> getCallheaders() { - return callheaders; - } - - @Override - public String toString() { - return "ActionConnectMxp{" - + "destination=" - + destination - + ", callheaders=" - + callheaders - + "} " - + super.toString(); - } - - public static Builder builder() { - return new Builder<>(); - } - - public static class Builder> { - - OptionalValue destination = OptionalValue.empty(); - OptionalValue>> callheaders = OptionalValue.empty(); - - public Builder setDestination(Destination destination) { - this.destination = OptionalValue.of(destination); - return this; - } - - public Builder setCallheaders(Collection> callheaders) { - this.callheaders = OptionalValue.of(callheaders); - return this; - } - - public ActionConnectMxp build() { - return new ActionConnectMxp(destination, callheaders); - } - - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/ActionConnectPstn.java b/client/src/main/com/sinch/sdk/domains/voice/models/svaml/ActionConnectPstn.java deleted file mode 100644 index c896f3ad7..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/ActionConnectPstn.java +++ /dev/null @@ -1,183 +0,0 @@ -package com.sinch.sdk.domains.voice.models.svaml; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.models.DualToneMultiFrequency; -import com.sinch.sdk.models.E164PhoneNumber; - -public class ActionConnectPstn extends Action { - - private final OptionalValue number; - private final OptionalValue locale; - private final OptionalValue maxDuration; - private final OptionalValue dialTimeout; - private final OptionalValue cli; - private final OptionalValue suppressCallbacks; - private final OptionalValue dualToneMultiFrequency; - private final OptionalValue indications; - private final OptionalValue answeringMachineDetection; - - private ActionConnectPstn( - OptionalValue number, - OptionalValue locale, - OptionalValue maxDuration, - OptionalValue dialTimeout, - OptionalValue cli, - OptionalValue suppressCallbacks, - OptionalValue dualToneMultiFrequency, - OptionalValue indications, - OptionalValue answeringMachineDetection) { - this.number = number; - this.locale = locale; - this.maxDuration = maxDuration; - this.dialTimeout = dialTimeout; - this.cli = cli; - this.suppressCallbacks = suppressCallbacks; - this.dualToneMultiFrequency = dualToneMultiFrequency; - this.indications = indications; - this.answeringMachineDetection = answeringMachineDetection; - } - - public OptionalValue getNumber() { - return number; - } - - public OptionalValue getLocale() { - return locale; - } - - public OptionalValue getMaxDuration() { - return maxDuration; - } - - public OptionalValue getDialTimeout() { - return dialTimeout; - } - - public OptionalValue getCli() { - return cli; - } - - public OptionalValue getSuppressCallbacks() { - return suppressCallbacks; - } - - public OptionalValue getDualToneMultiFrequency() { - return dualToneMultiFrequency; - } - - public OptionalValue getIndications() { - return indications; - } - - public OptionalValue getAnsweringMachineDetection() { - return answeringMachineDetection; - } - - @Override - public String toString() { - return "ActionConnectPstn{" - + "number=" - + number - + ", locale='" - + locale - + '\'' - + ", maxDuration=" - + maxDuration - + ", dialTimeout=" - + dialTimeout - + ", cli='" - + cli - + '\'' - + ", suppressCallbacks=" - + suppressCallbacks - + ", dualToneMultiFrequency=" - + dualToneMultiFrequency - + ", indications=" - + indications - + ", answeringMachineDetection=" - + answeringMachineDetection - + "} " - + super.toString(); - } - - public static Builder builder() { - return new Builder<>(); - } - - public static class Builder> { - - OptionalValue number = OptionalValue.empty(); - OptionalValue locale = OptionalValue.empty(); - OptionalValue maxDuration = OptionalValue.empty(); - OptionalValue dialTimeout = OptionalValue.empty(); - OptionalValue cli = OptionalValue.empty(); - OptionalValue suppressCallbacks = OptionalValue.empty(); - OptionalValue dualToneMultiFrequency = OptionalValue.empty(); - OptionalValue indications = OptionalValue.empty(); - OptionalValue answeringMachineDetection = OptionalValue.empty(); - - public Builder setNumber(E164PhoneNumber number) { - this.number = OptionalValue.of(number); - return this; - } - - public Builder setLocale(String locale) { - this.locale = OptionalValue.of(locale); - return this; - } - - public Builder setMaxDuration(Integer duration) { - this.maxDuration = OptionalValue.of(duration); - return this; - } - - public Builder setDialTimeout(Integer dialTimeout) { - this.dialTimeout = OptionalValue.of(dialTimeout); - return this; - } - - public Builder setCli(String cli) { - this.cli = OptionalValue.of(cli); - return this; - } - - public Builder setSuppressCallbacks(Boolean suppressCallbacks) { - this.suppressCallbacks = OptionalValue.of(suppressCallbacks); - return this; - } - - public Builder setDualToneMultiFrequency(DualToneMultiFrequency dualToneMultiFrequency) { - this.dualToneMultiFrequency = OptionalValue.of(dualToneMultiFrequency); - return this; - } - - public Builder setIndications(IndicationType indications) { - this.indications = OptionalValue.of(indications); - return this; - } - - public Builder setAnsweringMachineDetection( - AnsweringMachineDetection answeringMachineDetection) { - this.answeringMachineDetection = OptionalValue.of(answeringMachineDetection); - return this; - } - - public ActionConnectPstn build() { - return new ActionConnectPstn( - number, - locale, - maxDuration, - dialTimeout, - cli, - suppressCallbacks, - dualToneMultiFrequency, - indications, - answeringMachineDetection); - } - - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/ActionConnectSip.java b/client/src/main/com/sinch/sdk/domains/voice/models/svaml/ActionConnectSip.java deleted file mode 100644 index c731f34fa..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/ActionConnectSip.java +++ /dev/null @@ -1,146 +0,0 @@ -package com.sinch.sdk.domains.voice.models.svaml; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.core.utils.Pair; -import com.sinch.sdk.domains.voice.models.DestinationSip; -import com.sinch.sdk.domains.voice.models.MusicOnHoldType; -import com.sinch.sdk.domains.voice.models.TransportType; -import java.util.Collection; - -public class ActionConnectSip extends Action { - - private final OptionalValue destination; - private final OptionalValue maxDuration; - private final OptionalValue cli; - private final OptionalValue transport; - private final OptionalValue suppressCallbacks; - private final OptionalValue>> callHeaders; - private final OptionalValue musicOnHold; - - private ActionConnectSip( - OptionalValue destination, - OptionalValue maxDuration, - OptionalValue cli, - OptionalValue transport, - OptionalValue suppressCallbacks, - OptionalValue>> callHeaders, - OptionalValue musicOnHold) { - this.destination = destination; - this.maxDuration = maxDuration; - this.cli = cli; - this.transport = transport; - this.suppressCallbacks = suppressCallbacks; - this.callHeaders = callHeaders; - this.musicOnHold = musicOnHold; - } - - public OptionalValue getDestination() { - return destination; - } - - public OptionalValue getMaxDuration() { - return maxDuration; - } - - public OptionalValue getCli() { - return cli; - } - - public OptionalValue getTransport() { - return transport; - } - - public OptionalValue getSuppressCallbacks() { - return suppressCallbacks; - } - - public OptionalValue>> getCallHeaders() { - return callHeaders; - } - - public OptionalValue getMusicOnHold() { - return musicOnHold; - } - - @Override - public String toString() { - return "ActionConnectSip{" - + "destination=" - + destination - + ", maxDuration=" - + maxDuration - + ", cli='" - + cli - + '\'' - + ", transport=" - + transport - + ", suppressCallbacks=" - + suppressCallbacks - + ", callHeaders=" - + callHeaders - + ", musicOnHold=" - + musicOnHold - + "} " - + super.toString(); - } - - public static Builder builder() { - return new Builder<>(); - } - - public static class Builder> { - - OptionalValue destination = OptionalValue.empty(); - OptionalValue maxDuration = OptionalValue.empty(); - OptionalValue cli = OptionalValue.empty(); - OptionalValue transport = OptionalValue.empty(); - OptionalValue suppressCallbacks = OptionalValue.empty(); - OptionalValue>> callHeaders = OptionalValue.empty(); - OptionalValue musicOnHold = OptionalValue.empty(); - - public Builder setDestination(DestinationSip destination) { - this.destination = OptionalValue.of(destination); - return this; - } - - public Builder setMaxDuration(Integer maxDuration) { - this.maxDuration = OptionalValue.of(maxDuration); - return this; - } - - public Builder setCli(String cli) { - this.cli = OptionalValue.of(cli); - return this; - } - - public Builder setTransport(TransportType transport) { - this.transport = OptionalValue.of(transport); - return this; - } - - public Builder setSuppressCallbacks(Boolean suppressCallbacks) { - this.suppressCallbacks = OptionalValue.of(suppressCallbacks); - return this; - } - - public Builder setCallHeaders(Collection> callHeaders) { - this.callHeaders = OptionalValue.of(callHeaders); - return this; - } - - public Builder setMusicOnHold(MusicOnHoldType musicOnHold) { - this.musicOnHold = OptionalValue.of(musicOnHold); - return this; - } - - public ActionConnectSip build() { - return new ActionConnectSip( - destination, maxDuration, cli, transport, suppressCallbacks, callHeaders, musicOnHold); - } - - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/ActionContinue.java b/client/src/main/com/sinch/sdk/domains/voice/models/svaml/ActionContinue.java deleted file mode 100644 index 63803e871..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/ActionContinue.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.sinch.sdk.domains.voice.models.svaml; - -public class ActionContinue extends Action { - - private ActionContinue() {} - - public static Builder builder() { - return new Builder<>(); - } - - public static class Builder> { - - public ActionContinue build() { - return new ActionContinue(); - } - - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/ActionHangUp.java b/client/src/main/com/sinch/sdk/domains/voice/models/svaml/ActionHangUp.java deleted file mode 100644 index 477168c1a..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/ActionHangUp.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.sinch.sdk.domains.voice.models.svaml; - -public class ActionHangUp extends Action { - - private ActionHangUp() {} - - public static Builder builder() { - return new Builder<>(); - } - - public static class Builder> { - - public ActionHangUp build() { - return new ActionHangUp(); - } - - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/ActionPark.java b/client/src/main/com/sinch/sdk/domains/voice/models/svaml/ActionPark.java deleted file mode 100644 index d67e792ae..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/ActionPark.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.sinch.sdk.domains.voice.models.svaml; - -import com.sinch.sdk.core.models.OptionalValue; - -public class ActionPark extends Action { - - private final OptionalValue locale; - private final OptionalValue introPrompt; - private final OptionalValue holdPrompt; - private final OptionalValue maxDuration; - - private ActionPark( - OptionalValue locale, - OptionalValue introPrompt, - OptionalValue holdPrompt, - OptionalValue maxDuration) { - this.locale = locale; - this.introPrompt = introPrompt; - this.holdPrompt = holdPrompt; - this.maxDuration = maxDuration; - } - - public OptionalValue getLocale() { - return locale; - } - - public OptionalValue getIntroPrompt() { - return introPrompt; - } - - public OptionalValue getHoldPrompt() { - return holdPrompt; - } - - public OptionalValue getMaxDuration() { - return maxDuration; - } - - @Override - public String toString() { - return "ActionPark{" - + "locale='" - + locale - + '\'' - + ", introPrompt='" - + introPrompt - + '\'' - + ", holdPrompt='" - + holdPrompt - + '\'' - + ", maxDuration=" - + maxDuration - + "} " - + super.toString(); - } - - public static Builder builder() { - return new Builder<>(); - } - - public static class Builder> { - - OptionalValue locale = OptionalValue.empty(); - OptionalValue introPrompt = OptionalValue.empty(); - OptionalValue holdPrompt = OptionalValue.empty(); - OptionalValue maxDuration = OptionalValue.empty(); - - public Builder setLocale(String locale) { - this.locale = OptionalValue.of(locale); - return this; - } - - public Builder setIntroPrompt(String introPrompt) { - this.introPrompt = OptionalValue.of(introPrompt); - return this; - } - - public Builder setHoldPrompt(String holdPrompt) { - this.holdPrompt = OptionalValue.of(holdPrompt); - return this; - } - - public Builder setMaxDuration(Integer maxDuration) { - this.maxDuration = OptionalValue.of(maxDuration); - return this; - } - - public ActionPark build() { - return new ActionPark(locale, introPrompt, holdPrompt, maxDuration); - } - - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/ActionRunMenu.java b/client/src/main/com/sinch/sdk/domains/voice/models/svaml/ActionRunMenu.java deleted file mode 100644 index bdf252e6d..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/ActionRunMenu.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.sinch.sdk.domains.voice.models.svaml; - -import com.sinch.sdk.core.models.OptionalValue; -import java.util.Collection; - -public class ActionRunMenu extends Action { - - private final OptionalValue barge; - private final OptionalValue locale; - private final OptionalValue mainMenu; - private final OptionalValue enableVoice; - private final OptionalValue> menus; - - private ActionRunMenu( - OptionalValue barge, - OptionalValue locale, - OptionalValue mainMenu, - OptionalValue enableVoice, - OptionalValue> menus) { - this.barge = barge; - this.locale = locale; - this.mainMenu = mainMenu; - this.enableVoice = enableVoice; - this.menus = menus; - } - - public OptionalValue getBarge() { - return barge; - } - - public OptionalValue getLocale() { - return locale; - } - - public OptionalValue getMainMenu() { - return mainMenu; - } - - public OptionalValue getEnableVoice() { - return enableVoice; - } - - public OptionalValue> getMenus() { - return menus; - } - - @Override - public String toString() { - return "ActionRunMenu{" - + "barge=" - + barge - + ", locale='" - + locale - + '\'' - + ", mainMenu='" - + mainMenu - + '\'' - + ", enableVoice=" - + enableVoice - + ", menus=" - + menus - + "} " - + super.toString(); - } - - public static Builder builder() { - return new Builder<>(); - } - - public static class Builder> { - - OptionalValue barge = OptionalValue.empty(); - OptionalValue locale = OptionalValue.empty(); - OptionalValue mainMenu = OptionalValue.empty(); - OptionalValue enableVoice = OptionalValue.empty(); - OptionalValue> menus = OptionalValue.empty(); - - public Builder setBarge(Boolean barge) { - this.barge = OptionalValue.of(barge); - return this; - } - - public Builder setLocale(String locale) { - this.locale = OptionalValue.of(locale); - return this; - } - - public Builder setMainMenu(String mainMenu) { - this.mainMenu = OptionalValue.of(mainMenu); - return this; - } - - public Builder setEnableVoice(Boolean enableVoice) { - this.enableVoice = OptionalValue.of(enableVoice); - return this; - } - - public Builder setMenus(Collection

menus) { - this.menus = OptionalValue.of(menus); - return this; - } - - public ActionRunMenu build() { - return new ActionRunMenu(barge, locale, mainMenu, enableVoice, menus); - } - - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/AnsweringMachineDetection.java b/client/src/main/com/sinch/sdk/domains/voice/models/svaml/AnsweringMachineDetection.java deleted file mode 100644 index 753c3c67e..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/AnsweringMachineDetection.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.sinch.sdk.domains.voice.models.svaml; - -import com.sinch.sdk.core.models.OptionalValue; - -public class AnsweringMachineDetection { - - private final OptionalValue enabled; - - private AnsweringMachineDetection(OptionalValue enabled) { - this.enabled = enabled; - } - - public OptionalValue getEnabled() { - return enabled; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - OptionalValue enabled = OptionalValue.empty(); - - public Builder setEnabled(Boolean enabled) { - this.enabled = OptionalValue.of(enabled); - return this; - } - - public AnsweringMachineDetection build() { - return new AnsweringMachineDetection(enabled); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/IndicationType.java b/client/src/main/com/sinch/sdk/domains/voice/models/svaml/IndicationType.java deleted file mode 100644 index 65e7d389c..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/IndicationType.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.sinch.sdk.domains.voice.models.svaml; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -/** Domains type */ -public class IndicationType extends EnumDynamic { - - public static final IndicationType AUSTRIA = new IndicationType("at"); - public static final IndicationType AUSTRALIA = new IndicationType("au"); - public static final IndicationType BULGARIA = new IndicationType("bg"); - public static final IndicationType BRAZIL = new IndicationType("br"); - public static final IndicationType BELGIUM = new IndicationType("be"); - public static final IndicationType SWITZERLAND = new IndicationType("ch"); - public static final IndicationType CHILE = new IndicationType("cl"); - public static final IndicationType CHINA = new IndicationType("cn"); - public static final IndicationType CZECH_REPUBLIC = new IndicationType("cz"); - public static final IndicationType GERMANY = new IndicationType("de"); - public static final IndicationType DENMARK = new IndicationType("dk"); - public static final IndicationType ESTONIA = new IndicationType("ee"); - public static final IndicationType SPAIN = new IndicationType("es"); - public static final IndicationType FINLAND = new IndicationType("fi"); - public static final IndicationType FRANCE = new IndicationType("fr"); - public static final IndicationType GREECE = new IndicationType("gr"); - public static final IndicationType HUNGARY = new IndicationType("hu"); - public static final IndicationType ISRAEL = new IndicationType("il"); - public static final IndicationType INDIA = new IndicationType("in"); - public static final IndicationType ITALY = new IndicationType("it"); - public static final IndicationType LITHUANIA = new IndicationType("lt"); - public static final IndicationType JAPAN = new IndicationType("jp"); - public static final IndicationType MEXICO = new IndicationType("mx"); - public static final IndicationType MALAYSIA = new IndicationType("my"); - public static final IndicationType NETHERLANDS = new IndicationType("nl"); - public static final IndicationType NORWAY = new IndicationType("no"); - public static final IndicationType NEW_ZEALAND = new IndicationType("nz"); - public static final IndicationType PHILIPPINES = new IndicationType("ph"); - public static final IndicationType POLAND = new IndicationType("pl"); - public static final IndicationType PORTUGAL = new IndicationType("pt"); - public static final IndicationType RUSSIA = new IndicationType("ru"); - public static final IndicationType SWEDEN = new IndicationType("se"); - public static final IndicationType SINGAPORE = new IndicationType("sg"); - public static final IndicationType THAILAND = new IndicationType("th"); - public static final IndicationType UNITED_KINGDOM = new IndicationType("uk"); - public static final IndicationType UNITED_STATES = new IndicationType("us"); - public static final IndicationType TAIWAN = new IndicationType("tw"); - public static final IndicationType VENEZUELA = new IndicationType("ve"); - public static final IndicationType SOUTH_AFRICA = new IndicationType("za"); - - /** */ - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - IndicationType.class, - IndicationType::new, - Arrays.asList( - AUSTRIA, - AUSTRALIA, - BULGARIA, - BRAZIL, - BELGIUM, - SWITZERLAND, - CHILE, - CHINA, - CZECH_REPUBLIC, - GERMANY, - DENMARK, - ESTONIA, - SPAIN, - FINLAND, - FRANCE, - GREECE, - HUNGARY, - ISRAEL, - INDIA, - ITALY, - LITHUANIA, - JAPAN, - MEXICO, - MALAYSIA, - NETHERLANDS, - NORWAY, - NEW_ZEALAND, - PHILIPPINES, - POLAND, - PORTUGAL, - RUSSIA, - SWEDEN, - SINGAPORE, - THAILAND, - UNITED_KINGDOM, - UNITED_STATES, - TAIWAN, - VENEZUELA, - SOUTH_AFRICA)); - - private IndicationType(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static IndicationType from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(IndicationType e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/Instruction.java b/client/src/main/com/sinch/sdk/domains/voice/models/svaml/Instruction.java deleted file mode 100644 index 18c8275da..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/Instruction.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.sinch.sdk.domains.voice.models.svaml; - -public abstract class Instruction { - - @Override - public String toString() { - return ""; - } - - public abstract static class Builder> { - - public abstract Instruction build(); - - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/InstructionAnswer.java b/client/src/main/com/sinch/sdk/domains/voice/models/svaml/InstructionAnswer.java deleted file mode 100644 index aa0c5449f..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/InstructionAnswer.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.sinch.sdk.domains.voice.models.svaml; - -public class InstructionAnswer extends Instruction { - - private InstructionAnswer() {} - - @Override - public String toString() { - return "InstructionAnswer{} " + super.toString(); - } - - public static Builder builder() { - return new Builder<>(); - } - - public static class Builder> { - - public InstructionAnswer build() { - return new InstructionAnswer(); - } - - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/InstructionPlayFiles.java b/client/src/main/com/sinch/sdk/domains/voice/models/svaml/InstructionPlayFiles.java deleted file mode 100644 index d463bd33b..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/InstructionPlayFiles.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.sinch.sdk.domains.voice.models.svaml; - -import com.sinch.sdk.core.models.OptionalValue; -import java.util.Collection; - -public class InstructionPlayFiles extends Instruction { - - private final OptionalValue> ids; - private final OptionalValue locale; - - private InstructionPlayFiles( - OptionalValue> ids, OptionalValue locale) { - this.ids = ids; - this.locale = locale; - } - - public OptionalValue> getIds() { - return ids; - } - - public OptionalValue getLocale() { - return locale; - } - - @Override - public String toString() { - return "InstructionPlayFiles{" - + "ids=" - + ids - + ", locale='" - + locale - + '\'' - + "} " - + super.toString(); - } - - public static Builder builder() { - return new Builder<>(); - } - - public static class Builder> { - - OptionalValue> ids = OptionalValue.empty(); - OptionalValue locale = OptionalValue.empty(); - - public Builder setIds(Collection ids) { - this.ids = OptionalValue.of(ids); - return this; - } - - public Builder setLocale(String locale) { - this.locale = OptionalValue.of(locale); - return this; - } - - public InstructionPlayFiles build() { - return new InstructionPlayFiles(ids, locale); - } - - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/InstructionSay.java b/client/src/main/com/sinch/sdk/domains/voice/models/svaml/InstructionSay.java deleted file mode 100644 index 49f7f2818..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/InstructionSay.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.sinch.sdk.domains.voice.models.svaml; - -import com.sinch.sdk.core.models.OptionalValue; - -public class InstructionSay extends Instruction { - - private final OptionalValue text; - private final OptionalValue locale; - - private InstructionSay(OptionalValue text, OptionalValue locale) { - this.text = text; - this.locale = locale; - } - - public OptionalValue getText() { - return text; - } - - public OptionalValue getLocale() { - return locale; - } - - @Override - public String toString() { - return "InstructionSay{" - + "text=" - + text - + ", locale='" - + locale - + '\'' - + "} " - + super.toString(); - } - - public static Builder builder() { - return new Builder<>(); - } - - public static class Builder> { - - OptionalValue text = OptionalValue.empty(); - OptionalValue locale = OptionalValue.empty(); - - public Builder setText(String text) { - this.text = OptionalValue.of(text); - return this; - } - - public Builder setLocale(String locale) { - this.locale = OptionalValue.of(locale); - return this; - } - - public InstructionSay build() { - return new InstructionSay(text, locale); - } - - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/InstructionSendDtfm.java b/client/src/main/com/sinch/sdk/domains/voice/models/svaml/InstructionSendDtfm.java deleted file mode 100644 index 47cb0ebd9..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/InstructionSendDtfm.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.sinch.sdk.domains.voice.models.svaml; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.models.DualToneMultiFrequency; - -public class InstructionSendDtfm extends Instruction { - - private final OptionalValue dtfm; - - private InstructionSendDtfm(OptionalValue dtfm) { - this.dtfm = dtfm; - } - - public OptionalValue getTDtfm() { - return dtfm; - } - - @Override - public String toString() { - return "InstructionSendDtfm{" + "dtfm=" + dtfm + "} " + super.toString(); - } - - public static Builder builder() { - return new Builder<>(); - } - - public static class Builder> { - - OptionalValue dtfm = OptionalValue.empty(); - - public Builder setDtfm(DualToneMultiFrequency dtfm) { - this.dtfm = OptionalValue.of(dtfm); - return this; - } - - public InstructionSendDtfm build() { - return new InstructionSendDtfm(dtfm); - } - - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/InstructionSetCookie.java b/client/src/main/com/sinch/sdk/domains/voice/models/svaml/InstructionSetCookie.java deleted file mode 100644 index 188001957..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/InstructionSetCookie.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.sinch.sdk.domains.voice.models.svaml; - -public class InstructionSetCookie extends Instruction { - - private final String key; - private final String value; - - private InstructionSetCookie(String key, String value) { - this.key = key; - this.value = value; - } - - public String getKey() { - return key; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return "InstructionSetCookie{" - + "key='" - + key - + '\'' - + ", value='" - + value - + '\'' - + "} " - + super.toString(); - } - - public static Builder builder() { - return new Builder<>(); - } - - public static class Builder> { - - String key; - String value; - - public Builder setKey(String key) { - this.key = key; - return this; - } - - public Builder setValue(String value) { - this.value = value; - return this; - } - - public InstructionSetCookie build() { - return new InstructionSetCookie(key, value); - } - - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/InstructionStartRecording.java b/client/src/main/com/sinch/sdk/domains/voice/models/svaml/InstructionStartRecording.java deleted file mode 100644 index ed41960f2..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/InstructionStartRecording.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.sinch.sdk.domains.voice.models.svaml; - -import com.sinch.sdk.core.models.OptionalValue; - -public class InstructionStartRecording extends Instruction { - - private final OptionalValue options; - - private InstructionStartRecording(OptionalValue options) { - this.options = options; - } - - public OptionalValue getOptions() { - return options; - } - - @Override - public String toString() { - return "InstructionStartRecording{" + "options=" + options + "} " + super.toString(); - } - - public static Builder builder() { - return new Builder<>(); - } - - public static class Builder> { - - OptionalValue options = OptionalValue.empty(); - - public Builder setOptions(StartRecordingOptions options) { - this.options = OptionalValue.of(options); - return this; - } - - public InstructionStartRecording build() { - return new InstructionStartRecording(options); - } - - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/InstructionStopRecording.java b/client/src/main/com/sinch/sdk/domains/voice/models/svaml/InstructionStopRecording.java deleted file mode 100644 index fc41a5c0a..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/InstructionStopRecording.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.sinch.sdk.domains.voice.models.svaml; - -public class InstructionStopRecording extends Instruction { - - private InstructionStopRecording() {} - - @Override - public String toString() { - return "InstructionStopRecording{" + "} " + super.toString(); - } - - public static Builder builder() { - return new Builder<>(); - } - - public static class Builder> { - - public InstructionStopRecording build() { - return new InstructionStopRecording(); - } - - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/Menu.java b/client/src/main/com/sinch/sdk/domains/voice/models/svaml/Menu.java deleted file mode 100644 index ad07347b5..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/Menu.java +++ /dev/null @@ -1,153 +0,0 @@ -package com.sinch.sdk.domains.voice.models.svaml; - -import com.sinch.sdk.core.models.OptionalValue; -import java.util.Collection; - -public class Menu { - - private final OptionalValue id; - private final OptionalValue mainPrompt; - private final OptionalValue repeatPrompt; - private final OptionalValue repeats; - private final OptionalValue maxDigits; - private final OptionalValue timeoutMills; - private final OptionalValue maxTimeoutMills; - private final OptionalValue> options; - - private Menu( - OptionalValue id, - OptionalValue mainPrompt, - OptionalValue repeatPrompt, - OptionalValue repeats, - OptionalValue maxDigits, - OptionalValue timeoutMills, - OptionalValue maxTimeoutMills, - OptionalValue> options) { - this.id = id; - this.mainPrompt = mainPrompt; - this.repeatPrompt = repeatPrompt; - this.repeats = repeats; - this.maxDigits = maxDigits; - this.timeoutMills = timeoutMills; - this.maxTimeoutMills = maxTimeoutMills; - this.options = options; - } - - public OptionalValue getId() { - return id; - } - - public OptionalValue getMainPrompt() { - return mainPrompt; - } - - public OptionalValue getRepeatPrompt() { - return repeatPrompt; - } - - public OptionalValue getRepeats() { - return repeats; - } - - public OptionalValue getMaxDigits() { - return maxDigits; - } - - public OptionalValue getTimeoutMills() { - return timeoutMills; - } - - public OptionalValue getMaxTimeoutMills() { - return maxTimeoutMills; - } - - public OptionalValue> getOptions() { - return options; - } - - @Override - public String toString() { - return "Menu{" - + "id='" - + id - + '\'' - + ", mainPrompt='" - + mainPrompt - + '\'' - + ", repeatPrompt='" - + repeatPrompt - + '\'' - + ", repeats=" - + repeats - + ", maxDigits=" - + maxDigits - + ", timeoutMills=" - + timeoutMills - + ", maxTimeoutMills=" - + maxTimeoutMills - + ", options=" - + options - + '}'; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - OptionalValue id = OptionalValue.empty(); - OptionalValue mainPrompt = OptionalValue.empty(); - OptionalValue repeatPrompt = OptionalValue.empty(); - OptionalValue repeats = OptionalValue.empty(); - OptionalValue maxDigits = OptionalValue.empty(); - OptionalValue timeoutMills = OptionalValue.empty(); - OptionalValue maxTimeoutMills = OptionalValue.empty(); - OptionalValue> options = OptionalValue.empty(); - - public Builder setId(String id) { - this.id = OptionalValue.of(id); - return this; - } - - public Builder setMainPrompt(String mainPrompt) { - this.mainPrompt = OptionalValue.of(mainPrompt); - return this; - } - - public Builder setRepeatPrompt(String repeatPrompt) { - this.repeatPrompt = OptionalValue.of(repeatPrompt); - return this; - } - - public Builder setRepeats(Integer repeats) { - this.repeats = OptionalValue.of(repeats); - return this; - } - - public Builder setMaxDigits(Integer maxDigits) { - this.maxDigits = OptionalValue.of(maxDigits); - return this; - } - - public Builder setTimeoutMills(Integer timeoutMills) { - this.timeoutMills = OptionalValue.of(timeoutMills); - return this; - } - - public Builder setMaxTimeoutMills(Integer maxTimeoutMills) { - this.maxTimeoutMills = OptionalValue.of(maxTimeoutMills); - return this; - } - - public Builder setOptions(Collection options) { - this.options = OptionalValue.of(options); - return this; - } - - public Menu build() { - return new Menu( - id, mainPrompt, repeatPrompt, repeats, maxDigits, timeoutMills, maxTimeoutMills, options); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/MenuOption.java b/client/src/main/com/sinch/sdk/domains/voice/models/svaml/MenuOption.java deleted file mode 100644 index 54e4f5e78..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/MenuOption.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.sinch.sdk.domains.voice.models.svaml; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.models.DualToneMultiFrequency; - -public class MenuOption { - - private final OptionalValue dtfm; - private final OptionalValue action; - - private MenuOption( - OptionalValue dtfm, OptionalValue action) { - this.dtfm = dtfm; - this.action = action; - } - - public OptionalValue getDtfm() { - return dtfm; - } - - public OptionalValue getAction() { - return action; - } - - @Override - public String toString() { - return "MenuOption{" + "dtfm=" + dtfm + ", action=" + action + '}'; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - OptionalValue dtfm = OptionalValue.empty(); - OptionalValue action = OptionalValue.empty(); - - public Builder setDtfm(DualToneMultiFrequency dtfm) { - this.dtfm = OptionalValue.of(dtfm); - return this; - } - - public Builder setAction(MenuOptionAction action) { - this.action = OptionalValue.of(action); - return this; - } - - public MenuOption build() { - return new MenuOption(dtfm, action); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/MenuOptionAction.java b/client/src/main/com/sinch/sdk/domains/voice/models/svaml/MenuOptionAction.java deleted file mode 100644 index 44b3a111d..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/MenuOptionAction.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.sinch.sdk.domains.voice.models.svaml; - -import java.util.Objects; - -/** Navigates to the named menu */ -public class MenuOptionAction { - - private final MenuOptionActionType type; - private final String id; - - private MenuOptionAction(MenuOptionActionType type, String id) { - Objects.requireNonNull(type, "Action type cannot be null"); - this.type = type; - this.id = id; - } - - public String getId() { - return id; - } - - public MenuOptionActionType getType() { - return type; - } - - public static MenuOptionAction from(MenuOptionActionType type, String id) { - return new MenuOptionAction(type, id); - } - - @Override - public String toString() { - return "MenuOptionAction{" + "type=" + type + ", id='" + id + '\'' + '}'; - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/MenuOptionActionType.java b/client/src/main/com/sinch/sdk/domains/voice/models/svaml/MenuOptionActionType.java deleted file mode 100644 index 1b1965fa3..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/MenuOptionActionType.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.sinch.sdk.domains.voice.models.svaml; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -/** Menu Action type */ -public class MenuOptionActionType extends EnumDynamic { - - /** - * Triggers a Prompt Input Event (PIE) - * - * @see Prompt - * Input Event - */ - public static final MenuOptionActionType RETURN = new MenuOptionActionType("return"); - - /** Navigates to the named menu */ - public static final MenuOptionActionType MENU = new MenuOptionActionType("menu"); - - /** */ - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - MenuOptionActionType.class, MenuOptionActionType::new, Arrays.asList(RETURN, MENU)); - - private MenuOptionActionType(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static MenuOptionActionType from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(MenuOptionActionType e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/SVAMLControl.java b/client/src/main/com/sinch/sdk/domains/voice/models/svaml/SVAMLControl.java deleted file mode 100644 index 4dc0c1ace..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/SVAMLControl.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.sinch.sdk.domains.voice.models.svaml; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.voice.models.requests.Control; -import java.util.Collection; - -/** - * Class enabling to define SVAML actions and instructions - * - * @see SVAML - * Dcoumentation - */ -public class SVAMLControl extends Control { - private final OptionalValue> instructions; - private final OptionalValue action; - - private SVAMLControl( - OptionalValue> instructions, OptionalValue action) { - this.instructions = instructions; - this.action = action; - } - - /** - * Get instructions related to request - * - * @return See builder {@link Builder#setInstructions setter} - */ - public OptionalValue> getInstructions() { - return instructions; - } - - /** - * Get action related to request - * - * @return See builder {@link Builder#setAction setter} - */ - public OptionalValue getAction() { - return action; - } - - @Override - public String toString() { - return "SVAMLControl{" + "instructions=" + instructions + ", action=" + action + '}'; - } - - /** - * Create a builder instance - * - * @return Dedicated builder - */ - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - OptionalValue> instructions = OptionalValue.empty(); - OptionalValue action = OptionalValue.empty(); - - public Builder() {} - - /** - * The collection of instructions that can perform various tasks during the call - * - * @param instructions Instructions list - * @return Current builder - */ - public Builder setInstructions(Collection instructions) { - this.instructions = OptionalValue.of(instructions); - return this; - } - - /** - * The action that will control the call - * - * @param action The action description - * @return Current builder - */ - public Builder setAction(Action action) { - this.action = OptionalValue.of(action); - return this; - } - - /** - * Build the instance - * - * @return Built instance - */ - public SVAMLControl build() { - return new SVAMLControl(instructions, action); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/StartRecordingOptions.java b/client/src/main/com/sinch/sdk/domains/voice/models/svaml/StartRecordingOptions.java deleted file mode 100644 index 71fd8abb5..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/StartRecordingOptions.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.sinch.sdk.domains.voice.models.svaml; - -import com.sinch.sdk.core.models.OptionalValue; - -public class StartRecordingOptions { - - private final OptionalValue destinationUrl; - private final OptionalValue credentials; - private final OptionalValue format; - private final OptionalValue notificationEvents; - private final OptionalValue transcriptionOptions; - - private StartRecordingOptions( - OptionalValue destinationUrl, - OptionalValue credentials, - OptionalValue format, - OptionalValue notificationEvents, - OptionalValue transcriptionOptions) { - this.destinationUrl = destinationUrl; - this.credentials = credentials; - this.format = format; - this.notificationEvents = notificationEvents; - this.transcriptionOptions = transcriptionOptions; - } - - public OptionalValue getDestinationUrl() { - return destinationUrl; - } - - public OptionalValue getCredentials() { - return credentials; - } - - public OptionalValue getFormat() { - return format; - } - - public OptionalValue getNotificationEvents() { - return notificationEvents; - } - - public OptionalValue getTranscriptionOptions() { - return transcriptionOptions; - } - - @Override - public String toString() { - return "StartRecordingOptions{" - + "destinationUrl='" - + destinationUrl - + '\'' - + ", credentials='" - + credentials - + '\'' - + ", format='" - + format - + '\'' - + ", notificationEvents=" - + notificationEvents - + ", transcriptionOptions=" - + transcriptionOptions - + '}'; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - OptionalValue destinationUrl = OptionalValue.empty(); - OptionalValue credentials = OptionalValue.empty(); - OptionalValue format = OptionalValue.empty(); - OptionalValue notificationEvents = OptionalValue.empty(); - OptionalValue transcriptionOptions = OptionalValue.empty(); - - public Builder setDestinationUrl(String destinationUrl) { - this.destinationUrl = OptionalValue.of(destinationUrl); - return this; - } - - public Builder setCredentials(String credentials) { - this.credentials = OptionalValue.of(credentials); - return this; - } - - public Builder setFormat(String format) { - this.format = OptionalValue.of(format); - return this; - } - - public Builder setNotificationEvents(Boolean notificationEvents) { - this.notificationEvents = OptionalValue.of(notificationEvents); - return this; - } - - public Builder setTranscriptionOptions(TranscriptionOptions transcriptionOptions) { - this.transcriptionOptions = OptionalValue.of(transcriptionOptions); - return this; - } - - public StartRecordingOptions build() { - return new StartRecordingOptions( - destinationUrl, credentials, format, notificationEvents, transcriptionOptions); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/TranscriptionOptions.java b/client/src/main/com/sinch/sdk/domains/voice/models/svaml/TranscriptionOptions.java deleted file mode 100644 index 5589b73d5..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/TranscriptionOptions.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.sinch.sdk.domains.voice.models.svaml; - -import com.sinch.sdk.core.models.OptionalValue; - -public class TranscriptionOptions { - - private final OptionalValue enabled; - private final OptionalValue locale; - - private TranscriptionOptions(OptionalValue enabled, OptionalValue locale) { - this.enabled = enabled; - this.locale = locale; - } - - public OptionalValue getEnabled() { - return enabled; - } - - public OptionalValue getLocale() { - return locale; - } - - @Override - public String toString() { - return "TranscriptionOptions{" + "enabled=" + enabled + ", locale='" + locale + '\'' + '}'; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - OptionalValue enabled = OptionalValue.empty(); - OptionalValue locale = OptionalValue.empty(); - - public Builder setEnabled(Boolean enabled) { - this.enabled = OptionalValue.of(enabled); - return this; - } - - public Builder setLocale(String locale) { - this.locale = OptionalValue.of(locale); - return this; - } - - public TranscriptionOptions build() { - return new TranscriptionOptions(enabled, locale); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/package-info.java b/client/src/main/com/sinch/sdk/domains/voice/models/svaml/package-info.java deleted file mode 100644 index f6b66e8e9..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/svaml/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Sinch Voice Application Markup Language (SVAML) related models - * - * @see SVAML - * documentation - * @since 1.0 - */ -package com.sinch.sdk.domains.voice.models.svaml; diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/ConnectPstnAnsweringMachineDetection.java b/client/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/ConnectPstnAnsweringMachineDetection.java deleted file mode 100644 index beec8937d..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/ConnectPstnAnsweringMachineDetection.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * - */ - -package com.sinch.sdk.domains.voice.models.v1.svaml.action; - -/** - * @deprecated use {@link - * com.sinch.sdk.domains.voice.models.v1.svaml.action.AnsweringMachineDetectionQuery} instead. - */ -@Deprecated -public interface ConnectPstnAnsweringMachineDetection extends AnsweringMachineDetectionQuery { - - /** - * Getting builder - * - * @return New Builder instance - */ - static Builder builder() { - return new ConnectPstnAnsweringMachineDetectionImpl.Builder(); - } - - /** - * Dedicated Builder - * - * @deprecated use {@link - * com.sinch.sdk.domains.voice.models.v1.svaml.action.AnsweringMachineDetectionQuery} instead. - */ - @Deprecated - interface Builder extends AnsweringMachineDetectionQuery.Builder { - - /** - * Create instance - * - * @return The instance build with current builder values - */ - ConnectPstnAnsweringMachineDetection build(); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/ConnectPstnAnsweringMachineDetectionImpl.java b/client/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/ConnectPstnAnsweringMachineDetectionImpl.java deleted file mode 100644 index a4550cce7..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/ConnectPstnAnsweringMachineDetectionImpl.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.sinch.sdk.domains.voice.models.v1.svaml.action; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.sinch.sdk.core.models.OptionalValue; - -@Deprecated -public class ConnectPstnAnsweringMachineDetectionImpl extends AnsweringMachineDetectionQueryImpl - implements ConnectPstnAnsweringMachineDetection { - - public ConnectPstnAnsweringMachineDetectionImpl( - OptionalValue enabled, OptionalValue async) { - super(enabled, async); - } - - @Deprecated - static class Builder implements ConnectPstnAnsweringMachineDetection.Builder { - - OptionalValue enabled = OptionalValue.empty(); - OptionalValue async = OptionalValue.empty(); - - @JsonProperty(JSON_PROPERTY_ENABLED) - public Builder setEnabled(Boolean enabled) { - this.enabled = OptionalValue.of(enabled); - return this; - } - - @JsonProperty(JSON_PROPERTY_ASYNC) - public Builder setAsync(Boolean async) { - this.async = OptionalValue.of(async); - return this; - } - - public ConnectPstnAnsweringMachineDetectionImpl build() { - return new ConnectPstnAnsweringMachineDetectionImpl(enabled, async); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/MenuOptionActionFactory.java b/client/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/MenuOptionActionFactory.java index 9bc3bf03c..2cc628ee3 100644 --- a/client/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/MenuOptionActionFactory.java +++ b/client/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/MenuOptionActionFactory.java @@ -2,7 +2,6 @@ import com.sinch.sdk.core.utils.EnumDynamic; import com.sinch.sdk.core.utils.EnumSupportDynamic; -import com.sinch.sdk.domains.voice.models.svaml.MenuOptionActionType; import java.util.Arrays; import java.util.Objects; import java.util.stream.Stream; diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/AnsweredCallEventAnsweringMachineDetection.java b/client/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/AnsweredCallEventAnsweringMachineDetection.java deleted file mode 100644 index 948e6a071..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/AnsweredCallEventAnsweringMachineDetection.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.sinch.sdk.domains.voice.models.v1.webhooks; - -/** - * @deprecated - * @see AnsweringMachineDetection to be used in place of - */ -@Deprecated -public interface AnsweredCallEventAnsweringMachineDetection extends AnsweringMachineDetection { - - /** The determination by the system of who answered the call. */ - public class StatusEnum { - public static final AnsweringMachineDetection.StatusEnum MACHINE = - AnsweringMachineDetection.StatusEnum.MACHINE; - public static final AnsweringMachineDetection.StatusEnum HUMAN = - AnsweringMachineDetection.StatusEnum.HUMAN; - public static final AnsweringMachineDetection.StatusEnum NOTSURE = - AnsweringMachineDetection.StatusEnum.NOTSURE; - public static final AnsweringMachineDetection.StatusEnum HANGUP = - AnsweringMachineDetection.StatusEnum.HANGUP; - } - - /** - * Getting builder - * - * @return New Builder instance - */ - static Builder builder() { - return new AnsweredCallEventAnsweringMachineDetectionImpl.Builder(); - } - - /** Dedicated Builder */ - interface Builder extends AnsweringMachineDetection.Builder {} -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/AnsweredCallEventAnsweringMachineDetectionImpl.java b/client/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/AnsweredCallEventAnsweringMachineDetectionImpl.java deleted file mode 100644 index fab3b2dd7..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/AnsweredCallEventAnsweringMachineDetectionImpl.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.sinch.sdk.domains.voice.models.v1.webhooks; - -public class AnsweredCallEventAnsweringMachineDetectionImpl extends AnsweringMachineDetectionImpl - implements AnsweredCallEventAnsweringMachineDetection { - - static class Builder extends AnsweringMachineDetectionImpl.Builder - implements AnsweredCallEventAnsweringMachineDetection.Builder {} -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/package-info.java b/client/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/package-info.java deleted file mode 100644 index 2f6c91da4..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/package-info.java +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Models related to Voice WebHooks - * - * @since 1.4 - */ -package com.sinch.sdk.domains.voice.models.v1.webhooks; diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/AmdAnswer.java b/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/AmdAnswer.java deleted file mode 100644 index ab7de2661..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/AmdAnswer.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.sinch.sdk.domains.voice.models.webhooks; - -/** - * If Answering Machine Detection (see AMD) is enabled, this - * object contains information about whether the call was answered by a machine. - */ -public class AmdAnswer { - - private final AmdAnswerStatusType status; - private final AmdAnswerReasonType reason; - private final Integer duration; - - private AmdAnswer(AmdAnswerStatusType status, AmdAnswerReasonType reason, Integer duration) { - this.status = status; - this.reason = reason; - this.duration = duration; - } - - /** - * Get the status - * - * @return Status value - */ - public AmdAnswerStatusType getStatus() { - return status; - } - - /** - * Get the reason - * - * @return Reason value - */ - public AmdAnswerReasonType getReason() { - return reason; - } - - /** - * Get the length of the call - * - * @return Call length - */ - public Integer getDuration() { - return duration; - } - - @Override - public String toString() { - return "AmdAnswer{" - + "status=" - + status - + ", reason=" - + reason - + ", duration=" - + duration - + '}'; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - AmdAnswerStatusType status; - AmdAnswerReasonType reason; - Integer duration; - - public Builder setStatus(AmdAnswerStatusType status) { - this.status = status; - return this; - } - - public Builder setReason(AmdAnswerReasonType reason) { - this.reason = reason; - return this; - } - - public Builder setDuration(Integer duration) { - this.duration = duration; - return this; - } - - public AmdAnswer build() { - return new AmdAnswer(status, reason, duration); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/AmdAnswerReasonType.java b/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/AmdAnswerReasonType.java deleted file mode 100644 index b73d8fb99..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/AmdAnswerReasonType.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.sinch.sdk.domains.voice.models.webhooks; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -/** The reason that the system used to determine who answered the call. */ -public class AmdAnswerReasonType extends EnumDynamic { - - /** If the greeting is too long, this could be indicative of an answering machine. */ - public static final AmdAnswerReasonType LONG_GREETING = new AmdAnswerReasonType("longgreeting"); - - /** - * If there is an initial silence after the call is answered before the greeting starts, this - * could be indicative of an answering machine. - */ - public static final AmdAnswerReasonType INITIAL_SILENCE = - new AmdAnswerReasonType("initialsilence"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - AmdAnswerReasonType.class, - AmdAnswerReasonType::new, - Arrays.asList(LONG_GREETING, INITIAL_SILENCE)); - - private AmdAnswerReasonType(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static AmdAnswerReasonType from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(AmdAnswerReasonType e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/AmdAnswerStatusType.java b/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/AmdAnswerStatusType.java deleted file mode 100644 index 711d4c653..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/AmdAnswerStatusType.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.sinch.sdk.domains.voice.models.webhooks; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -/** The status of a call */ -public class AmdAnswerStatusType extends EnumDynamic { - - /** An answering machine was detected as answering the call. */ - public static final AmdAnswerStatusType MACHINE = new AmdAnswerStatusType("machine"); - - /** A human was detected as answering the call. */ - public static final AmdAnswerStatusType HUMAN = new AmdAnswerStatusType("human"); - - /** The system was unable to determine who answered the call. */ - public static final AmdAnswerStatusType NOTSURE = new AmdAnswerStatusType("notsure"); - - /** The call was hung up. */ - public static final AmdAnswerStatusType HANGUP = new AmdAnswerStatusType("hangup"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - AmdAnswerStatusType.class, - AmdAnswerStatusType::new, - Arrays.asList(MACHINE, HUMAN, NOTSURE, HANGUP)); - - private AmdAnswerStatusType(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static AmdAnswerStatusType from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(AmdAnswerStatusType e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/AnsweredCallEvent.java b/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/AnsweredCallEvent.java deleted file mode 100644 index 6ebdec096..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/AnsweredCallEvent.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.sinch.sdk.domains.voice.models.webhooks; - -import java.time.Instant; - -/** - * This callback is made when the call is picked up by the callee (person receiving the call). - * - *

It's a POST request to the specified calling callback URL. Look here for allowed {@link - * com.sinch.sdk.domains.voice.models.svaml.Action instructions} and {@link - * com.sinch.sdk.domains.voice.models.svaml.Instruction actions}. - * - *

If there is no response to the callback within the timeout period, the call is connected. - * - *

If you have Answering Machine Detection (AMD) enabled, the amd - * object will also be present on ACE callbacks. - * - *

Note: ACE Callbacks are not issued for InApp Calls (destination: username), only PSTN and SIP - * calls. - * - * @see ACE - */ -public class AnsweredCallEvent extends CallEvent { - - private final AmdAnswer amd; - - private AnsweredCallEvent( - String callId, Instant timestamp, Integer version, String custom, AmdAnswer amd) { - super(callId, timestamp, version, custom); - this.amd = amd; - } - - /** - * If Answering Machine Detection is enabled, this object contains information about whether the - * call was answered by a machine. - * - * @return AMD Answer value - */ - public AmdAnswer getAmd() { - return amd; - } - - @Override - public String toString() { - return "AnsweredCallEvent{" + "amd=" + amd + "} " + super.toString(); - } - - public static Builder builder() { - return new Builder<>(); - } - - public static class Builder> extends CallEvent.Builder> { - - AmdAnswer amd; - - public Builder setAmd(AmdAnswer amd) { - this.amd = amd; - return this; - } - - public AnsweredCallEvent build() { - return new AnsweredCallEvent(callId, timestamp, version, custom, amd); - } - - @Override - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/CallEvent.java b/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/CallEvent.java deleted file mode 100644 index 644f42ed9..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/CallEvent.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.sinch.sdk.domains.voice.models.webhooks; - -import java.time.Instant; - -/** Base class for webhooks call event */ -public class CallEvent extends WebhooksEvent { - - private final Instant timestamp; - private final String custom; - - protected CallEvent(String callId, Instant timestamp, Integer version, String custom) { - super(callId, version); - this.timestamp = timestamp; - this.custom = custom; - } - - /** - * Event timestamp - * - * @return Timestamp value - */ - public Instant getTimestamp() { - return timestamp; - } - - /** - * A string that can be used to pass custom information related to the call. - * - * @return The custom value used for call - */ - public String getCustom() { - return custom; - } - - @Override - public String toString() { - return "CallEvent{" + "timestamp=" + timestamp + ", custom='" + custom + '\'' + '}'; - } - - public static Builder builder() { - return new Builder<>(); - } - - public static class Builder> extends WebhooksEvent.Builder { - - Instant timestamp; - String custom; - - public B setTimestamp(Instant timestamp) { - this.timestamp = timestamp; - return self(); - } - - public B setCustom(String custom) { - this.custom = custom; - return self(); - } - - public CallEvent build() { - return new CallEvent(callId, timestamp, version, custom); - } - - @Override - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/DisconnectCallEvent.java b/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/DisconnectCallEvent.java deleted file mode 100644 index 7429a2d1f..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/DisconnectCallEvent.java +++ /dev/null @@ -1,229 +0,0 @@ -package com.sinch.sdk.domains.voice.models.webhooks; - -import com.sinch.sdk.domains.voice.models.CallReasonType; -import com.sinch.sdk.domains.voice.models.CallResultType; -import com.sinch.sdk.domains.voice.models.Destination; -import com.sinch.sdk.domains.voice.models.Price; -import java.time.Instant; - -/** - * This callback is made when the call is disconnected. - * - *

It's a POST request to the specified calling callback URL. This event doesn't support - * instructions and only supports the hangup action. - * - * @see DICE - */ -public class DisconnectCallEvent extends CallEvent { - - private final CallReasonType reason; - private final CallResultType result; - private final Price debit; - private final Price userRate; - private final Destination to; - private final String applicationKey; - private final Integer duration; - private final String from; - - private DisconnectCallEvent( - String callId, - Instant timestamp, - Integer version, - String custom, - CallReasonType reason, - CallResultType result, - Price debit, - Price userRate, - Destination to, - String applicationKey, - Integer duration, - String from) { - super(callId, timestamp, version, custom); - this.reason = reason; - this.result = result; - this.debit = debit; - this.userRate = userRate; - this.to = to; - this.applicationKey = applicationKey; - this.duration = duration; - this.from = from; - } - - /** - * The reason the call was disconnected - * - * @return Reason value - */ - public CallReasonType getReason() { - return reason; - } - - /** - * The result of the call - * - * @return Result value - */ - public CallResultType getResult() { - return result; - } - - /** - * Amount charged for the call - * - * @return charge value - */ - public Price getDebit() { - return debit; - } - - /** - * Rate per minute for the call - * - * @return rate value - */ - public Price getUserRate() { - return userRate; - } - - /** - * Information about the recipient of the call - * - * @return Recipient information - */ - public Destination getTo() { - return to; - } - - /** - * The unique application key - * - * @return Application key value - */ - public String getApplicationKey() { - return applicationKey; - } - - /** - * The duration of the call in seconds - * - * @return Call duration - */ - public Integer getDuration() { - return duration; - } - - /** - * Information about the initiator of the call. - * - * @return Initiator information - */ - public String getFrom() { - return from; - } - - @Override - public String toString() { - return "DisconnectCallEvent{" - + "reason='" - + reason - + '\'' - + ", result='" - + result - + '\'' - + ", debit=" - + debit - + ", userRate=" - + userRate - + ", to=" - + to - + ", applicationKey='" - + applicationKey - + '\'' - + ", duration=" - + duration - + ", from='" - + from - + '\'' - + "} " - + super.toString(); - } - - public static Builder builder() { - return new Builder<>(); - } - - public static class Builder> extends CallEvent.Builder> { - - CallReasonType reason; - CallResultType result; - Price debit; - Price userRate; - Destination to; - String applicationKey; - Integer duration; - String from; - - public B setReason(CallReasonType reason) { - this.reason = reason; - return self(); - } - - public B setResult(CallResultType result) { - this.result = result; - return self(); - } - - public B setDebit(Price debit) { - this.debit = debit; - return self(); - } - - public B setUserRate(Price userRate) { - this.userRate = userRate; - return self(); - } - - public B setTo(Destination to) { - this.to = to; - return self(); - } - - public B setApplicationKey(String applicationKey) { - this.applicationKey = applicationKey; - return self(); - } - - public B setDuration(Integer duration) { - this.duration = duration; - return self(); - } - - public B setFrom(String from) { - this.from = from; - return self(); - } - - public DisconnectCallEvent build() { - return new DisconnectCallEvent( - callId, - timestamp, - version, - custom, - reason, - result, - debit, - userRate, - to, - applicationKey, - duration, - from); - } - - @Override - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/IncomingCallEvent.java b/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/IncomingCallEvent.java deleted file mode 100644 index f250db15c..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/IncomingCallEvent.java +++ /dev/null @@ -1,285 +0,0 @@ -package com.sinch.sdk.domains.voice.models.webhooks; - -import com.sinch.sdk.core.utils.Pair; -import com.sinch.sdk.domains.voice.models.Destination; -import com.sinch.sdk.domains.voice.models.DomainType; -import com.sinch.sdk.domains.voice.models.Price; -import com.sinch.sdk.domains.voice.models.webhooks.CallEvent.Builder; -import java.time.Instant; -import java.util.Collection; - -/** - * This event, called the ICE event, can be triggered by either an incoming data call or an incoming - * PSTN call. - * - *

It's a POST request to the specified calling callback URL. Look here for allowed {@link - * com.sinch.sdk.domains.voice.models.svaml.Action instructions} and {@link - * com.sinch.sdk.domains.voice.models.svaml.Instruction actions}. - * - *

If there is no response to the callback within the timeout period, an error message is played, - * and the call is disconnected. - * - * @see ICE - */ -public class IncomingCallEvent extends CallEvent { - - private final String callResourceUrl; - private final Price userRate; - private final String cli; - private final Destination to; - private final DomainType domain; - private final String applicationKey; - private final DomainType originationType; - private final Integer duration; - private final String rdnis; - private final Collection> callHeaders; - - private IncomingCallEvent( - String callId, - Instant timestamp, - Integer version, - String custom, - String callResourceUrl, - Price userRate, - String cli, - Destination to, - DomainType domain, - String applicationKey, - DomainType originationType, - Integer duration, - String rdnis, - Collection> callHeaders) { - super(callId, timestamp, version, custom); - this.callResourceUrl = callResourceUrl; - this.userRate = userRate; - this.cli = cli; - this.to = to; - this.domain = domain; - this.applicationKey = applicationKey; - this.originationType = originationType; - this.duration = duration; - this.rdnis = rdnis; - this.callHeaders = callHeaders; - } - - /** - * The path of the API resource - * - * @return path value - */ - public String getCallResourceUrl() { - return callResourceUrl; - } - - /** - * Charged for the call established to the original destination. If the SVAML response specifies - * another destination, the same rate may not apply. - * - * @return charged value - */ - public Price getUserRate() { - return userRate; - } - - /** - * The number that will be displayed to the recipient of the call. - * - *

To set your own CLI, you may use your verified number or your Dashboard virtual number and - * add it to the {@link com.sinch.sdk.domains.voice.models.svaml.ActionConnectPstn - * ActionConnectPstn} SVAML response to the Incoming Call Event request. - * - * @return - */ - public String getCli() { - return cli; - } - - /** - * Information about the recipient of the call - * - * @return information value - */ - public Destination getTo() { - return to; - } - - /** - * The domain destination of the incoming call - * - * @return Domain value - */ - public DomainType getDomain() { - return domain; - } - - /** - * The unique application key - * - * @return Application key value - */ - public String getApplicationKey() { - return applicationKey; - } - - /** - * The origination domain of the incoming call - * - * @return Origin type - */ - public DomainType getOriginationType() { - return originationType; - } - - /** - * The duration of the call in seconds - * - * @return Duration value - */ - public Integer getDuration() { - return duration; - } - - /** - * The redirected dialled number identification service - * - * @return RDNIS value - */ - public String getRdnis() { - return rdnis; - } - - /** - * If the call is initiated by a Sinch SDK client, call headers are the headers specified by the - * caller client. Read more about call headers here - * - * @return Headers - */ - public Collection> getCallHeaders() { - return callHeaders; - } - - @Override - public String toString() { - return "IncomingCallEvent{" - + "callResourceUrl='" - + callResourceUrl - + '\'' - + ", userRate=" - + userRate - + ", cli='" - + cli - + '\'' - + ", to=" - + to - + ", domain=" - + domain - + ", applicationKey='" - + applicationKey - + '\'' - + ", originationType=" - + originationType - + ", duration=" - + duration - + ", rdnis='" - + rdnis - + '\'' - + ", callHeaders=" - + callHeaders - + "} " - + super.toString(); - } - - public static Builder builder() { - return new Builder<>(); - } - - public static class Builder> extends CallEvent.Builder> { - - String callResourceUrl; - Price userRate; - String cli; - Destination to; - DomainType domain; - String applicationKey; - DomainType originationType; - Integer duration; - String rdnis; - Collection> callHeaders; - - public B setCallResourceUrl(String callResourceUrl) { - this.callResourceUrl = callResourceUrl; - return self(); - } - - public B setUserRate(Price userRate) { - this.userRate = userRate; - return self(); - } - - public B setCli(String cli) { - this.cli = cli; - return self(); - } - - public B setTo(Destination to) { - this.to = to; - return self(); - } - - public B setDomain(DomainType domain) { - this.domain = domain; - return self(); - } - - public B setApplicationKey(String applicationKey) { - this.applicationKey = applicationKey; - return self(); - } - - public B setOriginationType(DomainType originationType) { - this.originationType = originationType; - return self(); - } - - public B setDuration(Integer duration) { - this.duration = duration; - return self(); - } - - public B setRdnis(String rdnis) { - this.rdnis = rdnis; - return self(); - } - - public B setCallHeaders(Collection> callHeaders) { - this.callHeaders = callHeaders; - return self(); - } - - public IncomingCallEvent build() { - return new IncomingCallEvent( - callId, - timestamp, - version, - custom, - callResourceUrl, - userRate, - cli, - to, - domain, - applicationKey, - originationType, - duration, - rdnis, - callHeaders); - } - - @Override - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/MenuInputType.java b/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/MenuInputType.java deleted file mode 100644 index 9308885d3..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/MenuInputType.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.sinch.sdk.domains.voice.models.webhooks; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -/** The type of information that's returned */ -public class MenuInputType extends EnumDynamic { - - /** Returned if there's an error with the input. */ - public static final MenuInputType ERROR = new MenuInputType("error"); - - /** Returned when the event has been triggered from a return command */ - public static final MenuInputType RETURN = new MenuInputType("return"); - - /** Returned when the event has been triggered from collecting DTMF digits */ - public static final MenuInputType SEQUENCE = new MenuInputType("sequence"); - - /** Returned when the timeout period has elapsed */ - public static final MenuInputType TIMEOUT = new MenuInputType("timeout"); - - /** Returned when the call is hung up */ - public static final MenuInputType HANGUP = new MenuInputType("hangup"); - - /** InvalidInput */ - public static final MenuInputType INVALID_INPUT = new MenuInputType("invalidinput"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - MenuInputType.class, - MenuInputType::new, - Arrays.asList(ERROR, RETURN, SEQUENCE, TIMEOUT, HANGUP, INVALID_INPUT)); - - private MenuInputType(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static MenuInputType from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(MenuInputType e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/MenuResult.java b/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/MenuResult.java deleted file mode 100644 index 2a3c0a9ed..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/MenuResult.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.sinch.sdk.domains.voice.models.webhooks; - -public class MenuResult { - - private final String menuId; - private final MenuInputType type; - private final String value; - private final MenuResultInputMethodType inputMethod; - - private MenuResult( - String menuId, MenuInputType type, String value, MenuResultInputMethodType inputMethod) { - this.menuId = menuId; - this.type = type; - this.value = value; - this.inputMethod = inputMethod; - } - - public String getMenuId() { - return menuId; - } - - public MenuInputType getType() { - return type; - } - - public String getValue() { - return value; - } - - public MenuResultInputMethodType getInputMethod() { - return inputMethod; - } - - @Override - public String toString() { - return "MenuResult{" - + "menuId='" - + menuId - + '\'' - + ", type=" - + type - + ", value='" - + value - + '\'' - + ", inputMethod=" - + inputMethod - + '}'; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - String menuId; - MenuInputType type; - String value; - MenuResultInputMethodType inputMethod; - - public Builder setMenuId(String menuId) { - this.menuId = menuId; - return this; - } - - public Builder setType(MenuInputType type) { - this.type = type; - return this; - } - - public Builder setValue(String value) { - this.value = value; - return this; - } - - public Builder setInputMethod(MenuResultInputMethodType inputMethod) { - this.inputMethod = inputMethod; - return this; - } - - public MenuResult build() { - return new MenuResult(menuId, type, value, inputMethod); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/MenuResultInputMethodType.java b/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/MenuResultInputMethodType.java deleted file mode 100644 index 0c4965eef..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/MenuResultInputMethodType.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.sinch.sdk.domains.voice.models.webhooks; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -/** The type of input received. */ -public class MenuResultInputMethodType extends EnumDynamic { - - /** The input is key presses of specified digits */ - public static final MenuResultInputMethodType DTMF = new MenuResultInputMethodType("dtmf"); - - /** The input is voice answers */ - public static final MenuResultInputMethodType VOICE = new MenuResultInputMethodType("voice"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - MenuResultInputMethodType.class, - MenuResultInputMethodType::new, - Arrays.asList(VOICE, DTMF)); - - private MenuResultInputMethodType(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static MenuResultInputMethodType from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(MenuResultInputMethodType e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/NotifyEvent.java b/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/NotifyEvent.java deleted file mode 100644 index a48be7115..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/NotifyEvent.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.sinch.sdk.domains.voice.models.webhooks; - -/** - * This is the general callback used to send notifications. It's a POST request to the specified - * calling callback URL. - * - *

If there is no response to the callback within the timeout period, the notification is - * discarded. - */ -public class NotifyEvent extends WebhooksEvent { - - private final String custom; - private final String type; - - private NotifyEvent(String callId, Integer version, String custom, String type) { - super(callId, version); - this.custom = custom; - this.type = type; - } - - /** - * An optional parameter containing notification-specific information - * - * @return custom value - */ - public String getCustom() { - return custom; - } - - /** - * The type of information communicated in the notification - * - * @return type value - */ - public String getType() { - return type; - } - - @Override - public String toString() { - return "NotifyEvent{" - + "custom='" - + custom - + '\'' - + ", type='" - + type - + '\'' - + "} " - + super.toString(); - } - - public static Builder builder() { - return new Builder<>(); - } - - public static class Builder> extends WebhooksEvent.Builder> { - - String custom; - String type; - - public B setCustom(String custom) { - this.custom = custom; - return self(); - } - - public B setType(String type) { - this.type = type; - return self(); - } - - public NotifyEvent build() { - return new NotifyEvent(callId, version, custom, type); - } - - @Override - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/PromptInputEvent.java b/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/PromptInputEvent.java deleted file mode 100644 index d22141437..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/PromptInputEvent.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.sinch.sdk.domains.voice.models.webhooks; - -import java.time.Instant; - -/** - * This callback is triggered as a result of a {@link - * com.sinch.sdk.domains.voice.models.svaml.ActionRunMenu runMenu} action. It can be triggered from - * either a user pressing a number of DTMF digits, or by the {@link - * com.sinch.sdk.domains.voice.models.svaml.MenuOptionActionType#RETURN return} command. - * - *

It's a POST request to the specified calling callback URL. Your application can respond with - * {@link com.sinch.sdk.domains.voice.models.svaml SVAML} logic. - * - *

Note: PIE callbacks are not issued for DATA Calls, only PSTN and SIP calls. - * - * @see PIE - */ -public class PromptInputEvent extends CallEvent { - - private final String applicationKey; - private final MenuResult menuResult; - - private PromptInputEvent( - String callId, - Instant timestamp, - Integer version, - String custom, - String applicationKey, - MenuResult menuResult) { - super(callId, timestamp, version, custom); - this.applicationKey = applicationKey; - this.menuResult = menuResult; - } - - /** - * The unique application key - * - * @return Application key value - */ - public String getApplicationKey() { - return applicationKey; - } - - /** - * Information about the returned menu result - * - * @return Menu - */ - public MenuResult getMenuResult() { - return menuResult; - } - - @Override - public String toString() { - return "PromptInputEvent{" - + "applicationKey='" - + applicationKey - + '\'' - + ", menuResult=" - + menuResult - + "} " - + super.toString(); - } - - public static Builder builder() { - return new Builder<>(); - } - - public static class Builder> extends CallEvent.Builder> { - - String applicationKey; - MenuResult menuResult; - - public Builder setApplicationKey(String applicationKey) { - this.applicationKey = applicationKey; - return this; - } - - public Builder setMenuResult(MenuResult menuResult) { - this.menuResult = menuResult; - return this; - } - - public PromptInputEvent build() { - return new PromptInputEvent(callId, timestamp, version, custom, applicationKey, menuResult); - } - - @Override - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/WebhooksEvent.java b/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/WebhooksEvent.java deleted file mode 100644 index a8160e755..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/WebhooksEvent.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.sinch.sdk.domains.voice.models.webhooks; - -public class WebhooksEvent { - - private final String callId; - private final Integer version; - - protected WebhooksEvent(String callId, Integer version) { - this.callId = callId; - this.version = version; - } - - /** - * The unique ID assigned to call related to this event - * - * @return Call ID value - */ - public String getCallId() { - return callId; - } - - /** - * The current API version - * - * @return API version sending the event - */ - public Integer getVersion() { - return version; - } - - @Override - public String toString() { - return "CallEvent{" + "callId='" + callId + '\'' + ", version=" + version + '}'; - } - - public static Builder builder() { - return new Builder<>(); - } - - public static class Builder> { - - String callId; - Integer version; - - public B setCallId(String callId) { - this.callId = callId; - return self(); - } - - public B setVersion(Integer version) { - this.version = version; - return self(); - } - - public WebhooksEvent build() { - return new WebhooksEvent(callId, version); - } - - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/package-info.java b/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/package-info.java deleted file mode 100644 index d21f6bf50..000000000 --- a/client/src/main/com/sinch/sdk/domains/voice/models/webhooks/package-info.java +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Voice API webhooks related models - * - * @since 1.0 - */ -package com.sinch.sdk.domains.voice.models.webhooks; diff --git a/client/src/test/java/com/sinch/sdk/domains/sms/api/v1/adapters/BatchesServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/sms/api/v1/adapters/BatchesServiceTest.java index abcd464fb..8442a09b9 100644 --- a/client/src/test/java/com/sinch/sdk/domains/sms/api/v1/adapters/BatchesServiceTest.java +++ b/client/src/test/java/com/sinch/sdk/domains/sms/api/v1/adapters/BatchesServiceTest.java @@ -22,7 +22,6 @@ import com.sinch.sdk.core.http.URLParameter.STYLE; import com.sinch.sdk.core.http.URLPathUtils; import com.sinch.sdk.core.models.ServerConfiguration; -import com.sinch.sdk.domains.PaginationFillerHelper; import com.sinch.sdk.domains.sms.api.v1.BatchesService; import com.sinch.sdk.domains.sms.models.v1.batches.request.DryRunQueryParameters; import com.sinch.sdk.domains.sms.models.v1.batches.request.ListBatchesQueryParameters; @@ -33,6 +32,7 @@ import com.sinch.sdk.domains.sms.models.v1.batches.response.DryRunResponse; import com.sinch.sdk.domains.sms.models.v1.batches.response.ListBatchesResponse; import com.sinch.sdk.domains.sms.models.v1.batches.response.internal.ApiBatchList; +import com.sinch.sdk.domains.voice.api.v1.adapters.PaginationFillerHelper; import java.time.Instant; import java.util.Arrays; import java.util.Collection; diff --git a/client/src/test/java/com/sinch/sdk/domains/sms/api/v1/adapters/DeliveryReportsServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/sms/api/v1/adapters/DeliveryReportsServiceTest.java index 1b4ef291b..ef18f589f 100644 --- a/client/src/test/java/com/sinch/sdk/domains/sms/api/v1/adapters/DeliveryReportsServiceTest.java +++ b/client/src/test/java/com/sinch/sdk/domains/sms/api/v1/adapters/DeliveryReportsServiceTest.java @@ -22,7 +22,6 @@ import com.sinch.sdk.core.http.URLParameter.STYLE; import com.sinch.sdk.core.http.URLPathUtils; import com.sinch.sdk.core.models.ServerConfiguration; -import com.sinch.sdk.domains.PaginationFillerHelper; import com.sinch.sdk.domains.sms.api.v1.DeliveryReportsService; import com.sinch.sdk.domains.sms.models.v1.deliveryreports.BatchDeliveryReport; import com.sinch.sdk.domains.sms.models.v1.deliveryreports.DeliveryReceiptErrorCode; @@ -31,6 +30,7 @@ import com.sinch.sdk.domains.sms.models.v1.deliveryreports.request.ListDeliveryReportsQueryParameters; import com.sinch.sdk.domains.sms.models.v1.deliveryreports.response.ListDeliveryReportsResponse; import com.sinch.sdk.domains.sms.models.v1.deliveryreports.response.internal.DeliveryReportList; +import com.sinch.sdk.domains.voice.api.v1.adapters.PaginationFillerHelper; import java.time.Instant; import java.util.Arrays; import java.util.Collection; diff --git a/client/src/test/java/com/sinch/sdk/domains/sms/api/v1/adapters/GroupsServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/sms/api/v1/adapters/GroupsServiceTest.java index a920f8212..23ce97bcc 100644 --- a/client/src/test/java/com/sinch/sdk/domains/sms/api/v1/adapters/GroupsServiceTest.java +++ b/client/src/test/java/com/sinch/sdk/domains/sms/api/v1/adapters/GroupsServiceTest.java @@ -22,7 +22,6 @@ import com.sinch.sdk.core.http.URLParameter.STYLE; import com.sinch.sdk.core.http.URLPathUtils; import com.sinch.sdk.core.models.ServerConfiguration; -import com.sinch.sdk.domains.PaginationFillerHelper; import com.sinch.sdk.domains.sms.api.v1.GroupsService; import com.sinch.sdk.domains.sms.models.v1.groups.Group; import com.sinch.sdk.domains.sms.models.v1.groups.request.GroupRequest; @@ -30,6 +29,7 @@ import com.sinch.sdk.domains.sms.models.v1.groups.request.ListGroupsQueryParameters; import com.sinch.sdk.domains.sms.models.v1.groups.response.ListGroupsResponse; import com.sinch.sdk.domains.sms.models.v1.groups.response.internal.ApiGroupList; +import com.sinch.sdk.domains.voice.api.v1.adapters.PaginationFillerHelper; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; diff --git a/client/src/test/java/com/sinch/sdk/domains/sms/api/v1/adapters/InboundsServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/sms/api/v1/adapters/InboundsServiceTest.java index a778b831f..a400b0456 100644 --- a/client/src/test/java/com/sinch/sdk/domains/sms/api/v1/adapters/InboundsServiceTest.java +++ b/client/src/test/java/com/sinch/sdk/domains/sms/api/v1/adapters/InboundsServiceTest.java @@ -22,13 +22,13 @@ import com.sinch.sdk.core.http.URLParameter.STYLE; import com.sinch.sdk.core.http.URLPathUtils; import com.sinch.sdk.core.models.ServerConfiguration; -import com.sinch.sdk.domains.PaginationFillerHelper; import com.sinch.sdk.domains.sms.api.v1.InboundsService; import com.sinch.sdk.domains.sms.models.v1.inbounds.InboundMessage; import com.sinch.sdk.domains.sms.models.v1.inbounds.TextMessage; import com.sinch.sdk.domains.sms.models.v1.inbounds.request.ListInboundMessagesQueryParameters; import com.sinch.sdk.domains.sms.models.v1.inbounds.response.ListInboundsResponse; import com.sinch.sdk.domains.sms.models.v1.inbounds.response.internal.ApiInboundList; +import com.sinch.sdk.domains.voice.api.v1.adapters.PaginationFillerHelper; import java.time.Instant; import java.util.Arrays; import java.util.Collection; diff --git a/client/src/test/java/com/sinch/sdk/domains/voice/adapters/ApplicationsServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/voice/adapters/ApplicationsServiceTest.java deleted file mode 100644 index 978b263a3..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/voice/adapters/ApplicationsServiceTest.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.sinch.sdk.domains.voice.adapters; - -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import com.adelean.inject.resources.junit.jupiter.TestWithResources; -import com.sinch.sdk.BaseTest; -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.domains.voice.adapters.converters.ApplicationsDtoConverter; -import com.sinch.sdk.domains.voice.adapters.converters.ApplicationsDtoConverterTest; -import com.sinch.sdk.domains.voice.models.CallbackUrls; -import com.sinch.sdk.domains.voice.models.response.AssignedNumbers; -import com.sinch.sdk.domains.voice.models.v1.applications.Callbacks; -import com.sinch.sdk.domains.voice.models.v1.applications.request.UnAssignNumberRequest; -import com.sinch.sdk.domains.voice.models.v1.applications.request.UpdateNumbersRequest; -import com.sinch.sdk.domains.voice.models.v1.applications.response.GetCallbackUrlsResponseTest; -import com.sinch.sdk.domains.voice.models.v1.applications.response.OwnedNumbersResponseTest; -import com.sinch.sdk.models.E164PhoneNumber; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.Mock; - -@TestWithResources -public class ApplicationsServiceTest extends BaseTest { - - @Mock com.sinch.sdk.domains.voice.api.v1.ApplicationsService v1; - - @Captor ArgumentCaptor applicationKeyCaptor; - @Captor ArgumentCaptor callbacksDtoCaptor; - @Captor ArgumentCaptor updateNumbersRequestDtoCaptor; - @Captor ArgumentCaptor unAssignNumberRequestDtoCaptor; - - ApplicationsService service; - - @BeforeEach - public void initMocks() { - service = spy(new ApplicationsService(v1)); - } - - @Test - void getNumbers() throws ApiException { - - when(v1.listNumbers()).thenReturn(OwnedNumbersResponseTest.expected); - - AssignedNumbers response = service.listNumbers(); - - TestHelpers.recursiveEquals( - response, ApplicationsDtoConverterTest.expectedAssignedNumbersResponse); - } - - @Test - void getCallbackUrls() throws ApiException { - when(v1.getCallbackUrls(eq("app id"))).thenReturn(GetCallbackUrlsResponseTest.expected); - - CallbackUrls response = service.getCallbackUrls("app id"); - - TestHelpers.recursiveEquals( - response, ApplicationsDtoConverterTest.expectedApplicationsCallbackUrls); - } - - @Test - void updateCallbackUrls() { - - service.updateCallbackUrls( - "app key", ApplicationsDtoConverterTest.expectedApplicationsCallbackUrls); - - verify(v1).updateCallbackUrls(applicationKeyCaptor.capture(), callbacksDtoCaptor.capture()); - - String appKey = applicationKeyCaptor.getValue(); - Assertions.assertThat(appKey).isEqualTo("app key"); - - Callbacks body = callbacksDtoCaptor.getValue(); - TestHelpers.recursiveEquals( - body, - ApplicationsDtoConverter.convert( - ApplicationsDtoConverterTest.expectedApplicationsCallbackUrls)); - } - - @Test - void updateNumbers() { - service.assignNumbers( - ApplicationsDtoConverterTest.expectedApplicationsAssignNumbersRequestParameters); - - verify(v1).assignNumbers(updateNumbersRequestDtoCaptor.capture()); - - UpdateNumbersRequest body = updateNumbersRequestDtoCaptor.getValue(); - TestHelpers.recursiveEquals( - body, - ApplicationsDtoConverter.convert( - ApplicationsDtoConverterTest.expectedApplicationsAssignNumbersRequestParameters)); - } - - @Test - void unassignNumber() { - service.unassignNumber(E164PhoneNumber.valueOf("+12345678"), "application key"); - - verify(v1).unassignNumber(unAssignNumberRequestDtoCaptor.capture()); - - UnAssignNumberRequest body = unAssignNumberRequestDtoCaptor.getValue(); - TestHelpers.recursiveEquals( - body, - ApplicationsDtoConverter.convert(E164PhoneNumber.valueOf("+12345678"), "application key")); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/voice/adapters/CalloutsServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/voice/adapters/CalloutsServiceTest.java deleted file mode 100644 index e16426486..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/voice/adapters/CalloutsServiceTest.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.sinch.sdk.domains.voice.adapters; - -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - -import com.adelean.inject.resources.junit.jupiter.TestWithResources; -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.domains.voice.models.requests.CalloutRequestParametersConferenceTest; -import com.sinch.sdk.domains.voice.models.requests.CalloutRequestParametersCustomTest; -import com.sinch.sdk.domains.voice.models.requests.CalloutRequestParametersTTSTest; -import com.sinch.sdk.domains.voice.models.v1.callouts.CalloutResponseDtoTest; -import com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequest; -import com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequestConference; -import com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequestCustom; -import com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequestTTS; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.mockito.Mock; - -@TestWithResources -public class CalloutsServiceTest extends VoiceBaseTest { - - @Mock com.sinch.sdk.domains.voice.api.v1.CalloutsService v1; - CalloutsService service; - - @BeforeEach - public void initMocks() { - service = spy(new CalloutsService(v1)); - } - - @Test - void conference() throws ApiException { - - when(v1.conference(any(CalloutRequestConference.class))) - .thenReturn(CalloutResponseDtoTest.expectedCalloutResponseDto.getCallId()); - - String response = - service.conference(CalloutRequestParametersConferenceTest.conferenceRequestParameters); - - Assertions.assertThat(response) - .isEqualTo(CalloutResponseDtoTest.expectedCalloutResponseDto.getCallId()); - } - - @Test - void textToSpeech() throws ApiException { - - when(v1.textToSpeech(any(CalloutRequestTTS.class))) - .thenReturn(CalloutResponseDtoTest.expectedCalloutResponseDto.getCallId()); - - String response = service.textToSpeech(CalloutRequestParametersTTSTest.ttsRequestParameters); - - Assertions.assertThat(response) - .isEqualTo(CalloutResponseDtoTest.expectedCalloutResponseDto.getCallId()); - } - - @Test - void custom() throws ApiException { - - when(v1.custom(any(CalloutRequestCustom.class))) - .thenReturn(CalloutResponseDtoTest.expectedCalloutResponseDto.getCallId()); - - String response = service.custom(CalloutRequestParametersCustomTest.customRequestParameters); - - Assertions.assertThat(response) - .isEqualTo(CalloutResponseDtoTest.expectedCalloutResponseDto.getCallId()); - } - - @Test - void call() throws ApiException { - - when(v1.call(any(CalloutRequest.class))) - .thenReturn(CalloutResponseDtoTest.expectedCalloutResponseDto.getCallId()); - - String response = service.call(CalloutRequestParametersCustomTest.customRequestParameters); - - Assertions.assertThat(response) - .isEqualTo(CalloutResponseDtoTest.expectedCalloutResponseDto.getCallId()); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/voice/adapters/CallsServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/voice/adapters/CallsServiceTest.java deleted file mode 100644 index 8f7775a24..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/voice/adapters/CallsServiceTest.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.sinch.sdk.domains.voice.adapters; - -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import com.adelean.inject.resources.junit.jupiter.TestWithResources; -import com.sinch.sdk.BaseTest; -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.domains.voice.adapters.converters.CallsDtoConverterTest; -import com.sinch.sdk.domains.voice.models.CallLegType; -import com.sinch.sdk.domains.voice.models.response.CallInformation; -import com.sinch.sdk.domains.voice.models.svaml.SVAMLControlTest; -import com.sinch.sdk.domains.voice.models.v1.calls.CallInformationTest; -import com.sinch.sdk.domains.voice.models.v1.calls.request.CallLeg; -import com.sinch.sdk.domains.voice.models.v1.svaml.SvamlControl; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.Mock; - -@TestWithResources -public class CallsServiceTest extends BaseTest { - - @Mock com.sinch.sdk.domains.voice.api.v1.CallsService v1; - - @Captor ArgumentCaptor callIdCaptor; - @Captor ArgumentCaptor callLegCaptor; - @Captor ArgumentCaptor updateParametersCaptor; - CallsService service; - - @BeforeEach - public void initMocks() { - service = spy(new CallsService(v1)); - } - - @Test - void get() throws ApiException { - when(v1.get(eq(CallInformationTest.expectedCallsGetInformationResponseDto.getCallId()))) - .thenReturn(CallInformationTest.expectedCallsGetInformationResponseDto); - - CallInformation response = - service.get(CallInformationTest.expectedCallsGetInformationResponseDto.getCallId()); - - TestHelpers.recursiveEquals(response, CallsDtoConverterTest.expectedCallInformation); - } - - @Test - void update() throws ApiException { - service.update("call id", SVAMLControlTest.parameters); - - verify(v1).update(callIdCaptor.capture(), updateParametersCaptor.capture()); - - String callId = callIdCaptor.getValue(); - Assertions.assertThat(callId).isEqualTo("call id"); - - SvamlControl body = updateParametersCaptor.getValue(); - TestHelpers.recursiveEquals(body, CallsDtoConverterTest.svamlControlDto); - } - - @Test - void manageWithCallLeg() throws ApiException { - - service.manageWithCallLeg("call id", CallLegType.BOTH, SVAMLControlTest.parameters); - - verify(v1) - .manageWithCallLeg( - callIdCaptor.capture(), callLegCaptor.capture(), updateParametersCaptor.capture()); - - String callId = callIdCaptor.getValue(); - Assertions.assertThat(callId).isEqualTo("call id"); - - CallLeg legType = callLegCaptor.getValue(); - Assertions.assertThat(legType).isEqualTo(CallLeg.BOTH); - - SvamlControl body = updateParametersCaptor.getValue(); - Assertions.assertThat(body).isEqualTo(CallsDtoConverterTest.svamlControlDto); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/voice/adapters/ConferencesServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/voice/adapters/ConferencesServiceTest.java deleted file mode 100644 index acde2ff1c..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/voice/adapters/ConferencesServiceTest.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.sinch.sdk.domains.voice.adapters; - -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import com.adelean.inject.resources.junit.jupiter.TestWithResources; -import com.sinch.sdk.BaseTest; -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.domains.voice.adapters.converters.ConferencesDtoConverterTest; -import com.sinch.sdk.domains.voice.models.requests.CalloutRequestParametersConferenceTest; -import com.sinch.sdk.domains.voice.models.requests.ConferenceManageParticipantRequestParametersTest; -import com.sinch.sdk.domains.voice.models.response.ConferenceParticipant; -import com.sinch.sdk.domains.voice.models.v1.callouts.CalloutRequestDtoTest; -import com.sinch.sdk.domains.voice.models.v1.callouts.CalloutResponseDtoTest; -import com.sinch.sdk.domains.voice.models.v1.conferences.request.ConferencesRequestDtoTest; -import com.sinch.sdk.domains.voice.models.v1.conferences.request.ManageConferenceParticipantRequest; -import com.sinch.sdk.domains.voice.models.v1.conferences.response.ConferencesResponseDtoTest; -import java.util.Collection; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.Mock; - -@TestWithResources -public class ConferencesServiceTest extends BaseTest { - - @Mock com.sinch.sdk.domains.voice.api.v1.ConferencesService v1; - - @Captor ArgumentCaptor conferenceIdCaptor; - @Captor ArgumentCaptor callIdCaptor; - @Captor ArgumentCaptor participantCaptor; - ConferencesService service; - - @BeforeEach - public void initMocks() { - service = spy(new ConferencesService(v1)); - } - - @Test - void call() throws ApiException { - - when(v1.call(eq(CalloutRequestDtoTest.conferenceRequestCalloutDto))) - .thenReturn(CalloutResponseDtoTest.expectedCalloutResponseDto.getCallId()); - - String response = - service.call(CalloutRequestParametersConferenceTest.conferenceRequestParameters); - - Assertions.assertThat(response) - .isEqualTo(CalloutResponseDtoTest.expectedCalloutResponseDto.getCallId()); - } - - @Test - void get() throws ApiException { - - when(v1.get(eq(CalloutRequestDtoTest.conferenceRequestCalloutDto.getConferenceId()))) - .thenReturn(ConferencesResponseDtoTest.expectedGetConferenceInfoResponseDto); - - Collection response = - service.get(CalloutRequestDtoTest.conferenceRequestCalloutDto.getConferenceId()); - - TestHelpers.recursiveEquals( - response, ConferencesDtoConverterTest.expectedConferenceGetInfoResponse); - } - - @Test - void kickParticipant() throws ApiException { - service.kickParticipant( - CalloutRequestDtoTest.conferenceRequestCalloutDto.getConferenceId(), - CalloutResponseDtoTest.expectedCalloutResponseDto.getCallId()); - verify(v1).kickParticipant(conferenceIdCaptor.capture(), callIdCaptor.capture()); - - String parameter = callIdCaptor.getValue(); - Assertions.assertThat(parameter) - .isEqualTo(CalloutResponseDtoTest.expectedCalloutResponseDto.getCallId()); - parameter = conferenceIdCaptor.getValue(); - Assertions.assertThat(parameter) - .isEqualTo(CalloutRequestDtoTest.conferenceRequestCalloutDto.getConferenceId()); - } - - @Test - void kickAll() throws ApiException { - - service.kickAll(CalloutRequestDtoTest.conferenceRequestCalloutDto.getConferenceId()); - verify(v1).kickAll(conferenceIdCaptor.capture()); - - String parameter = conferenceIdCaptor.getValue(); - Assertions.assertThat(parameter) - .isEqualTo(CalloutRequestDtoTest.conferenceRequestCalloutDto.getConferenceId()); - } - - @Test - void manageParticipant() throws ApiException { - - service.manageParticipant( - CalloutRequestDtoTest.conferenceRequestCalloutDto.getConferenceId(), - CalloutResponseDtoTest.expectedCalloutResponseDto.getCallId(), - ConferenceManageParticipantRequestParametersTest - .conferenceManageParticipantRequestParameters); - - verify(v1) - .manageParticipant( - conferenceIdCaptor.capture(), callIdCaptor.capture(), participantCaptor.capture()); - - String parameter = callIdCaptor.getValue(); - Assertions.assertThat(parameter) - .isEqualTo(CalloutResponseDtoTest.expectedCalloutResponseDto.getCallId()); - parameter = conferenceIdCaptor.getValue(); - Assertions.assertThat(parameter) - .isEqualTo(CalloutRequestDtoTest.conferenceRequestCalloutDto.getConferenceId()); - - ManageConferenceParticipantRequest participant = participantCaptor.getValue(); - Assertions.assertThat(participant) - .isEqualTo(ConferencesRequestDtoTest.manageConferenceParticipantRequestDto); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/voice/adapters/VoiceServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/voice/adapters/VoiceServiceTest.java deleted file mode 100644 index 832562fc0..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/voice/adapters/VoiceServiceTest.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.sinch.sdk.domains.voice.adapters; - - /* Un-versioned Voice service is based onto the versioned 'v1' one: so tests are covered - by v1 */ diff --git a/client/src/test/java/com/sinch/sdk/domains/voice/adapters/converters/ApplicationsDtoConverterTest.java b/client/src/test/java/com/sinch/sdk/domains/voice/adapters/converters/ApplicationsDtoConverterTest.java deleted file mode 100644 index 55a560f00..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/voice/adapters/converters/ApplicationsDtoConverterTest.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.sinch.sdk.domains.voice.adapters.converters; - -import com.adelean.inject.resources.junit.jupiter.TestWithResources; -import com.sinch.sdk.BaseTest; -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.domains.voice.models.ApplicationAssignedNumber; -import com.sinch.sdk.domains.voice.models.ApplicationURL; -import com.sinch.sdk.domains.voice.models.CallbackUrls; -import com.sinch.sdk.domains.voice.models.CapabilityType; -import com.sinch.sdk.domains.voice.models.NumberInformation; -import com.sinch.sdk.domains.voice.models.NumberType; -import com.sinch.sdk.domains.voice.models.Price; -import com.sinch.sdk.domains.voice.models.requests.ApplicationsAssignNumbersRequestParameters; -import com.sinch.sdk.domains.voice.models.response.AssignedNumbers; -import com.sinch.sdk.domains.voice.models.v1.applications.request.UnAssignNumberRequestTest; -import com.sinch.sdk.domains.voice.models.v1.applications.request.UpdateCallbackUrlsRequestTest; -import com.sinch.sdk.domains.voice.models.v1.applications.request.UpdateNumbersRequestTest; -import com.sinch.sdk.domains.voice.models.v1.applications.response.OwnedNumbersResponseTest; -import com.sinch.sdk.domains.voice.models.v1.applications.response.QueryNumberResponseTest; -import com.sinch.sdk.models.E164PhoneNumber; -import java.util.Arrays; -import java.util.Collections; -import org.junit.jupiter.api.Test; - -@TestWithResources -public class ApplicationsDtoConverterTest extends BaseTest { - - public static AssignedNumbers expectedAssignedNumbersResponse = - AssignedNumbers.builder() - .setNumbers( - Arrays.asList( - ApplicationAssignedNumber.builder() - .setNumber(E164PhoneNumber.valueOf("+123456789")) - .setApplicationKey("an application key") - .setCapability(CapabilityType.VOICE) - .build(), - ApplicationAssignedNumber.builder() - .setNumber(E164PhoneNumber.valueOf("+134567890")) - .setCapability(CapabilityType.SMS) - .build())) - .build(); - - public static CallbackUrls expectedApplicationsCallbackUrls = - CallbackUrls.builder() - .setUrl( - ApplicationURL.builder() - .setPrimary("https://foo.com") - .setFallback("https://fallback.foo.com") - .build()) - .build(); - - public static NumberInformation expectedApplicationsNumberInformation = - NumberInformation.builder() - .setCountryId("FR") - .setNumberType(NumberType.MOBILE) - .setNormalizedNumber(E164PhoneNumber.valueOf("+331234567489")) - .setRestricted(true) - .setRate(Price.builder().setCurrencyId("USD").setAmount(0.1850F).build()) - .build(); - - public static ApplicationsAssignNumbersRequestParameters - expectedApplicationsAssignNumbersRequestParameters = - ApplicationsAssignNumbersRequestParameters.builder() - .setNumbers(Collections.singletonList(E164PhoneNumber.valueOf("+12073091712"))) - .setApplicationKey("an app key") - .setCapability(CapabilityType.VOICE) - .build(); - - @Test - void convertGetApplicationsNumbersResponseDto() { - TestHelpers.recursiveEquals( - ApplicationsDtoConverter.convert(OwnedNumbersResponseTest.expected), - expectedAssignedNumbersResponse); - } - - @Test - void convertCallbackUrlsResponseDto() { - TestHelpers.recursiveEquals( - ApplicationsDtoConverter.convert(UpdateCallbackUrlsRequestTest.expected), - expectedApplicationsCallbackUrls); - } - - @Test - void convertCallbackUrlsRequestDto() { - TestHelpers.recursiveEquals( - ApplicationsDtoConverter.convert(expectedApplicationsCallbackUrls), - UpdateCallbackUrlsRequestTest.expected); - } - - @Test - void convertGetQueryNumberDto() { - TestHelpers.recursiveEquals( - ApplicationsDtoConverter.convert(QueryNumberResponseTest.expected), - expectedApplicationsNumberInformation); - } - - @Test - void convertApplicationsUpdateNumberRequestParameters() { - TestHelpers.recursiveEquals( - ApplicationsDtoConverter.convert(expectedApplicationsAssignNumbersRequestParameters), - UpdateNumbersRequestTest.updateNumbersDto); - } - - @Test - void convertUnAssignNumbersDto() { - TestHelpers.recursiveEquals( - ApplicationsDtoConverter.convert(E164PhoneNumber.valueOf("+12073091712"), "an app key"), - UnAssignNumberRequestTest.unAssignNumberDto); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/voice/adapters/converters/CalloutsDtoConverterTest.java b/client/src/test/java/com/sinch/sdk/domains/voice/adapters/converters/CalloutsDtoConverterTest.java deleted file mode 100644 index a77adaa27..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/voice/adapters/converters/CalloutsDtoConverterTest.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.sinch.sdk.domains.voice.adapters.converters; - -import com.adelean.inject.resources.junit.jupiter.TestWithResources; -import com.sinch.sdk.BaseTest; -import com.sinch.sdk.domains.voice.models.requests.CalloutRequestParametersConferenceTest; -import com.sinch.sdk.domains.voice.models.requests.CalloutRequestParametersCustomTest; -import com.sinch.sdk.domains.voice.models.requests.CalloutRequestParametersTTSTest; -import com.sinch.sdk.domains.voice.models.v1.callouts.CalloutRequestDtoTest; -import com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequestCustom; -import com.sinch.sdk.domains.voice.models.v1.destination.DestinationPstn; -import com.sinch.sdk.domains.voice.models.v1.svaml.ControlUrl; -import com.sinch.sdk.domains.voice.models.v1.svaml.SvamlControl; -import com.sinch.sdk.domains.voice.models.v1.svaml.action.ConnectPstnAnsweringMachineDetection; -import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionConnectPstn; -import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionHangup; -import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionSay; -import com.sinch.sdk.models.DualToneMultiFrequency; -import java.util.Arrays; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -@TestWithResources -public class CalloutsDtoConverterTest extends BaseTest { - - @Test - void convertConferenceCallRequest() { - - Assertions.assertThat( - CalloutsDtoConverter.convert( - CalloutRequestParametersConferenceTest.conferenceRequestParameters)) - .usingRecursiveComparison() - .isEqualTo(CalloutRequestDtoTest.conferenceRequestCalloutDto); - } - - @Test - void convertTTSCallRequest() { - - Assertions.assertThat( - CalloutsDtoConverter.convert(CalloutRequestParametersTTSTest.ttsRequestParameters)) - .usingRecursiveComparison() - .isEqualTo(CalloutRequestDtoTest.ttsRequestDto); - } - - @Test - void convertCustomCallRequest() { - - CalloutRequestCustom customRequestDtoDeprecated = - CalloutRequestCustom.builder() - .setDestination(DestinationPstn.from("+14045005000")) - .setCli("+14045001000") - .setDtmf(DualToneMultiFrequency.valueOf("w123#")) - .setCustom("my custom value") - .setMaxDuration(32) - .setIce( - SvamlControl.builder() - .setAction( - SvamlActionConnectPstn.builder() - .setNumber("+12233445566") - .setCli("+12234325234") - .setAmd( - ConnectPstnAnsweringMachineDetection.builder() - .setEnabled(true) - .build()) - .build()) - .build()) - .setAce( - SvamlControl.builder() - .setInstructions( - Arrays.asList( - SvamlInstructionSay.builder() - .setText("Hello, this is a call from Sinch!") - .build())) - .setAction(SvamlActionHangup.DEFAULT) - .build()) - .setPie(ControlUrl.from("https://your-application-server-host/application")) - .build(); - - Assertions.assertThat( - CalloutsDtoConverter.convert( - CalloutRequestParametersCustomTest.customRequestParameters)) - .usingRecursiveComparison() - .isEqualTo(customRequestDtoDeprecated); - } - - @Test - void convertCallResponse() { - - Assertions.assertThat( - CalloutsDtoConverter.convert( - CalloutRequestParametersConferenceTest.conferenceRequestParameters)) - .usingRecursiveComparison() - .isEqualTo(CalloutRequestDtoTest.conferenceRequestCalloutDto); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/voice/adapters/converters/CallsDtoConverterTest.java b/client/src/test/java/com/sinch/sdk/domains/voice/adapters/converters/CallsDtoConverterTest.java deleted file mode 100644 index 078233685..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/voice/adapters/converters/CallsDtoConverterTest.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.sinch.sdk.domains.voice.adapters.converters; - -import com.adelean.inject.resources.junit.jupiter.TestWithResources; -import com.sinch.sdk.BaseTest; -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.domains.voice.models.CallReasonType; -import com.sinch.sdk.domains.voice.models.CallResultType; -import com.sinch.sdk.domains.voice.models.DestinationNumber; -import com.sinch.sdk.domains.voice.models.DestinationUser; -import com.sinch.sdk.domains.voice.models.DomainType; -import com.sinch.sdk.domains.voice.models.Price; -import com.sinch.sdk.domains.voice.models.response.CallInformation; -import com.sinch.sdk.domains.voice.models.response.CallStatusType; -import com.sinch.sdk.domains.voice.models.svaml.SVAMLControlTest; -import com.sinch.sdk.domains.voice.models.v1.calls.CallInformationTest; -import com.sinch.sdk.domains.voice.models.v1.svaml.SvamlControl; -import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionConnectConferenceTest; -import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionAnswerTest; -import java.time.Instant; -import java.util.Collections; -import org.junit.jupiter.api.Test; - -@TestWithResources -public class CallsDtoConverterTest extends BaseTest { - - public static CallInformation expectedCallInformation = - CallInformation.builder() - .setFrom(DestinationUser.valueOf("user name endpoint validation")) - .setTo(DestinationNumber.valueOf("+33123456789")) - .setDomain(DomainType.PSTN) - .setCallId("a call UUID") - .setDuration(138) - .setStatus(CallStatusType.FINAL) - .setResult(CallResultType.ANSWERED) - .setReason(CallReasonType.CALLEE_HANGUP) - .setTimeStamp(Instant.parse("2024-01-08T09:48:12Z")) - .setCustom("{}") - .setUserRate(Price.builder().setCurrencyId("EUR").setAmount(0.1758F).build()) - .setDebit(Price.builder().setCurrencyId("EUR").setAmount(0.5274F).build()) - .build(); - - public static SvamlControl svamlControlDto = - SvamlControl.builder() - .setAction(SvamlActionConnectConferenceTest.dto) - .setInstructions(Collections.singletonList(SvamlInstructionAnswerTest.dto)) - .build(); - - @Test - void convertCallInformation() { - - TestHelpers.recursiveEquals( - CallsDtoConverter.convert(CallInformationTest.expectedCallsGetInformationResponseDto), - expectedCallInformation); - } - - @Test - void convertCallsUpdateRequestParameters() { - - TestHelpers.recursiveEquals( - svamlControlDto, ControlDtoConverter.convertControl(SVAMLControlTest.parameters)); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/voice/adapters/converters/ConferencesDtoConverterTest.java b/client/src/test/java/com/sinch/sdk/domains/voice/adapters/converters/ConferencesDtoConverterTest.java deleted file mode 100644 index 9a68fc154..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/voice/adapters/converters/ConferencesDtoConverterTest.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.sinch.sdk.domains.voice.adapters.converters; - -import com.sinch.sdk.domains.voice.models.requests.ConferenceManageParticipantRequestParametersTest; -import com.sinch.sdk.domains.voice.models.response.ConferenceParticipant; -import com.sinch.sdk.domains.voice.models.v1.conferences.request.ConferencesRequestDtoTest; -import com.sinch.sdk.domains.voice.models.v1.conferences.response.ConferencesResponseDtoTest; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -public class ConferencesDtoConverterTest { - - public static Collection expectedConferenceGetInfoResponse = - new ArrayList<>( - Collections.singletonList( - ConferenceParticipant.builder() - .setCli("a cli") - .setId("an id") - .setDuration(5) - .setMuted(true) - .setOnhold(false) - .build())); - - @Test - void convertGetConferenceInfoResponseDto() { - Assertions.assertThat( - ConferencesDtoConverter.convert( - ConferencesResponseDtoTest.expectedGetConferenceInfoResponseDto)) - .usingRecursiveComparison() - .isEqualTo(expectedConferenceGetInfoResponse); - } - - @Test - void testConferenceManageParticipantRequestParameters() { - Assertions.assertThat( - ConferencesDtoConverter.convert( - ConferenceManageParticipantRequestParametersTest - .conferenceManageParticipantRequestParameters)) - .usingRecursiveComparison() - .isEqualTo(ConferencesRequestDtoTest.manageConferenceParticipantRequestDto); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/voice/adapters/converters/SVAMLActionDtoConverterTest.java b/client/src/test/java/com/sinch/sdk/domains/voice/adapters/converters/SVAMLActionDtoConverterTest.java deleted file mode 100644 index 62cea4202..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/voice/adapters/converters/SVAMLActionDtoConverterTest.java +++ /dev/null @@ -1,183 +0,0 @@ -package com.sinch.sdk.domains.voice.adapters.converters; - -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.core.utils.Pair; -import com.sinch.sdk.domains.voice.models.ConferenceDtfmOptions; -import com.sinch.sdk.domains.voice.models.DestinationSip; -import com.sinch.sdk.domains.voice.models.DestinationUser; -import com.sinch.sdk.domains.voice.models.DtfmModeType; -import com.sinch.sdk.domains.voice.models.MusicOnHoldType; -import com.sinch.sdk.domains.voice.models.TransportType; -import com.sinch.sdk.domains.voice.models.svaml.ActionConnectConference; -import com.sinch.sdk.domains.voice.models.svaml.ActionConnectMxp; -import com.sinch.sdk.domains.voice.models.svaml.ActionConnectPstn; -import com.sinch.sdk.domains.voice.models.svaml.ActionConnectSip; -import com.sinch.sdk.domains.voice.models.svaml.ActionContinue; -import com.sinch.sdk.domains.voice.models.svaml.ActionHangUp; -import com.sinch.sdk.domains.voice.models.svaml.ActionPark; -import com.sinch.sdk.domains.voice.models.svaml.ActionRunMenu; -import com.sinch.sdk.domains.voice.models.svaml.AnsweringMachineDetection; -import com.sinch.sdk.domains.voice.models.svaml.IndicationType; -import com.sinch.sdk.domains.voice.models.svaml.Menu; -import com.sinch.sdk.domains.voice.models.svaml.MenuOption; -import com.sinch.sdk.domains.voice.models.svaml.MenuOptionAction; -import com.sinch.sdk.domains.voice.models.svaml.MenuOptionActionType; -import com.sinch.sdk.domains.voice.models.v1.svaml.action.ConnectPstnAnsweringMachineDetection; -import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionConnectConferenceTest; -import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionConnectMxpTest; -import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionConnectPstn; -import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionConnectPstn.IndicationsEnum; -import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionConnectSipTest; -import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionContinueTest; -import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionHangupTest; -import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionParkTest; -import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionRunMenuTest; -import com.sinch.sdk.models.DualToneMultiFrequency; -import com.sinch.sdk.models.E164PhoneNumber; -import java.util.Collections; -import org.junit.jupiter.api.Test; - -public class SVAMLActionDtoConverterTest { - - public static final ActionConnectConference actionConnectConference = - ActionConnectConference.builder() - .setConferenceId("My Conference Id") - .setDtfmOptions( - ConferenceDtfmOptions.builder() - .setMode(DtfmModeType.FORWARD) - .setMaxDigits(45) - .setTimeoutMills(456) - .build()) - .setMusicOnHold(MusicOnHoldType.MUSIC3) - .build(); - - ActionConnectMxp actionConnectMxp = - ActionConnectMxp.builder() - .setDestination(DestinationUser.valueOf("a user string")) - .setCallheaders(Collections.singletonList(new Pair<>("left string", "right string"))) - .build(); - - ActionConnectPstn actionConnectPstn = - ActionConnectPstn.builder() - .setNumber(E164PhoneNumber.valueOf("+123456789")) - .setLocale("fr") - .setMaxDuration(123) - .setDialTimeout(456) - .setCli("cli value") - .setSuppressCallbacks(true) - .setDualToneMultiFrequency(DualToneMultiFrequency.valueOf("#w123")) - .setIndications(IndicationType.from("unknown value")) - .setAnsweringMachineDetection( - AnsweringMachineDetection.builder().setEnabled(true).build()) - .build(); - - ActionConnectSip actionConnectSip = - ActionConnectSip.builder() - .setDestination(DestinationSip.valueOf("a sip string")) - .setMaxDuration(456) - .setCli("a cli value") - .setTransport(TransportType.TLS) - .setSuppressCallbacks(true) - .setCallHeaders(Collections.singletonList(new Pair<>("left string", "right string"))) - .setMusicOnHold(MusicOnHoldType.MUSIC2) - .build(); - - ActionContinue actionContinue = ActionContinue.builder().build(); - - ActionHangUp actionHanghup = ActionHangUp.builder().build(); - - ActionPark actionPark = - ActionPark.builder() - .setLocale("en") - .setIntroPrompt("intro prompt") - .setHoldPrompt("hold prompt") - .setMaxDuration(456) - .build(); - - ActionRunMenu actionRunMenu = - ActionRunMenu.builder() - .setBarge(true) - .setEnableVoice(false) - .setLocale("fr") - .setMainMenu(" the main menu") - .setMenus( - Collections.singletonList( - Menu.builder() - .setId("the id") - .setMainPrompt("main prompt") - .setRepeatPrompt("repeat prompt") - .setRepeats(5) - .setMaxDigits(18) - .setTimeoutMills(500) - .setMaxTimeoutMills(123456) - .setOptions( - Collections.singletonList( - MenuOption.builder() - .setAction( - MenuOptionAction.from(MenuOptionActionType.MENU, "foo")) - .setDtfm(DualToneMultiFrequency.valueOf("#w")) - .build())) - .build())) - .build(); - - @Test - void convertActionConnectConf() { - TestHelpers.recursiveEquals( - SVAMLActionDtoConverter.convert(actionConnectConference), - SvamlActionConnectConferenceTest.dto); - } - - @Test - void convertActionConnectMxp() { - TestHelpers.recursiveEquals( - SVAMLActionDtoConverter.convert(actionConnectMxp), SvamlActionConnectMxpTest.dto); - } - - @Test - void convertActionConnectPstn() { - - SvamlActionConnectPstn dtoDeprecated = - SvamlActionConnectPstn.builder() - .setNumber("+123456789") - .setLocale("fr") - .setMaxDuration(123) - .setDialTimeout(456) - .setCli("cli value") - .setSuppressCallbacks(true) - .setDtmf(DualToneMultiFrequency.valueOf("#w123")) - .setIndications(IndicationsEnum.from("unknown value")) - .setAmd(ConnectPstnAnsweringMachineDetection.builder().setEnabled(true).build()) - .build(); - TestHelpers.recursiveEquals(SVAMLActionDtoConverter.convert(actionConnectPstn), dtoDeprecated); - } - - @Test - void convertActionConnectSip() { - TestHelpers.recursiveEquals( - SVAMLActionDtoConverter.convert(actionConnectSip), SvamlActionConnectSipTest.dto); - } - - @Test - void convertActionContinue() { - TestHelpers.recursiveEquals( - SVAMLActionDtoConverter.convert(actionContinue), SvamlActionContinueTest.dto); - } - - @Test - void convertActionHangup() { - TestHelpers.recursiveEquals( - SVAMLActionDtoConverter.convert(actionHanghup), SvamlActionHangupTest.dto); - } - - @Test - void convertActionPark() { - TestHelpers.recursiveEquals( - SVAMLActionDtoConverter.convert(actionPark), SvamlActionParkTest.dto); - } - - @Test - void convertActionRunMenu() { - TestHelpers.recursiveEquals( - SVAMLActionDtoConverter.convert(actionRunMenu), SvamlActionRunMenuTest.dto); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/voice/adapters/converters/SVAMLInstructionDtoConverterTest.java b/client/src/test/java/com/sinch/sdk/domains/voice/adapters/converters/SVAMLInstructionDtoConverterTest.java deleted file mode 100644 index 401600fcf..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/voice/adapters/converters/SVAMLInstructionDtoConverterTest.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.sinch.sdk.domains.voice.adapters.converters; - -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.domains.voice.models.svaml.InstructionAnswer; -import com.sinch.sdk.domains.voice.models.svaml.InstructionPlayFiles; -import com.sinch.sdk.domains.voice.models.svaml.InstructionSay; -import com.sinch.sdk.domains.voice.models.svaml.InstructionSendDtfm; -import com.sinch.sdk.domains.voice.models.svaml.InstructionSetCookie; -import com.sinch.sdk.domains.voice.models.svaml.InstructionStartRecording; -import com.sinch.sdk.domains.voice.models.svaml.InstructionStopRecording; -import com.sinch.sdk.domains.voice.models.svaml.StartRecordingOptions; -import com.sinch.sdk.domains.voice.models.svaml.TranscriptionOptions; -import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionAnswerTest; -import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionPlayFilesTest; -import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionSayTest; -import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionSendDtmfDtoTest; -import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionSetCookieTest; -import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionStartRecordingTest; -import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionStopRecordingTest; -import com.sinch.sdk.models.DualToneMultiFrequency; -import java.util.ArrayList; -import java.util.Collections; -import org.junit.jupiter.api.Test; - -public class SVAMLInstructionDtoConverterTest { - - public static final InstructionAnswer instructionAnswer = InstructionAnswer.builder().build(); - - InstructionPlayFiles instructionPlayFiles = - InstructionPlayFiles.builder() - .setIds(Collections.singletonList("[Welcome]")) - .setLocale("en") - .build(); - - InstructionSay instructionSay = - InstructionSay.builder().setText("[Welcome]").setLocale("en").build(); - - InstructionSendDtfm instructionDtfm = - InstructionSendDtfm.builder().setDtfm(DualToneMultiFrequency.valueOf("ww123#")).build(); - - InstructionSetCookie instructionSetCookie = - InstructionSetCookie.builder().setKey("a key").setValue("a value").build(); - - InstructionStartRecording instructionStartRecording = - InstructionStartRecording.builder() - .setOptions( - StartRecordingOptions.builder() - .setCredentials("credential value") - .setDestinationUrl("destination value") - .setFormat("mp3") - .setNotificationEvents(true) - .setTranscriptionOptions( - TranscriptionOptions.builder().setEnabled(true).setLocale("en-US").build()) - .build()) - .build(); - - InstructionStopRecording instructionStopRecording = InstructionStopRecording.builder().build(); - - @Test - void convertInstructionAnswer() { - TestHelpers.recursiveEquals( - SVAMLInstructionDtoConverter.convert(Collections.singletonList(instructionAnswer)), - new ArrayList<>(Collections.singletonList(SvamlInstructionAnswerTest.dto))); - } - - @Test - void convertInstructionPlayFiles() { - TestHelpers.recursiveEquals( - SVAMLInstructionDtoConverter.convert(Collections.singletonList(instructionPlayFiles)), - new ArrayList<>(Collections.singletonList(SvamlInstructionPlayFilesTest.dto))); - } - - @Test - void convertInstructionSay() { - TestHelpers.recursiveEquals( - SVAMLInstructionDtoConverter.convert(Collections.singletonList(instructionSay)), - new ArrayList<>(Collections.singletonList(SvamlInstructionSayTest.dto))); - } - - @Test - void convertInstructionSendDtfm() { - TestHelpers.recursiveEquals( - SVAMLInstructionDtoConverter.convert(Collections.singletonList(instructionDtfm)), - new ArrayList<>(Collections.singletonList(SvamlInstructionSendDtmfDtoTest.dto))); - } - - @Test - void convertInstructionSetCookie() { - TestHelpers.recursiveEquals( - SVAMLInstructionDtoConverter.convert(Collections.singletonList(instructionSetCookie)), - new ArrayList<>(Collections.singletonList(SvamlInstructionSetCookieTest.dto))); - } - - @Test - void convertInstructionStartRecording() { - TestHelpers.recursiveEquals( - SVAMLInstructionDtoConverter.convert(Collections.singletonList(instructionStartRecording)), - new ArrayList<>(Collections.singletonList(SvamlInstructionStartRecordingTest.dto))); - } - - @Test - void convertInstructionStopRecording() { - TestHelpers.recursiveEquals( - SVAMLInstructionDtoConverter.convert(Collections.singletonList(instructionStopRecording)), - new ArrayList<>(Collections.singletonList(SvamlInstructionStopRecordingTest.dto))); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/voice/adapters/converters/WebhooksEventDtoConverterTest.java b/client/src/test/java/com/sinch/sdk/domains/voice/adapters/converters/WebhooksEventDtoConverterTest.java deleted file mode 100644 index 8cb1abf7f..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/voice/adapters/converters/WebhooksEventDtoConverterTest.java +++ /dev/null @@ -1,141 +0,0 @@ -package com.sinch.sdk.domains.voice.adapters.converters; - -import com.adelean.inject.resources.junit.jupiter.TestWithResources; -import com.sinch.sdk.BaseTest; -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.core.utils.Pair; -import com.sinch.sdk.domains.voice.models.CallReasonType; -import com.sinch.sdk.domains.voice.models.CallResultType; -import com.sinch.sdk.domains.voice.models.DestinationNumber; -import com.sinch.sdk.domains.voice.models.DomainType; -import com.sinch.sdk.domains.voice.models.Price; -import com.sinch.sdk.domains.voice.models.v1.webhooks.VoiceWebhookEventTest; -import com.sinch.sdk.domains.voice.models.webhooks.AmdAnswer; -import com.sinch.sdk.domains.voice.models.webhooks.AmdAnswerReasonType; -import com.sinch.sdk.domains.voice.models.webhooks.AmdAnswerStatusType; -import com.sinch.sdk.domains.voice.models.webhooks.AnsweredCallEvent; -import com.sinch.sdk.domains.voice.models.webhooks.DisconnectCallEvent; -import com.sinch.sdk.domains.voice.models.webhooks.IncomingCallEvent; -import com.sinch.sdk.domains.voice.models.webhooks.MenuInputType; -import com.sinch.sdk.domains.voice.models.webhooks.MenuResult; -import com.sinch.sdk.domains.voice.models.webhooks.MenuResultInputMethodType; -import com.sinch.sdk.domains.voice.models.webhooks.NotifyEvent; -import com.sinch.sdk.domains.voice.models.webhooks.PromptInputEvent; -import java.time.Instant; -import java.util.Collections; -import org.junit.jupiter.api.Test; - -@TestWithResources -public class WebhooksEventDtoConverterTest extends BaseTest { - - public static IncomingCallEvent expectedIncomingCallEvent = - IncomingCallEvent.builder() - .setCallId("a call id") - .setCallResourceUrl("https://calling-euc1.api.sinch.com/calling/v1/calls/id/a call id") - .setTimestamp(Instant.parse("2024-01-16T16:46:36Z")) - .setVersion(1) - .setCli("cli number") - .setUserRate(Price.builder().setCurrencyId("USD").setAmount(0.0F).build()) - .setCustom("my custom") - .setTo(DestinationNumber.valueOf("+123456879")) - .setDomain(DomainType.MXP) - .setApplicationKey("an app key") - .setOriginationType(DomainType.MXP) - .setRdnis("rdnis value") - .setCallHeaders(Collections.singletonList(new Pair<>("the key", "the value"))) - .build(); - - public static DisconnectCallEvent expectedDisconnectCallEvent = - DisconnectCallEvent.builder() - .setCallId("a call id") - .setTimestamp(Instant.parse("2024-01-19T12:49:53Z")) - .setReason(CallReasonType.MANAGER_HANGUP) - .setResult(CallResultType.ANSWERED) - .setVersion(1) - .setCustom("my custom value") - .setDebit(Price.builder().setCurrencyId("EUR").setAmount(0.1758F).build()) - .setUserRate(Price.builder().setCurrencyId("USD").setAmount(0.345F).build()) - .setTo(DestinationNumber.valueOf("123456789")) - .setApplicationKey("an app key") - .setDuration(1) - .setFrom("private") - .build(); - - public static AnsweredCallEvent expectedAnsweredCallEvent = - AnsweredCallEvent.builder() - .setCallId("a call id") - .setTimestamp(Instant.parse("2024-01-19T12:49:53Z")) - .setVersion(1) - .setCustom("my custom value") - .setAmd( - AmdAnswer.builder() - .setStatus(AmdAnswerStatusType.HUMAN) - .setReason(AmdAnswerReasonType.LONG_GREETING) - .setDuration(15) - .build()) - .build(); - - public static PromptInputEvent expectedPromptInputEvent = - PromptInputEvent.builder() - .setCallId("a call id") - .setCustom("my custom value") - .setTimestamp(Instant.parse(("2024-01-23T15:04:28Z"))) - .setVersion(1) - .setApplicationKey("my application key") - .setMenuResult( - MenuResult.builder() - .setMenuId("confirm") - .setType(MenuInputType.SEQUENCE) - .setValue("1452") - .setInputMethod(MenuResultInputMethodType.DTMF) - .build()) - .build(); - - public static NotifyEvent expectedNotifyEvent = - NotifyEvent.builder() - .setCallId("a call id") - .setCustom("my custom value") - .setVersion(1) - .setType("recording_finished") - .build(); - - @Test - void convertIncomingCallRequest() { - - TestHelpers.recursiveEquals( - WebhooksEventDtoConverter.convert(VoiceWebhookEventTest.expectedIceRequestDto), - expectedIncomingCallEvent); - } - - @Test - void convertDisconnectCallRequest() { - - TestHelpers.recursiveEquals( - WebhooksEventDtoConverter.convert(VoiceWebhookEventTest.expectedDiceRequestDto), - expectedDisconnectCallEvent); - } - - @Test - void convertAnsweredCallEvent() { - - TestHelpers.recursiveEquals( - WebhooksEventDtoConverter.convert(VoiceWebhookEventTest.expectedAceRequestDto), - expectedAnsweredCallEvent); - } - - @Test - void convertPieEvent() { - - TestHelpers.recursiveEquals( - WebhooksEventDtoConverter.convert(VoiceWebhookEventTest.expectedPieRequestDto), - expectedPromptInputEvent); - } - - @Test - void convertNotifyEvent() { - - TestHelpers.recursiveEquals( - WebhooksEventDtoConverter.convert(VoiceWebhookEventTest.expectedNotifyRequestDto), - expectedNotifyEvent); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/PaginationFillerHelper.java b/client/src/test/java/com/sinch/sdk/domains/voice/api/v1/adapters/PaginationFillerHelper.java similarity index 93% rename from client/src/test/java/com/sinch/sdk/domains/PaginationFillerHelper.java rename to client/src/test/java/com/sinch/sdk/domains/voice/api/v1/adapters/PaginationFillerHelper.java index aec8749f6..bdc518921 100644 --- a/client/src/test/java/com/sinch/sdk/domains/PaginationFillerHelper.java +++ b/client/src/test/java/com/sinch/sdk/domains/voice/api/v1/adapters/PaginationFillerHelper.java @@ -1,4 +1,4 @@ -package com.sinch.sdk.domains; +package com.sinch.sdk.domains.voice.api.v1.adapters; import com.sinch.sdk.core.http.URLParameter; import com.sinch.sdk.core.http.URLParameter.STYLE; diff --git a/client/src/test/java/com/sinch/sdk/domains/voice/models/requests/CalloutRequestParametersConferenceTest.java b/client/src/test/java/com/sinch/sdk/domains/voice/models/requests/CalloutRequestParametersConferenceTest.java deleted file mode 100644 index bd305a3fb..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/voice/models/requests/CalloutRequestParametersConferenceTest.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.sinch.sdk.domains.voice.models.requests; - -import static org.junit.jupiter.api.Assertions.*; - -import com.sinch.sdk.domains.voice.models.ConferenceDtfmOptions; -import com.sinch.sdk.domains.voice.models.DestinationNumber; -import com.sinch.sdk.domains.voice.models.DomainType; -import com.sinch.sdk.domains.voice.models.DtfmModeType; -import com.sinch.sdk.domains.voice.models.MusicOnHoldType; -import com.sinch.sdk.models.DualToneMultiFrequency; -import com.sinch.sdk.models.E164PhoneNumber; -import org.junit.jupiter.api.Test; - -public class CalloutRequestParametersConferenceTest { - - static final ConferenceDtfmOptions dtfmOptions = - ConferenceDtfmOptions.builder() - .setMode(DtfmModeType.DETECT) - .setMaxDigits(3) - .setTimeoutMills(456) - .build(); - public static final CalloutRequestParametersConference conferenceRequestParameters = - CalloutRequestParametersConference.builder() - .setDestination(DestinationNumber.valueOf("+14045005000")) - .setConferenceId("MyConfId") - .setCli(E164PhoneNumber.valueOf("+14045001000")) - .setDtfmOptions(dtfmOptions) - .setDtfm(DualToneMultiFrequency.valueOf("w123#")) - .setMaxDuration(32) - .setEnableAce(Boolean.TRUE) - .setEnableDice(Boolean.TRUE) - .setEnablePie(Boolean.TRUE) - .setLocale("en-US") - .setGreeting("Welcome to my conference") - .setMusicOnHold(MusicOnHoldType.MUSIC2) - .setCustom("my custom value") - .setDomain(DomainType.PSTN) - .build(); - - @Test - void getDestination() { - assertEquals( - DestinationNumber.valueOf("+14045005000"), - conferenceRequestParameters.getDestination().get()); - } - - @Test - void getCli() { - assertEquals( - E164PhoneNumber.valueOf("+14045001000"), conferenceRequestParameters.getCli().get()); - } - - @Test - void getDtfm() { - assertEquals("w123#", conferenceRequestParameters.getDtfm().get().stringValue()); - } - - @Test - void getCustom() { - assertEquals("my custom value", conferenceRequestParameters.getCustom().get()); - } - - @Test - void getConferenceId() { - assertEquals("MyConfId", conferenceRequestParameters.getConferenceId().get()); - } - - @Test - void getDtfmOptions() { - assertEquals(dtfmOptions, conferenceRequestParameters.getDtfmOptions().get()); - } - - @Test - void getMaxDuration() { - assertEquals(32, conferenceRequestParameters.getMaxDuration().get()); - } - - @Test - void getEnableAce() { - assertEquals(Boolean.TRUE, conferenceRequestParameters.getEnableAce().get()); - } - - @Test - void getEnableDice() { - assertEquals(Boolean.TRUE, conferenceRequestParameters.getEnableDice().get()); - } - - @Test - void getEnablePie() { - assertEquals(Boolean.TRUE, conferenceRequestParameters.getEnablePie().get()); - } - - @Test - void getLocale() { - assertEquals("en-US", conferenceRequestParameters.getLocale().get()); - } - - @Test - void getGreeting() { - assertEquals("Welcome to my conference", conferenceRequestParameters.getGreeting().get()); - } - - @Test - void getMohClass() { - assertEquals(MusicOnHoldType.MUSIC2, conferenceRequestParameters.getMusicOnHold().get()); - } - - @Test - void getDomain() { - assertEquals(DomainType.PSTN, conferenceRequestParameters.getDomain().get()); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/voice/models/requests/CalloutRequestParametersCustomTest.java b/client/src/test/java/com/sinch/sdk/domains/voice/models/requests/CalloutRequestParametersCustomTest.java deleted file mode 100644 index e5876e556..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/voice/models/requests/CalloutRequestParametersCustomTest.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.sinch.sdk.domains.voice.models.requests; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -import com.sinch.sdk.domains.voice.models.DestinationNumber; -import com.sinch.sdk.domains.voice.models.svaml.ActionConnectPstn; -import com.sinch.sdk.domains.voice.models.svaml.ActionHangUp; -import com.sinch.sdk.domains.voice.models.svaml.AnsweringMachineDetection; -import com.sinch.sdk.domains.voice.models.svaml.InstructionSay; -import com.sinch.sdk.domains.voice.models.svaml.SVAMLControl; -import com.sinch.sdk.models.DualToneMultiFrequency; -import com.sinch.sdk.models.E164PhoneNumber; -import java.util.Arrays; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -public class CalloutRequestParametersCustomTest { - - public static final CalloutRequestParametersCustom customRequestParameters = - CalloutRequestParametersCustom.builder() - .setDestination(DestinationNumber.valueOf("+14045005000")) - .setCli(E164PhoneNumber.valueOf("+14045001000")) - .setCustom("my custom value") - .setDtfm(DualToneMultiFrequency.valueOf("w123#")) - .setMaxDuration(32) - .setIce( - SVAMLControl.builder() - .setAction( - ActionConnectPstn.builder() - .setCli("+12234325234") - .setNumber(E164PhoneNumber.valueOf("+12233445566")) - .setAnsweringMachineDetection( - AnsweringMachineDetection.builder().setEnabled(true).build()) - .build()) - .build()) - .setAce( - SVAMLControl.builder() - .setAction(ActionHangUp.builder().build()) - .setInstructions( - Arrays.asList( - InstructionSay.builder() - .setText("Hello, this is a call from Sinch!") - .build())) - .build()) - .setPie(ControlUrl.from("https://your-application-server-host/application")) - .build(); - - @Test - void getDestination() { - assertEquals( - DestinationNumber.valueOf("+14045005000"), customRequestParameters.getDestination().get()); - } - - @Test - void getCli() { - assertEquals(E164PhoneNumber.valueOf("+14045001000"), customRequestParameters.getCli().get()); - } - - @Test - void getDtfm() { - assertEquals("w123#", customRequestParameters.getDtfm().get().stringValue()); - } - - @Test - void getCustom() { - assertEquals("my custom value", customRequestParameters.getCustom().get()); - } - - @Test - void getIce() { - Assertions.assertThat( - SVAMLControl.builder() - .setAction( - ActionConnectPstn.builder() - .setCli("+12234325234") - .setNumber(E164PhoneNumber.valueOf("+12233445566")) - .setAnsweringMachineDetection( - AnsweringMachineDetection.builder().setEnabled(true).build()) - .build()) - .build()) - .usingRecursiveComparison() - .isEqualTo(customRequestParameters.getIce().get()); - } - - @Test - void getAce() { - - Assertions.assertThat( - SVAMLControl.builder() - .setAction(ActionHangUp.builder().build()) - .setInstructions( - Arrays.asList( - InstructionSay.builder() - .setText("Hello, this is a call from Sinch!") - .build())) - .build()) - .usingRecursiveComparison() - .isEqualTo(customRequestParameters.getAce().get()); - } - - @Test - void getPie() { - - Assertions.assertThat(ControlUrl.from("https://your-application-server-host/application")) - .usingRecursiveComparison() - .isEqualTo(customRequestParameters.getPie().get()); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/voice/models/requests/CalloutRequestParametersTTSTest.java b/client/src/test/java/com/sinch/sdk/domains/voice/models/requests/CalloutRequestParametersTTSTest.java deleted file mode 100644 index e83c993ba..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/voice/models/requests/CalloutRequestParametersTTSTest.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.sinch.sdk.domains.voice.models.requests; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -import com.sinch.sdk.domains.voice.models.DestinationUser; -import com.sinch.sdk.domains.voice.models.DomainType; -import com.sinch.sdk.models.DualToneMultiFrequency; -import com.sinch.sdk.models.E164PhoneNumber; -import org.junit.jupiter.api.Test; - -public class CalloutRequestParametersTTSTest { - - public static final CalloutRequestParametersTTS ttsRequestParameters = - CalloutRequestParametersTTS.builder() - .setDestination(DestinationUser.valueOf("an user name")) - .setCli(E164PhoneNumber.valueOf("+14045001000")) - .setDtfm(DualToneMultiFrequency.valueOf("w123#")) - .setEnableAce(Boolean.TRUE) - .setEnableDice(Boolean.TRUE) - .setEnablePie(Boolean.TRUE) - .setLocale("en-US") - .setCustom("my custom value") - .setDomain(DomainType.PSTN) - .setText("text value") - .setPrompts( - "#ssml[

Your PIN code is 1234

Please enter it now

]") - .build(); - - @Test - void getDestination() { - assertEquals( - DestinationUser.valueOf("an user name"), ttsRequestParameters.getDestination().get()); - } - - @Test - void getCli() { - assertEquals(E164PhoneNumber.valueOf("+14045001000"), ttsRequestParameters.getCli().get()); - } - - @Test - void getDtfm() { - assertEquals("w123#", ttsRequestParameters.getDtfm().get().stringValue()); - } - - @Test - void getCustom() { - assertEquals("my custom value", ttsRequestParameters.getCustom().get()); - } - - @Test - void getEnableAce() { - assertEquals(Boolean.TRUE, ttsRequestParameters.getEnableAce().get()); - } - - @Test - void getEnableDice() { - assertEquals(Boolean.TRUE, ttsRequestParameters.getEnableDice().get()); - } - - @Test - void getEnablePie() { - assertEquals(Boolean.TRUE, ttsRequestParameters.getEnablePie().get()); - } - - @Test - void getLocale() { - assertEquals("en-US", ttsRequestParameters.getLocale().get()); - } - - @Test - void getDomain() { - assertEquals(DomainType.PSTN, ttsRequestParameters.getDomain().get()); - } - - @Test - void getText() { - assertEquals("text value", ttsRequestParameters.getText().get()); - } - - @Test - void getPrompts() { - assertEquals( - "#ssml[

Your PIN code is 1234

Please enter it now

]", - ttsRequestParameters.getPrompts().get()); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/voice/models/requests/ConferenceManageParticipantRequestParametersTest.java b/client/src/test/java/com/sinch/sdk/domains/voice/models/requests/ConferenceManageParticipantRequestParametersTest.java deleted file mode 100644 index 3e299f086..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/voice/models/requests/ConferenceManageParticipantRequestParametersTest.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.sinch.sdk.domains.voice.models.requests; - -import static org.junit.jupiter.api.Assertions.*; - -import com.sinch.sdk.domains.voice.models.MusicOnHoldType; -import org.junit.jupiter.api.Test; - -public class ConferenceManageParticipantRequestParametersTest { - - public static final ConferenceManageParticipantRequestParameters - conferenceManageParticipantRequestParameters = - ConferenceManageParticipantRequestParameters.builder() - .setCommand(ConferenceManageParticipantCommandType.UNMUTE) - .setMusicOnHold(MusicOnHoldType.RING) - .build(); - - @Test - void command() { - assertEquals( - ConferenceManageParticipantCommandType.UNMUTE, - conferenceManageParticipantRequestParameters.getCommand().get()); - } - - @Test - void moh() { - assertEquals( - MusicOnHoldType.RING, conferenceManageParticipantRequestParameters.getMusicOnHold().get()); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/voice/models/svaml/MenuOptionActionTest.java b/client/src/test/java/com/sinch/sdk/domains/voice/models/svaml/MenuOptionActionTest.java deleted file mode 100644 index 4bcc20dbc..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/voice/models/svaml/MenuOptionActionTest.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.sinch.sdk.domains.voice.models.svaml; - -import static org.junit.jupiter.api.Assertions.*; - -import org.junit.jupiter.api.Test; - -class MenuOptionActionTest { - - @Test - void getId() { - - assertEquals("an id", MenuOptionAction.from(MenuOptionActionType.MENU, "an id").getId()); - } - - @Test - void getType() { - assertEquals( - MenuOptionActionType.MENU, - MenuOptionAction.from(MenuOptionActionType.MENU, "an id").getType()); - } - - @Test - void throwExceptionOntoNullAction() { - String value = "Action type cannot be null"; - Exception exception = - assertThrows(NullPointerException.class, () -> MenuOptionAction.from(null, "an id")); - assertEquals(exception.getMessage(), value); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/voice/models/svaml/SVAMLControlTest.java b/client/src/test/java/com/sinch/sdk/domains/voice/models/svaml/SVAMLControlTest.java deleted file mode 100644 index 84023dfa3..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/voice/models/svaml/SVAMLControlTest.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.sinch.sdk.domains.voice.models.svaml; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -import com.sinch.sdk.domains.voice.adapters.converters.SVAMLActionDtoConverterTest; -import com.sinch.sdk.domains.voice.adapters.converters.SVAMLInstructionDtoConverterTest; -import java.util.Collections; -import org.junit.jupiter.api.Test; - -public class SVAMLControlTest { - - public static final SVAMLControl parameters = - SVAMLControl.builder() - .setAction(SVAMLActionDtoConverterTest.actionConnectConference) - .setInstructions( - Collections.singletonList(SVAMLInstructionDtoConverterTest.instructionAnswer)) - .build(); - - @Test - void action() { - assertEquals(SVAMLActionDtoConverterTest.actionConnectConference, parameters.getAction().get()); - } - - @Test - void instructions() { - assertEquals( - Collections.singletonList(SVAMLInstructionDtoConverterTest.instructionAnswer), - parameters.getInstructions().get()); - } -} diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/ApplicationsSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/ApplicationsSteps.java deleted file mode 100644 index 0995eaa21..000000000 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/ApplicationsSteps.java +++ /dev/null @@ -1,159 +0,0 @@ -package com.sinch.sdk.e2e.domains.voice.v0; - -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.domains.voice.ApplicationsService; -import com.sinch.sdk.domains.voice.models.ApplicationAssignedNumber; -import com.sinch.sdk.domains.voice.models.ApplicationURL; -import com.sinch.sdk.domains.voice.models.CallbackUrls; -import com.sinch.sdk.domains.voice.models.CapabilityType; -import com.sinch.sdk.domains.voice.models.NumberInformation; -import com.sinch.sdk.domains.voice.models.NumberType; -import com.sinch.sdk.domains.voice.models.Price; -import com.sinch.sdk.domains.voice.models.requests.ApplicationsAssignNumbersRequestParameters; -import com.sinch.sdk.domains.voice.models.response.AssignedNumbers; -import com.sinch.sdk.e2e.Config; -import com.sinch.sdk.models.E164PhoneNumber; -import io.cucumber.java.en.Given; -import io.cucumber.java.en.Then; -import io.cucumber.java.en.When; -import java.util.Arrays; -import java.util.Collections; -import org.junit.jupiter.api.Assertions; - -public class ApplicationsSteps { - - ApplicationsService service; - - AssignedNumbers listNumbersResponse; - Boolean assignNumbersPassed; - Boolean unassignNumberPassed; - NumberInformation queryNumberResult; - CallbackUrls getCallbackUrlsResult; - Boolean updateCallbackUrlsPassed; - - @Given("^the Voice service \"Applications\" is available") - public void serviceAvailable() { - - service = Config.getSinchClient().voice().applications(); - } - - @When("^I send a request to get information about my owned numbers$") - public void listNumbers() { - - listNumbersResponse = service.listNumbers(); - } - - @When("^I send a request to assign some numbers to a Voice Application$") - public void assignNumbers() { - - ApplicationsAssignNumbersRequestParameters request = - ApplicationsAssignNumbersRequestParameters.builder() - .setNumbers(Collections.singletonList(E164PhoneNumber.valueOf("+12012222222"))) - .setApplicationKey("f00dcafe-abba-c0de-1dea-dabb1ed4caf3") - .setCapability(CapabilityType.VOICE) - .build(); - service.assignNumbers(request); - assignNumbersPassed = true; - } - - @When("^I send a request to unassign a number from a Voice Application$") - public void unassignNumber() { - - service.unassignNumber(E164PhoneNumber.valueOf("+12012222222"), ""); - unassignNumberPassed = true; - } - - @When("^I send a request to get information about a specific number$") - public void queryNumber() { - - queryNumberResult = service.queryNumber(E164PhoneNumber.valueOf("+12015555555")); - } - - @When("^I send a request to get the callback URLs associated to an application$") - public void getCallbackUrls() { - - getCallbackUrlsResult = service.getCallbackUrls("f00dcafe-abba-c0de-1dea-dabb1ed4caf3"); - } - - @When("^I send a request to update the callback URLs associated to an application$") - public void updateCallbackUrls() { - CallbackUrls request = - CallbackUrls.builder() - .setUrl( - ApplicationURL.builder() - .setPrimary("https://my-new.callback-server.com/voice") - .build()) - .build(); - service.updateCallbackUrls("f00dcafe-abba-c0de-1dea-dabb1ed4caf3", request); - updateCallbackUrlsPassed = true; - } - - @Then("the response contains details about the numbers that I own") - public void listNumbersResult() { - AssignedNumbers expected = - AssignedNumbers.builder() - .setNumbers( - Arrays.asList( - ApplicationAssignedNumber.builder() - .setNumber(E164PhoneNumber.valueOf("+12012222222")) - .setCapability(CapabilityType.VOICE) - .build(), - ApplicationAssignedNumber.builder() - .setNumber(E164PhoneNumber.valueOf("+12013333333")) - .setCapability(CapabilityType.VOICE) - .setApplicationKey("ba5eba11-1dea-1337-babe-5a1ad00d1eaf") - .build(), - ApplicationAssignedNumber.builder() - .setNumber(E164PhoneNumber.valueOf("+12014444444")) - .setCapability(CapabilityType.VOICE) - .build(), - ApplicationAssignedNumber.builder() - .setNumber(E164PhoneNumber.valueOf("+12015555555")) - .setCapability(CapabilityType.VOICE) - .setApplicationKey("f00dcafe-abba-c0de-1dea-dabb1ed4caf3") - .build())) - .build(); - TestHelpers.recursiveEquals(listNumbersResponse, expected); - } - - @Then("the assign numbers response contains no data") - public void assignNumbersResult() { - Assertions.assertTrue(assignNumbersPassed); - } - - @Then("the unassign number response contains no data") - public void unassignNumberResult() { - Assertions.assertTrue(unassignNumberPassed); - } - - @Then("the response contains details about the specific number") - public void queryNumberResult() { - NumberInformation expected = - NumberInformation.builder() - .setCountryId("US") - .setNumberType(NumberType.FIXED) - .setNormalizedNumber(E164PhoneNumber.valueOf("+12015555555")) - .setRestricted(true) - .setRate(Price.builder().setCurrencyId("USD").setAmount(0.01F).build()) - .build(); - TestHelpers.recursiveEquals(queryNumberResult, expected); - } - - @Then("the response contains callback URLs details") - public void getCallbackUrlsResult() { - CallbackUrls expected = - CallbackUrls.builder() - .setUrl( - ApplicationURL.builder() - .setPrimary("https://my.callback-server.com/voice") - .setFallback("https://my.fallback-server.com/voice") - .build()) - .build(); - TestHelpers.recursiveEquals(getCallbackUrlsResult, expected); - } - - @Then("the update callback URLs response contains no data") - public void updateCallbackUrlsResult() { - Assertions.assertTrue(updateCallbackUrlsPassed); - } -} diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/CalloutsSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/CalloutsSteps.java deleted file mode 100644 index 31b6ce12d..000000000 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/CalloutsSteps.java +++ /dev/null @@ -1,159 +0,0 @@ -package com.sinch.sdk.e2e.domains.voice.v0; - -import com.sinch.sdk.domains.voice.CalloutsService; -import com.sinch.sdk.domains.voice.models.DestinationNumber; -import com.sinch.sdk.domains.voice.models.MusicOnHoldType; -import com.sinch.sdk.domains.voice.models.requests.CalloutRequestParametersConference; -import com.sinch.sdk.domains.voice.models.requests.CalloutRequestParametersCustom; -import com.sinch.sdk.domains.voice.models.requests.CalloutRequestParametersTTS; -import com.sinch.sdk.domains.voice.models.requests.ControlUrl; -import com.sinch.sdk.domains.voice.models.svaml.ActionConnectPstn; -import com.sinch.sdk.domains.voice.models.svaml.ActionRunMenu; -import com.sinch.sdk.domains.voice.models.svaml.InstructionSay; -import com.sinch.sdk.domains.voice.models.svaml.InstructionStartRecording; -import com.sinch.sdk.domains.voice.models.svaml.Menu; -import com.sinch.sdk.domains.voice.models.svaml.MenuOption; -import com.sinch.sdk.domains.voice.models.svaml.MenuOptionAction; -import com.sinch.sdk.domains.voice.models.svaml.MenuOptionActionType; -import com.sinch.sdk.domains.voice.models.svaml.SVAMLControl; -import com.sinch.sdk.domains.voice.models.svaml.StartRecordingOptions; -import com.sinch.sdk.e2e.Config; -import com.sinch.sdk.models.DualToneMultiFrequency; -import com.sinch.sdk.models.E164PhoneNumber; -import io.cucumber.java.en.Given; -import io.cucumber.java.en.Then; -import io.cucumber.java.en.When; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public class CalloutsSteps { - - CalloutsService service; - String ttsResponse; - String conferenceResponse; - String customResponse; - - @Given("^the Voice service \"Callouts\" is available$") - public void serviceAvailable() { - service = Config.getSinchClient().voice().callouts(); - } - - @When("^I send a request to make a TTS call$") - public void createTTS() { - - CalloutRequestParametersTTS request = - CalloutRequestParametersTTS.builder() - .setLocale("en-US") - .setDestination(DestinationNumber.valueOf("+12017777777")) - .setCli(E164PhoneNumber.valueOf("+12015555555")) - .setText("Hello, this is a call from Sinch.") - .build(); - - ttsResponse = service.textToSpeech(request); - } - - @When("^I send a request to make a Conference call with the \"Callout\" service$") - public void createConference() { - CalloutRequestParametersConference request = - CalloutRequestParametersConference.builder() - .setLocale("en-US") - .setDestination(DestinationNumber.valueOf("+12017777777")) - .setCli(E164PhoneNumber.valueOf("+12015555555")) - .setConferenceId("myConferenceId-E2E") - .setGreeting("Welcome to this conference call.") - .setMusicOnHold(MusicOnHoldType.MUSIC1) - .build(); - - conferenceResponse = service.conference(request); - } - - @When("^I send a request to make a Custom call$") - public void createCustom() { - CalloutRequestParametersCustom request = - CalloutRequestParametersCustom.builder() - .setDestination(DestinationNumber.valueOf("+12017777777")) - .setCli(E164PhoneNumber.valueOf("+12015555555")) - .setCustom("Custom text") - .setIce( - SVAMLControl.builder() - .setAction( - ActionConnectPstn.builder() - .setNumber(E164PhoneNumber.valueOf("+12017777777")) - .setCli("+12015555555") - .build()) - .setInstructions( - Arrays.asList( - InstructionSay.builder() - .setText("Welcome to Sinch.") - .setLocale("en-US/male") - .build(), - InstructionStartRecording.builder() - .setOptions( - StartRecordingOptions.builder() - .setDestinationUrl("To specify") - .setCredentials("To specify") - .build()) - .build())) - .build()) - .setAce( - SVAMLControl.builder() - .setAction( - ActionRunMenu.builder() - .setLocale("Kimberly") - .setEnableVoice(true) - .setBarge(true) - .setMenus( - Arrays.asList( - Menu.builder() - .setId("main") - .setMainPrompt( - "#tts[Welcome to the main menu. Press 1 to confirm" - + " order or 2 to cancel]") - .setRepeatPrompt( - "#tts[We didn't get your input, please try again]") - .setTimeoutMills(5000) - .setOptions( - Arrays.asList( - MenuOption.builder() - .setDtfm(DualToneMultiFrequency.valueOf("1")) - .setAction( - MenuOptionAction.from( - MenuOptionActionType.MENU, "confirm")) - .build(), - MenuOption.builder() - .setDtfm(DualToneMultiFrequency.valueOf("2")) - .setAction( - MenuOptionAction.from( - MenuOptionActionType.RETURN, "cancel")) - .build())) - .build(), - Menu.builder() - .setId("confirm") - .setMainPrompt( - "#tts[Thank you for confirming your order. Enter your" - + " 4-digit PIN.]") - .setMaxDigits(4) - .build())) - .build()) - .build()) - .setPie(ControlUrl.from("https://callback-server.com/voice")) - .build(); - - customResponse = service.custom(request); - } - - @Then("the callout response contains the TTS call ID") - public void ttsResult() { - Assertions.assertEquals(ttsResponse, "1ce0ffee-ca11-ca11-ca11-abcdef000001"); - } - - @Then("the callout response contains the Conference call ID") - public void conferenceResult() { - Assertions.assertEquals(conferenceResponse, "1ce0ffee-ca11-ca11-ca11-abcdef000002"); - } - - @Then("the callout response contains the Custom call ID") - public void customResult() { - Assertions.assertEquals(customResponse, "1ce0ffee-ca11-ca11-ca11-abcdef000003"); - } -} diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/CallsSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/CallsSteps.java deleted file mode 100644 index ecdeabbb1..000000000 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/CallsSteps.java +++ /dev/null @@ -1,134 +0,0 @@ -package com.sinch.sdk.e2e.domains.voice.v0; - -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.domains.voice.CallsService; -import com.sinch.sdk.domains.voice.models.CallLegType; -import com.sinch.sdk.domains.voice.models.CallReasonType; -import com.sinch.sdk.domains.voice.models.CallResultType; -import com.sinch.sdk.domains.voice.models.DestinationNumber; -import com.sinch.sdk.domains.voice.models.DomainType; -import com.sinch.sdk.domains.voice.models.Price; -import com.sinch.sdk.domains.voice.models.response.CallInformation; -import com.sinch.sdk.domains.voice.models.response.CallStatusType; -import com.sinch.sdk.domains.voice.models.svaml.ActionContinue; -import com.sinch.sdk.domains.voice.models.svaml.ActionHangUp; -import com.sinch.sdk.domains.voice.models.svaml.InstructionPlayFiles; -import com.sinch.sdk.domains.voice.models.svaml.InstructionSay; -import com.sinch.sdk.domains.voice.models.svaml.SVAMLControl; -import com.sinch.sdk.e2e.Config; -import io.cucumber.java.en.Given; -import io.cucumber.java.en.Then; -import io.cucumber.java.en.When; -import java.time.Instant; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public class CallsSteps { - - CallsService service; - CallInformation getResponse; - Boolean updatePassed; - ApiException updateNotFoundException; - Boolean manageWithCallLegPassed; - - @Given("^the Voice service \"Calls\" is available$") - public void serviceAvailable() { - service = Config.getSinchClient().voice().calls(); - } - - @When("^I send a request to get a call's information$") - public void getCall() { - - getResponse = service.get("1ce0ffee-ca11-ca11-ca11-abcdef000003"); - } - - @When("^I send a request to update a call$") - public void updateCall() { - - SVAMLControl request = - SVAMLControl.builder() - .setInstructions( - Arrays.asList( - InstructionSay.builder() - .setText("Sorry, the conference has been cancelled. The call will end now.") - .setLocale("en-US") - .build())) - .setAction(ActionHangUp.builder().build()) - .build(); - service.update("1ce0ffee-ca11-ca11-ca11-abcdef000022", request); - updatePassed = true; - } - - @When("^I send a request to update a call that doesn't exist$") - public void updateCallNotExits() { - - SVAMLControl request = - SVAMLControl.builder() - .setInstructions( - Arrays.asList( - InstructionSay.builder() - .setText("Sorry, the conference has been cancelled. The call will end now.") - .setLocale("en-US") - .build())) - .setAction(ActionHangUp.builder().build()) - .build(); - try { - service.update("not-existing-callId", request); - } catch (ApiException ae) { - updateNotFoundException = ae; - } - } - - @When("^I send a request to manage a call with callLeg$") - public void manageCallWithCallLeg() { - - SVAMLControl request = - SVAMLControl.builder() - .setInstructions( - Arrays.asList( - InstructionPlayFiles.builder() - .setIds( - Arrays.asList( - "https://samples-files.com/samples/Audio/mp3/sample-file-4.mp3")) - .build())) - .setAction(ActionContinue.builder().build()) - .build(); - service.manageWithCallLeg("1ce0ffee-ca11-ca11-ca11-abcdef000022", CallLegType.CALLEE, request); - manageWithCallLegPassed = true; - } - - @Then("the response contains the information about the call") - public void getCallResult() { - CallInformation information = - CallInformation.builder() - .setTo(DestinationNumber.valueOf("+12017777777")) - .setDomain(DomainType.PSTN) - .setCallId("1ce0ffee-ca11-ca11-ca11-abcdef000003") - .setDuration(14) - .setStatus(CallStatusType.FINAL) - .setResult(CallResultType.ANSWERED) - .setReason(CallReasonType.MANAGER_HANGUP) - .setTimeStamp(Instant.parse("2024-06-06T17:36:00Z")) - .setCustom("Custom text") - .setUserRate(Price.builder().setCurrencyId("EUR").setAmount(0.1758F).build()) - .setDebit(Price.builder().setCurrencyId("EUR").setAmount(0.1758F).build()) - .build(); - TestHelpers.recursiveEquals(getResponse, information); - } - - @Then("the update call response contains no data") - public void updateCallResult() { - Assertions.assertEquals(true, updatePassed); - } - - @Then("the update call response contains a \"not found\" error") - public void updateCallNotFoundResult() { - Assertions.assertTrue(updateNotFoundException.getMessage().contains("not found")); - } - - @Then("the manage a call with callLeg response contains no data") - public void manageCallWithCallLegResult() { - Assertions.assertEquals(true, manageWithCallLegPassed); - } -} diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/ConferenceSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/ConferenceSteps.java deleted file mode 100644 index 20b77039c..000000000 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/ConferenceSteps.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.sinch.sdk.e2e.domains.voice.v0; - -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.domains.voice.ConferencesService; -import com.sinch.sdk.domains.voice.models.DestinationNumber; -import com.sinch.sdk.domains.voice.models.MusicOnHoldType; -import com.sinch.sdk.domains.voice.models.requests.CalloutRequestParametersConference; -import com.sinch.sdk.domains.voice.models.requests.ConferenceManageParticipantCommandType; -import com.sinch.sdk.domains.voice.models.requests.ConferenceManageParticipantRequestParameters; -import com.sinch.sdk.domains.voice.models.response.ConferenceParticipant; -import com.sinch.sdk.e2e.Config; -import com.sinch.sdk.models.E164PhoneNumber; -import io.cucumber.java.en.Given; -import io.cucumber.java.en.Then; -import io.cucumber.java.en.When; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import org.junit.jupiter.api.Assertions; - -public class ConferenceSteps { - - ConferencesService service; - String callResponse; - Collection getResponse; - Boolean manageParticipantPassed; - Boolean kickParticipantPassed; - Boolean kickAllParticipantPassed; - - @Given("^the Voice service \"Conferences\" is available$") - public void serviceAvailable() { - service = Config.getSinchClient().voice().conferences(); - } - - @When("^I send a request to make a Conference call with the \"Conferences\" service$") - public void createCall() { - - CalloutRequestParametersConference request = - CalloutRequestParametersConference.builder() - .setLocale("en-US") - .setDestination(DestinationNumber.valueOf("+12017777777")) - .setCli(E164PhoneNumber.valueOf("+12015555555")) - .setConferenceId("myConferenceId-E2E") - .setGreeting("Welcome to this conference call.") - .setMusicOnHold(MusicOnHoldType.MUSIC1) - .build(); - - callResponse = service.call(request); - } - - @When("^I send a request to get the conference information$") - public void getCall() { - - getResponse = service.get("myConferenceId-E2E"); - } - - @When("^I send a request to put a participant on hold$") - public void manageParticipant() { - - ConferenceManageParticipantRequestParameters request = - ConferenceManageParticipantRequestParameters.builder() - .setCommand(ConferenceManageParticipantCommandType.ONHOLD) - .setMusicOnHold(MusicOnHoldType.MUSIC2) - .build(); - - service.manageParticipant( - "myConferenceId-E2E", "1ce0ffee-ca11-ca11-ca11-abcdef000012", request); - manageParticipantPassed = true; - } - - @When("^I send a request to kick a participant from a conference$") - public void kickParticipant() { - - service.kickParticipant("myConferenceId-E2E", "1ce0ffee-ca11-ca11-ca11-abcdef000012"); - kickParticipantPassed = true; - } - - @When("^I send a request to kick all the participants from a conference$") - public void kickAllParticipant() { - - service.kickAll("myConferenceId-E2E"); - kickAllParticipantPassed = true; - } - - @Then("the callout response from the \"Conferences\" service contains the Conference call ID") - public void createCallResult() { - Assertions.assertEquals(callResponse, "1ce0ffee-ca11-ca11-ca11-abcdef000002"); - } - - @Then("the response contains the information about the conference participants") - public void getCallResult() { - Collection participants = - new ArrayList<>( - Arrays.asList( - ConferenceParticipant.builder() - .setCli("+12015555555") - .setId("1ce0ffee-ca11-ca11-ca11-abcdef000012") - .setDuration(35) - .setMuted(true) - .setOnhold(true) - .build(), - ConferenceParticipant.builder() - .setCli("+12015555555") - .setId("1ce0ffee-ca11-ca11-ca11-abcdef000022") - .setDuration(6) - .setMuted(false) - .setOnhold(false) - .build())); - TestHelpers.recursiveEquals(getResponse, participants); - } - - @Then("the manage participant response contains no data") - public void manageParticipantResult() { - Assertions.assertTrue(manageParticipantPassed); - } - - @Then("the kick participant response contains no data") - public void kickParticipantPassedResult() { - Assertions.assertTrue(kickParticipantPassed); - } - - @Then("the kick all participants response contains no data") - public void kickAllParticipantPassedResult() { - Assertions.assertTrue(kickAllParticipantPassed); - } -} diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/VoiceIT.java b/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/VoiceIT.java deleted file mode 100644 index 269765e95..000000000 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/VoiceIT.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.sinch.sdk.e2e.domains.voice.v0; - -import static io.cucumber.junit.platform.engine.Constants.GLUE_PROPERTY_NAME; - -import org.junit.platform.suite.api.ConfigurationParameter; -import org.junit.platform.suite.api.IncludeEngines; -import org.junit.platform.suite.api.SelectClasspathResource; -import org.junit.platform.suite.api.Suite; -import org.junit.platform.suite.api.SuiteDisplayName; - -@Suite -@SuiteDisplayName("Voice V0") -@IncludeEngines("cucumber") -@SelectClasspathResource("features/voice") -@ConfigurationParameter(key = GLUE_PROPERTY_NAME, value = "com.sinch.sdk.e2e.domains.voice.v0") -public class VoiceIT {} diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/WebhooksEventsSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/WebhooksEventsSteps.java deleted file mode 100644 index d58e43be7..000000000 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/WebhooksEventsSteps.java +++ /dev/null @@ -1,291 +0,0 @@ -package com.sinch.sdk.e2e.domains.voice.v0; - -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.domains.voice.WebHooksService; -import com.sinch.sdk.domains.voice.models.CallReasonType; -import com.sinch.sdk.domains.voice.models.CallResultType; -import com.sinch.sdk.domains.voice.models.DestinationNumber; -import com.sinch.sdk.domains.voice.models.DestinationNumberType; -import com.sinch.sdk.domains.voice.models.DomainType; -import com.sinch.sdk.domains.voice.models.Price; -import com.sinch.sdk.domains.voice.models.webhooks.AnsweredCallEvent; -import com.sinch.sdk.domains.voice.models.webhooks.DisconnectCallEvent; -import com.sinch.sdk.domains.voice.models.webhooks.IncomingCallEvent; -import com.sinch.sdk.domains.voice.models.webhooks.MenuInputType; -import com.sinch.sdk.domains.voice.models.webhooks.MenuResult; -import com.sinch.sdk.domains.voice.models.webhooks.MenuResultInputMethodType; -import com.sinch.sdk.domains.voice.models.webhooks.NotifyEvent; -import com.sinch.sdk.domains.voice.models.webhooks.PromptInputEvent; -import com.sinch.sdk.domains.voice.models.webhooks.WebhooksEvent; -import com.sinch.sdk.e2e.Config; -import com.sinch.sdk.e2e.domains.WebhooksHelper; -import com.sinch.sdk.models.E164PhoneNumber; -import io.cucumber.java.en.Given; -import io.cucumber.java.en.Then; -import io.cucumber.java.en.When; -import java.io.IOException; -import java.net.URL; -import java.time.Instant; -import org.junit.jupiter.api.Assertions; - -public class WebhooksEventsSteps { - - static final String WEBHOOKS_PATH_PREFIX = "/webhooks/voice"; - static final String WEBHOOKS_URL = Config.VOICE_HOST_NAME + WEBHOOKS_PATH_PREFIX; - - WebHooksService service; - - WebhooksHelper.Response pieReturn; - WebhooksHelper.Response pieSequence; - WebhooksHelper.Response diceEvent; - WebhooksHelper.Response aceEvent; - WebhooksHelper.Response iceEvent; - WebhooksHelper.Response recordingFinishedEvent; - WebhooksHelper.Response recordingAvailableEvent; - WebhooksHelper.Response transcriptionAvailableEvent; - - PromptInputEvent expectedPieReturnEvent = - PromptInputEvent.builder() - .setApplicationKey("f00dcafe-abba-c0de-1dea-dabb1ed4caf3") - .setCallId("1ce0ffee-ca11-ca11-ca11-abcdef000013") - .setTimestamp(Instant.parse("2024-06-06T17:35:01Z")) - .setVersion(1) - .setCustom("Custom text") - .setMenuResult( - MenuResult.builder() - .setType(MenuInputType.RETURN) - .setValue("cancel") - .setMenuId("main") - .setInputMethod(MenuResultInputMethodType.DTMF) - .build()) - .build(); - - PromptInputEvent expectedPieSequenceEvent = - PromptInputEvent.builder() - .setApplicationKey("f00dcafe-abba-c0de-1dea-dabb1ed4caf3") - .setCallId("1ce0ffee-ca11-ca11-ca11-abcdef000023") - .setTimestamp(Instant.parse("2024-06-06T17:35:58Z")) - .setVersion(1) - .setCustom("Custom text") - .setMenuResult( - MenuResult.builder() - .setType(MenuInputType.SEQUENCE) - .setValue("1234") - .setMenuId("confirm") - .setInputMethod(MenuResultInputMethodType.DTMF) - .build()) - .build(); - - WebhooksEvent expectedDiceEvent = - DisconnectCallEvent.builder() - .setCallId("1ce0ffee-ca11-ca11-ca11-abcdef000033") - .setTimestamp(Instant.parse("2024-06-06T16:59:42Z")) - .setReason(CallReasonType.MANAGER_HANGUP) - .setResult(CallResultType.ANSWERED) - .setVersion(1) - .setCustom("Custom text") - .setDebit(Price.builder().setCurrencyId("EUR").setAmount(0.0095F).build()) - .setUserRate(Price.builder().setCurrencyId("EUR").setAmount(0.0095F).build()) - .setTo(DestinationNumber.valueOf("12017777777")) - .setApplicationKey("f00dcafe-abba-c0de-1dea-dabb1ed4caf3") - .setDuration(12) - .setFrom("12015555555") - .build(); - WebhooksEvent expectedAceEvent = - AnsweredCallEvent.builder() - .setCallId("1ce0ffee-ca11-ca11-ca11-abcdef000043") - .setTimestamp(Instant.parse("2024-06-06T17:10:34Z")) - .setVersion(1) - .setCustom("Custom text") - .build(); - - IncomingCallEvent expectedIceEvent = - IncomingCallEvent.builder() - .setCallId("1ce0ffee-ca11-ca11-ca11-abcdef000053") - .setCallResourceUrl( - "https://calling-use1.api.sinch.com/calling/v1/calls/id/1ce0ffee-ca11-ca11-ca11-abcdef000053") - .setTimestamp(Instant.parse("2024-06-06T17:20:14Z")) - .setVersion(1) - .setUserRate(Price.builder().setCurrencyId("USD").setAmount(0.0F).build()) - .setCli("12015555555") - .setTo( - new DestinationNumber( - E164PhoneNumber.valueOf("+12017777777"), DestinationNumberType.DID)) - .setDomain(DomainType.PSTN) - .setApplicationKey("f00dcafe-abba-c0de-1dea-dabb1ed4caf3") - .setOriginationType(DomainType.PSTN) - .setRdnis("") - .build(); - - NotifyEvent expectedRecordingFinishedEvent = - NotifyEvent.builder() - .setCallId("33dd8e62-0ac6-4e0c-a89f-36d121f861f9") - .setVersion(1) - .setType("recording_finished") - .build(); - - NotifyEvent expectedRecordingAvailableEvent = - NotifyEvent.builder() - .setCallId("33dd8e62-0ac6-4e0c-a89f-36d121f861f9") - .setVersion(1) - .setType("recording_available") - .build(); - - NotifyEvent expectedTranscriptionAvailableEvent = - NotifyEvent.builder() - .setCallId("33dd8e62-0ac6-4e0c-a89f-36d121f861f9") - .setVersion(1) - .setType("transcription_available") - .build(); - - @Given("^the Voice Webhooks handler is available$") - public void serviceAvailable() { - service = Config.getSinchClient().voice().webhooks(); - } - - @When("^I send a request to trigger a \"PIE\" event with a \"return\" type$") - public void sendPieReturn() throws IOException { - pieReturn = - WebhooksHelper.callURL( - new URL(WEBHOOKS_URL + "/pie-return"), service::unserializeWebhooksEvent); - } - - @When("^I send a request to trigger a \"PIE\" event with a \"sequence\" type$") - public void sendPieSequence() throws IOException { - pieSequence = - WebhooksHelper.callURL( - new URL(WEBHOOKS_URL + "/pie-sequence"), service::unserializeWebhooksEvent); - } - - @When("^I send a request to trigger a \"DICE\" event$") - public void sendDICEEvent() throws IOException { - diceEvent = - WebhooksHelper.callURL(new URL(WEBHOOKS_URL + "/dice"), service::unserializeWebhooksEvent); - } - - @When("^I send a request to trigger a \"ACE\" event$") - public void sendACEEvent() throws IOException { - aceEvent = - WebhooksHelper.callURL(new URL(WEBHOOKS_URL + "/ace"), service::unserializeWebhooksEvent); - } - - @When("^I send a request to trigger a \"ICE\" event$") - public void sendICEEvent() throws IOException { - iceEvent = - WebhooksHelper.callURL(new URL(WEBHOOKS_URL + "/ice"), service::unserializeWebhooksEvent); - } - - @When("^I send a request to trigger a \"recording_finished\" event$") - public void sendRecordingFinishedEvent() throws IOException { - recordingFinishedEvent = - WebhooksHelper.callURL( - new URL(WEBHOOKS_URL + "/notify/recording_finished"), - service::unserializeWebhooksEvent); - } - - @When("^I send a request to trigger a \"recording_available\" event$") - public void sendRecordingAvailableEvent() throws IOException { - recordingAvailableEvent = - WebhooksHelper.callURL( - new URL(WEBHOOKS_URL + "/notify/recording_available"), - service::unserializeWebhooksEvent); - } - - @When("^I send a request to trigger a \"transcription_available\" event$") - public void sendTranscriptionAvailableEvent() throws IOException { - transcriptionAvailableEvent = - WebhooksHelper.callURL( - new URL(WEBHOOKS_URL + "/notify/transcription_available"), - service::unserializeWebhooksEvent); - } - - @Then("the header of the {string} event with a {string} type contains a valid authorization") - public void validatePieHeader(String event, String type) { - - WebhooksHelper.Response receivedEvent = null; - if (event.equals("PIE") && type.equals("return")) { - receivedEvent = pieReturn; - } else if (event.equals("PIE") && type.equals("sequence")) { - receivedEvent = pieSequence; - } else { - Assertions.fail(); - } - boolean validated = - service.validateAuthenticatedRequest( - "POST", WEBHOOKS_PATH_PREFIX, receivedEvent.headers, receivedEvent.rawPayload); - Assertions.assertTrue(validated); - } - - @Then("the header of the {string} event contains a valid authorization") - public void validateHeader(String event) { - - WebhooksHelper.Response receivedEvent = null; - if (event.equals("DICE")) { - receivedEvent = diceEvent; - } else if (event.equals("ACE")) { - receivedEvent = aceEvent; - } else if (event.equals("ICE")) { - receivedEvent = iceEvent; - } else if (event.equals("recording_finished")) { - receivedEvent = recordingFinishedEvent; - } else if (event.equals("recording_available")) { - receivedEvent = recordingAvailableEvent; - } else if (event.equals("transcription_available")) { - receivedEvent = transcriptionAvailableEvent; - } else { - Assertions.fail(); - } - boolean validated = - service.validateAuthenticatedRequest( - "POST", WEBHOOKS_PATH_PREFIX, receivedEvent.headers, receivedEvent.rawPayload); - Assertions.assertTrue(validated); - } - - @Then("the Voice event describes a {string} event with a {string} type") - public void validateTypeEvent(String event, String type) { - - WebhooksHelper.Response receivedEvent = null; - WebhooksEvent expectedEvent = null; - if (event.equals("PIE") && type.equals("return")) { - receivedEvent = pieReturn; - expectedEvent = expectedPieReturnEvent; - } else if (event.equals("PIE") && type.equals("sequence")) { - receivedEvent = pieSequence; - expectedEvent = expectedPieSequenceEvent; - } else if (event.equals("notify") && type.equals("recording_finished")) { - receivedEvent = recordingFinishedEvent; - expectedEvent = expectedRecordingFinishedEvent; - } else if (event.equals("notify") && type.equals("recording_available")) { - receivedEvent = recordingAvailableEvent; - expectedEvent = expectedRecordingAvailableEvent; - } else if (event.equals("notify") && type.equals("transcription_available")) { - receivedEvent = transcriptionAvailableEvent; - expectedEvent = expectedTranscriptionAvailableEvent; - } else { - Assertions.fail(); - } - - TestHelpers.recursiveEquals(expectedEvent, receivedEvent.event); - } - - @Then("the Voice event describes a {string} event") - public void validateEvent(String event) { - - WebhooksHelper.Response receivedEvent = null; - WebhooksEvent expectedEvent = null; - if (event.equals("DICE")) { - receivedEvent = diceEvent; - expectedEvent = expectedDiceEvent; - } else if (event.equals("ACE")) { - receivedEvent = aceEvent; - expectedEvent = expectedAceEvent; - } else if (event.equals("ICE")) { - receivedEvent = iceEvent; - expectedEvent = expectedIceEvent; - } else { - Assertions.fail(); - } - - TestHelpers.recursiveEquals(expectedEvent, receivedEvent.event); - } -} diff --git a/examples/tutorials/voice/handle-incoming-call/src/main/java/com/mycompany/app/WebhookController.java b/examples/tutorials/voice/handle-incoming-call/src/main/java/com/mycompany/app/WebhookController.java index 55548e90d..87911edfc 100644 --- a/examples/tutorials/voice/handle-incoming-call/src/main/java/com/mycompany/app/WebhookController.java +++ b/examples/tutorials/voice/handle-incoming-call/src/main/java/com/mycompany/app/WebhookController.java @@ -1,7 +1,7 @@ package com.mycompany.app; import com.sinch.sdk.domains.voice.VoiceService; -import com.sinch.sdk.domains.voice.models.webhooks.IncomingCallEvent; +import com.sinch.sdk.domains.voice.models.v1.webhooks.IncomingCallEvent; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; @@ -36,8 +36,9 @@ public String voiceEvent(@RequestHeader Map headers, @RequestBod // ensure valid authentication before handling request var validAuth = voiceService + .v1() .webhooks() - .validateAuthenticatedRequest( + .validateAuthenticationHeader( // The HTTP verb this controller is managing "POST", // The URI this path is managing @@ -53,7 +54,7 @@ public String voiceEvent(@RequestHeader Map headers, @RequestBod } // decode the payload request - var event = voiceService.webhooks().unserializeWebhooksEvent(body); + var event = voiceService.v1().webhooks().parseEvent(body); if (!(event instanceof IncomingCallEvent)) { return ""; @@ -62,6 +63,6 @@ public String voiceEvent(@RequestHeader Map headers, @RequestBod // let business layer process the request var response = webhookService.answered((IncomingCallEvent) event); - return voiceService.webhooks().serializeWebhooksResponse(response); + return voiceService.v1().webhooks().serializeResponse(response); } } diff --git a/examples/tutorials/voice/handle-incoming-call/src/main/java/com/mycompany/app/WebhookService.java b/examples/tutorials/voice/handle-incoming-call/src/main/java/com/mycompany/app/WebhookService.java index 179108869..f618ab34a 100644 --- a/examples/tutorials/voice/handle-incoming-call/src/main/java/com/mycompany/app/WebhookService.java +++ b/examples/tutorials/voice/handle-incoming-call/src/main/java/com/mycompany/app/WebhookService.java @@ -1,9 +1,9 @@ package com.mycompany.app; -import com.sinch.sdk.domains.voice.models.svaml.ActionHangUp; -import com.sinch.sdk.domains.voice.models.svaml.InstructionSay; -import com.sinch.sdk.domains.voice.models.svaml.SVAMLControl; -import com.sinch.sdk.domains.voice.models.webhooks.IncomingCallEvent; +import com.sinch.sdk.domains.voice.models.v1.svaml.SvamlControl; +import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionHangup; +import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionSay; +import com.sinch.sdk.domains.voice.models.v1.webhooks.IncomingCallEvent; import java.util.Collections; import java.util.logging.Logger; import org.springframework.stereotype.Component; @@ -13,19 +13,19 @@ public class WebhookService { private static final Logger LOGGER = Logger.getLogger(WebhookService.class.getName()); - public SVAMLControl answered(IncomingCallEvent event) { + public SvamlControl answered(IncomingCallEvent event) { LOGGER.info( "Incoming call from '%s' received for '%s' :".formatted(event.getCli(), event.getTo())); - var hangupAction = ActionHangUp.builder().build(); + var hangupAction = SvamlActionHangup.builder().build(); var sayInstruction = - InstructionSay.builder() + SvamlInstructionSay.builder() .setText("Thank you for calling Sinch. This call will now end.") .build(); - return SVAMLControl.builder() + return SvamlControl.builder() .setInstructions(Collections.singletonList(sayInstruction)) .setAction(hangupAction) .build(); diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/callouts/CalloutRequestDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/callouts/CalloutRequestDtoTest.java index 1cf3d3751..d10ba10a6 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/callouts/CalloutRequestDtoTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/callouts/CalloutRequestDtoTest.java @@ -15,7 +15,7 @@ import com.sinch.sdk.domains.voice.models.v1.destination.DestinationPstn; import com.sinch.sdk.domains.voice.models.v1.svaml.ControlUrl; import com.sinch.sdk.domains.voice.models.v1.svaml.SvamlControl; -import com.sinch.sdk.domains.voice.models.v1.svaml.action.ConnectPstnAnsweringMachineDetection; +import com.sinch.sdk.domains.voice.models.v1.svaml.action.AnsweringMachineDetectionQuery; import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionConnectPstn; import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionHangup; import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionSay; @@ -91,10 +91,7 @@ public class CalloutRequestDtoTest extends VoiceBaseTest { SvamlActionConnectPstn.builder() .setNumber("+12233445566") .setCli("+12234325234") - .setAmd( - ConnectPstnAnsweringMachineDetection.builder() - .setEnabled(true) - .build()) + .setAmd(AnsweringMachineDetectionQuery.builder().setEnabled(true).build()) .build()) .build()) .setAce( diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectPstnTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectPstnTest.java index 65324f58d..f14f63c17 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectPstnTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectPstnTest.java @@ -23,11 +23,7 @@ public class SvamlActionConnectPstnTest extends BaseTest { .setSuppressCallbacks(true) .setDtmf(DualToneMultiFrequency.valueOf("#w123")) .setIndications(IndicationsEnum.from("unknown value")) - .setAmd( - ConnectPstnAnsweringMachineDetection.builder() - .setEnabled(true) - .setAsync(true) - .build()) + .setAmd(AnsweringMachineDetectionQuery.builder().setEnabled(true).setAsync(true).build()) .build(); public static SvamlActionConnectPstn dto = diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/webhooks/VoiceWebhookEventTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/webhooks/VoiceWebhookEventTest.java index 876f69533..fc78a76e6 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/webhooks/VoiceWebhookEventTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/webhooks/VoiceWebhookEventTest.java @@ -71,22 +71,6 @@ public class VoiceWebhookEventTest extends VoiceBaseTest { .setUserRate(Price.builder().setCurrencyId("USD").setAmount(0.345F).build()) .build(); - public static AnsweredCallEvent expectedAceRequestDtoDeprecated = - AnsweredCallEvent.builder() - .setCallid("a call id") - .setConferenceId("a conference id") - .setTimestamp(Instant.parse("2024-01-19T12:49:53Z")) - .setVersion(1) - .setCustom("my custom value") - .setApplicationKey("my application key") - .setAmd( - AnsweredCallEventAnsweringMachineDetection.builder() - .setStatus(AnsweredCallEventAnsweringMachineDetection.StatusEnum.HUMAN) - .setReason(AnsweredCallEventAnsweringMachineDetection.ReasonEnum.LONGGREETING) - .setDuration(15) - .build()) - .build(); - public static AnsweredCallEvent expectedAceRequestDto = AnsweredCallEvent.builder() .setCallid("a call id") @@ -150,11 +134,6 @@ void deserializeAceRequest() { TestHelpers.recursiveEquals(loadedAceRequestDto, expectedAceRequestDto); } - @Test - void deserializeAceRequestDeprecated() { - TestHelpers.recursiveEquals(loadedAceRequestDto, expectedAceRequestDtoDeprecated); - } - @Test void deserializePieRequest() { TestHelpers.recursiveEquals(loadedPieRequestDto, expectedPieRequestDto); diff --git a/pom.xml b/pom.xml index fdebaa695..c4ec08967 100644 --- a/pom.xml +++ b/pom.xml @@ -147,16 +147,6 @@ com/sinch/sdk/domains/verification/VerificationsService.java com/sinch/sdk/domains/verification/VerificationStatusService.java com/sinch/sdk/domains/verification/WebHooksService.java - com/sinch/sdk/domains/voice/models/*.java - com/sinch/sdk/domains/voice/models/requests/*.java - com/sinch/sdk/domains/voice/models/response/*.java - com/sinch/sdk/domains/voice/models/svaml/*.java - com/sinch/sdk/domains/voice/models/webhooks/*.java - com/sinch/sdk/domains/voice/ApplicationsService.java - com/sinch/sdk/domains/voice/CalloutsService.java - com/sinch/sdk/domains/voice/CallsService.java - com/sinch/sdk/domains/voice/ConferencesService.java - com/sinch/sdk/domains/voice/WebHooksService.java @@ -317,7 +307,6 @@ com.sinch.sdk.e2e.domains.numbers.v1.NumbersIT com.sinch.sdk.e2e.domains.conversation.ConversationIT com.sinch.sdk.e2e.domains.sms.v1.SmsIT - com.sinch.sdk.e2e.domains.voice.v0.VoiceIT com.sinch.sdk.e2e.domains.voice.v1.VoiceIT com.sinch.sdk.e2e.domains.verification.v0.VerificationIT com.sinch.sdk.e2e.domains.verification.v1.VerificationIT From 639916cd467b4106bfab780229900c99686ceddf Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier <141755467+JPPortier@users.noreply.github.com> Date: Wed, 23 Jul 2025 15:52:24 +0200 Subject: [PATCH 006/122] feat (Verification): Remove Verification deprecated features (#260) * feat (Verification): Remove Verification deprecated features --- MIGRATION-GUIDE.md | 83 ++++ .../verification/VerificationService.java | 42 -- .../VerificationStatusService.java | 68 ---- .../verification/VerificationsService.java | 220 ----------- .../domains/verification/WebHooksService.java | 77 ---- .../adapters/VerificationService.java | 33 -- .../adapters/VerificationStatusService.java | 39 -- .../adapters/VerificationsReportService.java | 71 ---- .../adapters/VerificationsService.java | 81 ---- .../adapters/VerificationsStartService.java | 63 --- .../adapters/WebHooksService.java | 39 -- .../converters/IdentityDtoConverter.java | 46 --- .../adapters/converters/LinkDtoConverter.java | 23 -- .../converters/PriceDtoConverter.java | 13 - .../converters/StatusDtoConverter.java | 129 ------ .../converters/VerificationsDtoConverter.java | 359 ----------------- .../converters/WebHooksDtoConverter.java | 141 ------- .../domains/verification/models/Identity.java | 21 - .../sdk/domains/verification/models/Link.java | 127 ------ .../verification/models/LinkRelType.java | 56 --- .../verification/models/NumberIdentity.java | 110 ------ .../domains/verification/models/Price.java | 95 ----- .../verification/models/VerificationId.java | 38 -- .../models/VerificationMethodType.java | 75 ---- .../models/VerificationReference.java | 38 -- .../models/VerificationReport.java | 104 ----- .../models/VerificationReportCallout.java | 53 --- .../models/VerificationReportFlashCall.java | 53 --- .../models/VerificationReportSMS.java | 53 --- .../models/VerificationSourceType.java | 61 --- .../models/VerificationStatus.java | 265 ------------- .../models/VerificationStatusCallout.java | 200 ---------- .../models/VerificationStatusFlashCall.java | 200 ---------- .../models/VerificationStatusReasonType.java | 124 ------ .../models/VerificationStatusSMS.java | 133 ------- .../models/VerificationStatusType.java | 73 ---- .../models/requests/SMSCodeType.java | 56 --- .../StartVerificationCalloutOptions.java | 67 ---- ...tVerificationCalloutRequestParameters.java | 84 ---- ...StartVerificationCalloutSpeechOptions.java | 69 ---- ...erificationFlashCallRequestParameters.java | 97 ----- .../StartVerificationRequestParameters.java | 153 ------- .../requests/StartVerificationSMSOptions.java | 128 ------ ...StartVerificationSMSRequestParameters.java | 85 ---- ...VerificationSeamlessRequestParameters.java | 62 --- ...icationReportCalloutRequestParameters.java | 91 ----- ...ationReportFlashCallRequestParameters.java | 92 ----- .../VerificationReportRequestParameters.java | 69 ---- ...erificationReportSMSRequestParameters.java | 119 ------ .../models/requests/package-info.java | 6 - .../response/StartVerificationResponse.java | 110 ------ .../StartVerificationResponseCallout.java | 67 ---- .../StartVerificationResponseFlashCall.java | 184 --------- .../StartVerificationResponseSMS.java | 123 ------ .../StartVerificationResponseSeamless.java | 96 ----- .../models/response/package-info.java | 6 - .../models/webhooks/VerificationEvent.java | 103 ----- .../webhooks/VerificationRequestEvent.java | 72 ---- .../models/webhooks/VerificationResponse.java | 82 ---- .../VerificationResponseActionType.java | 76 ---- .../webhooks/VerificationResponseCallout.java | 119 ------ .../VerificationResponseCalloutSpeech.java | 78 ---- .../VerificationResponseFlashCall.java | 125 ------ .../webhooks/VerificationResponseSMS.java | 119 ------ .../webhooks/VerificationResultEvent.java | 84 ---- .../models/webhooks/package-info.java | 6 - .../adapters/VerificationServiceTest.java | 4 - .../VerificationStatusServiceTest.java | 84 ---- .../VerificationsReportServiceTest.java | 162 -------- .../VerificationsStartServiceTest.java | 111 ------ .../adapters/WebhooksServiceTest.java | 118 ------ .../converters/LinkDtoConverterTest.java | 40 -- .../VerificationsDtoConverterTest.java | 372 ------------------ .../converters/WebhooksDtoConverterTest.java | 109 ----- ...ificationCalloutRequestParametersTest.java | 42 -- ...icationFlashCallRequestParametersTest.java | 49 --- ...tVerificationSMSRequestParametersTest.java | 42 -- ...ficationSeamlessRequestParametersTest.java | 42 -- ...nReportFlashCallRequestParametersTest.java | 23 -- ...ionStatusCalloutRequestParametersTest.java | 23 -- ...icationStatusSMSRequestParametersTest.java | 29 -- .../domains/verification/v0/ReportSteps.java | 157 -------- .../domains/verification/v0/StartSteps.java | 173 -------- .../domains/verification/v0/StatusSteps.java | 100 ----- .../verification/v0/VerificationIT.java | 18 - .../verification/v0/WebhooksEventsSteps.java | 105 ----- pom.xml | 8 - 87 files changed, 83 insertions(+), 7762 deletions(-) delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/VerificationStatusService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/VerificationsService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/WebHooksService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/adapters/VerificationStatusService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/adapters/VerificationsReportService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/adapters/VerificationsService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/adapters/VerificationsStartService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/adapters/WebHooksService.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/adapters/converters/IdentityDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/adapters/converters/LinkDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/adapters/converters/PriceDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/adapters/converters/StatusDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/adapters/converters/VerificationsDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/adapters/converters/WebHooksDtoConverter.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/Identity.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/Link.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/LinkRelType.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/NumberIdentity.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/Price.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/VerificationId.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/VerificationMethodType.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/VerificationReference.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/VerificationReport.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/VerificationReportCallout.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/VerificationReportFlashCall.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/VerificationReportSMS.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/VerificationSourceType.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/VerificationStatus.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/VerificationStatusCallout.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/VerificationStatusFlashCall.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/VerificationStatusReasonType.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/VerificationStatusSMS.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/VerificationStatusType.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/requests/SMSCodeType.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/requests/StartVerificationCalloutOptions.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/requests/StartVerificationCalloutRequestParameters.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/requests/StartVerificationCalloutSpeechOptions.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/requests/StartVerificationFlashCallRequestParameters.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/requests/StartVerificationRequestParameters.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/requests/StartVerificationSMSOptions.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/requests/StartVerificationSMSRequestParameters.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/requests/StartVerificationSeamlessRequestParameters.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/requests/VerificationReportCalloutRequestParameters.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/requests/VerificationReportFlashCallRequestParameters.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/requests/VerificationReportRequestParameters.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/requests/VerificationReportSMSRequestParameters.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/requests/package-info.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/response/StartVerificationResponse.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/response/StartVerificationResponseCallout.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/response/StartVerificationResponseFlashCall.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/response/StartVerificationResponseSMS.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/response/StartVerificationResponseSeamless.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/response/package-info.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/webhooks/VerificationEvent.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/webhooks/VerificationRequestEvent.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/webhooks/VerificationResponse.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/webhooks/VerificationResponseActionType.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/webhooks/VerificationResponseCallout.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/webhooks/VerificationResponseCalloutSpeech.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/webhooks/VerificationResponseFlashCall.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/webhooks/VerificationResponseSMS.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/webhooks/VerificationResultEvent.java delete mode 100644 client/src/main/com/sinch/sdk/domains/verification/models/webhooks/package-info.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/verification/adapters/VerificationServiceTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/verification/adapters/VerificationStatusServiceTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/verification/adapters/VerificationsReportServiceTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/verification/adapters/VerificationsStartServiceTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/verification/adapters/WebhooksServiceTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/verification/adapters/converters/LinkDtoConverterTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/verification/adapters/converters/VerificationsDtoConverterTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/verification/adapters/converters/WebhooksDtoConverterTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/verification/models/requests/StartVerificationCalloutRequestParametersTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/verification/models/requests/StartVerificationFlashCallRequestParametersTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/verification/models/requests/StartVerificationSMSRequestParametersTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/verification/models/requests/StartVerificationSeamlessRequestParametersTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/verification/models/requests/VerificationReportFlashCallRequestParametersTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/verification/models/requests/VerificationStatusCalloutRequestParametersTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/domains/verification/models/requests/VerificationStatusSMSRequestParametersTest.java delete mode 100644 client/src/test/java/com/sinch/sdk/e2e/domains/verification/v0/ReportSteps.java delete mode 100644 client/src/test/java/com/sinch/sdk/e2e/domains/verification/v0/StartSteps.java delete mode 100644 client/src/test/java/com/sinch/sdk/e2e/domains/verification/v0/StatusSteps.java delete mode 100644 client/src/test/java/com/sinch/sdk/e2e/domains/verification/v0/VerificationIT.java delete mode 100644 client/src/test/java/com/sinch/sdk/e2e/domains/verification/v0/WebhooksEventsSteps.java diff --git a/MIGRATION-GUIDE.md b/MIGRATION-GUIDE.md index ab85d8772..8885e9343 100644 --- a/MIGRATION-GUIDE.md +++ b/MIGRATION-GUIDE.md @@ -289,3 +289,86 @@ Use the new versioned API under `voice().v1()` to get access to [VoiceService](h | calls() | [v1().calls()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/api/v1/CallsService.html) | | conferences() | [v1().conferences()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/api/v1/ConferencesService.html) | | webhooks() | [v1().webhooks()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/voice/api/v1/WebHooksService.html) | + + +### [`Verification`](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/package-summary.html) + +#### Replacement models +##### Common Report + +| Old class | New class | +|-------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| models/Price | [com.sinch.sdk.domains.verification.models.v1.Price](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/Price.html) | +| models/VerificationStatusType | [com.sinch.sdk.domains.verification.models.v1.VerificationStatus](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/VerificationStatus.html) | +| models/VerificationMethodType | [com.sinch.sdk.domains.verification.models.v1.VerificationMethod](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/VerificationMethod.html) | +| models/Identity | [com.sinch.sdk.domains.verification.models.v1.Identity](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/Identity.html) | +| models/NumberIdentity | [com.sinch.sdk.domains.verification.models.v1.NumberIdentity](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/NumberIdentity.html) | +| models/VerificationId | `java.lang.String` | +| models/VerificationReference | `java.lang.String` | + +##### Verification Report +| Old class | New class | +|--------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| models/requests/VerificationReportCalloutRequestParameters | [com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestPhoneCall](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/report/request/VerificationReportRequestPhoneCall.html) | +| models/requests/VerificationReportFlashCallRequestParameters | [com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestFlashCall](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/report/request/VerificationReportRequestFlashCall.html) | +| models/requests/VerificationReportRequestParameters | [com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequest](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/report/request/VerificationReportRequest.html) | +| models/requests/VerificationReportSMSRequestParameters | [com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestSms](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/report/request/VerificationReportRequestSms.html) | +| models/VerificationReport | [com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/report/response/VerificationReportResponse.html) | +| models/VerificationReportCallout | [com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponsePhoneCall](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/report/response/VerificationReportResponsePhoneCall.html) | +| models/VerificationReportFlashCall | [com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponseFlashCall](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/report/response/VerificationReportResponseFlashCall.html) | +| models/VerificationReportSMS | [com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponseSms](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/report/response/VerificationReportResponseSms.html) | + +##### Verification Start +| Old class | New class | +|-------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| models/requests/StartVerificationCalloutOptions | N/A (direct access to `PhoneCallSpeech` from `VerificationStartRequestPhoneCall`) | +| models/requests/StartVerificationCalloutRequestParameters | [com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestPhoneCall](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestPhoneCall.html) | +| models/requests/StartVerificationCalloutSpeechOptions | [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/requests/StartVerificationFlashCallRequestParameters | [com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestFlashCall](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestFlashCall.html) | +| models/requests/StartVerificationRequestParameters | [com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequest](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequest.html) | +| models/requests/StartVerificationSMSOptions | N/A (direct access to dedicated `fields` from `VerificationStartRequestSms`) | +| models/requests/StartVerificationSMSRequestParameters | [com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestSms](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestSms.html) | +| models/requests/StartVerificationSeamlessRequestParameters | [com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestData](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestData.html) | +| models/requests/SMSCodeType | [com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestSms.CodeTypeEnum](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestSms.CodeTypeEnum.html) | +| models/response/StartVerificationResponse | [com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponse.html) | +| models/response/StartVerificationResponseCallout | [com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponsePhoneCall](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponsePhoneCall.html) | +| models/response/StartVerificationResponseFlashCall | [com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseFlashCall](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseFlashCall.html) | +| models/response/StartVerificationResponseSMS | [com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseSms](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseSms.html) | +| models/response/StartVerificationResponseSeamless | [com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseData](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseData.html) | +| models/Link | [com.sinch.sdk.domains.verification.models.v1.start.response.Link](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/response/Link.html) | +| models/LinkRelType | [com.sinch.sdk.domains.verification.models.v1.start.response.Link.RelEnum](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/response/Link.RelEnum.html) | + +##### Verification Status +| Old class | New class | +|-------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| models/VerificationStatus | [com.sinch.sdk.domains.verification.models.v1.status.response.VerificationStatusResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponse.html) | +| models/VerificationStatusCallout | [com.sinch.sdk.domains.verification.models.v1.status.response.VerificationStatusResponsePhoneCall](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponsePhoneCall.html) | +| models/VerificationStatusFlashCall | [com.sinch.sdk.domains.verification.models.v1.status.response.VerificationStatusResponseFlashCall](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponseFlashCall.html) | +| models/VerificationStatusReasonType | [com.sinch.sdk.domains.verification.models.v1.VerificationStatusReason](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/VerificationStatusReason.html) | +| models/VerificationStatusSMS | [com.sinch.sdk.domains.verification.models.v1.status.response.VerificationStatusResponseSms](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponseSms.html) | +| 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) | + + +#### Replacement APIs + +Use the new versioned API under `verification().v1()` to get access to [VerificationService](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/api/v1/VerificationService.html): [`sinchClient.verification().v1()`](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/VerificationService.html#v1()) + +| Old interface | New Equivalent in `verification().v1()` | +|---------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 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) | diff --git a/client/src/main/com/sinch/sdk/domains/verification/VerificationService.java b/client/src/main/com/sinch/sdk/domains/verification/VerificationService.java index 88d47b492..d028020b3 100644 --- a/client/src/main/com/sinch/sdk/domains/verification/VerificationService.java +++ b/client/src/main/com/sinch/sdk/domains/verification/VerificationService.java @@ -18,46 +18,4 @@ public interface VerificationService { * @since 1.1 */ com.sinch.sdk.domains.verification.api.v1.VerificationService v1(); - - /** - * Non versioned Verifications Service instance - * - * @return service instance for project - * @see Documentation - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.verification.api.v1.VerificationService#verificationReport()} and - * {@link com.sinch.sdk.domains.verification.api.v1.VerificationService#verificationStart()} - * instead. - */ - @Deprecated - VerificationsService verifications(); - - /** - * Non versioned Status Service instance - * - * @return service instance for project - * @see Documentation - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.verification.api.v1.VerificationService#verificationStatus()} - * instead. - */ - @Deprecated - VerificationStatusService verificationStatus(); - - /** - * Non versioned Webhooks helpers instance - * - * @return instance service related to webhooks helpers - * @see Documentation - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.verification.api.v1.VerificationService#webhooks()} instead. - */ - @Deprecated - WebHooksService webhooks(); } diff --git a/client/src/main/com/sinch/sdk/domains/verification/VerificationStatusService.java b/client/src/main/com/sinch/sdk/domains/verification/VerificationStatusService.java deleted file mode 100644 index 78dee723a..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/VerificationStatusService.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.sinch.sdk.domains.verification; - -import com.sinch.sdk.domains.verification.models.NumberIdentity; -import com.sinch.sdk.domains.verification.models.VerificationId; -import com.sinch.sdk.domains.verification.models.VerificationMethodType; -import com.sinch.sdk.domains.verification.models.VerificationReference; -import com.sinch.sdk.domains.verification.models.VerificationStatus; -import com.sinch.sdk.domains.verification.models.v1.VerificationMethod; - -/** - * Get the status of specific verification requests in the verification process. Returns the status - * of pending and completed verifications. You can retrieve the status of verification requests by - * using the ID of the request, the phone number of the user being verified, or a custom reference - * string. - * - * @see https://developers.sinch.com/docs/verification/api-reference/verification/tag/Verification-status - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.verification.api.v1.VerificationStatusService} - * instead. - */ -@Deprecated -public interface VerificationStatusService { - - /** - * Queries the verification result by sending the verification Identity (usually a phone number) - * and its method. With this query you can get the result of a verification. - * - * @param identity Currently Only {@link - * com.sinch.sdk.domains.verification.models.NumberIdentity NumberIdentity} is supported - * @param method Method used for verification - * @return Verification status response - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.verification.api.v1.VerificationStatusService#getByIdentity(com.sinch.sdk.domains.verification.models.v1.NumberIdentity, - * VerificationMethod)} instead. - */ - @Deprecated - VerificationStatus getByIdentity(NumberIdentity identity, VerificationMethodType method); - - /** - * Queries the verification result by sending the verification ID. With this query you can get the - * result of a verification. - * - * @param id The ID of the verification - * @return Verification status response - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.verification.api.v1.VerificationStatusService#getById(String)} - * instead. - */ - @Deprecated - VerificationStatus getById(VerificationId id); - - /** - * Queries the verification result by sending the verification Reference. With this query you can - * get the result of a verification - * - * @param reference The custom reference of the verification - * @return Verification status response - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.verification.api.v1.VerificationStatusService#getByReference(String)} - * instead. - */ - @Deprecated - VerificationStatus getByReference(VerificationReference reference); -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/VerificationsService.java b/client/src/main/com/sinch/sdk/domains/verification/VerificationsService.java deleted file mode 100644 index 5944ce48e..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/VerificationsService.java +++ /dev/null @@ -1,220 +0,0 @@ -package com.sinch.sdk.domains.verification; - -import com.sinch.sdk.domains.verification.models.NumberIdentity; -import com.sinch.sdk.domains.verification.models.VerificationId; -import com.sinch.sdk.domains.verification.models.VerificationReportCallout; -import com.sinch.sdk.domains.verification.models.VerificationReportFlashCall; -import com.sinch.sdk.domains.verification.models.VerificationReportSMS; -import com.sinch.sdk.domains.verification.models.requests.StartVerificationCalloutRequestParameters; -import com.sinch.sdk.domains.verification.models.requests.StartVerificationFlashCallRequestParameters; -import com.sinch.sdk.domains.verification.models.requests.StartVerificationSMSRequestParameters; -import com.sinch.sdk.domains.verification.models.requests.StartVerificationSeamlessRequestParameters; -import com.sinch.sdk.domains.verification.models.requests.VerificationReportCalloutRequestParameters; -import com.sinch.sdk.domains.verification.models.requests.VerificationReportFlashCallRequestParameters; -import com.sinch.sdk.domains.verification.models.requests.VerificationReportSMSRequestParameters; -import com.sinch.sdk.domains.verification.models.response.StartVerificationResponseCallout; -import com.sinch.sdk.domains.verification.models.response.StartVerificationResponseFlashCall; -import com.sinch.sdk.domains.verification.models.response.StartVerificationResponseSMS; -import com.sinch.sdk.domains.verification.models.response.StartVerificationResponseSeamless; -import com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestFlashCall; -import com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestPhoneCall; -import com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestSms; -import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestData; -import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestFlashCall; -import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestPhoneCall; -import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestSms; - -/** - * Verifications Service - * - *

Start new verification requests and report on existing verification requests. - * - * @see https://developers.sinch.com/docs/verification/api-reference/verification/tag/Verifications - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.verification.api.v1.VerificationStartService} - * instead. - */ -@Deprecated -public interface VerificationsService { - - /** - * Start verification by {@link - * com.sinch.sdk.domains.verification.models.VerificationMethodType#SMS SMS} - * - *

This method is used by the mobile and web Verification SDKs to start a verification. It can - * also be used to request a verification from your backend, by making a request. - * - * @param parameters Parameters to be used to start verification - * @return Verification response - * @deprecated use {@link - * com.sinch.sdk.domains.verification.api.v1.VerificationStartService#startSms(VerificationStartRequestSms)} - * instead. - * @since 1.0 - */ - @Deprecated - StartVerificationResponseSMS startSms(StartVerificationSMSRequestParameters parameters); - - /** - * Start verification by {@link - * com.sinch.sdk.domains.verification.models.VerificationMethodType#FLASH_CALL FLASH_CALL} - * - *

This method is used by the mobile and web Verification SDKs to start a verification. It can - * also be used to request a verification from your backend, by making a request. - * - * @param parameters Parameters to be used to start verification - * @return Verification response - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.verification.api.v1.VerificationStartService#startFlashCall(VerificationStartRequestFlashCall)} - * instead. - */ - @Deprecated - StartVerificationResponseFlashCall startFlashCall( - StartVerificationFlashCallRequestParameters parameters); - - /** - * Start verification by {@link - * com.sinch.sdk.domains.verification.models.VerificationMethodType#CALLOUT CALLOUT} - * - *

This method is used by the mobile and web Verification SDKs to start a verification. It can - * also be used to request a verification from your backend, by making a request. - * - * @param parameters Parameters to be used to start verification - * @return Verification response - * @deprecated use {@link - * com.sinch.sdk.domains.verification.api.v1.VerificationStartService#startPhoneCall(VerificationStartRequestPhoneCall)} - * instead. - * @since 1.0 - */ - @Deprecated - StartVerificationResponseCallout startCallout( - StartVerificationCalloutRequestParameters parameters); - - /** - * Start verification by {@link - * com.sinch.sdk.domains.verification.models.VerificationMethodType#SEAMLESS SEAMLESS} - * - *

This method is used by the mobile and web Verification SDKs to start a verification. It can - * also be used to request a verification from your backend, by making a request. - * - * @param parameters Parameters to be used to start verification - * @return Verification response - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.verification.api.v1.VerificationStartService#startData(VerificationStartRequestData)} - * instead. - */ - @Deprecated - StartVerificationResponseSeamless startSeamless( - StartVerificationSeamlessRequestParameters parameters); - - /** - * Report a verification using {@link - * com.sinch.sdk.domains.verification.models.VerificationMethodType#SMS SMS} & Identity - * - *

Report the received verification code to verify it, using the identity of the user - * - * @param identity Currently Only {@link - * com.sinch.sdk.domains.verification.models.NumberIdentity NumberIdentity} is supported - * @param parameters Parameters to be used to get report - * @return Verification report response - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.verification.api.v1.VerificationReportService#reportSmsByIdentity(com.sinch.sdk.domains.verification.models.v1.NumberIdentity, - * VerificationReportRequestSms)} instead. - */ - @Deprecated - VerificationReportSMS reportSmsByIdentity( - NumberIdentity identity, VerificationReportSMSRequestParameters parameters); - - /** - * Report a verification using {@link - * com.sinch.sdk.domains.verification.models.VerificationMethodType#FLASH_CALL FLASH_CALL} & - * Identity - * - *

Report the received verification code to verify it, using the identity of the user - * - * @param identity Currently Only {@link - * com.sinch.sdk.domains.verification.models.NumberIdentity NumberIdentity} is supported - * @param parameters Parameters to be used to get report - * @return Verification report response - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.verification.api.v1.VerificationReportService#reportFlashCallByIdentity(com.sinch.sdk.domains.verification.models.v1.NumberIdentity, - * VerificationReportRequestFlashCall)} instead. - */ - @Deprecated - VerificationReportFlashCall reportFlashCallByIdentity( - NumberIdentity identity, VerificationReportFlashCallRequestParameters parameters); - - /** - * Report a verification using {@link - * com.sinch.sdk.domains.verification.models.VerificationMethodType#CALLOUT CALLOUT} & - * Identity - * - *

Report the received verification code to verify it, using the identity of the user - * - * @param identity Currently Only {@link - * com.sinch.sdk.domains.verification.models.NumberIdentity NumberIdentity} is supported - * @param parameters Parameters to be used to get report - * @return Verification report response - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.verification.api.v1.VerificationReportService#reportPhoneCallByIdentity(com.sinch.sdk.domains.verification.models.v1.NumberIdentity, - * VerificationReportRequestPhoneCall)} instead. - */ - @Deprecated - VerificationReportCallout reportCalloutByIdentity( - NumberIdentity identity, VerificationReportCalloutRequestParameters parameters); - - /** - * Report the received verification code to verify it, using the Verification ID of the {@link - * com.sinch.sdk.domains.verification.models.VerificationMethodType#SMS SMS} Verification request - * - * @param id ID returned from start verification - * @param parameters Parameters to be used to get report - * @return Verification report response - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.verification.api.v1.VerificationReportService#reportSmsById(String, - * VerificationReportRequestSms)} instead. - */ - @Deprecated - VerificationReportSMS reportSmsById( - VerificationId id, VerificationReportSMSRequestParameters parameters); - - /** - * Report the received verification code to verify it, using the Verification ID of the {@link - * com.sinch.sdk.domains.verification.models.VerificationMethodType#FLASH_CALL FLASH_CALL} - * Verification request - * - * @param id ID returned from start verification - * @param parameters Parameters to be used to get report - * @return Verification report response - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.verification.api.v1.VerificationReportService#reportFlashCallById(String, - * VerificationReportRequestFlashCall)} instead. - */ - @Deprecated - VerificationReportFlashCall reportFlashCallById( - VerificationId id, VerificationReportFlashCallRequestParameters parameters); - - /** - * Report the received verification code to verify it, using the Verification ID of the {@link - * com.sinch.sdk.domains.verification.models.VerificationMethodType#CALLOUT CALLOUT} Verification - * request - * - * @param id ID returned from start verification - * @param parameters Parameters to be used to get report - * @return Verification report response - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.verification.api.v1.VerificationReportService#reportPhoneCallByIdentity(com.sinch.sdk.domains.verification.models.v1.NumberIdentity, - * VerificationReportRequestPhoneCall)} instead. - */ - @Deprecated - VerificationReportCallout reportCalloutById( - VerificationId id, VerificationReportCalloutRequestParameters parameters); -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/WebHooksService.java b/client/src/main/com/sinch/sdk/domains/verification/WebHooksService.java deleted file mode 100644 index 45f117c59..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/WebHooksService.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.sinch.sdk.domains.verification; - -import com.sinch.sdk.core.exceptions.ApiMappingException; -import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEventResponse; -import com.sinch.sdk.domains.verification.models.webhooks.VerificationEvent; -import com.sinch.sdk.domains.verification.models.webhooks.VerificationResponse; -import java.util.Map; - -/** - * Webhooks service - * - *

Callback events are used to authorize and manage your verification requests and return - * verification results. - * - *

see https://developers.sinch.com/docs/verification/api-reference/verification/tag/Verification-callbacks/#tag/Verification-callbacks/paths/VerificationRequestEvent/post - * - * @since 1.0 - * @deprecated use {@link com.sinch.sdk.domains.verification.api.v1.WebHooksService} instead. - */ -@Deprecated -public interface WebHooksService { - - /** - * The Sinch Platform can initiate callback requests to a URL you define (Callback URL) on request - * and result events. All callback requests are signed using your Application key and secret pair - * found on your dashboard. The signature is included in the Authorization header of the request - * - *

By using following function, you can ensure authentication according to received payload - * from your backend - * - * @param method The HTTP method used ot handle the callback - * @param path The path to you backend endpoint used for callback - * @param headers Received headers - * @param jsonPayload Received payload - * @return Is authentication is validated (true) or not (false) - *

see https://developers.sinch.com/docs/verification/api-reference/authentication/callback-signed-request - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.verification.api.v1.WebHooksService#validateAuthenticationHeader(String, - * String, Map, String)} instead. - */ - @Deprecated - boolean validateAuthenticationHeader( - String method, String path, Map headers, String jsonPayload); - - /** - * This function can be called to deserialize received payload onto callback onto proper java - * verification event class - * - * @param jsonPayload Received payload to be deserialized - * @return The verification event instance class - *

see https://developers.sinch.com/docs/verification/api-reference/verification/tag/Verification-callbacks/ - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.verification.api.v1.WebHooksService#parseEvent(String)} instead. - */ - @Deprecated - VerificationEvent parseEvent(String jsonPayload) throws ApiMappingException; - - /** - * This function can be called to serialize a verification response to be sent as JSON - * - * @param response The response to be serialized - * @return The JSON string to be sent - *

see https://developers.sinch.com/docs/verification/api-reference/verification/tag/Verification-callbacks/ - * @since 1.0 - * @deprecated use {@link - * com.sinch.sdk.domains.verification.api.v1.WebHooksService#serializeResponse(VerificationRequestEventResponse)} - * instead. - */ - @Deprecated - String serializeResponse(VerificationResponse response) throws ApiMappingException; -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/adapters/VerificationService.java b/client/src/main/com/sinch/sdk/domains/verification/adapters/VerificationService.java index ac4331c2e..ec078fd2c 100644 --- a/client/src/main/com/sinch/sdk/domains/verification/adapters/VerificationService.java +++ b/client/src/main/com/sinch/sdk/domains/verification/adapters/VerificationService.java @@ -1,9 +1,6 @@ package com.sinch.sdk.domains.verification.adapters; import com.sinch.sdk.core.http.HttpClient; -import com.sinch.sdk.domains.verification.VerificationStatusService; -import com.sinch.sdk.domains.verification.VerificationsService; -import com.sinch.sdk.domains.verification.WebHooksService; import com.sinch.sdk.models.ApplicationCredentials; import com.sinch.sdk.models.VerificationContext; import java.util.function.Supplier; @@ -12,10 +9,6 @@ public class VerificationService implements com.sinch.sdk.domains.verification.V private final com.sinch.sdk.domains.verification.api.v1.VerificationService v1; - private VerificationsService verifications; - private VerificationStatusService verificationStatus; - private WebHooksService webhooks; - static { LocalLazyInit.init(); } @@ -34,32 +27,6 @@ public com.sinch.sdk.domains.verification.api.v1.VerificationService v1() { return this.v1; } - public VerificationsService verifications() { - if (null == this.verifications) { - this.verifications = - new com.sinch.sdk.domains.verification.adapters.VerificationsService( - v1.verificationStart(), v1.verificationReport()); - } - return this.verifications; - } - - public VerificationStatusService verificationStatus() { - if (null == this.verificationStatus) { - this.verificationStatus = - new com.sinch.sdk.domains.verification.adapters.VerificationStatusService( - v1.verificationStatus()); - } - return this.verificationStatus; - } - - public WebHooksService webhooks() { - if (null == this.webhooks) { - this.webhooks = - new com.sinch.sdk.domains.verification.adapters.WebHooksService(v1.webhooks()); - } - return this.webhooks; - } - static final class LocalLazyInit { private LocalLazyInit() { diff --git a/client/src/main/com/sinch/sdk/domains/verification/adapters/VerificationStatusService.java b/client/src/main/com/sinch/sdk/domains/verification/adapters/VerificationStatusService.java deleted file mode 100644 index f0a32b0bc..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/adapters/VerificationStatusService.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.sinch.sdk.domains.verification.adapters; - -import com.sinch.sdk.domains.verification.adapters.converters.StatusDtoConverter; -import com.sinch.sdk.domains.verification.models.NumberIdentity; -import com.sinch.sdk.domains.verification.models.VerificationId; -import com.sinch.sdk.domains.verification.models.VerificationMethodType; -import com.sinch.sdk.domains.verification.models.VerificationReference; -import com.sinch.sdk.domains.verification.models.VerificationStatus; -import com.sinch.sdk.domains.verification.models.v1.VerificationMethod; - -public class VerificationStatusService - implements com.sinch.sdk.domains.verification.VerificationStatusService { - - private final com.sinch.sdk.domains.verification.api.v1.VerificationStatusService v1; - - public VerificationStatusService( - com.sinch.sdk.domains.verification.api.v1.VerificationStatusService v1) { - this.v1 = v1; - } - - public VerificationStatus getByIdentity(NumberIdentity identity, VerificationMethodType method) { - - return StatusDtoConverter.convert( - v1.getByIdentity( - com.sinch.sdk.domains.verification.models.v1.NumberIdentity.valueOf( - identity.getEndpoint()), - VerificationMethod.from(method.value()))); - } - - public VerificationStatus getById(VerificationId id) { - - return StatusDtoConverter.convert(v1.getById(id.getId())); - } - - public VerificationStatus getByReference(VerificationReference reference) { - - return StatusDtoConverter.convert(v1.getByReference(reference.getReference())); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/adapters/VerificationsReportService.java b/client/src/main/com/sinch/sdk/domains/verification/adapters/VerificationsReportService.java deleted file mode 100644 index 2f241aec9..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/adapters/VerificationsReportService.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.sinch.sdk.domains.verification.adapters; - -import com.sinch.sdk.domains.verification.adapters.converters.IdentityDtoConverter; -import com.sinch.sdk.domains.verification.adapters.converters.VerificationsDtoConverter; -import com.sinch.sdk.domains.verification.models.NumberIdentity; -import com.sinch.sdk.domains.verification.models.VerificationId; -import com.sinch.sdk.domains.verification.models.VerificationReportCallout; -import com.sinch.sdk.domains.verification.models.VerificationReportFlashCall; -import com.sinch.sdk.domains.verification.models.VerificationReportSMS; -import com.sinch.sdk.domains.verification.models.requests.VerificationReportCalloutRequestParameters; -import com.sinch.sdk.domains.verification.models.requests.VerificationReportFlashCallRequestParameters; -import com.sinch.sdk.domains.verification.models.requests.VerificationReportSMSRequestParameters; -import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponseFlashCall; -import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponsePhoneCall; -import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponseSms; - -public class VerificationsReportService { - - private final com.sinch.sdk.domains.verification.api.v1.VerificationReportService v1; - - public VerificationsReportService( - com.sinch.sdk.domains.verification.api.v1.VerificationReportService v1) { - this.v1 = v1; - } - - public VerificationReportSMS reportSmsByIdentity( - NumberIdentity identity, VerificationReportSMSRequestParameters parameters) { - - VerificationReportResponseSms response = - v1.reportSmsByIdentity( - IdentityDtoConverter.convert(identity), VerificationsDtoConverter.convert(parameters)); - return (VerificationReportSMS) VerificationsDtoConverter.convert(response); - } - - public VerificationReportFlashCall reportFlashCallByIdentity( - NumberIdentity identity, VerificationReportFlashCallRequestParameters parameters) { - VerificationReportResponseFlashCall response = - v1.reportFlashCallByIdentity( - IdentityDtoConverter.convert(identity), VerificationsDtoConverter.convert(parameters)); - return (VerificationReportFlashCall) VerificationsDtoConverter.convert(response); - } - - public VerificationReportCallout reportCalloutByIdentity( - NumberIdentity identity, VerificationReportCalloutRequestParameters parameters) { - VerificationReportResponsePhoneCall response = - v1.reportPhoneCallByIdentity( - IdentityDtoConverter.convert(identity), VerificationsDtoConverter.convert(parameters)); - return (VerificationReportCallout) VerificationsDtoConverter.convert(response); - } - - public VerificationReportSMS reportSmsById( - VerificationId id, VerificationReportSMSRequestParameters parameters) { - VerificationReportResponseSms response = - v1.reportSmsById(id.getId(), VerificationsDtoConverter.convert(parameters)); - return (VerificationReportSMS) VerificationsDtoConverter.convert(response); - } - - public VerificationReportFlashCall reportFlashCallById( - VerificationId id, VerificationReportFlashCallRequestParameters parameters) { - VerificationReportResponseFlashCall response = - v1.reportFlashCallById(id.getId(), VerificationsDtoConverter.convert(parameters)); - return (VerificationReportFlashCall) VerificationsDtoConverter.convert(response); - } - - public VerificationReportCallout reportCalloutById( - VerificationId id, VerificationReportCalloutRequestParameters parameters) { - VerificationReportResponsePhoneCall response = - v1.reportPhoneCallById(id.getId(), VerificationsDtoConverter.convert(parameters)); - return (VerificationReportCallout) VerificationsDtoConverter.convert(response); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/adapters/VerificationsService.java b/client/src/main/com/sinch/sdk/domains/verification/adapters/VerificationsService.java deleted file mode 100644 index 59f198814..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/adapters/VerificationsService.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.sinch.sdk.domains.verification.adapters; - -import com.sinch.sdk.domains.verification.models.NumberIdentity; -import com.sinch.sdk.domains.verification.models.VerificationId; -import com.sinch.sdk.domains.verification.models.VerificationReportCallout; -import com.sinch.sdk.domains.verification.models.VerificationReportFlashCall; -import com.sinch.sdk.domains.verification.models.VerificationReportSMS; -import com.sinch.sdk.domains.verification.models.requests.StartVerificationCalloutRequestParameters; -import com.sinch.sdk.domains.verification.models.requests.StartVerificationFlashCallRequestParameters; -import com.sinch.sdk.domains.verification.models.requests.StartVerificationSMSRequestParameters; -import com.sinch.sdk.domains.verification.models.requests.StartVerificationSeamlessRequestParameters; -import com.sinch.sdk.domains.verification.models.requests.VerificationReportCalloutRequestParameters; -import com.sinch.sdk.domains.verification.models.requests.VerificationReportFlashCallRequestParameters; -import com.sinch.sdk.domains.verification.models.requests.VerificationReportSMSRequestParameters; -import com.sinch.sdk.domains.verification.models.response.StartVerificationResponseCallout; -import com.sinch.sdk.domains.verification.models.response.StartVerificationResponseFlashCall; -import com.sinch.sdk.domains.verification.models.response.StartVerificationResponseSMS; -import com.sinch.sdk.domains.verification.models.response.StartVerificationResponseSeamless; - -public class VerificationsService - implements com.sinch.sdk.domains.verification.VerificationsService { - - private final VerificationsReportService reportService; - private final VerificationsStartService startService; - - public VerificationsService( - com.sinch.sdk.domains.verification.api.v1.VerificationStartService startV1, - com.sinch.sdk.domains.verification.api.v1.VerificationReportService reportV1) { - this.reportService = new VerificationsReportService(reportV1); - this.startService = new VerificationsStartService(startV1); - } - - public StartVerificationResponseSMS startSms(StartVerificationSMSRequestParameters parameters) { - return startService.startSms(parameters); - } - - public StartVerificationResponseFlashCall startFlashCall( - StartVerificationFlashCallRequestParameters parameters) { - return startService.startFlashCall(parameters); - } - - public StartVerificationResponseCallout startCallout( - StartVerificationCalloutRequestParameters parameters) { - return startService.startCallout(parameters); - } - - public StartVerificationResponseSeamless startSeamless( - StartVerificationSeamlessRequestParameters parameters) { - return startService.startSeamless(parameters); - } - - public VerificationReportSMS reportSmsByIdentity( - NumberIdentity identity, VerificationReportSMSRequestParameters parameters) { - return reportService.reportSmsByIdentity(identity, parameters); - } - - public VerificationReportFlashCall reportFlashCallByIdentity( - NumberIdentity identity, VerificationReportFlashCallRequestParameters parameters) { - return reportService.reportFlashCallByIdentity(identity, parameters); - } - - public VerificationReportCallout reportCalloutByIdentity( - NumberIdentity identity, VerificationReportCalloutRequestParameters parameters) { - return reportService.reportCalloutByIdentity(identity, parameters); - } - - public VerificationReportSMS reportSmsById( - VerificationId id, VerificationReportSMSRequestParameters parameters) { - return reportService.reportSmsById(id, parameters); - } - - public VerificationReportFlashCall reportFlashCallById( - VerificationId id, VerificationReportFlashCallRequestParameters parameters) { - return reportService.reportFlashCallById(id, parameters); - } - - public VerificationReportCallout reportCalloutById( - VerificationId id, VerificationReportCalloutRequestParameters parameters) { - return reportService.reportCalloutById(id, parameters); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/adapters/VerificationsStartService.java b/client/src/main/com/sinch/sdk/domains/verification/adapters/VerificationsStartService.java deleted file mode 100644 index 9a680b750..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/adapters/VerificationsStartService.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.sinch.sdk.domains.verification.adapters; - -import com.sinch.sdk.domains.verification.adapters.converters.VerificationsDtoConverter; -import com.sinch.sdk.domains.verification.models.requests.StartVerificationCalloutRequestParameters; -import com.sinch.sdk.domains.verification.models.requests.StartVerificationFlashCallRequestParameters; -import com.sinch.sdk.domains.verification.models.requests.StartVerificationSMSRequestParameters; -import com.sinch.sdk.domains.verification.models.requests.StartVerificationSeamlessRequestParameters; -import com.sinch.sdk.domains.verification.models.response.StartVerificationResponseCallout; -import com.sinch.sdk.domains.verification.models.response.StartVerificationResponseFlashCall; -import com.sinch.sdk.domains.verification.models.response.StartVerificationResponseSMS; -import com.sinch.sdk.domains.verification.models.response.StartVerificationResponseSeamless; -import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestData; -import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestFlashCall; -import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestPhoneCall; -import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestSms; -import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseSms; - -public class VerificationsStartService { - - private final com.sinch.sdk.domains.verification.api.v1.VerificationStartService v1; - - public VerificationsStartService( - com.sinch.sdk.domains.verification.api.v1.VerificationStartService v1) { - this.v1 = v1; - } - - public StartVerificationResponseSMS startSms(StartVerificationSMSRequestParameters parameters) { - - VerificationStartResponseSms response = - v1.startSms((VerificationStartRequestSms) VerificationsDtoConverter.convert(parameters)); - return (StartVerificationResponseSMS) VerificationsDtoConverter.convert(response); - } - - public StartVerificationResponseFlashCall startFlashCall( - StartVerificationFlashCallRequestParameters parameters) { - - com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseFlashCall - response = - v1.startFlashCall( - (VerificationStartRequestFlashCall) VerificationsDtoConverter.convert(parameters)); - return (StartVerificationResponseFlashCall) VerificationsDtoConverter.convert(response); - } - - public StartVerificationResponseCallout startCallout( - StartVerificationCalloutRequestParameters parameters) { - - com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponsePhoneCall - response = - v1.startPhoneCall( - (VerificationStartRequestPhoneCall) VerificationsDtoConverter.convert(parameters)); - return (StartVerificationResponseCallout) VerificationsDtoConverter.convert(response); - } - - public StartVerificationResponseSeamless startSeamless( - StartVerificationSeamlessRequestParameters parameters) { - - com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseData - response = - v1.startData( - (VerificationStartRequestData) VerificationsDtoConverter.convert(parameters)); - return (StartVerificationResponseSeamless) VerificationsDtoConverter.convert(response); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/adapters/WebHooksService.java b/client/src/main/com/sinch/sdk/domains/verification/adapters/WebHooksService.java deleted file mode 100644 index ae227656c..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/adapters/WebHooksService.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.sinch.sdk.domains.verification.adapters; - -import com.sinch.sdk.core.exceptions.ApiMappingException; -import com.sinch.sdk.domains.verification.adapters.converters.WebHooksDtoConverter; -import com.sinch.sdk.domains.verification.models.webhooks.VerificationEvent; -import com.sinch.sdk.domains.verification.models.webhooks.VerificationResponse; -import java.util.Map; -import java.util.logging.Logger; - -public class WebHooksService implements com.sinch.sdk.domains.verification.WebHooksService { - - private static final Logger LOGGER = Logger.getLogger(WebHooksService.class.getName()); - - private final com.sinch.sdk.domains.verification.api.v1.WebHooksService v1; - - public WebHooksService(com.sinch.sdk.domains.verification.api.v1.WebHooksService v1) { - this.v1 = v1; - } - - public boolean validateAuthenticationHeader( - String method, String path, Map headers, String jsonPayload) { - - return v1.validateAuthenticationHeader(method, path, headers, jsonPayload); - } - - @Override - public VerificationEvent parseEvent(String jsonPayload) throws ApiMappingException { - - com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationEvent dto = - v1.parseEvent(jsonPayload); - - return WebHooksDtoConverter.convert(dto); - } - - @Override - public String serializeResponse(VerificationResponse response) throws ApiMappingException { - return v1.serializeResponse(WebHooksDtoConverter.convert(response)); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/adapters/converters/IdentityDtoConverter.java b/client/src/main/com/sinch/sdk/domains/verification/adapters/converters/IdentityDtoConverter.java deleted file mode 100644 index a7d67a7be..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/adapters/converters/IdentityDtoConverter.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.sinch.sdk.domains.verification.adapters.converters; - -import com.sinch.sdk.domains.verification.models.Identity; -import com.sinch.sdk.domains.verification.models.NumberIdentity; -import com.sinch.sdk.domains.verification.models.v1.internal.IdentityInternal; -import java.util.logging.Logger; - -public class IdentityDtoConverter { - private static final Logger LOGGER = Logger.getLogger(IdentityDtoConverter.class.getName()); - - public static Identity convert(IdentityInternal dto) { - Identity identity = null; - if (IdentityInternal.TypeEnum.NUMBER.equals(dto.getType())) { - identity = NumberIdentity.valueOf(dto.getEndpoint()); - } else { - LOGGER.severe(String.format("Unexpected '%s'", dto)); - } - return identity; - } - - public static com.sinch.sdk.domains.verification.models.Identity convert( - com.sinch.sdk.domains.verification.models.v1.Identity dto) { - com.sinch.sdk.domains.verification.models.Identity client = null; - if (dto instanceof com.sinch.sdk.domains.verification.models.v1.NumberIdentity) { - client = - com.sinch.sdk.domains.verification.models.NumberIdentity.valueOf( - ((com.sinch.sdk.domains.verification.models.v1.NumberIdentity) dto).getEndpoint()); - } else { - LOGGER.severe(String.format("Unexpected '%s'", client)); - } - return client; - } - - public static com.sinch.sdk.domains.verification.models.v1.NumberIdentity convert( - com.sinch.sdk.domains.verification.models.Identity client) { - com.sinch.sdk.domains.verification.models.v1.NumberIdentity dto = null; - if (client instanceof com.sinch.sdk.domains.verification.models.NumberIdentity) { - dto = - com.sinch.sdk.domains.verification.models.v1.NumberIdentity.valueOf( - ((com.sinch.sdk.domains.verification.models.NumberIdentity) client).getEndpoint()); - } else { - LOGGER.severe(String.format("Unexpected '%s'", client)); - } - return dto; - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/adapters/converters/LinkDtoConverter.java b/client/src/main/com/sinch/sdk/domains/verification/adapters/converters/LinkDtoConverter.java deleted file mode 100644 index 154be3777..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/adapters/converters/LinkDtoConverter.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.sinch.sdk.domains.verification.adapters.converters; - -import com.sinch.sdk.core.http.HttpMethod; -import com.sinch.sdk.domains.verification.models.Link; -import com.sinch.sdk.domains.verification.models.LinkRelType; -import java.util.Collection; -import java.util.stream.Collectors; - -public class LinkDtoConverter { - - public static Collection convert( - Collection dto) { - return dto.stream().map(LinkDtoConverter::convert).collect(Collectors.toList()); - } - - public static Link convert(com.sinch.sdk.domains.verification.models.v1.start.response.Link dto) { - return Link.builder() - .setRel(LinkRelType.from(dto.getRel().value())) - .setHref(dto.getHref()) - .setMethod(HttpMethod.valueOf(dto.getMethod())) - .build(); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/adapters/converters/PriceDtoConverter.java b/client/src/main/com/sinch/sdk/domains/verification/adapters/converters/PriceDtoConverter.java deleted file mode 100644 index 87417f227..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/adapters/converters/PriceDtoConverter.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.sinch.sdk.domains.verification.adapters.converters; - -import com.sinch.sdk.domains.verification.models.Price; - -public class PriceDtoConverter { - - public static Price convert(com.sinch.sdk.domains.verification.models.v1.Price dto) { - if (null == dto) { - return Price.builder().build(); - } - return Price.builder().setCurrencyId(dto.getCurrencyId()).setAmount(dto.getAmount()).build(); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/adapters/converters/StatusDtoConverter.java b/client/src/main/com/sinch/sdk/domains/verification/adapters/converters/StatusDtoConverter.java deleted file mode 100644 index 9158a3d2c..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/adapters/converters/StatusDtoConverter.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.sinch.sdk.domains.verification.adapters.converters; - -import com.sinch.sdk.domains.verification.models.VerificationId; -import com.sinch.sdk.domains.verification.models.VerificationReference; -import com.sinch.sdk.domains.verification.models.VerificationSourceType; -import com.sinch.sdk.domains.verification.models.VerificationStatus; -import com.sinch.sdk.domains.verification.models.VerificationStatusCallout; -import com.sinch.sdk.domains.verification.models.VerificationStatusFlashCall; -import com.sinch.sdk.domains.verification.models.VerificationStatusReasonType; -import com.sinch.sdk.domains.verification.models.VerificationStatusSMS; -import com.sinch.sdk.domains.verification.models.VerificationStatusType; -import com.sinch.sdk.domains.verification.models.v1.status.StatusPriceImpl; -import com.sinch.sdk.domains.verification.models.v1.status.response.VerificationStatusResponse; -import com.sinch.sdk.domains.verification.models.v1.status.response.VerificationStatusResponseFlashCall; -import com.sinch.sdk.domains.verification.models.v1.status.response.VerificationStatusResponseFlashCallImpl; -import com.sinch.sdk.domains.verification.models.v1.status.response.VerificationStatusResponsePhoneCall; -import com.sinch.sdk.domains.verification.models.v1.status.response.VerificationStatusResponsePhoneCallImpl; -import com.sinch.sdk.domains.verification.models.v1.status.response.VerificationStatusResponseSms; -import com.sinch.sdk.domains.verification.models.v1.status.response.VerificationStatusResponseSmsImpl; -import com.sinch.sdk.domains.verification.models.v1.status.response.VerificationStatusResponseSmsPriceImpl; -import java.util.logging.Logger; - -public class StatusDtoConverter { - - private static final Logger LOGGER = Logger.getLogger(VerificationsDtoConverter.class.getName()); - - public static VerificationStatus convert(VerificationStatusResponse dto) { - - VerificationStatus.Builder builder; - - if (dto instanceof VerificationStatusResponseSms) { - builder = convert((VerificationStatusResponseSmsImpl) dto); - } else if (dto instanceof VerificationStatusResponseFlashCall) { - builder = convert((VerificationStatusResponseFlashCallImpl) dto); - } else if (dto instanceof VerificationStatusResponsePhoneCall) { - builder = convert((VerificationStatusResponsePhoneCallImpl) dto); - } else { - LOGGER.severe(String.format("Unexpected class '%s'", dto)); - builder = VerificationStatus.builder(); - } - return builder.build(); - } - - private static VerificationStatusFlashCall.Builder convert( - VerificationStatusResponseFlashCallImpl dto) { - - VerificationStatusFlashCall.Builder builder = VerificationStatusFlashCall.builder(); - - dto.id().ifPresent(f -> builder.setId(VerificationId.valueOf(f))); - dto.status().ifPresent(f -> builder.setStatus(VerificationStatusType.from(f.value()))); - dto.reason().ifPresent(f -> builder.setReason(VerificationStatusReasonType.from(f.value()))); - dto.reference().ifPresent(f -> builder.setReference(VerificationReference.valueOf(f))); - dto.identity().ifPresent(f -> builder.setIdentity(IdentityDtoConverter.convert(f))); - dto.countryId().ifPresent(f -> builder.setCountryId(dto.getCountryId())); - - dto.verificationTimestamp().ifPresent(builder::setVerificationTimeStamp); - dto.source().ifPresent(f -> builder.setSource(VerificationSourceType.from(f.value()))); - - dto.price() - .ifPresent( - f -> { - StatusPriceImpl price = (StatusPriceImpl) f; - price - .verificationPrice() - .ifPresent(p -> builder.setVerificationPrice(PriceDtoConverter.convert(p))); - price - .terminationPrice() - .ifPresent(p -> builder.setTerminationPrice(PriceDtoConverter.convert(p))); - price.billableDuration().ifPresent(builder::setBillableDuration); - }); - return builder; - } - - private static VerificationStatusSMS.Builder convert(VerificationStatusResponseSmsImpl dto) { - - VerificationStatusSMS.Builder builder = VerificationStatusSMS.builder(); - - dto.id().ifPresent(f -> builder.setId(VerificationId.valueOf(f))); - dto.status().ifPresent(f -> builder.setStatus(VerificationStatusType.from(f.value()))); - dto.reason().ifPresent(f -> builder.setReason(VerificationStatusReasonType.from(f.value()))); - dto.reference().ifPresent(f -> builder.setReference(VerificationReference.valueOf(f))); - dto.identity().ifPresent(f -> builder.setIdentity(IdentityDtoConverter.convert(f))); - dto.countryId().ifPresent(f -> builder.setCountryId(dto.getCountryId())); - - dto.verificationTimestamp().ifPresent(builder::setVerificationTimeStamp); - dto.source().ifPresent(f -> builder.setSource(VerificationSourceType.from(f.value()))); - - dto.price() - .ifPresent( - f -> { - VerificationStatusResponseSmsPriceImpl price = - (VerificationStatusResponseSmsPriceImpl) f; - price - .verificationPrice() - .ifPresent(p -> builder.setVerificationPrice(PriceDtoConverter.convert(p))); - }); - return builder; - } - - private static VerificationStatusCallout.Builder convert( - VerificationStatusResponsePhoneCallImpl dto) { - - VerificationStatusCallout.Builder builder = VerificationStatusCallout.builder(); - - dto.id().ifPresent(f -> builder.setId(VerificationId.valueOf(f))); - dto.status().ifPresent(f -> builder.setStatus(VerificationStatusType.from(f.value()))); - dto.reason().ifPresent(f -> builder.setReason(VerificationStatusReasonType.from(f.value()))); - dto.reference().ifPresent(f -> builder.setReference(VerificationReference.valueOf(f))); - dto.identity().ifPresent(f -> builder.setIdentity(IdentityDtoConverter.convert(f))); - dto.countryId().ifPresent(f -> builder.setCountryId(dto.getCountryId())); - - dto.verificationTimestamp().ifPresent(builder::setVerificationTimeStamp); - dto.callComplete().ifPresent(builder::setCallComplete); - - dto.price() - .ifPresent( - f -> { - StatusPriceImpl price = (StatusPriceImpl) f; - price - .verificationPrice() - .ifPresent(p -> builder.setVerificationPrice(PriceDtoConverter.convert(p))); - price - .terminationPrice() - .ifPresent(p -> builder.setTerminationPrice(PriceDtoConverter.convert(p))); - price.billableDuration().ifPresent(builder::setBillableDuration); - }); - return builder; - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/adapters/converters/VerificationsDtoConverter.java b/client/src/main/com/sinch/sdk/domains/verification/adapters/converters/VerificationsDtoConverter.java deleted file mode 100644 index 9f35fe996..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/adapters/converters/VerificationsDtoConverter.java +++ /dev/null @@ -1,359 +0,0 @@ -package com.sinch.sdk.domains.verification.adapters.converters; - -import com.sinch.sdk.domains.common.adapters.converters.EnumDynamicConverter; -import com.sinch.sdk.domains.verification.models.Identity; -import com.sinch.sdk.domains.verification.models.NumberIdentity; -import com.sinch.sdk.domains.verification.models.VerificationId; -import com.sinch.sdk.domains.verification.models.VerificationMethodType; -import com.sinch.sdk.domains.verification.models.VerificationReport; -import com.sinch.sdk.domains.verification.models.VerificationReportCallout; -import com.sinch.sdk.domains.verification.models.VerificationReportFlashCall; -import com.sinch.sdk.domains.verification.models.VerificationReportSMS; -import com.sinch.sdk.domains.verification.models.VerificationStatusType; -import com.sinch.sdk.domains.verification.models.requests.StartVerificationCalloutOptions; -import com.sinch.sdk.domains.verification.models.requests.StartVerificationCalloutRequestParameters; -import com.sinch.sdk.domains.verification.models.requests.StartVerificationCalloutSpeechOptions; -import com.sinch.sdk.domains.verification.models.requests.StartVerificationFlashCallRequestParameters; -import com.sinch.sdk.domains.verification.models.requests.StartVerificationRequestParameters; -import com.sinch.sdk.domains.verification.models.requests.StartVerificationSMSOptions; -import com.sinch.sdk.domains.verification.models.requests.StartVerificationSMSRequestParameters; -import com.sinch.sdk.domains.verification.models.requests.StartVerificationSeamlessRequestParameters; -import com.sinch.sdk.domains.verification.models.requests.VerificationReportCalloutRequestParameters; -import com.sinch.sdk.domains.verification.models.requests.VerificationReportFlashCallRequestParameters; -import com.sinch.sdk.domains.verification.models.requests.VerificationReportSMSRequestParameters; -import com.sinch.sdk.domains.verification.models.response.StartVerificationResponse; -import com.sinch.sdk.domains.verification.models.response.StartVerificationResponseCallout; -import com.sinch.sdk.domains.verification.models.response.StartVerificationResponseFlashCall; -import com.sinch.sdk.domains.verification.models.response.StartVerificationResponseSMS; -import com.sinch.sdk.domains.verification.models.response.StartVerificationResponseSeamless; -import com.sinch.sdk.domains.verification.models.v1.VerificationMethod; -import com.sinch.sdk.domains.verification.models.v1.internal.IdentityInternal; -import com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestFlashCall; -import com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestPhoneCall; -import com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestSms; -import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponse; -import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponseFlashCall; -import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponseFlashCallImpl; -import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponsePhoneCall; -import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponsePhoneCallImpl; -import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponseSms; -import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponseSmsImpl; -import com.sinch.sdk.domains.verification.models.v1.start.request.PhoneCallSpeech; -import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestSms; -import com.sinch.sdk.domains.verification.models.v1.start.response.internal.VerificationStartResponseDataContentImpl; -import com.sinch.sdk.domains.verification.models.v1.start.response.internal.VerificationStartResponseFlashCallContentImpl; -import com.sinch.sdk.domains.verification.models.v1.start.response.internal.VerificationStartResponseSmsContentImpl; -import java.util.logging.Logger; - -public class VerificationsDtoConverter { - - private static final Logger LOGGER = Logger.getLogger(VerificationsDtoConverter.class.getName()); - - public static com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequest - convert(StartVerificationRequestParameters client) { - - com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequest.Builder dto; - - if (client instanceof StartVerificationFlashCallRequestParameters) { - com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestFlashCall - .Builder - flashCallBuilder = - com.sinch.sdk.domains.verification.models.v1.start.request - .VerificationStartRequestFlashCall.builder(); - dto = flashCallBuilder; - StartVerificationFlashCallRequestParameters options = - (StartVerificationFlashCallRequestParameters) client; - options.getDialTimeOut().ifPresent(flashCallBuilder::setDialTimeout); - } else if (client instanceof StartVerificationSMSRequestParameters) { - com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestSms.Builder - smsBuilder = - com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestSms - .builder(); - dto = smsBuilder; - StartVerificationSMSRequestParameters options = - (StartVerificationSMSRequestParameters) client; - options.getOptions().ifPresent(f -> convert(smsBuilder, f)); - } else if (client instanceof StartVerificationCalloutRequestParameters) { - com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestPhoneCall - .Builder - phoneCallBuilder = - com.sinch.sdk.domains.verification.models.v1.start.request - .VerificationStartRequestPhoneCall.builder(); - dto = phoneCallBuilder; - StartVerificationCalloutRequestParameters options = - (StartVerificationCalloutRequestParameters) client; - options.getOptions().ifPresent(f -> convert(phoneCallBuilder, f)); - } else if (client instanceof StartVerificationSeamlessRequestParameters) { - dto = - com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestData - .builder(); - } else { - LOGGER.severe(String.format("Unexpected class '%s'", client.getClass())); - return null; - } - - client.getIdentity().ifPresent(f -> dto.setIdentity(IdentityDtoConverter.convert(f))); - client.getReference().ifPresent(f -> dto.setReference(f.getReference())); - client.getCustom().ifPresent(dto::setCustom); - - return dto.build(); - } - - private static void convert( - com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestSms.Builder - smsBuilder, - StartVerificationSMSOptions client) { - - client.getExpiry().ifPresent(smsBuilder::setExpiry); - client - .getCodeType() - .ifPresent( - f -> smsBuilder.setCodeType(VerificationStartRequestSms.CodeTypeEnum.from(f.value()))); - client.getTemplate().ifPresent(smsBuilder::setTemplate); - client.getAcceptLanguage().ifPresent(smsBuilder::setAcceptLanguage); - } - - private static void convert( - com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestPhoneCall - .Builder - phoneCallBuilder, - StartVerificationCalloutOptions client) { - client.getSpeech().ifPresent(f -> phoneCallBuilder.setSpeech(convert(f))); - } - - private static PhoneCallSpeech convert(StartVerificationCalloutSpeechOptions client) { - PhoneCallSpeech.Builder dto = PhoneCallSpeech.builder(); - client.getLocale().ifPresent(dto::setLocale); - return dto.build(); - } - - public static IdentityInternal convert(Identity client) { - IdentityInternal.Builder dto = IdentityInternal.builder(); - if (client instanceof NumberIdentity) { - dto.setType(IdentityInternal.TypeEnum.NUMBER) - .setEndpoint(((NumberIdentity) client).getEndpoint()); - } else { - LOGGER.severe(String.format("Unexpected class '%s'", client.getClass())); - } - return dto.build(); - } - - public static Identity convert(IdentityInternal dto) { - Identity identity = null; - if (IdentityInternal.TypeEnum.NUMBER.equals(dto.getType())) { - identity = NumberIdentity.valueOf(dto.getEndpoint()); - } else { - LOGGER.severe(String.format("Unexpected '%s'", dto)); - } - return identity; - } - - public static VerificationMethod convert(VerificationMethodType client) { - return VerificationMethod.from(EnumDynamicConverter.convert(client)); - } - - public static StartVerificationResponse convert( - com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponse dto) { - - StartVerificationResponse.Builder builder; - - if (dto - instanceof - com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseSms) { - builder = - convert( - (com.sinch.sdk.domains.verification.models.v1.start.response - .VerificationStartResponseSms) - dto); - } else if (dto - instanceof - com.sinch.sdk.domains.verification.models.v1.start.response - .VerificationStartResponseFlashCall) { - builder = - convert( - (com.sinch.sdk.domains.verification.models.v1.start.response - .VerificationStartResponseFlashCall) - dto); - } else if (dto - instanceof - com.sinch.sdk.domains.verification.models.v1.start.response - .VerificationStartResponsePhoneCall) { - builder = - convert( - (com.sinch.sdk.domains.verification.models.v1.start.response - .VerificationStartResponsePhoneCall) - dto); - } else if (dto - instanceof - com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseData) { - builder = - convert( - (com.sinch.sdk.domains.verification.models.v1.start.response - .VerificationStartResponseData) - dto); - } else { - LOGGER.severe(String.format("Unexpected class '%s'", dto)); - builder = StartVerificationResponse.builder(); - } - return builder.build(); - } - - private static StartVerificationResponseSMS.Builder convert( - com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseSms - _dto) { - - com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseSmsImpl - dto = - (com.sinch.sdk.domains.verification.models.v1.start.response - .VerificationStartResponseSmsImpl) - _dto; - StartVerificationResponseSMS.Builder builder = StartVerificationResponseSMS.builder(); - - dto.id().ifPresent(f -> builder.setId(VerificationId.valueOf(f))); - dto.links().ifPresent(f -> builder.setLinks(LinkDtoConverter.convert(f))); - - dto.sms() - .ifPresent( - _sms -> { - VerificationStartResponseSmsContentImpl sms = - (VerificationStartResponseSmsContentImpl) _sms; - sms.template().ifPresent(builder::setTemplate); - sms.interceptionTimeout().ifPresent(builder::setInterceptionTimeOut); - }); - - return builder; - } - - private static StartVerificationResponseFlashCall.Builder convert( - com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseFlashCall - _dto) { - - com.sinch.sdk.domains.verification.models.v1.start.response - .VerificationStartResponseFlashCallImpl - dto = - (com.sinch.sdk.domains.verification.models.v1.start.response - .VerificationStartResponseFlashCallImpl) - _dto; - StartVerificationResponseFlashCall.Builder builder = - StartVerificationResponseFlashCall.builder(); - - dto.id().ifPresent(f -> builder.setId(VerificationId.valueOf(f))); - dto.links().ifPresent(f -> builder.setLinks(LinkDtoConverter.convert(f))); - - dto.flashCall() - .ifPresent( - _flashCall -> { - VerificationStartResponseFlashCallContentImpl flashCall = - (VerificationStartResponseFlashCallContentImpl) _flashCall; - flashCall.cliFilter().ifPresent(builder::setCliFilter); - flashCall.interceptionTimeout().ifPresent(builder::setInterceptionTimeOut); - flashCall.reportTimeout().ifPresent(builder::setReportTimeout); - flashCall.denyCallAfter().ifPresent(builder::setDenyCallAfter); - }); - return builder; - } - - private static StartVerificationResponseCallout.Builder convert( - com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponsePhoneCall - _dto) { - - com.sinch.sdk.domains.verification.models.v1.start.response - .VerificationStartResponsePhoneCallImpl - dto = - (com.sinch.sdk.domains.verification.models.v1.start.response - .VerificationStartResponsePhoneCallImpl) - _dto; - StartVerificationResponseCallout.Builder builder = StartVerificationResponseCallout.builder(); - - dto.id().ifPresent(f -> builder.setId(VerificationId.valueOf(f))); - dto.links().ifPresent(f -> builder.setLinks(LinkDtoConverter.convert(f))); - - return builder; - } - - private static StartVerificationResponseSeamless.Builder convert( - com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseData - _dto) { - - com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseDataImpl - dto = - (com.sinch.sdk.domains.verification.models.v1.start.response - .VerificationStartResponseDataImpl) - _dto; - StartVerificationResponseSeamless.Builder builder = StartVerificationResponseSeamless.builder(); - - dto.id().ifPresent(f -> builder.setId(VerificationId.valueOf(f))); - dto.links().ifPresent(f -> builder.setLinks(LinkDtoConverter.convert(f))); - - dto.seamless() - .ifPresent( - _seamless -> { - VerificationStartResponseDataContentImpl seamless = - (VerificationStartResponseDataContentImpl) _seamless; - seamless.targetUri().ifPresent(builder::setTargetUri); - }); - return builder; - } - - public static VerificationReportRequestFlashCall convert( - VerificationReportFlashCallRequestParameters client) { - - VerificationReportRequestFlashCall.Builder builder = - VerificationReportRequestFlashCall.builder(); - - client.getCli().ifPresent(builder::setCli); - - return builder.build(); - } - - public static VerificationReportRequestSms convert( - VerificationReportSMSRequestParameters client) { - - VerificationReportRequestSms.Builder builder = VerificationReportRequestSms.builder(); - - client.getCode().ifPresent(builder::setCode); - client.getCli().ifPresent(builder::setCli); - - return builder.build(); - } - - public static VerificationReportRequestPhoneCall convert( - VerificationReportCalloutRequestParameters client) { - - VerificationReportRequestPhoneCall.Builder builder = - VerificationReportRequestPhoneCall.builder(); - - client.getCode().ifPresent(builder::setCode); - - return builder.build(); - } - - public static VerificationReport convert(VerificationReportResponse _dto) { - - VerificationReport.Builder builder; - if (_dto instanceof VerificationReportResponseSms) { - builder = VerificationReportSMS.builder(); - VerificationReportResponseSmsImpl dto = (VerificationReportResponseSmsImpl) _dto; - dto.id().ifPresent(f -> builder.setId(VerificationId.valueOf(f))); - dto.status() - .ifPresent(f -> builder.setStatus(VerificationStatusType.from(dto.getStatus().value()))); - } else if (_dto instanceof VerificationReportResponseFlashCall) { - builder = VerificationReportFlashCall.builder(); - VerificationReportResponseFlashCallImpl dto = (VerificationReportResponseFlashCallImpl) _dto; - dto.id().ifPresent(f -> builder.setId(VerificationId.valueOf(f))); - dto.status() - .ifPresent(f -> builder.setStatus(VerificationStatusType.from(dto.getStatus().value()))); - } else if (_dto instanceof VerificationReportResponsePhoneCall) { - builder = VerificationReportCallout.builder(); - VerificationReportResponsePhoneCallImpl dto = (VerificationReportResponsePhoneCallImpl) _dto; - dto.id().ifPresent(f -> builder.setId(VerificationId.valueOf(f))); - dto.status() - .ifPresent(f -> builder.setStatus(VerificationStatusType.from(dto.getStatus().value()))); - } else { - LOGGER.severe(String.format("Unexpected value '%s'", _dto)); - return VerificationReport.builder().build(); - } - - return builder.build(); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/adapters/converters/WebHooksDtoConverter.java b/client/src/main/com/sinch/sdk/domains/verification/adapters/converters/WebHooksDtoConverter.java deleted file mode 100644 index c4628dfe8..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/adapters/converters/WebHooksDtoConverter.java +++ /dev/null @@ -1,141 +0,0 @@ -package com.sinch.sdk.domains.verification.adapters.converters; - -import com.sinch.sdk.domains.verification.models.VerificationMethodType; -import com.sinch.sdk.domains.verification.models.VerificationReference; -import com.sinch.sdk.domains.verification.models.VerificationSourceType; -import com.sinch.sdk.domains.verification.models.VerificationStatusReasonType; -import com.sinch.sdk.domains.verification.models.VerificationStatusType; -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.VerificationRequestEventImpl; -import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEventResponse; -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.VerificationResultEventImpl; -import com.sinch.sdk.domains.verification.models.webhooks.VerificationEvent; -import com.sinch.sdk.domains.verification.models.webhooks.VerificationRequestEvent; -import com.sinch.sdk.domains.verification.models.webhooks.VerificationResponse; -import com.sinch.sdk.domains.verification.models.webhooks.VerificationResponseCallout; -import com.sinch.sdk.domains.verification.models.webhooks.VerificationResponseCalloutSpeech; -import com.sinch.sdk.domains.verification.models.webhooks.VerificationResponseFlashCall; -import com.sinch.sdk.domains.verification.models.webhooks.VerificationResponseSMS; -import com.sinch.sdk.domains.verification.models.webhooks.VerificationResultEvent; -import java.util.ArrayList; -import java.util.logging.Logger; - -public class WebHooksDtoConverter { - - private static final Logger LOGGER = Logger.getLogger(WebHooksDtoConverter.class.getName()); - - public static VerificationEvent convert( - com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationEvent dto) { - - if (dto instanceof VerificationRequestEventImpl) { - return convert((VerificationRequestEventImpl) dto); - } else if (dto instanceof VerificationResultEventImpl) { - return convert((VerificationResultEventImpl) dto); - } else { - LOGGER.severe(String.format("Unexpected class '%s'", dto)); - return null; - } - } - - static VerificationRequestEvent convert(VerificationRequestEventImpl dto) { - - return new VerificationRequestEvent( - dto.getId(), - dto.method().isPresent() ? VerificationMethodType.from(dto.getMethod().value()) : null, - dto.identity().isPresent() ? IdentityDtoConverter.convert(dto.getIdentity()) : null, - dto.price().isPresent() ? PriceDtoConverter.convert(dto.getPrice()) : null, - dto.reference().isPresent() ? VerificationReference.valueOf(dto.getReference()) : null, - dto.getCustom(), - dto.getAcceptLanguage()); - } - - static VerificationResultEvent convert(VerificationResultEventImpl dto) { - - return new VerificationResultEvent( - dto.getId(), - dto.method().isPresent() ? VerificationMethodType.from(dto.getMethod().value()) : null, - dto.identity().isPresent() ? IdentityDtoConverter.convert(dto.getIdentity()) : null, - dto.reference().isPresent() ? VerificationReference.valueOf(dto.getReference()) : null, - dto.getCustom(), - dto.status().isPresent() ? VerificationStatusType.from(dto.getStatus().value()) : null, - dto.reason().isPresent() - ? VerificationStatusReasonType.from(dto.getReason().value()) - : null, - dto.source().isPresent() ? VerificationSourceType.from(dto.getSource().value()) : null); - } - - public static VerificationRequestEventResponse convert(VerificationResponse client) { - - if (null == client) { - return null; - } - if (client instanceof VerificationResponseCallout) { - return convert((VerificationResponseCallout) client); - } else if (client instanceof VerificationResponseFlashCall) { - return convert((VerificationResponseFlashCall) client); - } else if (client instanceof VerificationResponseSMS) { - return convert((VerificationResponseSMS) client); - } else { - LOGGER.severe(String.format("Unexpected class '%s'", client)); - return null; - } - } - - static VerificationRequestEventResponsePhoneCall convert(VerificationResponseCallout client) { - VerificationRequestEventResponsePhoneCall.Builder dto = - VerificationRequestEventResponsePhoneCall.builder(); - - if (null != client.getAction()) { - dto.setAction(VerificationEventResponseAction.from(client.getAction().getValue())); - } - if (null != client.getCode()) { - dto.setCode(client.getCode()); - } - if (null != client.getSpeech()) { - dto.setSpeech(convert(client.getSpeech())); - } - return dto.build(); - } - - static PhoneCallSpeech convert(VerificationResponseCalloutSpeech client) { - if (null == client) { - return null; - } - return PhoneCallSpeech.builder().setLocale(client.getLocale()).build(); - } - - static VerificationRequestEventResponseFlashCall convert(VerificationResponseFlashCall client) { - VerificationRequestEventResponseFlashCall.Builder dto = - VerificationRequestEventResponseFlashCall.builder(); - - if (null != client.getAction()) { - dto.setAction(VerificationEventResponseAction.from(client.getAction().getValue())); - } - if (null != client.getCli()) { - dto.setCli(client.getCli()); - } - if (null != client.getDialTimeout()) { - dto.setDialTimeout(client.getDialTimeout()); - } - return dto.build(); - } - - static VerificationRequestEventResponseSms convert(VerificationResponseSMS client) { - VerificationRequestEventResponseSms.Builder dto = VerificationRequestEventResponseSms.builder(); - - if (null != client.getAction()) { - dto.setAction(VerificationEventResponseAction.from(client.getAction().getValue())); - } - if (null != client.getCode()) { - dto.setCode(client.getCode()); - } - if (null != client.getAcceptLanguage()) { - dto.setAcceptLanguage(new ArrayList<>(client.getAcceptLanguage())); - } - return dto.build(); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/Identity.java b/client/src/main/com/sinch/sdk/domains/verification/models/Identity.java deleted file mode 100644 index 9363ad662..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/Identity.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.sinch.sdk.domains.verification.models; - -/** Base class for Identity objects */ -public abstract class Identity { - - private final String type; - - /** - * Create an instance of identity with type - * - * @param type Identity type - */ - protected Identity(String type) { - this.type = type; - } - - @Override - public String toString() { - return "Identity{" + "type='" + type + '\'' + '}'; - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/Link.java b/client/src/main/com/sinch/sdk/domains/verification/models/Link.java deleted file mode 100644 index 1f717c9c2..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/Link.java +++ /dev/null @@ -1,127 +0,0 @@ -package com.sinch.sdk.domains.verification.models; - -import com.sinch.sdk.core.http.HttpMethod; - -/** - * Available methods and actions which can be done after a successful Verification - * - * @since 1.0 - */ -public class Link { - private final LinkRelType rel; - private final String href; - private final HttpMethod method; - - private Link(LinkRelType rel, String href, HttpMethod method) { - this.rel = rel; - this.href = href; - this.method = method; - } - - /** - * The related action that can be performed on the initiated Verification - * - * @return Related type - * @since 1.0 - */ - public LinkRelType getRel() { - return rel; - } - - /** - * The complete URL to perform the specified action, localized to the DataCenter which handled the - * original Verification request - * - * @return URL value - * @since 1.0 - */ - public String getHref() { - return href; - } - - /** - * The HTTP method to use when performing the action using the linked localized URL - * - * @return HTTP method - * @since 1.0 - */ - public HttpMethod getMethod() { - return method; - } - - /** {@inheritDoc} */ - @Override - public String toString() { - return "Link{" + "rel='" + rel + '\'' + ", href='" + href + '\'' + ", method=" + method + '}'; - } - - /** - * Getting Builder - * - * @return New Builder instance - * @since 1.0 - */ - public static Builder builder() { - return new Builder(); - } - - /** - * Dedicated Builder - * - * @since 1.0 - */ - public static class Builder { - - LinkRelType rel; - String href; - HttpMethod method; - - private Builder() {} - - /** - * Setter - * - * @param rel See {@link #getRel()} getter - * @return Current builder - * @since 1.0 - */ - public Builder setRel(LinkRelType rel) { - this.rel = rel; - return this; - } - - /** - * Setter - * - * @param href See {@link #getHref()} getter - * @return Current builder - * @since 1.0 - */ - public Builder setHref(String href) { - this.href = href; - return this; - } - - /** - * Setter - * - * @param method See {@link #getMethod()} getter - * @return Current builder - * @since 1.0 - */ - public Builder setMethod(HttpMethod method) { - this.method = method; - return this; - } - - /** - * Create instance - * - * @return The instance build with current builder values - * @since 1.0 - */ - public Link build() { - return new Link(rel, href, method); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/LinkRelType.java b/client/src/main/com/sinch/sdk/domains/verification/models/LinkRelType.java deleted file mode 100644 index 867737101..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/LinkRelType.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.sinch.sdk.domains.verification.models; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -/** - * Link rel authorized values - * - * @since 1.0 - */ -public class LinkRelType extends EnumDynamic { - - /** Get the status of a Verification. */ - public static final LinkRelType STATUS = new LinkRelType("status"); - - /** Report a verification */ - public static final LinkRelType REPORT = new LinkRelType("report"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>(LinkRelType.class, LinkRelType::new, Arrays.asList(STATUS, REPORT)); - - private LinkRelType(String value) { - super(value); - } - - /** - * Get declared values - * - * @return Stream of values - */ - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - /** - * Get value from a string - * - * @param value String identifier - * @return Dynamic enum from value. A new enum is created if value is not yet registered - */ - public static LinkRelType from(String value) { - return ENUM_SUPPORT.from(value); - } - - /** - * Value of the enum as String - * - * @param e The enum identifier - * @return String identifier of the enum value - */ - public static String valueOf(LinkRelType e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/NumberIdentity.java b/client/src/main/com/sinch/sdk/domains/verification/models/NumberIdentity.java deleted file mode 100644 index e3cf83e2d..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/NumberIdentity.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.sinch.sdk.domains.verification.models; - -import com.sinch.sdk.models.E164PhoneNumber; -import java.util.Objects; - -/** Identity based onto a phone number */ -public class NumberIdentity extends Identity { - - private final String endpoint; - - /** - * Get related endpoint - * - *

See {@link Builder#setEndpoint(String)} setter - * - * @return Phone number value - */ - public String getEndpoint() { - return endpoint; - } - - /** - * @param endpoint An E.164-compatible phone number. - */ - private NumberIdentity(String endpoint) { - super("number"); - this.endpoint = endpoint; - } - - @Override - public String toString() { - return "NumberIdentity{" + "endpoint='" + endpoint + '\'' + "} " + super.toString(); - } - - /** - * Create a NumberIdentity from a phone number as a String - * - * @param phoneNumber String representation of phone number - * @return Instance of NumberIdentity - * @since 1.0 - */ - public static NumberIdentity valueOf(String phoneNumber) { - return builder().setEndpoint(phoneNumber).build(); - } - - /** - * Create a NumberIdentity from a phone number as a E164PhoneNumber - * - * @param phoneNumber E164PhoneNumber representation of phone number - * @return Instance of NumberIdentity - * @since 1.0 - */ - public static NumberIdentity valueOf(E164PhoneNumber phoneNumber) { - return builder().setEndpoint(phoneNumber.stringValue()).build(); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (!(o instanceof NumberIdentity)) { - return false; - } - NumberIdentity that = (NumberIdentity) o; - return Objects.equals(getEndpoint(), that.getEndpoint()); - } - - @Override - public int hashCode() { - return Objects.hash(getEndpoint()); - } - - /** - * Getting Builder - * - * @return New Builder instance - */ - public static Builder builder() { - return new Builder(); - } - - /** Dedicated Builder */ - public static class Builder { - - String endpoint; - - private Builder() {} - - /** - * Endpoint to be used for number identity (the phone number) - * - * @param endpoint Phone number value - * @return Current builder - */ - public Builder setEndpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /** - * Create instance - * - * @return The instance build with current builder values - */ - public NumberIdentity build() { - return new NumberIdentity(endpoint); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/Price.java b/client/src/main/com/sinch/sdk/domains/verification/models/Price.java deleted file mode 100644 index 6e7f163ec..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/Price.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.sinch.sdk.domains.verification.models; - -/** Price object representation */ -public class Price { - private final String currencyId; - private final Float amount; - - private Price(String currencyId, Float amount) { - this.currencyId = currencyId; - this.amount = amount; - } - - /** - * ISO 4217 currency code - * - * @return Currency value - * @since 1.0 - */ - public String getCurrencyId() { - return currencyId; - } - - /** - * Amount value - * - * @return The amount - * @since 1.0 - */ - public Float getAmount() { - return amount; - } - - /** {@inheritDoc} */ - @Override - public String toString() { - return "Price{" + "currencyId='" + currencyId + '\'' + ", amount=" + amount + '}'; - } - - /** - * Getting Builder - * - * @return New Builder instance - * @since 1.0 - */ - public static Builder builder() { - return new Builder(); - } - - /** - * Dedicated Builder - * - * @since 1.0 - */ - public static class Builder { - - String currencyId; - Float amount; - - private Builder() {} - - /** - * Setter - * - * @param currencyId See {@link Price#getCurrencyId()} getter - * @return Current builder - * @since 1.0 - */ - public Builder setCurrencyId(String currencyId) { - this.currencyId = currencyId; - return this; - } - - /** - * Setter - * - * @param amount See {@link Price#getAmount()} getter - * @return Current builder - * @since 1.0 - */ - public Builder setAmount(Float amount) { - this.amount = amount; - return this; - } - - /** - * Create instance - * - * @return The instance build with current builder values - * @since 1.0 - */ - public Price build() { - return new Price(currencyId, amount); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/VerificationId.java b/client/src/main/com/sinch/sdk/domains/verification/models/VerificationId.java deleted file mode 100644 index 3353281f9..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/VerificationId.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.sinch.sdk.domains.verification.models; - -/** Verification ID related to a Verification request */ -public class VerificationId { - - private final String id; - - private VerificationId(String id) { - this.id = id; - } - - /** {@inheritDoc} */ - @Override - public String toString() { - return "VerificationId{" + "id='" + id + '\'' + '}'; - } - - /** - * Get the verification Id value - * - * @return Id Value - * @since 1.0 - */ - public String getId() { - return id; - } - - /** - * Create a new verification id from a String - * - * @param id The id value - * @return The newly created VerificationId instance - * @since 1.0 - */ - public static VerificationId valueOf(String id) { - return new VerificationId(id); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/VerificationMethodType.java b/client/src/main/com/sinch/sdk/domains/verification/models/VerificationMethodType.java deleted file mode 100644 index 38e9bf5a8..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/VerificationMethodType.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.sinch.sdk.domains.verification.models; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -/** - * The type of the verification request authorized values - * - * @since 1.0 - */ -public class VerificationMethodType extends EnumDynamic { - - /** Verification by SMS message with a PIN code */ - public static final VerificationMethodType SMS = new VerificationMethodType("sms"); - - /** - * Verification by placing a flashcall (missed call) and detecting the incoming calling number - * (CLI). - */ - public static final VerificationMethodType FLASH_CALL = new VerificationMethodType("flashcall"); - - /** - * Verification by placing a PSTN call to the user's phone and playing an announcement, asking the - * user to press a particular digit to verify the phone number. - */ - public static final VerificationMethodType CALLOUT = new VerificationMethodType("callout"); - - /** - * Data verification. Verification by accessing internal infrastructure of mobile carriers to - * verify if given verification attempt was originated from device with matching phone number. - */ - public static final VerificationMethodType SEAMLESS = new VerificationMethodType("seamless"); - - /** */ - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - VerificationMethodType.class, - VerificationMethodType::new, - Arrays.asList(SMS, FLASH_CALL, CALLOUT, SEAMLESS)); - - private VerificationMethodType(String value) { - super(value); - } - - /** - * Get declared values - * - * @return Stream of values - */ - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - /** - * Get value from a string - * - * @param value String identifier - * @return Dynamic enum from value. A new enum is created if value is not yet registered - */ - public static VerificationMethodType from(String value) { - return ENUM_SUPPORT.from(value); - } - - /** - * Value of the enum as String - * - * @param e The enum identifier - * @return String identifier of the enum value - */ - public static String valueOf(VerificationMethodType e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/VerificationReference.java b/client/src/main/com/sinch/sdk/domains/verification/models/VerificationReference.java deleted file mode 100644 index c8dbc7367..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/VerificationReference.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.sinch.sdk.domains.verification.models; - -/** Verification reference related to a Verification request */ -public class VerificationReference { - - private final String reference; - - private VerificationReference(String reference) { - this.reference = reference; - } - - /** {@inheritDoc} */ - @Override - public String toString() { - return "VerificationReference{" + "reference='" + reference + '\'' + '}'; - } - - /** - * Get the verification reference value - * - * @return reference Value - * @since 1.0 - */ - public String getReference() { - return reference; - } - - /** - * Create a new verification reference from a String - * - * @param reference The id value - * @return The newly created VerificationReference instance - * @since 1.0 - */ - public static VerificationReference valueOf(String reference) { - return new VerificationReference(reference); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/VerificationReport.java b/client/src/main/com/sinch/sdk/domains/verification/models/VerificationReport.java deleted file mode 100644 index 7a8c04671..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/VerificationReport.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.sinch.sdk.domains.verification.models; - -/** - * Common class to all verification report responses - * - * @since 1.1 - */ -public class VerificationReport { - - private final VerificationId id; - private final VerificationStatusType status; - - protected VerificationReport(VerificationId id, VerificationStatusType status) { - this.id = id; - this.status = status; - } - - /** - * ID related to verification request - * - * @return Verification ID - * @since 1.1 - */ - public VerificationId getId() { - return id; - } - - /** - * Current verification status - * - * @return The status value - * @since 1.1 - */ - public VerificationStatusType getStatus() { - return status; - } - - /** {@inheritDoc} */ - @Override - public String toString() { - return "VerificationReport{" + "id=" + id + ", status=" + status + '}'; - } - - public static Builder builder() { - return new Builder<>(); - } - - /** - * Dedicated Builder - * - * @param Builder - * @since 1.1 - */ - public static class Builder> { - - VerificationId id; - VerificationStatusType status; - - protected Builder() {} - - /** - * Setter - * - *

See {@link VerificationReport#getId()} getter - * - * @param id See getter - * @return Current builder - * @since 1.1 - */ - public B setId(VerificationId id) { - this.id = id; - return self(); - } - - /** - * Setter - * - *

See {@link VerificationReport#getStatus()} getter - * - * @param status See getter - * @return Current builder - * @since 1.1 - */ - public B setStatus(VerificationStatusType status) { - this.status = status; - return self(); - } - - /** - * Create instance - * - * @return The instance build with current builder values - * @since 1.1 - */ - public VerificationReport build() { - return new VerificationReport(id, status); - } - - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/VerificationReportCallout.java b/client/src/main/com/sinch/sdk/domains/verification/models/VerificationReportCallout.java deleted file mode 100644 index 87c24f401..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/VerificationReportCallout.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.sinch.sdk.domains.verification.models; - -/** - * Dedicated report type for a callout verification - * - *

Verification report when using {@link - * com.sinch.sdk.domains.verification.VerificationsService#reportCalloutById} or {@link - * com.sinch.sdk.domains.verification.VerificationsService#reportCalloutByIdentity} - * - * @since 1.1 - */ -public class VerificationReportCallout extends VerificationReport { - - protected VerificationReportCallout(VerificationId id, VerificationStatusType status) { - super(id, status); - } - - @Override - public String toString() { - return "VerificationReportCallout{} " + super.toString(); - } - - /** - * Getting Builder - * - * @return New Builder instance - * @since 1.1 - */ - public static Builder builder() { - return new Builder(); - } - - /** Dedicated Builder */ - public static class Builder extends VerificationReport.Builder { - - private Builder() {} - - /** - * Create instance - * - * @return The instance build with current builder values - * @since 1.1 - */ - public VerificationReportCallout build() { - return new VerificationReportCallout(id, status); - } - - @Override - protected Builder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/VerificationReportFlashCall.java b/client/src/main/com/sinch/sdk/domains/verification/models/VerificationReportFlashCall.java deleted file mode 100644 index 1a00bf565..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/VerificationReportFlashCall.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.sinch.sdk.domains.verification.models; - -/** - * Dedicated report type for a flashcall verification - * - *

Verification report when using {@link - * com.sinch.sdk.domains.verification.VerificationsService#reportFlashCallById} or {@link - * com.sinch.sdk.domains.verification.VerificationsService#reportFlashCallByIdentity} - * - * @since 1.1 - */ -public class VerificationReportFlashCall extends VerificationReport { - - protected VerificationReportFlashCall(VerificationId id, VerificationStatusType status) { - super(id, status); - } - - @Override - public String toString() { - return "VerificationReportFlashCall{} " + super.toString(); - } - - /** - * Getting Builder - * - * @return New Builder instance - * @since 1.1 - */ - public static Builder builder() { - return new Builder(); - } - - /** Dedicated Builder */ - public static class Builder extends VerificationReport.Builder { - - private Builder() {} - - /** - * Create instance - * - * @return The instance build with current builder values - * @since 1.1 - */ - public VerificationReportFlashCall build() { - return new VerificationReportFlashCall(id, status); - } - - @Override - protected Builder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/VerificationReportSMS.java b/client/src/main/com/sinch/sdk/domains/verification/models/VerificationReportSMS.java deleted file mode 100644 index 5a45f3026..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/VerificationReportSMS.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.sinch.sdk.domains.verification.models; - -/** - * Dedicated report type for a SMS verification - * - *

Verification report when using {@link - * com.sinch.sdk.domains.verification.VerificationsService#reportSmsById} or {@link - * com.sinch.sdk.domains.verification.VerificationsService#reportSmsByIdentity} - * - * @since 1.1 - */ -public class VerificationReportSMS extends VerificationReport { - - protected VerificationReportSMS(VerificationId id, VerificationStatusType status) { - super(id, status); - } - - @Override - public String toString() { - return "VerificationReportSMS{} " + super.toString(); - } - - /** - * Getting Builder - * - * @return New Builder instance - * @since 1.1 - */ - public static Builder builder() { - return new Builder(); - } - - /** Dedicated Builder */ - public static class Builder extends VerificationReport.Builder { - - private Builder() {} - - /** - * Create instance - * - * @return The instance build with current builder values - * @since 1.1 - */ - public VerificationReportSMS build() { - return new VerificationReportSMS(id, status); - } - - @Override - protected Builder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/VerificationSourceType.java b/client/src/main/com/sinch/sdk/domains/verification/models/VerificationSourceType.java deleted file mode 100644 index b30aeb28f..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/VerificationSourceType.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.sinch.sdk.domains.verification.models; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -/** - * The type of the verification request authorized values - * - * @since 1.1 - */ -public class VerificationSourceType extends EnumDynamic { - - /** Show if the call/SMS was intercepted or not. */ - public static final VerificationSourceType INTERCEPTED = - new VerificationSourceType("intercepted"); - - /** Show if the call/SMS was intercepted or not. */ - public static final VerificationSourceType MANUAL = new VerificationSourceType("manual"); - - /** */ - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - VerificationSourceType.class, - VerificationSourceType::new, - Arrays.asList(INTERCEPTED, MANUAL)); - - private VerificationSourceType(String value) { - super(value); - } - - /** - * Get declared values - * - * @return Stream of values - */ - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - /** - * Get value from a string - * - * @param value String identifier - * @return Dynamic enum from value. A new enum is created if value is not yet registered - */ - public static VerificationSourceType from(String value) { - return ENUM_SUPPORT.from(value); - } - - /** - * Value of the enum as String - * - * @param e The enum identifier - * @return String identifier of the enum value - */ - public static String valueOf(VerificationSourceType e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/VerificationStatus.java b/client/src/main/com/sinch/sdk/domains/verification/models/VerificationStatus.java deleted file mode 100644 index 4fddf8e53..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/VerificationStatus.java +++ /dev/null @@ -1,265 +0,0 @@ -package com.sinch.sdk.domains.verification.models; - -import java.time.Instant; - -/** - * Common class to all verification status responses - * - * @since 1.0 - */ -public class VerificationStatus { - - private final VerificationId id; - private final VerificationStatusType status; - private final VerificationStatusReasonType reason; - private final VerificationReference reference; - private final Identity identity; - private final String countryId; - private final Instant verificationTimeStamp; - - protected VerificationStatus( - VerificationId id, - VerificationStatusType status, - VerificationStatusReasonType reason, - VerificationReference reference, - Identity identity, - String countryId, - Instant verificationTimeStamp) { - this.id = id; - this.status = status; - this.reason = reason; - this.reference = reference; - this.identity = identity; - this.countryId = countryId; - this.verificationTimeStamp = verificationTimeStamp; - } - - /** - * ID related to verification request - * - * @return Verification ID - * @since 1.0 - */ - public VerificationId getId() { - return id; - } - - /** - * Current verification status - * - * @return The status value - * @since 1.0 - */ - public VerificationStatusType getStatus() { - return status; - } - - /** - * The reason why a verification has {@link VerificationStatusType#FAIL FAIL}, was {@link - * VerificationStatusType#DENIED DENIED}, or was {@link VerificationStatusType#ABORTED ABORTED}. - * - * @return The reason value - * @since 1.0 - */ - public VerificationStatusReasonType getReason() { - return reason; - } - - /** - * The reference value that was optionally passed together with the verification request. - * - * @return The reference value - * @since 1.0 - */ - public VerificationReference getReference() { - return reference; - } - - /** - * @see Identity - * @return The identity - * @since 1.1 - */ - public Identity getIdentity() { - return identity; - } - - /** - * The ID of the country to which the verification was sent - * - * @return Country ID value - * @since 1.1 - */ - public String getCountryId() { - return countryId; - } - - /** - * Verification time stamp - * - * @return Verification timestamp value - * @since 1.1 - */ - public Instant getVerificationTimeStamp() { - return verificationTimeStamp; - } - - /** {@inheritDoc} */ - @Override - public String toString() { - return "VerificationStatus{" - + "id=" - + id - + ", status=" - + status - + ", reason=" - + reason - + ", reference=" - + reference - + ", identity=" - + identity - + ", countryId='" - + countryId - + '\'' - + ", verificationTimeStamp=" - + verificationTimeStamp - + '}'; - } - - public static Builder builder() { - return new Builder<>(); - } - - /** - * Dedicated Builder - * - * @param Builder - * @since 1.0 - */ - public static class Builder> { - - VerificationId id; - VerificationStatusType status; - VerificationStatusReasonType reason; - VerificationReference reference; - Identity identity; - String countryId; - Instant verificationTimeStamp; - - protected Builder() {} - - /** - * Setter - * - *

See {@link VerificationStatus#getId()} getter - * - * @param id See getter - * @return Current builder - * @since 1.0 - */ - public B setId(VerificationId id) { - this.id = id; - return self(); - } - - /** - * Setter - * - *

See {@link VerificationStatus#getStatus()} getter - * - * @param status See getter - * @return Current builder - * @since 1.0 - */ - public B setStatus(VerificationStatusType status) { - this.status = status; - return self(); - } - - /** - * Setter - * - *

See {@link VerificationStatus#getReason()} getter - * - * @param reason See getter - * @return Current builder - * @since 1.0 - */ - public B setReason(VerificationStatusReasonType reason) { - this.reason = reason; - return self(); - } - - /** - * Setter - * - *

See {@link VerificationStatus#getReference()} getter - * - * @param reference See getter - * @return Current builder - * @since 1.0 - */ - public B setReference(VerificationReference reference) { - this.reference = reference; - return self(); - } - - /** - * Setter - * - *

See {@link VerificationStatus#getIdentity()} ()} getter - * - * @param identity See getter - * @return Current builder - * @since 1.1 - */ - public B setIdentity(Identity identity) { - this.identity = identity; - return self(); - } - - /** - * Setter - * - *

See {@link VerificationStatus#getCountryId()} ()} getter - * - * @param countryId See getter - * @return Current builder - * @since 1.1 - */ - public B setCountryId(String countryId) { - this.countryId = countryId; - return self(); - } - - /** - * Setter - * - *

See {@link VerificationStatus#getVerificationTimeStamp()} ()} ()} getter - * - * @param verificationTimeStamp See getter - * @return Current builder - * @since 1.1 - */ - public B setVerificationTimeStamp(Instant verificationTimeStamp) { - this.verificationTimeStamp = verificationTimeStamp; - return self(); - } - - /** - * Create instance - * - * @return The instance build with current builder values - * @since 1.0 - */ - public VerificationStatus build() { - return new VerificationStatus( - id, status, reason, reference, identity, countryId, verificationTimeStamp); - } - - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/VerificationStatusCallout.java b/client/src/main/com/sinch/sdk/domains/verification/models/VerificationStatusCallout.java deleted file mode 100644 index 01f29ac84..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/VerificationStatusCallout.java +++ /dev/null @@ -1,200 +0,0 @@ -package com.sinch.sdk.domains.verification.models; - -import java.time.Instant; - -/** - * Verification report related to a {@link - * com.sinch.sdk.domains.verification.VerificationsService#startCallout} - * - * @since 1.0 - */ -public class VerificationStatusCallout extends VerificationStatus { - - private final Price verificationPrice; - private final Price terminationPrice; - private final Integer billableDuration; - private final Boolean callComplete; - - private VerificationStatusCallout( - VerificationId id, - VerificationStatusType status, - VerificationStatusReasonType reason, - VerificationReference reference, - Identity identity, - String countryId, - Instant verificationTimeStamp, - Price verificationPrice, - Price terminationPrice, - Integer billableDuration, - Boolean callComplete) { - super(id, status, reason, reference, identity, countryId, verificationTimeStamp); - this.verificationPrice = verificationPrice; - this.terminationPrice = terminationPrice; - this.billableDuration = billableDuration; - this.callComplete = callComplete; - } - - /** - * The maximum price charged for this verification process. - * - *

This property will appear in the body of the response with a delay. It will become visible - * only when the verification status is other than {@link VerificationStatusType#PENDING PENDING} - * - * @return Verification price object - * @since 1.0 - */ - public Price getVerificationPrice() { - return verificationPrice; - } - - /** - * The maximum cost of the call made during this verification process. - * - *

Present only when termination debiting is enabled (disabled by default). - * - *

This property will appear in the body of the response with a delay. It will become visible - * only after the call is completed, when its cost is known to Sinch. - * - * @return The termination price object - * @since 1.0 - */ - public Price getTerminationPrice() { - return terminationPrice; - } - - /** - * The time of the call for which the fee was charged. - * - *

Present only when termination debiting is enabled (disabled by default). - * - *

Depending on the type of rounding used, the value is the actual call time rounded to the - * nearest second, minute or other value. - * - * @return The billable price object - * @since 1.0 - */ - public Integer getBillableDuration() { - return billableDuration; - } - - /** - * Shows whether the call is complete or not. - * - * @return TRUE.FALSE - * @since 1.0 - */ - public Boolean getCallComplete() { - return callComplete; - } - - /** {@inheritDoc} */ - @Override - public String toString() { - return "VerificationStatusCallout{" - + "verificationPrice=" - + verificationPrice - + ", terminationPrice=" - + terminationPrice - + ", billableDuration=" - + billableDuration - + ", callComplete=" - + callComplete - + "} " - + super.toString(); - } - - /** - * Getting Builder - * - * @return New Builder instance - * @since 1.0 - */ - public static Builder builder() { - return new Builder(); - } - - /** Dedicated Builder */ - public static class Builder extends VerificationStatus.Builder { - - Price verificationPrice; - Price terminationPrice; - Integer billableDuration; - Boolean callComplete; - - private Builder() {} - - /** - * See {@link VerificationStatusCallout#getVerificationPrice()} getter - * - * @param verificationPrice See getter - * @return Current builder - * @since 1.0 - */ - public Builder setVerificationPrice(Price verificationPrice) { - this.verificationPrice = verificationPrice; - return this; - } - - /** - * See {@link VerificationStatusCallout#getTerminationPrice()} getter - * - * @param terminationPrice See getter - * @return Current builder - * @since 1.0 - */ - public Builder setTerminationPrice(Price terminationPrice) { - this.terminationPrice = terminationPrice; - return this; - } - - /** - * See {@link VerificationStatusCallout#getBillableDuration()} getter - * - * @param billableDuration See getter - * @return Current builder - * @since 1.0 - */ - public Builder setBillableDuration(Integer billableDuration) { - this.billableDuration = billableDuration; - return this; - } - - /** - * See {@link VerificationStatusCallout#getCallComplete()} getter - * - * @param callComplete See getter - * @return Current builder - * @since 1.0 - */ - public Builder setCallComplete(Boolean callComplete) { - this.callComplete = callComplete; - return this; - } - - /** - * Create instance - * - * @return The instance build with current builder values - * @since 1.0 - */ - public VerificationStatusCallout build() { - return new VerificationStatusCallout( - id, - status, - reason, - reference, - identity, - countryId, - verificationTimeStamp, - verificationPrice, - terminationPrice, - billableDuration, - callComplete); - } - - @Override - protected Builder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/VerificationStatusFlashCall.java b/client/src/main/com/sinch/sdk/domains/verification/models/VerificationStatusFlashCall.java deleted file mode 100644 index b8f0efb54..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/VerificationStatusFlashCall.java +++ /dev/null @@ -1,200 +0,0 @@ -package com.sinch.sdk.domains.verification.models; - -import java.time.Instant; - -/** - * Verification report related to a {@link - * com.sinch.sdk.domains.verification.VerificationsService#startFlashCall} - * - * @since 1.0 - */ -public class VerificationStatusFlashCall extends VerificationStatus { - - private final Price verificationPrice; - private final Price terminationPrice; - private final Integer billableDuration; - private final VerificationSourceType source; - - private VerificationStatusFlashCall( - VerificationId id, - VerificationStatusType status, - VerificationStatusReasonType reason, - VerificationReference reference, - Identity identity, - String countryId, - Instant verificationTimeStamp, - Price verificationPrice, - Price terminationPrice, - Integer billableDuration, - VerificationSourceType source) { - super(id, status, reason, reference, identity, countryId, verificationTimeStamp); - this.verificationPrice = verificationPrice; - this.terminationPrice = terminationPrice; - this.billableDuration = billableDuration; - this.source = source; - } - - /** - * The maximum price charged for this verification process. - * - *

This property will appear in the body of the response with a delay. It will become visible - * only when the verification status is other than {@link VerificationStatusType#PENDING PENDING} - * - * @return Verification price object - * @since 1.0 - */ - public Price getVerificationPrice() { - return verificationPrice; - } - - /** - * The maximum cost of the call made during this verification process. - * - *

Present only when termination debiting is enabled (disabled by default). - * - *

This property will appear in the body of the response with a delay. It will become visible - * only after the call is completed, when its cost is known to Sinch. - * - * @return The termination price object - * @since 1.0 - */ - public Price getTerminationPrice() { - return terminationPrice; - } - - /** - * The time of the call for which the fee was charged. - * - *

Present only when termination debiting is enabled (disabled by default). - * - *

Depending on the type of rounding used, the value is the actual call time rounded to the - * nearest second, minute or other value. - * - * @return The billable price object - * @since 1.0 - */ - public Integer getBillableDuration() { - return billableDuration; - } - - /** - * Free text that the client is sending, used to show if the call/SMS was intercepted or not. - * - * @return source value - */ - public VerificationSourceType getSource() { - return source; - } - - /** {@inheritDoc} */ - @Override - public String toString() { - return "VerificationStatusFlashCall{" - + "verificationPrice=" - + verificationPrice - + ", terminationPrice=" - + terminationPrice - + ", billableDuration=" - + billableDuration - + ", source='" - + source - + '\'' - + "} " - + super.toString(); - } - - /** - * Getting Builder - * - * @return New Builder instance - * @since 1.0 - */ - public static Builder builder() { - return new Builder(); - } - - /** Dedicated Builder */ - public static class Builder extends VerificationStatus.Builder { - - Price verificationPrice; - Price terminationPrice; - Integer billableDuration; - VerificationSourceType source; - - private Builder() {} - - /** - * See {@link VerificationStatusFlashCall#getVerificationPrice()} getter - * - * @param verificationPrice See getter - * @return Current builder - * @since 1.0 - */ - public Builder setVerificationPrice(Price verificationPrice) { - this.verificationPrice = verificationPrice; - return this; - } - - /** - * See {@link VerificationStatusFlashCall#getTerminationPrice()} getter - * - * @param terminationPrice See getter - * @return Current builder - * @since 1.0 - */ - public Builder setTerminationPrice(Price terminationPrice) { - this.terminationPrice = terminationPrice; - return this; - } - - /** - * See {@link VerificationStatusFlashCall#getBillableDuration()} getter - * - * @param billableDuration See getter - * @return Current builder - * @since 1.0 - */ - public Builder setBillableDuration(Integer billableDuration) { - this.billableDuration = billableDuration; - return this; - } - - /** - * See {@link VerificationStatusFlashCall#getSource()} getter - * - * @param source See getter - * @return Current builder - * @since 1.0 - */ - public Builder setSource(VerificationSourceType source) { - this.source = source; - return this; - } - - /** - * Create instance - * - * @return The instance build with current builder values - * @since 1.0 - */ - public VerificationStatusFlashCall build() { - return new VerificationStatusFlashCall( - id, - status, - reason, - reference, - identity, - countryId, - verificationTimeStamp, - verificationPrice, - terminationPrice, - billableDuration, - source); - } - - @Override - protected Builder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/VerificationStatusReasonType.java b/client/src/main/com/sinch/sdk/domains/verification/models/VerificationStatusReasonType.java deleted file mode 100644 index 8163b90e3..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/VerificationStatusReasonType.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.sinch.sdk.domains.verification.models; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -/** - * The type of the verification report reason - * - * @since 1.0 - */ -public class VerificationStatusReasonType - extends EnumDynamic { - - /** FRAUD */ - public static final VerificationStatusReasonType FRAUD = - new VerificationStatusReasonType("Fraud"); - - /** NOT_ENOUGH_CREDIT */ - public static final VerificationStatusReasonType NOT_ENOUGH_CREDIT = - new VerificationStatusReasonType("Not enough credit"); - - /** BLOCKED */ - public static final VerificationStatusReasonType BLOCKED = - new VerificationStatusReasonType("Blocked"); - - /** DENIED_BY_CALLBACK */ - public static final VerificationStatusReasonType DENIED_BY_CALLBACK = - new VerificationStatusReasonType("Denied by callback"); - - /** INVALID_CALLBACK */ - public static final VerificationStatusReasonType INVALID_CALLBACK = - new VerificationStatusReasonType("Invalid callback"); - - /** INTERNAL_ERROR */ - public static final VerificationStatusReasonType INTERNAL_ERROR = - new VerificationStatusReasonType("Internal error"); - - /** DESTINATION_DENIED */ - public static final VerificationStatusReasonType DESTINATION_DENIED = - new VerificationStatusReasonType("Destination denied"); - - /** NETWORK_ERROR_OR_NUMBER_UNREACHABLE */ - public static final VerificationStatusReasonType NETWORK_ERROR_OR_NUMBER_UNREACHABLE = - new VerificationStatusReasonType("Network error or number unreachable"); - - /** FAILED_PENDING */ - public static final VerificationStatusReasonType FAILED_PENDING = - new VerificationStatusReasonType("Failed pending"); - - /** SMS_DELIVERY_FAILURE */ - public static final VerificationStatusReasonType SMS_DELIVERY_FAILURE = - new VerificationStatusReasonType("SMS delivery failure"); - - /** INVALID_CLI */ - public static final VerificationStatusReasonType INVALID_CLI = - new VerificationStatusReasonType("Invalid CLI"); - - /** INVALID_CODE */ - public static final VerificationStatusReasonType INVALID_CODE = - new VerificationStatusReasonType("Invalid code"); - - /** EXPIRED */ - public static final VerificationStatusReasonType EXPIRED = - new VerificationStatusReasonType("Expired"); - - /** HUNG_UP_WITHOUT_ENTERING_VALID_CODE */ - public static final VerificationStatusReasonType HUNG_UP_WITHOUT_ENTERING_VALID_CODE = - new VerificationStatusReasonType("Hung up without entering valid code"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - VerificationStatusReasonType.class, - VerificationStatusReasonType::new, - Arrays.asList( - FRAUD, - NOT_ENOUGH_CREDIT, - BLOCKED, - DENIED_BY_CALLBACK, - INVALID_CALLBACK, - INTERNAL_ERROR, - DESTINATION_DENIED, - NETWORK_ERROR_OR_NUMBER_UNREACHABLE, - FAILED_PENDING, - SMS_DELIVERY_FAILURE, - INVALID_CLI, - INVALID_CODE, - EXPIRED, - HUNG_UP_WITHOUT_ENTERING_VALID_CODE)); - - private VerificationStatusReasonType(String value) { - super(value); - } - - /** - * Get declared values - * - * @return Stream of values - */ - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - /** - * Get value from a string - * - * @param value String identifier - * @return Dynamic enum from value. A new enum is created if value is not yet registered - */ - public static VerificationStatusReasonType from(String value) { - return ENUM_SUPPORT.from(value); - } - - /** - * Value of the enum as String - * - * @param e The enum identifier - * @return String identifier of the enum value - */ - public static String valueOf(VerificationStatusReasonType e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/VerificationStatusSMS.java b/client/src/main/com/sinch/sdk/domains/verification/models/VerificationStatusSMS.java deleted file mode 100644 index 4ceb7336d..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/VerificationStatusSMS.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.sinch.sdk.domains.verification.models; - -import java.time.Instant; - -/** - * Verification report related to a {@link - * com.sinch.sdk.domains.verification.VerificationsService#startSms} - * - * @since 1.0 - */ -public class VerificationStatusSMS extends VerificationStatus { - - private final Price verificationPrice; - private final VerificationSourceType source; - - private VerificationStatusSMS( - VerificationId id, - VerificationStatusType status, - VerificationStatusReasonType reason, - VerificationReference reference, - Identity identity, - String countryId, - Instant verificationTimeStamp, - Price verificationPrice, - VerificationSourceType source) { - super(id, status, reason, reference, identity, countryId, verificationTimeStamp); - this.verificationPrice = verificationPrice; - this.source = source; - } - - /** - * The maximum price charged for this verification process. - * - *

This property will appear in the body of the response with a delay. It will become visible - * only when the verification status is other than {@link VerificationStatusType#PENDING PENDING} - * - * @return Verification price object - * @since 1.0 - */ - public Price getVerificationPrice() { - return verificationPrice; - } - - /** - * Used to show if the SMS was intercepted or not - * - * @return Source type value - * @since 1.0 - */ - public VerificationSourceType getSource() { - return source; - } - - /** {@inheritDoc} */ - @Override - public String toString() { - return "VerificationStatusSMS{" - + "verificationPrice=" - + verificationPrice - + ", source='" - + source - + '\'' - + "} " - + super.toString(); - } - - /** - * Getting Builder - * - * @return New Builder instance - * @since 1.0 - */ - public static Builder builder() { - return new Builder(); - } - - /** Dedicated Builder */ - public static class Builder extends VerificationStatus.Builder { - - Price verificationPrice; - VerificationSourceType source; - - private Builder() {} - - /** - * See {@link VerificationStatusSMS#getVerificationPrice() getter} - * - * @param verificationPrice Price object value - * @return Current builder - * @since 1.0 - */ - public Builder setVerificationPrice(Price verificationPrice) { - this.verificationPrice = verificationPrice; - return this; - } - - /** - * See {@link VerificationStatusSMS#getSource() getter} - * - * @param source Source to be set - * @return Current builder - * @since 1.0 - */ - public Builder setSource(VerificationSourceType source) { - this.source = source; - return this; - } - - /** - * Create instance - * - * @return The instance build with current builder values - * @since 1.0 - */ - public VerificationStatusSMS build() { - return new VerificationStatusSMS( - id, - status, - reason, - reference, - identity, - countryId, - verificationTimeStamp, - verificationPrice, - source); - } - - @Override - protected Builder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/VerificationStatusType.java b/client/src/main/com/sinch/sdk/domains/verification/models/VerificationStatusType.java deleted file mode 100644 index 793918b9c..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/VerificationStatusType.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.sinch.sdk.domains.verification.models; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -/** - * The type of the verification report status - * - * @since 1.0 - */ -public class VerificationStatusType extends EnumDynamic { - - /** The verification is ongoing */ - public static final VerificationStatusType PENDING = new VerificationStatusType("PENDING"); - - /** The verification was successful */ - public static final VerificationStatusType SUCCESSFUL = new VerificationStatusType("SUCCESSFUL"); - - /** The verification attempt was made, but the number wasn't verified */ - public static final VerificationStatusType FAIL = new VerificationStatusType("FAIL"); - - /** The verification attempt was denied by Sinch or your backend */ - public static final VerificationStatusType DENIED = new VerificationStatusType("DENIED"); - - /** The verification attempt was aborted by requesting a new verification */ - public static final VerificationStatusType ABORTED = new VerificationStatusType("ABORTED"); - - /** - * The verification couldn't be completed due to a network error or the number being unreachable - */ - public static final VerificationStatusType ERROR = new VerificationStatusType("ERROR"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - VerificationStatusType.class, - VerificationStatusType::new, - Arrays.asList(PENDING, SUCCESSFUL, FAIL, DENIED, ABORTED, ERROR)); - - private VerificationStatusType(String value) { - super(value); - } - - /** - * Get declared values - * - * @return Stream of values - */ - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - /** - * Get value from a string - * - * @param value String identifier - * @return Dynamic enum from value. A new enum is created if value is not yet registered - */ - public static VerificationStatusType from(String value) { - return ENUM_SUPPORT.from(value); - } - - /** - * Value of the enum as String - * - * @param e The enum identifier - * @return String identifier of the enum value - */ - public static String valueOf(VerificationStatusType e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/requests/SMSCodeType.java b/client/src/main/com/sinch/sdk/domains/verification/models/requests/SMSCodeType.java deleted file mode 100644 index 1964fd8a9..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/requests/SMSCodeType.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.sinch.sdk.domains.verification.models.requests; - -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; - -/** - * Accepted values for the type of code to be generated are Numeric, Alpha, and Alphanumeric. - * - * @since 1.1 - */ -public class SMSCodeType extends EnumDynamic { - - public static final SMSCodeType NUMERIC = new SMSCodeType("Numeric"); - - public static final SMSCodeType ALPHA = new SMSCodeType("Alpha"); - - public static final SMSCodeType ALPHANUMERIC = new SMSCodeType("Alphanumeric"); - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - SMSCodeType.class, SMSCodeType::new, Arrays.asList(NUMERIC, ALPHA, ALPHANUMERIC)); - - private SMSCodeType(String value) { - super(value); - } - - /** - * Get declared values - * - * @return Stream of values - */ - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - /** - * Get value from a string - * - * @param value String identifier - * @return Dynamic enum from value. A new enum is created if value is not yet registered - */ - public static SMSCodeType from(String value) { - return ENUM_SUPPORT.from(value); - } - - /** - * Value of the enum as String - * - * @param e The enum identifier - * @return String identifier of the enum value - */ - public static String valueOf(SMSCodeType e) { - return ENUM_SUPPORT.valueOf(e); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/requests/StartVerificationCalloutOptions.java b/client/src/main/com/sinch/sdk/domains/verification/models/requests/StartVerificationCalloutOptions.java deleted file mode 100644 index 40367fa21..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/requests/StartVerificationCalloutOptions.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.sinch.sdk.domains.verification.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; - -/** - * Dedicated options related to {@link StartVerificationCalloutRequestParameters - * StartVerificationCalloutRequestParameters} - * - * @since 1.1 - */ -public class StartVerificationCalloutOptions { - - private final OptionalValue speech; - - private StartVerificationCalloutOptions( - OptionalValue speech) { - this.speech = speech; - } - - /** - * Getting Builder - * - * @return New Builder instance - * @since 1.0 - */ - public static Builder builder() { - return new Builder(); - } - - public OptionalValue getSpeech() { - return speech; - } - - /** - * Dedicated Builder - * - * @since 1.0 - */ - public static class Builder { - - OptionalValue speech = OptionalValue.empty(); - - private Builder() {} - - /** - * Speech settings - * - * @param speech Set speech settings - * @return current builder - * @since 1.0 - */ - public Builder setSpeech(StartVerificationCalloutSpeechOptions speech) { - this.speech = OptionalValue.of(speech); - return this; - } - - /** - * Create instance - * - * @return The instance build with current builder values - * @since 1.0 - */ - public StartVerificationCalloutOptions build() { - return new StartVerificationCalloutOptions(speech); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/requests/StartVerificationCalloutRequestParameters.java b/client/src/main/com/sinch/sdk/domains/verification/models/requests/StartVerificationCalloutRequestParameters.java deleted file mode 100644 index 269fe5bb3..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/requests/StartVerificationCalloutRequestParameters.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.sinch.sdk.domains.verification.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.verification.models.Identity; -import com.sinch.sdk.domains.verification.models.VerificationMethodType; -import com.sinch.sdk.domains.verification.models.VerificationReference; - -/** - * Dedicated request parameters to be used for a CALLOUT verification - * - * @since 1.0 - */ -public class StartVerificationCalloutRequestParameters extends StartVerificationRequestParameters { - - private final OptionalValue options; - - private StartVerificationCalloutRequestParameters( - OptionalValue identity, - OptionalValue reference, - OptionalValue custom, - OptionalValue options) { - super(identity, VerificationMethodType.CALLOUT, reference, custom); - this.options = options; - } - - /** - * Getting Builder - * - * @return New Builder instance - * @since 1.0 - */ - public static Builder builder() { - return new Builder(); - } - - public OptionalValue getOptions() { - return options; - } - - @Override - public String toString() { - return "StartVerificationCalloutRequestParameters{} " + super.toString(); - } - - /** - * Dedicated Builder - * - * @since 1.0 - */ - public static class Builder extends StartVerificationRequestParameters.Builder { - - OptionalValue options = OptionalValue.empty(); - - private Builder() {} - - /** - * Callout options to be used - * - * @param options Specifies options - * @return current builder - * @since 1.0 - */ - public Builder setOptions(StartVerificationCalloutOptions options) { - this.options = OptionalValue.of(options); - return this; - } - - /** - * Create instance - * - * @return The instance build with current builder values - * @since 1.0 - */ - @Override - public StartVerificationCalloutRequestParameters build() { - return new StartVerificationCalloutRequestParameters(identity, reference, custom, options); - } - - @Override - protected Builder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/requests/StartVerificationCalloutSpeechOptions.java b/client/src/main/com/sinch/sdk/domains/verification/models/requests/StartVerificationCalloutSpeechOptions.java deleted file mode 100644 index e7dc80568..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/requests/StartVerificationCalloutSpeechOptions.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.sinch.sdk.domains.verification.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; - -/** - * Text-To-Speech engine settings - * - *

Dedicated options related to {@link StartVerificationCalloutOptions - * StartVerificationCalloutOptions} - * - * @since 1.1 - */ -public class StartVerificationCalloutSpeechOptions { - - private final OptionalValue locale; - - private StartVerificationCalloutSpeechOptions(OptionalValue locale) { - this.locale = locale; - } - - /** - * Getting Builder - * - * @return New Builder instance - * @since 1.1 - */ - public static Builder builder() { - return new Builder(); - } - - public OptionalValue getLocale() { - return locale; - } - - /** - * Dedicated Builder - * - * @since 1.1 - */ - public static class Builder { - - private OptionalValue locale = OptionalValue.empty(); - - private Builder() {} - - /** - * A language-region identifier according to IANA. Only a subset of those identifiers is - * accepted to be used for Text To Speech engine - * - * @param locale Specifies expiry time - * @return current builder - * @since 1.1 - */ - public Builder setLocale(String locale) { - this.locale = OptionalValue.of(locale); - return this; - } - - /** - * Create instance - * - * @return The instance build with current builder values - * @since 1.1 - */ - public StartVerificationCalloutSpeechOptions build() { - return new StartVerificationCalloutSpeechOptions(locale); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/requests/StartVerificationFlashCallRequestParameters.java b/client/src/main/com/sinch/sdk/domains/verification/models/requests/StartVerificationFlashCallRequestParameters.java deleted file mode 100644 index e59570ca7..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/requests/StartVerificationFlashCallRequestParameters.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.sinch.sdk.domains.verification.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.verification.models.Identity; -import com.sinch.sdk.domains.verification.models.VerificationMethodType; -import com.sinch.sdk.domains.verification.models.VerificationReference; - -/** - * Dedicated request parameters to be used for a FLASH_CALL verification - * - * @since 1.0 - */ -public class StartVerificationFlashCallRequestParameters - extends StartVerificationRequestParameters { - - private final OptionalValue dialTimeOut; - - private StartVerificationFlashCallRequestParameters( - OptionalValue identity, - OptionalValue reference, - OptionalValue custom, - OptionalValue dialTimeOut) { - super(identity, VerificationMethodType.FLASH_CALL, reference, custom); - this.dialTimeOut = dialTimeOut; - } - - /** - * See {@link StartVerificationFlashCallRequestParameters.Builder#setDialTimeOut(Integer) builder - * setter} - * - * @return Dial Time Out value - * @since 1.0 - */ - public OptionalValue getDialTimeOut() { - return dialTimeOut; - } - - @Override - public String toString() { - return "StartVerificationFlashCallRequestParameters{" - + "dialTimeOut=" - + dialTimeOut - + "} " - + super.toString(); - } - - /** - * Getting Builder - * - * @return New Builder instance - * @since 1.0 - */ - public static Builder builder() { - return new Builder(); - } - - /** - * Dedicated Builder - * - * @since 1.0 - */ - public static class Builder extends StartVerificationRequestParameters.Builder { - - OptionalValue dialTimeOut = OptionalValue.empty(); - - private Builder() {} - - /** - * Set the dial timeout - * - * @param dialTimeOut The dial timeout in seconds. - * @return current builder - * @since 1.0 - */ - public Builder setDialTimeOut(Integer dialTimeOut) { - this.dialTimeOut = OptionalValue.of(dialTimeOut); - return this; - } - - /** - * Create instance - * - * @return The instance build with current builder values - * @since 1.0 - */ - @Override - public StartVerificationFlashCallRequestParameters build() { - return new StartVerificationFlashCallRequestParameters( - identity, reference, custom, dialTimeOut); - } - - @Override - protected Builder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/requests/StartVerificationRequestParameters.java b/client/src/main/com/sinch/sdk/domains/verification/models/requests/StartVerificationRequestParameters.java deleted file mode 100644 index 0678bf7ef..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/requests/StartVerificationRequestParameters.java +++ /dev/null @@ -1,153 +0,0 @@ -package com.sinch.sdk.domains.verification.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.verification.models.Identity; -import com.sinch.sdk.domains.verification.models.NumberIdentity; -import com.sinch.sdk.domains.verification.models.VerificationMethodType; -import com.sinch.sdk.domains.verification.models.VerificationReference; - -/** - * Base class for start verification request parameters - * - * @since 1.0 - */ -public abstract class StartVerificationRequestParameters { - - private final VerificationMethodType method; - private final OptionalValue identity; - private final OptionalValue reference; - private final OptionalValue custom; - - protected StartVerificationRequestParameters( - OptionalValue identity, - VerificationMethodType method, - OptionalValue reference, - OptionalValue custom) { - this.identity = identity; - this.method = method; - this.reference = reference; - this.custom = custom; - } - - /** - * See {@link StartVerificationRequestParameters.Builder#setIdentity(NumberIdentity) builder - * setter} - * - * @return The reference value - * @since 1.0 - */ - public OptionalValue getIdentity() { - return identity; - } - - /** - * The type of the verification request. - * - * @return The method value - * @since 1.0 - */ - public VerificationMethodType getMethod() { - return method; - } - - /** - * See {@link StartVerificationRequestParameters.Builder#setReference(VerificationReference) - * builder setter} - * - * @return The reference value - * @since 1.0 - */ - public OptionalValue getReference() { - return reference; - } - - /** - * See {@link StartVerificationRequestParameters.Builder#setCustom(String) builder setter} - * - * @return The custom value - * @since 1.0 - */ - public OptionalValue getCustom() { - return custom; - } - - @Override - public String toString() { - return "StartVerificationRequestParameters{" - + "method=" - + method - + ", identity=" - + identity - + ", reference='" - + reference - + '\'' - + ", custom='" - + custom - + '\'' - + '}'; - } - - /** - * Dedicated Builder - * - * @param Builder - * @since 1.0 - */ - public abstract static class Builder> { - - OptionalValue identity = OptionalValue.empty(); - OptionalValue reference = OptionalValue.empty(); - OptionalValue custom = OptionalValue.empty(); - - /** - * Specifies the type of endpoint that will be verified and the particular endpoint. - * NumberIdentity is currently the only supported endpoint type - * - * @param identity Specifies the type of endpoint that will be verified and the particular - * endpoint. number is currently the only supported endpoint type - * @return current builder - * @since 1.0 - */ - public B setIdentity(NumberIdentity identity) { - this.identity = OptionalValue.of(identity); - return self(); - } - - /** - * Used to pass your own reference in the request for tracking purposes - * - * @param reference your own reference to be used - * @return current builder - * @since 1.0 - */ - public B setReference(VerificationReference reference) { - this.reference = OptionalValue.of(reference); - return self(); - } - - /** - * Pass custom data in the request - * - * @param custom custom data - * @return current builder - * @since 1.0 - */ - public B setCustom(String custom) { - this.custom = OptionalValue.of(custom); - return self(); - } - - /** - * Create instance - * - * @return The instance build with current builder values - * @since 1.0 - */ - public abstract StartVerificationRequestParameters build(); - - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/requests/StartVerificationSMSOptions.java b/client/src/main/com/sinch/sdk/domains/verification/models/requests/StartVerificationSMSOptions.java deleted file mode 100644 index 0a851cec5..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/requests/StartVerificationSMSOptions.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.sinch.sdk.domains.verification.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; - -/** - * Dedicated options related to {@link StartVerificationSMSRequestParameters - * StartVerificationSMSRequestParameters} - * - * @since 1.1 - */ -public class StartVerificationSMSOptions { - - private final OptionalValue expiry; - private final OptionalValue codeType; - private final OptionalValue template; - private final OptionalValue acceptLanguage; - - private StartVerificationSMSOptions( - OptionalValue expiry, - OptionalValue codeType, - OptionalValue template, - OptionalValue acceptLanguage) { - this.expiry = expiry; - this.codeType = codeType; - this.template = template; - this.acceptLanguage = acceptLanguage; - } - - /** - * Getting Builder - * - * @return New Builder instance - * @since 1.1 - */ - public static Builder builder() { - return new Builder(); - } - - public OptionalValue getExpiry() { - return expiry; - } - - public OptionalValue getCodeType() { - return codeType; - } - - public OptionalValue getTemplate() { - return template; - } - - public OptionalValue getAcceptLanguage() { - return acceptLanguage; - } - - /** - * Dedicated Builder - * - * @since 1.1 - */ - public static class Builder { - - private OptionalValue expiry = OptionalValue.empty(); - private OptionalValue codeType = OptionalValue.empty(); - private OptionalValue template = OptionalValue.empty(); - private OptionalValue acceptLanguage = OptionalValue.empty(); - - private Builder() {} - - /** - * The expiration time for a verification process is represented in the format HH:MM:SS. - * - * @param expiry Specifies expiry time - * @return current builder - * @since 1.1 - */ - public Builder setExpiry(String expiry) { - this.expiry = OptionalValue.of(expiry); - return this; - } - - /** - * The type of code to be generated - * - * @param codeType Specifies code type - * @return current builder - * @since 1.1 - */ - public Builder setCodeType(SMSCodeType codeType) { - this.codeType = OptionalValue.of(codeType); - return this; - } - - /** - * The SMS template must include a placeholder {{CODE}} where the verification code will be - * inserted, and it can otherwise be customized as desired - * - * @param template Template string - * @return current builder - * @since 1.1 - */ - public Builder setTemplate(String template) { - this.template = OptionalValue.of(template); - return this; - } - - /** - * Value of accept language is used to determine the language of an SMS message - * - * @param acceptLanguage locale string - * @return current builder - * @since 1.1 - */ - public Builder setAcceptLanguage(String acceptLanguage) { - this.acceptLanguage = OptionalValue.of(acceptLanguage); - return this; - } - - /** - * Create instance - * - * @return The instance build with current builder values - * @since 1.1 - */ - public StartVerificationSMSOptions build() { - return new StartVerificationSMSOptions(expiry, codeType, template, acceptLanguage); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/requests/StartVerificationSMSRequestParameters.java b/client/src/main/com/sinch/sdk/domains/verification/models/requests/StartVerificationSMSRequestParameters.java deleted file mode 100644 index 85a312db4..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/requests/StartVerificationSMSRequestParameters.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.sinch.sdk.domains.verification.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.verification.models.Identity; -import com.sinch.sdk.domains.verification.models.VerificationMethodType; -import com.sinch.sdk.domains.verification.models.VerificationReference; - -/** - * Dedicated request parameters to be used for an SMS verification - * - * @since 1.0 - */ -public class StartVerificationSMSRequestParameters extends StartVerificationRequestParameters { - - private final OptionalValue options; - - private StartVerificationSMSRequestParameters( - OptionalValue identity, - OptionalValue reference, - OptionalValue custom, - OptionalValue options) { - super(identity, VerificationMethodType.SMS, reference, custom); - this.options = options; - } - - /** - * Getting Builder - * - * @return New Builder instance - * @since 1.0 - */ - public static Builder builder() { - return new Builder(); - } - - public OptionalValue getOptions() { - return options; - } - - @Override - public String toString() { - return "StartVerificationSMSRequestParameters{} " + super.toString(); - } - - /** - * Dedicated Builder - * - * @since 1.0 - */ - public static class Builder extends StartVerificationRequestParameters.Builder { - - OptionalValue acceptLanguage = OptionalValue.empty(); - OptionalValue options = OptionalValue.empty(); - - private Builder() {} - - /** - * SMS options to be used - * - * @param options Specifies options - * @return current builder - * @since 1.0 - */ - public Builder setOptions(StartVerificationSMSOptions options) { - this.options = OptionalValue.of(options); - return self(); - } - - /** - * Create instance - * - * @return The instance build with current builder values - * @since 1.0 - */ - @Override - public StartVerificationSMSRequestParameters build() { - return new StartVerificationSMSRequestParameters(identity, reference, custom, options); - } - - @Override - protected Builder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/requests/StartVerificationSeamlessRequestParameters.java b/client/src/main/com/sinch/sdk/domains/verification/models/requests/StartVerificationSeamlessRequestParameters.java deleted file mode 100644 index b11e623f4..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/requests/StartVerificationSeamlessRequestParameters.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.sinch.sdk.domains.verification.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.verification.models.Identity; -import com.sinch.sdk.domains.verification.models.VerificationMethodType; -import com.sinch.sdk.domains.verification.models.VerificationReference; - -/** - * Dedicated request parameters to be used for a SEAMLESS verification - * - * @since 1.0 - */ -public class StartVerificationSeamlessRequestParameters extends StartVerificationRequestParameters { - - private StartVerificationSeamlessRequestParameters( - OptionalValue identity, - OptionalValue reference, - OptionalValue custom) { - super(identity, VerificationMethodType.SEAMLESS, reference, custom); - } - - @Override - public String toString() { - return "StartVerificationSeamlessRequestParameters{} " + super.toString(); - } - - /** - * Getting Builder - * - * @return New Builder instance - * @since 1.0 - */ - public static Builder builder() { - return new Builder(); - } - - /** - * Dedicated Builder - * - * @since 1.0 - */ - public static class Builder extends StartVerificationRequestParameters.Builder { - - private Builder() {} - - /** - * Create instance - * - * @return The instance build with current builder values - * @since 1.0 - */ - @Override - public StartVerificationSeamlessRequestParameters build() { - return new StartVerificationSeamlessRequestParameters(identity, reference, custom); - } - - @Override - protected Builder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/requests/VerificationReportCalloutRequestParameters.java b/client/src/main/com/sinch/sdk/domains/verification/models/requests/VerificationReportCalloutRequestParameters.java deleted file mode 100644 index fde2660ef..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/requests/VerificationReportCalloutRequestParameters.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.sinch.sdk.domains.verification.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.verification.models.VerificationMethodType; - -/** - * Dedicated request parameters to be used to start a verification report by callout (Verification - * by placing a PSTN call to the user's phone) - * - * @since 1.0 - */ -public class VerificationReportCalloutRequestParameters - extends VerificationReportRequestParameters { - - private final OptionalValue code; - - private VerificationReportCalloutRequestParameters(OptionalValue code) { - super(OptionalValue.of(VerificationMethodType.CALLOUT)); - this.code = code; - } - - /** - * See {@link VerificationReportCalloutRequestParameters.Builder#setCode(String) builder setter} - * - * @return Code value - * @since 1.0 - */ - public OptionalValue getCode() { - return code; - } - - @Override - public String toString() { - return "VerificationReportCalloutRequestParameters{" - + "code='" - + code - + '\'' - + "} " - + super.toString(); - } - - /** - * Getting Builder - * - * @return New Builder instance - * @since 1.0 - */ - public static Builder builder() { - return new Builder(); - } - - /** - * Dedicated Builder - * - * @since 1.0 - */ - public static class Builder extends VerificationReportRequestParameters.Builder { - - OptionalValue code = OptionalValue.empty(); - - protected Builder() { - super(VerificationMethodType.CALLOUT); - } - - /** - * The code which was received by the user submitting the SMS verification. - * - * @param code The code which was received by the user submitting the Phone Call verification. - * @return current builder - */ - public Builder setCode(String code) { - this.code = OptionalValue.of(code); - return this; - } - - /** - * Create instance - * - * @return The instance build with current builder values - * @since 1.0 - */ - public VerificationReportCalloutRequestParameters build() { - return new VerificationReportCalloutRequestParameters(code); - } - - @Override - protected Builder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/requests/VerificationReportFlashCallRequestParameters.java b/client/src/main/com/sinch/sdk/domains/verification/models/requests/VerificationReportFlashCallRequestParameters.java deleted file mode 100644 index 2a76d317e..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/requests/VerificationReportFlashCallRequestParameters.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.sinch.sdk.domains.verification.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.verification.models.VerificationMethodType; - -/** - * Dedicated request parameters to be used to start a verification report by flash call (missed - * call) - * - * @since 1.0 - */ -public class VerificationReportFlashCallRequestParameters - extends VerificationReportRequestParameters { - - private final OptionalValue cli; - - private VerificationReportFlashCallRequestParameters(OptionalValue cli) { - super(OptionalValue.of(VerificationMethodType.FLASH_CALL)); - this.cli = cli; - } - - /** - * See {@link VerificationReportFlashCallRequestParameters.Builder#setCli(String) builder setter} - * - * @return CLI value - * @since 1.0 - */ - public OptionalValue getCli() { - return cli; - } - - @Override - public String toString() { - return "VerificationReportFlashCallRequestParameters{" - + "cli='" - + cli - + '\'' - + "} " - + super.toString(); - } - - /** - * Getting Builder - * - * @return New Builder instance - * @since 1.0 - */ - public static Builder builder() { - return new Builder(); - } - - /** - * Dedicated Builder - * - * @since 1.0 - */ - public static class Builder extends VerificationReportRequestParameters.Builder { - - OptionalValue cli = OptionalValue.empty(); - - protected Builder() { - super(VerificationMethodType.FLASH_CALL); - } - - /** - * The caller ID of the FlashCall - * - * @param cli The caller ID value - * @return current builder - * @since 1.0 - */ - public Builder setCli(String cli) { - this.cli = OptionalValue.of(cli); - return this; - } - - /** - * Create instance - * - * @return The instance build with current builder values - * @since 1.0 - */ - public VerificationReportFlashCallRequestParameters build() { - return new VerificationReportFlashCallRequestParameters(cli); - } - - @Override - protected Builder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/requests/VerificationReportRequestParameters.java b/client/src/main/com/sinch/sdk/domains/verification/models/requests/VerificationReportRequestParameters.java deleted file mode 100644 index 3cecabcfe..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/requests/VerificationReportRequestParameters.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.sinch.sdk.domains.verification.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.verification.models.VerificationMethodType; - -/** - * Base class for verification report request parameters - * - * @since 1.0 - */ -public class VerificationReportRequestParameters { - - private final OptionalValue method; - - protected VerificationReportRequestParameters(OptionalValue method) { - this.method = method; - } - - /** - * The type of the verification request. - * - * @return method value - * @since 1.0 - */ - public OptionalValue getMethod() { - return method; - } - - @Override - public String toString() { - return "VerificationReportRequestParameters{" + "method=" + method + '}'; - } - - protected static Builder builder() { - return new Builder<>(); - } - - /** - * Dedicated Builder - * - * @param Builder - * @since 1.0 - */ - public static class Builder> { - - OptionalValue method; - - protected Builder() {} - - protected Builder(VerificationMethodType method) { - this.method = OptionalValue.of(method); - } - - /** - * Create instance - * - * @return The instance build with current builder values - * @since 1.0 - */ - public VerificationReportRequestParameters build() { - return new VerificationReportRequestParameters(method); - } - - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/requests/VerificationReportSMSRequestParameters.java b/client/src/main/com/sinch/sdk/domains/verification/models/requests/VerificationReportSMSRequestParameters.java deleted file mode 100644 index 07f0a01f3..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/requests/VerificationReportSMSRequestParameters.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.sinch.sdk.domains.verification.models.requests; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.verification.models.VerificationMethodType; - -/** - * Dedicated request parameters to be used to start a verification report by SMS - * - * @since 1.0 - */ -public class VerificationReportSMSRequestParameters extends VerificationReportRequestParameters { - - private final OptionalValue code; - private final OptionalValue cli; - - private VerificationReportSMSRequestParameters( - OptionalValue code, OptionalValue cli) { - super(OptionalValue.of(VerificationMethodType.SMS)); - this.code = code; - this.cli = cli; - } - - /** - * See {@link VerificationReportSMSRequestParameters.Builder#setCode(String) builder setter} - * - * @return Code value - * @since 1.0 - */ - public OptionalValue getCode() { - return code; - } - - /** - * See {@link VerificationReportSMSRequestParameters.Builder#setCli(String) builder setter} - * - * @return CLI value - * @since 1.0 - */ - public OptionalValue getCli() { - return cli; - } - - @Override - public String toString() { - return "VerificationReportSMSRequestParameters{" - + "code='" - + code - + '\'' - + ", cli='" - + cli - + '\'' - + "} " - + super.toString(); - } - - /** - * Getting Builder - * - * @return New Builder instance - * @since 1.0 - */ - public static Builder builder() { - return new Builder(); - } - - /** - * Dedicated Builder - * - * @since 1.0 - */ - public static class Builder extends VerificationReportRequestParameters.Builder { - - OptionalValue code = OptionalValue.empty(); - OptionalValue cli = OptionalValue.empty(); - - protected Builder() { - super(VerificationMethodType.SMS); - } - - /** - * The code which was received by the user submitting the SMS verification. - * - * @param code The code value - * @return current builder - * @since 1.0 - */ - public Builder setCode(String code) { - this.code = OptionalValue.of(code); - return this; - } - - /** - * The sender ID of the SMS. - * - * @param cli The sender ID value - * @return current builder - * @since 1.0 - */ - public Builder setCli(String cli) { - this.cli = OptionalValue.of(cli); - return this; - } - - /** - * Create instance - * - * @return The instance build with current builder values - * @since 1.0 - */ - public VerificationReportSMSRequestParameters build() { - return new VerificationReportSMSRequestParameters(code, cli); - } - - @Override - protected Builder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/requests/package-info.java b/client/src/main/com/sinch/sdk/domains/verification/models/requests/package-info.java deleted file mode 100644 index 0e7e95264..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/requests/package-info.java +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Verification API requests related models - * - * @since 1.0 - */ -package com.sinch.sdk.domains.verification.models.requests; diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/response/StartVerificationResponse.java b/client/src/main/com/sinch/sdk/domains/verification/models/response/StartVerificationResponse.java deleted file mode 100644 index 06f1ba452..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/response/StartVerificationResponse.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.sinch.sdk.domains.verification.models.response; - -import com.sinch.sdk.domains.verification.models.Link; -import com.sinch.sdk.domains.verification.models.VerificationId; -import java.util.Collection; - -/** - * Base class to all Start verification requests - * - * @since 1.0 - */ -public class StartVerificationResponse { - - private final VerificationId id; - private final Collection links; - - protected StartVerificationResponse(VerificationId id, Collection links) { - this.id = id; - this.links = links; - } - - /** - * Verification identifier used to query for status. - * - * @return Id value - * @since 1.0 - */ - public VerificationId getId() { - return id; - } - - /** - * Available methods and actions which can be done after a successful Verification - * - * @return Links value - * @since 1.0 - */ - public Collection getLinks() { - return links; - } - - @Override - public String toString() { - return "StartVerificationResponse{" + "id='" + id + '\'' + ", links=" + links + '}'; - } - - /** - * Getting Builder - * - * @return New Builder instance - * @since 1.0 - */ - public static Builder builder() { - return new Builder<>(); - } - - /** - * Dedicated Builder - * - * @param Builder - * @since 1.0 - */ - public static class Builder> { - - VerificationId id; - Collection links; - - protected Builder() {} - ; - - /** - * See {@link StartVerificationResponse#getId() getter} - * - * @param id see getter - * @return The current builder - * @since 1.0 - */ - public B setId(VerificationId id) { - this.id = id; - return self(); - } - - /** - * See {@link StartVerificationResponse#getLinks() getter} - * - * @param links see getter - * @return The current builder - * @since 1.0 - */ - public B setLinks(Collection links) { - this.links = links; - return self(); - } - - /** - * Create instance - * - * @return The instance build with current builder values - * @since 1.0 - */ - public StartVerificationResponse build() { - return new StartVerificationResponse(id, links); - } - - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/response/StartVerificationResponseCallout.java b/client/src/main/com/sinch/sdk/domains/verification/models/response/StartVerificationResponseCallout.java deleted file mode 100644 index 93e78f663..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/response/StartVerificationResponseCallout.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.sinch.sdk.domains.verification.models.response; - -import com.sinch.sdk.domains.verification.models.Link; -import com.sinch.sdk.domains.verification.models.VerificationId; -import com.sinch.sdk.domains.verification.models.requests.StartVerificationCalloutRequestParameters; -import java.util.Collection; - -/** - * Dedicated response type for a callout verification - * - *

Verification response when started using {@link - * com.sinch.sdk.domains.verification.VerificationsService#startCallout(StartVerificationCalloutRequestParameters)} - * - * @since 1.0 - */ -public class StartVerificationResponseCallout extends StartVerificationResponse { - - /** - * @param id Verification identifier used to query for status. - * @param links Available methods and actions which can be done after a successful Verification - */ - private StartVerificationResponseCallout(VerificationId id, Collection links) { - super(id, links); - } - - @Override - public String toString() { - return "StartVerificationResponseCallout{} " + super.toString(); - } - - /** - * Getting Builder - * - * @return New Builder instance - * @since 1.0 - */ - public static Builder builder() { - return new Builder(); - } - - /** - * Dedicated Builder - * - * @since 1.0 - */ - public static class Builder extends StartVerificationResponse.Builder { - - private Builder() { - super(); - } - - /** - * Create instance - * - * @return The instance build with current builder values - * @since 1.0 - */ - public StartVerificationResponseCallout build() { - return new StartVerificationResponseCallout(id, links); - } - - @Override - protected Builder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/response/StartVerificationResponseFlashCall.java b/client/src/main/com/sinch/sdk/domains/verification/models/response/StartVerificationResponseFlashCall.java deleted file mode 100644 index eded98f55..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/response/StartVerificationResponseFlashCall.java +++ /dev/null @@ -1,184 +0,0 @@ -package com.sinch.sdk.domains.verification.models.response; - -import com.sinch.sdk.domains.verification.models.Link; -import com.sinch.sdk.domains.verification.models.VerificationId; -import com.sinch.sdk.domains.verification.models.requests.StartVerificationFlashCallRequestParameters; -import java.util.Collection; - -/** - * Dedicated response type for a flash call verification - * - *

Verification response when started using {@link - * com.sinch.sdk.domains.verification.VerificationsService#startFlashCall(StartVerificationFlashCallRequestParameters)} - * - * @since 1.0 - */ -public class StartVerificationResponseFlashCall extends StartVerificationResponse { - - private final String cliFilter; - private final Integer interceptionTimeOut; - private final Integer reportTimeout; - private final Integer denyCallAfter; - - private StartVerificationResponseFlashCall( - VerificationId id, - Collection links, - String cliFilter, - Integer interceptionTimeOut, - Integer reportTimeout, - Integer denyCallAfter) { - super(id, links); - this.cliFilter = cliFilter; - this.interceptionTimeOut = interceptionTimeOut; - this.reportTimeout = reportTimeout; - this.denyCallAfter = denyCallAfter; - } - - /** - * Filter that should be applied for incoming calls to intercept the Flashcall. - * - * @return Filter value - * @since 1.0 - */ - public String getCliFilter() { - return cliFilter; - } - - /** - * Amount of seconds client should wait for the Flashcall. - * - * @return time out value - * @since 1.0 - */ - public Integer getInterceptionTimeOut() { - return interceptionTimeOut; - } - - /** - * The time in seconds allowed for reporting the code after which the verification will expire. - * - * @return time out value - * @since 1.0 - */ - public Integer getReportTimeout() { - return reportTimeout; - } - - /** - * Used by the SDKs, this setting makes the handset deny the flashcall after the set time in - * seconds. - * - * @return Deny value - * @since 1.0 - */ - public Integer getDenyCallAfter() { - return denyCallAfter; - } - - @Override - public String toString() { - return "StartVerificationResponseFlashCall{" - + "cliFilter='" - + cliFilter - + '\'' - + ", interceptionTimeOut=" - + interceptionTimeOut - + ", reportTimeout=" - + reportTimeout - + ", denyCallAfter=" - + denyCallAfter - + "} " - + super.toString(); - } - - /** - * Getting Builder - * - * @return New Builder instance - * @since 1.0 - */ - public static Builder builder() { - return new Builder(); - } - - /** - * Dedicated Builder - * - * @since 1.0 - */ - public static class Builder extends StartVerificationResponse.Builder { - - String cliFilter; - Integer interceptionTimeOut; - Integer reportTimeout; - Integer denyCallAfter; - - private Builder() { - super(); - } - - /** - * See {@link StartVerificationResponseFlashCall#getCliFilter() getter} - * - * @param cliFilter see getter - * @return The current builder - * @since 1.0 - */ - public Builder setCliFilter(String cliFilter) { - this.cliFilter = cliFilter; - return self(); - } - - /** - * See {@link StartVerificationResponseFlashCall#getInterceptionTimeOut() getter} - * - * @param interceptionTimeOut see getter - * @return The current builder - * @since 1.0 - */ - public Builder setInterceptionTimeOut(Integer interceptionTimeOut) { - this.interceptionTimeOut = interceptionTimeOut; - return self(); - } - - /** - * See {@link StartVerificationResponseFlashCall#getReportTimeout() getter} - * - * @param reportTimeout see getter - * @return The current builder - * @since 1.0 - */ - public Builder setReportTimeout(Integer reportTimeout) { - this.reportTimeout = reportTimeout; - return self(); - } - - /** - * See {@link StartVerificationResponseFlashCall#getDenyCallAfter() getter} - * - * @param denyCallAfter see getter - * @return The current builder - * @since 1.0 - */ - public Builder setDenyCallAfter(Integer denyCallAfter) { - this.denyCallAfter = denyCallAfter; - return self(); - } - - /** - * Create instance - * - * @return The instance build with current builder values - * @since 1.0 - */ - public StartVerificationResponseFlashCall build() { - return new StartVerificationResponseFlashCall( - id, links, cliFilter, interceptionTimeOut, reportTimeout, denyCallAfter); - } - - @Override - protected Builder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/response/StartVerificationResponseSMS.java b/client/src/main/com/sinch/sdk/domains/verification/models/response/StartVerificationResponseSMS.java deleted file mode 100644 index 8dba1710b..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/response/StartVerificationResponseSMS.java +++ /dev/null @@ -1,123 +0,0 @@ -package com.sinch.sdk.domains.verification.models.response; - -import com.sinch.sdk.domains.verification.models.Link; -import com.sinch.sdk.domains.verification.models.VerificationId; -import com.sinch.sdk.domains.verification.models.requests.StartVerificationSMSRequestParameters; -import java.util.Collection; - -/** - * Dedicated response type for a SMS verification - * - *

Verification response when started using {@link - * com.sinch.sdk.domains.verification.VerificationsService#startSms(StartVerificationSMSRequestParameters)} - * - * @since 1.0 - */ -public class StartVerificationResponseSMS extends StartVerificationResponse { - - private final String template; - private final Integer interceptionTimeOut; - - private StartVerificationResponseSMS( - VerificationId id, Collection links, String template, Integer interceptionTimeOut) { - super(id, links); - this.template = template; - this.interceptionTimeOut = interceptionTimeOut; - } - - /** - * The expected template for the SMS response - * - * @return Template value - * @since 1.0 - */ - public String getTemplate() { - return template; - } - - /** - * The amount of time in seconds that the client should wait for the SMS. - * - * @return Timeout value - * @since 1.0 - */ - public Integer getInterceptionTimeOut() { - return interceptionTimeOut; - } - - @Override - public String toString() { - return "StartVerificationResponseSMS{" - + "template='" - + template - + '\'' - + ", interceptionTimeOut=" - + interceptionTimeOut - + "} " - + super.toString(); - } - - /** - * Getting Builder - * - * @return New Builder instance - * @since 1.0 - */ - public static Builder builder() { - return new Builder(); - } - - /** - * Dedicated Builder - * - * @since 1.0 - */ - public static class Builder extends StartVerificationResponse.Builder { - - String template; - Integer interceptionTimeOut; - - private Builder() { - super(); - } - - /** - * See {@link StartVerificationResponseSMS#getTemplate() getter} - * - * @param template see getter - * @return The current builder - * @since 1.0 - */ - public Builder setTemplate(String template) { - this.template = template; - return this; - } - - /** - * See {@link StartVerificationResponseSMS#getInterceptionTimeOut() getter} - * - * @param interceptionTimeOut see getter - * @return The current builder - * @since 1.0 - */ - public Builder setInterceptionTimeOut(Integer interceptionTimeOut) { - this.interceptionTimeOut = interceptionTimeOut; - return this; - } - - /** - * Create instance - * - * @return The instance build with current builder values - * @since 1.0 - */ - public StartVerificationResponseSMS build() { - return new StartVerificationResponseSMS(id, links, template, interceptionTimeOut); - } - - @Override - protected Builder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/response/StartVerificationResponseSeamless.java b/client/src/main/com/sinch/sdk/domains/verification/models/response/StartVerificationResponseSeamless.java deleted file mode 100644 index d2dce9ef5..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/response/StartVerificationResponseSeamless.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.sinch.sdk.domains.verification.models.response; - -import com.sinch.sdk.domains.verification.models.Link; -import com.sinch.sdk.domains.verification.models.VerificationId; -import com.sinch.sdk.domains.verification.models.requests.StartVerificationSeamlessRequestParameters; -import java.util.Collection; - -/** - * Dedicated response type for a seamless call verification - * - *

Verification response when started using with {@link - * com.sinch.sdk.domains.verification.VerificationsService#startSeamless(StartVerificationSeamlessRequestParameters)} - * - * @since 1.0 - */ -public class StartVerificationResponseSeamless extends StartVerificationResponse { - - private final String targetUri; - - private StartVerificationResponseSeamless( - VerificationId id, Collection links, String targetUri) { - super(id, links); - this.targetUri = targetUri; - } - - /** - * The target URI - * - * @return The target URI - * @since 1.0 - */ - public String getTargetUri() { - return targetUri; - } - - @Override - public String toString() { - return "StartVerificationResponseSeamless{" - + "targetUri='" - + targetUri - + '\'' - + "} " - + super.toString(); - } - - /** - * Getting Builder - * - * @return New Builder instance - * @since 1.0 - */ - public static Builder builder() { - return new Builder(); - } - - /** - * Dedicated Builder - * - * @since 1.0 - */ - public static class Builder extends StartVerificationResponse.Builder { - - String targetUri; - - private Builder() { - super(); - } - - /** - * See {@link StartVerificationResponseSeamless#getLinks() getter} - * - * @param targetUri see getter - * @return The current builder - * @since 1.0 - */ - public Builder setTargetUri(String targetUri) { - this.targetUri = targetUri; - return this; - } - - /** - * Create instance - * - * @return The instance build with current builder values - * @since 1.0 - */ - public StartVerificationResponseSeamless build() { - return new StartVerificationResponseSeamless(id, links, targetUri); - } - - @Override - protected Builder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/response/package-info.java b/client/src/main/com/sinch/sdk/domains/verification/models/response/package-info.java deleted file mode 100644 index 7b16cb3f0..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/response/package-info.java +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Verification API responses related models - * - * @since 1.0 - */ -package com.sinch.sdk.domains.verification.models.response; diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/webhooks/VerificationEvent.java b/client/src/main/com/sinch/sdk/domains/verification/models/webhooks/VerificationEvent.java deleted file mode 100644 index 63facc25f..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/webhooks/VerificationEvent.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.sinch.sdk.domains.verification.models.webhooks; - -import com.sinch.sdk.domains.verification.models.Identity; -import com.sinch.sdk.domains.verification.models.NumberIdentity; -import com.sinch.sdk.domains.verification.models.VerificationId; -import com.sinch.sdk.domains.verification.models.VerificationMethodType; -import com.sinch.sdk.domains.verification.models.VerificationReference; -import java.util.Optional; - -/** - * Base class for received Verification Events onto webhooks callback - * - * @see https://developers.sinch.com/docs/verification/api-reference/verification/tag/Verification-callbacks - */ -public class VerificationEvent { - private final VerificationId id; - private final VerificationMethodType method; - private final Identity identity; - private final VerificationReference reference; - private final String custom; - - public VerificationEvent( - String id, - VerificationMethodType method, - Identity identity, - VerificationReference reference, - String custom) { - this.id = VerificationId.valueOf(id); - this.method = method; - this.identity = identity; - this.reference = reference; - this.custom = custom; - } - - /** - * The ID of the verification request. - * - * @return Id value - * @since 1.0 - */ - public VerificationId getId() { - return id; - } - - /** - * The verification method - * - * @return The method value - * @since 1.0 - */ - public VerificationMethodType getMethod() { - return method; - } - - /** - * Specifies the type of endpoint that will be verified and the particular endpoint. {@link - * NumberIdentity} is currently the only supported endpoint type - * - * @return identity - * @since 1.0 - */ - public Identity getIdentity() { - return identity; - } - - /** - * The reference that was optionally passed together with the verification request - * - * @return Reference value - * @since 1.0 - */ - public Optional getReference() { - return Optional.ofNullable(reference); - } - - /** - * A custom string that can be provided during a verification request - * - * @return The custom value - * @since 1.0 - */ - public Optional getCustom() { - return Optional.ofNullable(custom); - } - - @Override - public String toString() { - return "VerificationEvent{" - + "id=" - + id - + ", method=" - + method - + ", identity=" - + identity - + ", reference=" - + reference - + ", custom='" - + custom - + '\'' - + '}'; - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/webhooks/VerificationRequestEvent.java b/client/src/main/com/sinch/sdk/domains/verification/models/webhooks/VerificationRequestEvent.java deleted file mode 100644 index 0b31f3c53..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/webhooks/VerificationRequestEvent.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.sinch.sdk.domains.verification.models.webhooks; - -import com.sinch.sdk.domains.verification.models.Identity; -import com.sinch.sdk.domains.verification.models.Price; -import com.sinch.sdk.domains.verification.models.VerificationMethodType; -import com.sinch.sdk.domains.verification.models.VerificationReference; -import java.util.Collection; -import java.util.Optional; - -/** - * Event received onto verification request - * - *

This event is received onto a POST request to the specified verification callback URL and is - * triggered when a new verification request is made from the SDK client or the Verification Request - * API. This callback event is only triggered when a verification callback URL is specified in your - * dashboard. - */ -public class VerificationRequestEvent extends VerificationEvent { - - private final Price price; - private final Collection acceptLanguage; - - public VerificationRequestEvent( - String id, - VerificationMethodType method, - Identity identity, - Price price, - VerificationReference reference, - String custom, - @Deprecated Collection acceptLanguage) { - super(id, method, identity, reference, custom); - this.price = price; - this.acceptLanguage = acceptLanguage; - } - - /** - * The amount of money and currency of the verification request - * - * @return Price value - * @since 1.0 - */ - public Optional getPrice() { - return Optional.ofNullable(price); - } - - /** - * Allows you to set or override if provided in the API request, the SMS verification content - * language. Only used with the SMS verification method. The content language specified in the API - * request or in the callback can be overridden by carrier provider specific templates, due to - * compliance and legal requirements, such as US shortcode requirements see https://developers.sinch.com/docs/verification/api-reference/verification/tag/Verification-callbacks/#tag/Verification-callbacks/paths/VerificationRequestEvent/post - * - * @return Values collection list - * @since 1.0 - * @deprecated - */ - @Deprecated - public Optional> getAcceptLanguage() { - return Optional.ofNullable(acceptLanguage); - } - - @Override - public String toString() { - return "VerificationRequestEvent{" - + "price=" - + price - + ", acceptLanguage=" - + acceptLanguage - + "} " - + super.toString(); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/webhooks/VerificationResponse.java b/client/src/main/com/sinch/sdk/domains/verification/models/webhooks/VerificationResponse.java deleted file mode 100644 index 7c97d19e1..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/webhooks/VerificationResponse.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.sinch.sdk.domains.verification.models.webhooks; - -/** - * Base class for verification callback response - * - * @since 1.0 - */ -public class VerificationResponse { - - private final VerificationResponseActionType action; - - VerificationResponse(VerificationResponseActionType action) { - this.action = action; - } - - /** - * Determines whether the verification can be executed - * - * @return action type to be performed - * @since 1.0 - */ - public VerificationResponseActionType getAction() { - return action; - } - - @Override - public String toString() { - return "VerificationResponseActionType{" + "action=" + action + '}'; - } - - /** - * Getting Builder - * - * @return New Builder instance - * @since 1.0 - */ - public static Builder builder() { - return new Builder<>(); - } - - /** - * Dedicated Builder - * - * @param Builder - * @since 1.0 - */ - public static class Builder> { - - VerificationResponseActionType action; - - protected Builder() { - super(); - } - - /** - * See {@link VerificationResponse#getAction() getter} - * - * @param action see getter - * @return The current builder - * @since 1.0 - */ - public B setAction(VerificationResponseActionType action) { - this.action = action; - return self(); - } - - /** - * Create instance - * - * @return The instance build with current builder values - * @since 1.0 - */ - public VerificationResponse build() { - return new VerificationResponse(action); - } - - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/webhooks/VerificationResponseActionType.java b/client/src/main/com/sinch/sdk/domains/verification/models/webhooks/VerificationResponseActionType.java deleted file mode 100644 index bc3f2fd0e..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/webhooks/VerificationResponseActionType.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.sinch.sdk.domains.verification.models.webhooks; - -import com.fasterxml.jackson.annotation.JsonValue; -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. See action - * type response documentation - * - * @since 1.0 - */ -public class VerificationResponseActionType - extends EnumDynamic { - - /** Action is allowed */ - public static final VerificationResponseActionType ALLOW = - new VerificationResponseActionType("allow"); - - /** Action is denied */ - public static final VerificationResponseActionType DENY = - new VerificationResponseActionType("deny"); - - /** */ - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - VerificationResponseActionType.class, - VerificationResponseActionType::new, - Arrays.asList(ALLOW, DENY)); - - private VerificationResponseActionType(String value) { - super(value); - } - - /** - * Get declared values - * - * @return Stream of values - */ - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - /** - * Get value from a string - * - * @param value String identifier - * @return Dynamic enum from value. A new enum is created if value is not yet registered - */ - public static VerificationResponseActionType from(String value) { - return ENUM_SUPPORT.from(value); - } - - /** - * Value of the enum as String - * - * @param e The enum identifier - * @return String identifier of the enum value - */ - public static String valueOf(VerificationResponseActionType e) { - return ENUM_SUPPORT.valueOf(e); - } - - /** - * Value of the enum as String - * - * @return String identifier of the enum value # @since 1.0 - */ - @JsonValue - public String getValue() { - return this.value(); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/webhooks/VerificationResponseCallout.java b/client/src/main/com/sinch/sdk/domains/verification/models/webhooks/VerificationResponseCallout.java deleted file mode 100644 index 0614f05a4..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/webhooks/VerificationResponseCallout.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.sinch.sdk.domains.verification.models.webhooks; - -/** Verification response related to a call out */ -public class VerificationResponseCallout extends VerificationResponse { - - private final String code; - private final VerificationResponseCalloutSpeech speech; - - /** - * @param action Determines whether the verification can be executed. - * @param code see {@link #getCode() getter} - * @param speech see {@link #getSpeech() getter} - */ - VerificationResponseCallout( - VerificationResponseActionType action, - String code, - VerificationResponseCalloutSpeech speech) { - super(action); - this.code = code; - this.speech = speech; - } - - /** - * The Phone Call PIN that should be entered by the user. Sinch servers automatically generate PIN - * codes for Phone Call verification. If you want to set your own code, you can specify it in the - * response to the Verification Request Event. - * - * @return The code value - * @since 1.0 - */ - public String getCode() { - return code; - } - - /** - * Speech related information - * - * @return Speech information - * @since 1.0 - */ - public VerificationResponseCalloutSpeech getSpeech() { - return speech; - } - - @Override - public String toString() { - return "VerificationResponseCallout{" - + "code='" - + code - + '\'' - + ", speech=" - + speech - + "} " - + super.toString(); - } - - /** - * Getting Builder - * - * @return New Builder instance - * @since 1.0 - */ - public static Builder builder() { - return new Builder(); - } - - /** - * Dedicated Builder - * - * @since 1.0 - */ - public static class Builder extends VerificationResponse.Builder { - - String code; - - VerificationResponseCalloutSpeech speech; - - private Builder() {} - - /** - * See {@link VerificationResponseCallout#getCode()} - * - * @param code {@link VerificationResponseCallout#getCode()} - * @return The current builder - * @since 1.0 - */ - public Builder setCode(String code) { - this.code = code; - return self(); - } - - /** - * See {@link VerificationResponseCallout#getSpeech()} - * - * @param speech {@link VerificationResponseCallout#getSpeech()} - * @return The current builder - * @since 1.0 - */ - public Builder setSpeech(VerificationResponseCalloutSpeech speech) { - this.speech = speech; - return self(); - } - - /** - * Create instance - * - * @return The instance build with current builder values - * @since 1.0 - */ - public VerificationResponseCallout build() { - return new VerificationResponseCallout(action, code, speech); - } - - @Override - protected Builder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/webhooks/VerificationResponseCalloutSpeech.java b/client/src/main/com/sinch/sdk/domains/verification/models/webhooks/VerificationResponseCalloutSpeech.java deleted file mode 100644 index e10ceed28..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/webhooks/VerificationResponseCalloutSpeech.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.sinch.sdk.domains.verification.models.webhooks; - -/** Verification response details related to call out speech */ -public class VerificationResponseCalloutSpeech { - - private final String locale; - - /** - * Indicates the language that should be used for the text-to-speech message. Currently, only - * en-US is supported. - * - * @param locale Locale value - */ - VerificationResponseCalloutSpeech(String locale) { - this.locale = locale; - } - - /** - * Indicates the language that should be used for the text-to-speech message. Currently, only - * en-US is supported. - * - * @return locale value - * @since 1.1 - */ - public String getLocale() { - return locale; - } - - @Override - public String toString() { - return "VerificationResponseCalloutSpeech{" + "locale='" + locale + '\'' + '}'; - } - - /** - * Getting Builder - * - * @return New Builder instance - * @since 1.1 - */ - public static Builder builder() { - return new Builder(); - } - - /** - * Dedicated Builder - * - * @since 1.1 - */ - public static class Builder { - - String locale; - - private Builder() {} - - /** - * See {@link VerificationResponseCalloutSpeech#VerificationResponseCalloutSpeech(String) - * constructor} - * - * @param locale see constructor - * @return The current builder - * @since 1.1 - */ - public Builder setLocale(String locale) { - this.locale = locale; - return this; - } - - /** - * Create instance - * - * @return The instance build with current builder values - * @since 1.1 - */ - public VerificationResponseCalloutSpeech build() { - return new VerificationResponseCalloutSpeech(locale); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/webhooks/VerificationResponseFlashCall.java b/client/src/main/com/sinch/sdk/domains/verification/models/webhooks/VerificationResponseFlashCall.java deleted file mode 100644 index 44791040a..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/webhooks/VerificationResponseFlashCall.java +++ /dev/null @@ -1,125 +0,0 @@ -package com.sinch.sdk.domains.verification.models.webhooks; - -/** Verification response related to a flash call */ -public class VerificationResponseFlashCall extends VerificationResponse { - - private final String cli; - - private final Integer dialTimeout; - - /** - * Flash call response related information - * - * @param action Determines whether the verification can be executed. - * @param cli see {@link #getCli() getter} - * @param dialTimeout see {@link #getDialTimeout() getter} - */ - public VerificationResponseFlashCall( - VerificationResponseActionType action, String cli, Integer dialTimeout) { - super(action); - this.cli = cli; - this.dialTimeout = dialTimeout; - } - - /** - * The phone number that will be displayed to the user when the flashcall is received on the - * user's phone. By default, the Sinch dashboard will randomly select the CLI that will be - * displayed during a flashcall from a pool of numbers. If you want to set your own CLI, you can - * specify it in the response to the Verification Request Event. - * - * @return CLI value - * @since 1.0 - */ - public String getCli() { - return cli; - } - - /** - * The maximum time that a flashcall verification will be active and can be completed. If the - * phone number hasn't been verified successfully during this time, then the verification request - * will fail. By default, the Sinch dashboard will automatically optimize dial time out during a - * flashcall. If you want to set your own dial time out for the flashcall, you can specify it in - * the response to the Verification Request Event. - * - * @return The dial timeout value - * @since 1.0 - */ - public Integer getDialTimeout() { - return dialTimeout; - } - - @Override - public String toString() { - return "VerificationResponseFlashCall{" - + "cli='" - + cli - + '\'' - + ", dialTimeout=" - + dialTimeout - + "} " - + super.toString(); - } - - /** - * Getting Builder - * - * @return New Builder instance - * @since 1.0 - */ - public static Builder builder() { - return new Builder(); - } - - /** - * Dedicated Builder - * - * @since 1.0 - */ - public static class Builder extends VerificationResponse.Builder { - - String cli; - - Integer dialTimeout; - - private Builder() {} - - /** - * See {@link VerificationResponseFlashCall#getCli()} - * - * @param cli See {@link VerificationResponseFlashCall#getCli()} - * @return The current builder - * @since 1.0 - */ - public Builder setCli(String cli) { - this.cli = cli; - return self(); - } - - /** - * See {@link VerificationResponseFlashCall#getDialTimeout()} - * - * @param dialTimeout See {@link VerificationResponseFlashCall#getDialTimeout()} - * @return The current builder - * @since 1.0 - */ - public Builder setDialTimeout(Integer dialTimeout) { - this.dialTimeout = dialTimeout; - return self(); - } - - /** - * Create instance - * - * @return The instance build with current builder values - * @since 1.0 - */ - public VerificationResponseFlashCall build() { - return new VerificationResponseFlashCall(action, cli, dialTimeout); - } - - @Override - protected Builder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/webhooks/VerificationResponseSMS.java b/client/src/main/com/sinch/sdk/domains/verification/models/webhooks/VerificationResponseSMS.java deleted file mode 100644 index 5906227c8..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/webhooks/VerificationResponseSMS.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.sinch.sdk.domains.verification.models.webhooks; - -import java.util.Collection; - -/** Verification response related to a SMS */ -public class VerificationResponseSMS extends VerificationResponse { - - private final String code; - - private final Collection acceptLanguage; - - /** - * SMS response related information - * - * @param action Determines whether the verification can be executed. - * @param code see {@link #getCode() getter} - * @param acceptLanguage see {@link #getAcceptLanguage() getter} - */ - public VerificationResponseSMS( - VerificationResponseActionType action, String code, Collection acceptLanguage) { - super(action); - this.code = code; - this.acceptLanguage = acceptLanguage; - } - - /** - * The SMS PIN that should be used. By default, the Sinch dashboard will automatically generate - * PIN codes for SMS verification. If you want to set your own PIN, you can specify it in the - * response to the Verification Request Event. - * - * @return Code value - */ - public String getCode() { - return code; - } - - /** - * The SMS verification content languages. Set in the verification request. - * - * @return Accepted languages list - */ - public Collection getAcceptLanguage() { - return acceptLanguage; - } - - @Override - public String toString() { - return "VerificationResponseSMS{" - + "code='" - + code - + '\'' - + ", acceptLanguage=" - + acceptLanguage - + "} " - + super.toString(); - } - - /** - * Getting Builder - * - * @return New Builder instance - * @since 1.0 - */ - public static Builder builder() { - return new Builder(); - } - - /** - * Dedicated Builder - * - * @since 1.0 - */ - public static class Builder extends VerificationResponse.Builder { - - String code; - Collection acceptLanguage; - - private Builder() {} - - /** - * See {@link VerificationResponseSMS#getCode()} - * - * @param code See {@link VerificationResponseSMS#getCode()} - * @return The current builder - * @since 1.0 - */ - public Builder setCode(String code) { - this.code = code; - return self(); - } - - /** - * See {@link VerificationResponseSMS#getAcceptLanguage()} - * - * @param acceptLanguage See {@link VerificationResponseSMS#getAcceptLanguage()} - * @return The current builder - * @since 1.0 - */ - public Builder setAcceptLanguage(Collection acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return self(); - } - - /** - * Create instance - * - * @return The instance build with current builder values - * @since 1.0 - */ - public VerificationResponseSMS build() { - return new VerificationResponseSMS(action, code, acceptLanguage); - } - - @Override - protected Builder self() { - return this; - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/webhooks/VerificationResultEvent.java b/client/src/main/com/sinch/sdk/domains/verification/models/webhooks/VerificationResultEvent.java deleted file mode 100644 index 7342fb425..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/webhooks/VerificationResultEvent.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.sinch.sdk.domains.verification.models.webhooks; - -import com.sinch.sdk.domains.verification.models.Identity; -import com.sinch.sdk.domains.verification.models.VerificationMethodType; -import com.sinch.sdk.domains.verification.models.VerificationReference; -import com.sinch.sdk.domains.verification.models.VerificationSourceType; -import com.sinch.sdk.domains.verification.models.VerificationStatusReasonType; -import com.sinch.sdk.domains.verification.models.VerificationStatusType; -import java.util.Optional; - -/** - * Event received when a verification has been completed - * - *

This event is received onto a POST request to the specified verification callback URL and - * triggered when a verification has been completed and the result is known. It's used to report the - * verification result to the developer's backend application. This callback event is only triggered - * when the verification callback URL is specified in your dashboard. - */ -public class VerificationResultEvent extends VerificationEvent { - - private final VerificationStatusType status; - private final VerificationStatusReasonType reason; - private final VerificationSourceType source; - - public VerificationResultEvent( - String id, - VerificationMethodType method, - Identity identity, - VerificationReference reference, - String custom, - VerificationStatusType status, - VerificationStatusReasonType reason, - VerificationSourceType source) { - super(id, method, identity, reference, custom); - - this.status = status; - this.reason = reason; - this.source = source; - } - - /** - * The status of the verification request - * - * @return Status value - * @since 1.0 - */ - public VerificationStatusType getStatus() { - return status; - } - - /** - * Displays the reason why a verification has FAILED, was DENIED, or was ABORTED - * - * @return reason value - * @since 1.0 - */ - public Optional getReason() { - return Optional.ofNullable(reason); - } - - /** - * Used to show if the call/SMS was intercepted or not - * - * @return Type value - * @since 1.0 - */ - public Optional getSource() { - return Optional.ofNullable(source); - } - - @Override - public String toString() { - return "VerificationResultEvent{" - + "status=" - + status - + ", reason=" - + reason - + ", source='" - + source - + '\'' - + "} " - + super.toString(); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/verification/models/webhooks/package-info.java b/client/src/main/com/sinch/sdk/domains/verification/models/webhooks/package-info.java deleted file mode 100644 index 6cc0c7fbb..000000000 --- a/client/src/main/com/sinch/sdk/domains/verification/models/webhooks/package-info.java +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Verification API webhooks (callback) related models - * - * @since 1.0 - */ -package com.sinch.sdk.domains.verification.models.webhooks; diff --git a/client/src/test/java/com/sinch/sdk/domains/verification/adapters/VerificationServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/verification/adapters/VerificationServiceTest.java deleted file mode 100644 index 8b0ca87d8..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/verification/adapters/VerificationServiceTest.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.sinch.sdk.domains.verification.adapters; - - /* Un-versioned Verification service is based onto the versioned 'v1' one: so tests are covered - by v1 */ diff --git a/client/src/test/java/com/sinch/sdk/domains/verification/adapters/VerificationStatusServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/verification/adapters/VerificationStatusServiceTest.java deleted file mode 100644 index d9cea6442..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/verification/adapters/VerificationStatusServiceTest.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.sinch.sdk.domains.verification.adapters; - -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - -import com.adelean.inject.resources.junit.jupiter.TestWithResources; -import com.sinch.sdk.BaseTest; -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.domains.verification.adapters.converters.VerificationsDtoConverterTest; -import com.sinch.sdk.domains.verification.models.NumberIdentity; -import com.sinch.sdk.domains.verification.models.VerificationId; -import com.sinch.sdk.domains.verification.models.VerificationMethodType; -import com.sinch.sdk.domains.verification.models.VerificationReference; -import com.sinch.sdk.domains.verification.models.VerificationStatus; -import com.sinch.sdk.domains.verification.models.dto.v1.status.VerificationStatusResponseTest; -import com.sinch.sdk.domains.verification.models.v1.VerificationMethod; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.mockito.Mock; - -@TestWithResources -public class VerificationStatusServiceTest extends BaseTest { - - @Mock com.sinch.sdk.domains.verification.api.v1.VerificationStatusService v1; - - VerificationStatusService service; - - @BeforeEach - public void initMocks() { - service = spy(new VerificationStatusService(v1)); - } - - @Test - void getByIdentity() throws ApiException { - - when(v1.getByIdentity( - eq( - com.sinch.sdk.domains.verification.models.v1.NumberIdentity.valueOf( - "endpoint string")), - eq(VerificationMethod.SMS))) - .thenReturn( - VerificationStatusResponseTest.expectedVerificationSmsDto - .getVerificationStatusResponseSmsImpl()); - - VerificationStatus response = - service.getByIdentity( - NumberIdentity.builder().setEndpoint("endpoint string").build(), - VerificationMethodType.SMS); - - TestHelpers.recursiveEquals( - response, VerificationsDtoConverterTest.expectedVerificationStatusSmsResponse); - } - - @Test - void getById() throws ApiException { - - when(v1.getById(eq("the id"))) - .thenReturn( - VerificationStatusResponseTest.expectedVerificationPhoneCallDto - .getVerificationStatusResponsePhoneCallImpl()); - - VerificationStatus response = service.getById(VerificationId.valueOf("the id")); - - TestHelpers.recursiveEquals( - response, VerificationsDtoConverterTest.expectedVerificationStatusPhoneCallResponse); - } - - @Test - void getByReference() throws ApiException { - - when(v1.getByReference(eq("the reference"))) - .thenReturn( - VerificationStatusResponseTest.expectedVerificationFlashCallDto - .getVerificationStatusResponseFlashCallImpl()); - - VerificationStatus response = - service.getByReference(VerificationReference.valueOf("the reference")); - - TestHelpers.recursiveEquals( - response, VerificationsDtoConverterTest.expectedVerificationStatusFlashCallResponse); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/verification/adapters/VerificationsReportServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/verification/adapters/VerificationsReportServiceTest.java deleted file mode 100644 index a808f27ea..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/verification/adapters/VerificationsReportServiceTest.java +++ /dev/null @@ -1,162 +0,0 @@ -package com.sinch.sdk.domains.verification.adapters; - -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - -import com.adelean.inject.resources.junit.jupiter.GivenJsonResource; -import com.adelean.inject.resources.junit.jupiter.TestWithResources; -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.domains.verification.adapters.converters.VerificationsDtoConverterTest; -import com.sinch.sdk.domains.verification.models.NumberIdentity; -import com.sinch.sdk.domains.verification.models.VerificationId; -import com.sinch.sdk.domains.verification.models.VerificationReportCallout; -import com.sinch.sdk.domains.verification.models.VerificationReportFlashCall; -import com.sinch.sdk.domains.verification.models.VerificationReportSMS; -import com.sinch.sdk.domains.verification.models.dto.v1.report.VerificationReportResponseDtoTest; -import com.sinch.sdk.domains.verification.models.v1.report.request.internal.VerificationReportRequestInternalImpl; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.mockito.Mock; - -@TestWithResources -public class VerificationsReportServiceTest extends VerificationBaseTest { - - @GivenJsonResource("/domains/verification/v1/report/VerificationReportRequestPhoneCallDto.json") - public VerificationReportRequestInternalImpl verificationReportPhoneCallRequestDto; - - @GivenJsonResource("/domains/verification/v1/report/VerificationReportRequestFlashCallDto.json") - public VerificationReportRequestInternalImpl verificationReportFlashCallRequestDto; - - @GivenJsonResource("/domains/verification/v1/report/VerificationReportRequestSmsDto.json") - public VerificationReportRequestInternalImpl verificationReportSmsRequestDto; - - @Mock com.sinch.sdk.domains.verification.api.v1.VerificationReportService v1; - VerificationsReportService service; - - @BeforeEach - public void initMocks() { - service = spy(new VerificationsReportService(v1)); - } - - @Test - void reportSmsByIdentity() throws ApiException { - - when(v1.reportSmsByIdentity( - eq( - com.sinch.sdk.domains.verification.models.v1.NumberIdentity.valueOf( - "endpoint string")), - eq(verificationReportSmsRequestDto.getVerificationReportRequestSmsImpl()))) - .thenReturn( - VerificationReportResponseDtoTest.verificationReportSmsDto - .getVerificationReportResponseSmsImpl()); - - VerificationReportSMS response = - service.reportSmsByIdentity( - NumberIdentity.builder().setEndpoint("endpoint string").build(), - VerificationsDtoConverterTest.verificationReportSmsRequest); - - TestHelpers.recursiveEquals( - response, VerificationsDtoConverterTest.expectedVerificationReportSmsResponse); - } - - @Test - void reportFlashCallByIdentity() throws ApiException { - - when(v1.reportFlashCallByIdentity( - eq( - com.sinch.sdk.domains.verification.models.v1.NumberIdentity.valueOf( - "endpoint string")), - eq(verificationReportFlashCallRequestDto.getVerificationReportRequestFlashCallImpl()))) - .thenReturn( - VerificationReportResponseDtoTest.verificationReportFlashCallDto - .getVerificationReportResponseFlashCallImpl()); - - VerificationReportFlashCall response = - service.reportFlashCallByIdentity( - NumberIdentity.builder().setEndpoint("endpoint string").build(), - VerificationsDtoConverterTest.verificationReportFlashCallRequest); - - TestHelpers.recursiveEquals( - response, VerificationsDtoConverterTest.expectedVerificationReportFlashCallResponse); - } - - @Test - void reportPhoneCallByIdentity() throws ApiException { - - when(v1.reportPhoneCallByIdentity( - eq( - com.sinch.sdk.domains.verification.models.v1.NumberIdentity.valueOf( - "endpoint string")), - eq(verificationReportPhoneCallRequestDto.getVerificationReportRequestPhoneCallImpl()))) - .thenReturn( - VerificationReportResponseDtoTest.verificationReportPhoneCallDto - .getVerificationReportResponsePhoneCallImpl()); - - VerificationReportCallout response = - service.reportCalloutByIdentity( - NumberIdentity.builder().setEndpoint("endpoint string").build(), - VerificationsDtoConverterTest.verificationReportPhoneCallRequest); - - TestHelpers.recursiveEquals( - response, VerificationsDtoConverterTest.expectedVerificationReportPhoneCallResponse); - } - - @Test - void reportSmsById() throws ApiException { - - when(v1.reportSmsById( - eq("the id"), - eq(verificationReportSmsRequestDto.getVerificationReportRequestSmsImpl()))) - .thenReturn( - VerificationReportResponseDtoTest.verificationReportSmsDto - .getVerificationReportResponseSmsImpl()); - - VerificationReportSMS response = - service.reportSmsById( - VerificationId.valueOf("the id"), - VerificationsDtoConverterTest.verificationReportSmsRequest); - - TestHelpers.recursiveEquals( - response, VerificationsDtoConverterTest.expectedVerificationReportSmsResponse); - } - - @Test - void reportFlashCallById() throws ApiException { - - when(v1.reportFlashCallById( - eq("the id"), - eq(verificationReportFlashCallRequestDto.getVerificationReportRequestFlashCallImpl()))) - .thenReturn( - VerificationReportResponseDtoTest.verificationReportFlashCallDto - .getVerificationReportResponseFlashCallImpl()); - - VerificationReportFlashCall response = - service.reportFlashCallById( - VerificationId.valueOf("the id"), - VerificationsDtoConverterTest.verificationReportFlashCallRequest); - - TestHelpers.recursiveEquals( - response, VerificationsDtoConverterTest.expectedVerificationReportFlashCallResponse); - } - - @Test - void reportPhoneCallById() throws ApiException { - - when(v1.reportPhoneCallById( - eq("the id"), - eq(verificationReportPhoneCallRequestDto.getVerificationReportRequestPhoneCallImpl()))) - .thenReturn( - VerificationReportResponseDtoTest.verificationReportPhoneCallDto - .getVerificationReportResponsePhoneCallImpl()); - - VerificationReportCallout response = - service.reportCalloutById( - VerificationId.valueOf("the id"), - VerificationsDtoConverterTest.verificationReportPhoneCallRequest); - - TestHelpers.recursiveEquals( - response, VerificationsDtoConverterTest.expectedVerificationReportPhoneCallResponse); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/verification/adapters/VerificationsStartServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/verification/adapters/VerificationsStartServiceTest.java deleted file mode 100644 index 2a2499cdc..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/verification/adapters/VerificationsStartServiceTest.java +++ /dev/null @@ -1,111 +0,0 @@ -package com.sinch.sdk.domains.verification.adapters; - -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - -import com.adelean.inject.resources.junit.jupiter.GivenJsonResource; -import com.adelean.inject.resources.junit.jupiter.TestWithResources; -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.domains.verification.adapters.converters.VerificationsDtoConverterTest; -import com.sinch.sdk.domains.verification.models.dto.v1.start.response.VerificationStartResponseTest; -import com.sinch.sdk.domains.verification.models.response.StartVerificationResponseCallout; -import com.sinch.sdk.domains.verification.models.response.StartVerificationResponseFlashCall; -import com.sinch.sdk.domains.verification.models.response.StartVerificationResponseSMS; -import com.sinch.sdk.domains.verification.models.response.StartVerificationResponseSeamless; -import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestSms; -import com.sinch.sdk.domains.verification.models.v1.start.request.internal.VerificationStartRequestInternalImpl; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.mockito.Mock; - -@TestWithResources -public class VerificationsStartServiceTest extends VerificationBaseTest { - - @GivenJsonResource( - "/domains/verification/v1/start/request/VerificationStartRequestPhoneCallDto.json") - public VerificationStartRequestInternalImpl startVerificationPhoneCallRequestDto; - - @GivenJsonResource( - "/domains/verification/v1/start/request/VerificationStartRequestFlashCallDto.json") - public VerificationStartRequestInternalImpl startVerificationFlashCallRequestDto; - - @GivenJsonResource("/domains/verification/v1/start/request/VerificationStartRequestDataDto.json") - public VerificationStartRequestInternalImpl startVerificationDataRequestDto; - - @GivenJsonResource("/domains/verification/v1/start/request/VerificationStartRequestSmsDto.json") - public VerificationStartRequestInternalImpl startVerificationSmsRequestDto; - - @Mock com.sinch.sdk.domains.verification.api.v1.VerificationStartService v1; - - VerificationsStartService service; - - @BeforeEach - public void initMocks() { - service = spy(new VerificationsStartService(v1)); - } - - @Test - void startSms() throws ApiException { - - when(v1.startSms(any(VerificationStartRequestSms.class))) - .thenReturn( - VerificationStartResponseTest.expectedStartVerificationSmsDto - .getVerificationStartResponseSmsImpl()); - - StartVerificationResponseSMS response = - service.startSms(VerificationsDtoConverterTest.startVerificationSmsRequest); - - TestHelpers.recursiveEquals( - response, VerificationsDtoConverterTest.expectedStartVerificationSmsResponse); - } - - @Test - void startFlashCall() throws ApiException { - - when(v1.startFlashCall( - eq(startVerificationFlashCallRequestDto.getVerificationStartRequestFlashCallImpl()))) - .thenReturn( - VerificationStartResponseTest.expectedStartVerificationFlashCallDto - .getVerificationStartResponseFlashCallImpl()); - - StartVerificationResponseFlashCall response = - service.startFlashCall(VerificationsDtoConverterTest.startVerificationFlashCallRequest); - - TestHelpers.recursiveEquals( - response, VerificationsDtoConverterTest.expectedStartVerificationFlashCallResponse); - } - - @Test - void startPhoneCall() throws ApiException { - - when(v1.startPhoneCall( - eq(startVerificationPhoneCallRequestDto.getVerificationStartRequestPhoneCallImpl()))) - .thenReturn( - VerificationStartResponseTest.expectedStartVerificationPhoneCallDto - .getVerificationStartResponsePhoneCallImpl()); - - StartVerificationResponseCallout response = - service.startCallout(VerificationsDtoConverterTest.startVerificationPhoneCallRequest); - - TestHelpers.recursiveEquals( - response, VerificationsDtoConverterTest.expectedStartVerificationPhoneCallResponse); - } - - @Test - void startData() throws ApiException { - - when(v1.startData(eq(startVerificationDataRequestDto.getVerificationStartRequestDataImpl()))) - .thenReturn( - VerificationStartResponseTest.expectedStartVerificationDataDto - .getVerificationStartResponseDataImpl()); - - StartVerificationResponseSeamless response = - service.startSeamless(VerificationsDtoConverterTest.startVerificationDataRequest); - - TestHelpers.recursiveEquals( - response, VerificationsDtoConverterTest.expectedStartVerificationDataResponse); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/verification/adapters/WebhooksServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/verification/adapters/WebhooksServiceTest.java deleted file mode 100644 index efc1fa3b2..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/verification/adapters/WebhooksServiceTest.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.sinch.sdk.domains.verification.adapters; - -import com.adelean.inject.resources.junit.jupiter.GivenTextResource; -import com.adelean.inject.resources.junit.jupiter.TestWithResources; -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.domains.verification.WebHooksService; -import com.sinch.sdk.domains.verification.adapters.converters.WebhooksDtoConverterTest; -import com.sinch.sdk.models.ApplicationCredentials; -import com.sinch.sdk.models.VerificationContext; -import java.io.IOException; -import java.util.AbstractMap; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.assertj.core.api.Assertions; -import org.json.JSONException; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.skyscreamer.jsonassert.JSONAssert; - -@TestWithResources -public class WebhooksServiceTest 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") - static String jsonVerificationRequestEventDto; - - @GivenTextResource("/domains/verification/v1/webhooks/VerificationResultEventDto.json") - static String jsonVerificationResultEventDto; - - @GivenTextResource("/domains/verification/v1/webhooks/VerificationResponsePhoneCall.json") - String jsonResponsePhoneCall; - - @GivenTextResource("/domains/verification/v1/webhooks/VerificationResponseFlashCall.json") - String jsonResponseFlashCall; - - @GivenTextResource("/domains/verification/v1/webhooks/VerificationResponseSms.json") - String jsonResponseSms; - - WebHooksService webHooksService; - - @Test - void checkApplicationAuthentication() throws ApiException { - - Map headers = - Stream.of( - new AbstractMap.SimpleEntry<>( - "authorization", - "application 789:xfKhO0XvlRNJraahUBEJzzi1f3Fn3pYO41/ZzwOHPaQ="), - new AbstractMap.SimpleEntry<>("content-type", "application/json; charset=utf-8"), - new AbstractMap.SimpleEntry<>("x-timestamp", "2023-12-01T15:01:20.0406449Z")) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); - - boolean authenticationResult = - webHooksService.validateAuthenticationHeader( - "POST", "/VerificationRequestEvent", headers, request); - - Assertions.assertThat(authenticationResult).isEqualTo(true); - } - - @Test - void checkParseEventVerificationRequestEventDto() throws ApiException { - - TestHelpers.recursiveEquals( - webHooksService.parseEvent(jsonVerificationRequestEventDto), - WebhooksDtoConverterTest.verificationRequestEvent); - } - - @Test - void checkParseEventVerificationResultEventDto() throws ApiException { - - TestHelpers.recursiveEquals( - webHooksService.parseEvent(jsonVerificationResultEventDto), - WebhooksDtoConverterTest.verificationResultEvent); - } - - @Test - void checkSerializeResponsePhoneCall() throws JSONException { - - JSONAssert.assertEquals( - webHooksService.serializeResponse(WebhooksDtoConverterTest.verificationResponsePhoneCall), - jsonResponsePhoneCall, - true); - } - - @Test - void checkSerializeResponseFlashCall() throws JSONException { - - JSONAssert.assertEquals( - webHooksService.serializeResponse(WebhooksDtoConverterTest.verificationResponseFlashCall), - jsonResponseFlashCall, - true); - } - - @Test - void checkSerializeResponseSms() throws JSONException { - - JSONAssert.assertEquals( - webHooksService.serializeResponse(WebhooksDtoConverterTest.verificationResponseSms), - jsonResponseSms, - true); - } - - @BeforeEach - public void setUp() throws IOException { - - ApplicationCredentials credentials = - ApplicationCredentials.builder() - .setApplicationKey("789") - .setApplicationSecret("9876543210") - .build(); - VerificationContext context = VerificationContext.builder().setVerificationUrl("foo").build(); - webHooksService = new VerificationService(credentials, context, null).webhooks(); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/verification/adapters/converters/LinkDtoConverterTest.java b/client/src/test/java/com/sinch/sdk/domains/verification/adapters/converters/LinkDtoConverterTest.java deleted file mode 100644 index 0625d78f0..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/verification/adapters/converters/LinkDtoConverterTest.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.sinch.sdk.domains.verification.adapters.converters; - -import com.adelean.inject.resources.junit.jupiter.GivenJsonResource; -import com.adelean.inject.resources.junit.jupiter.TestWithResources; -import com.sinch.sdk.BaseTest; -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.core.http.HttpMethod; -import com.sinch.sdk.domains.verification.models.Link; -import com.sinch.sdk.domains.verification.models.LinkRelType; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import org.junit.jupiter.api.Test; - -@TestWithResources -public class LinkDtoConverterTest extends BaseTest { - - @GivenJsonResource("/domains/verification/v1/start/LinkDto.json") - public Collection linksDto; - - public static Collection linksClient = - new ArrayList<>( - Arrays.asList( - Link.builder() - .setRel(LinkRelType.STATUS) - .setHref("an href for status") - .setMethod(HttpMethod.GET) - .build(), - Link.builder() - .setRel(LinkRelType.REPORT) - .setHref("an href for report") - .setMethod(HttpMethod.PUT) - .build())); - - @Test - void convert() { - - TestHelpers.recursiveEquals(LinkDtoConverter.convert(linksDto), linksClient); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/verification/adapters/converters/VerificationsDtoConverterTest.java b/client/src/test/java/com/sinch/sdk/domains/verification/adapters/converters/VerificationsDtoConverterTest.java deleted file mode 100644 index 5fda5e3ca..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/verification/adapters/converters/VerificationsDtoConverterTest.java +++ /dev/null @@ -1,372 +0,0 @@ -package com.sinch.sdk.domains.verification.adapters.converters; - -import com.sinch.sdk.BaseTest; -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.domains.verification.models.NumberIdentity; -import com.sinch.sdk.domains.verification.models.Price; -import com.sinch.sdk.domains.verification.models.VerificationId; -import com.sinch.sdk.domains.verification.models.VerificationReference; -import com.sinch.sdk.domains.verification.models.VerificationReportCallout; -import com.sinch.sdk.domains.verification.models.VerificationReportFlashCall; -import com.sinch.sdk.domains.verification.models.VerificationReportSMS; -import com.sinch.sdk.domains.verification.models.VerificationSourceType; -import com.sinch.sdk.domains.verification.models.VerificationStatusCallout; -import com.sinch.sdk.domains.verification.models.VerificationStatusFlashCall; -import com.sinch.sdk.domains.verification.models.VerificationStatusReasonType; -import com.sinch.sdk.domains.verification.models.VerificationStatusSMS; -import com.sinch.sdk.domains.verification.models.VerificationStatusType; -import com.sinch.sdk.domains.verification.models.dto.v1.report.VerificationReportRequestDtoTest; -import com.sinch.sdk.domains.verification.models.dto.v1.report.VerificationReportResponseDtoTest; -import com.sinch.sdk.domains.verification.models.dto.v1.start.request.VerificationStartRequestTest; -import com.sinch.sdk.domains.verification.models.dto.v1.start.response.VerificationStartResponseTest; -import com.sinch.sdk.domains.verification.models.dto.v1.status.VerificationStatusResponseTest; -import com.sinch.sdk.domains.verification.models.requests.SMSCodeType; -import com.sinch.sdk.domains.verification.models.requests.StartVerificationCalloutOptions; -import com.sinch.sdk.domains.verification.models.requests.StartVerificationCalloutRequestParameters; -import com.sinch.sdk.domains.verification.models.requests.StartVerificationCalloutSpeechOptions; -import com.sinch.sdk.domains.verification.models.requests.StartVerificationFlashCallRequestParameters; -import com.sinch.sdk.domains.verification.models.requests.StartVerificationSMSOptions; -import com.sinch.sdk.domains.verification.models.requests.StartVerificationSMSRequestParameters; -import com.sinch.sdk.domains.verification.models.requests.StartVerificationSeamlessRequestParameters; -import com.sinch.sdk.domains.verification.models.requests.VerificationReportCalloutRequestParameters; -import com.sinch.sdk.domains.verification.models.requests.VerificationReportFlashCallRequestParameters; -import com.sinch.sdk.domains.verification.models.requests.VerificationReportSMSRequestParameters; -import com.sinch.sdk.domains.verification.models.response.StartVerificationResponseCallout; -import com.sinch.sdk.domains.verification.models.response.StartVerificationResponseFlashCall; -import com.sinch.sdk.domains.verification.models.response.StartVerificationResponseSMS; -import com.sinch.sdk.domains.verification.models.response.StartVerificationResponseSeamless; -import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequest; -import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestSms; -import java.time.Instant; -import org.junit.jupiter.api.Test; - -public class VerificationsDtoConverterTest extends BaseTest { - - public static StartVerificationCalloutRequestParameters startVerificationPhoneCallRequest = - StartVerificationCalloutRequestParameters.builder() - .setCustom("a custom") - .setReference(VerificationReference.valueOf("a reference")) - .setIdentity(NumberIdentity.builder().setEndpoint("+endpoint").build()) - .setOptions( - StartVerificationCalloutOptions.builder() - .setSpeech( - StartVerificationCalloutSpeechOptions.builder().setLocale("fr-FR").build()) - .build()) - .build(); - - public static StartVerificationResponseCallout expectedStartVerificationPhoneCallResponse = - StartVerificationResponseCallout.builder() - .setId(VerificationId.valueOf("the id")) - .setLinks(LinkDtoConverterTest.linksClient) - .build(); - - public static StartVerificationFlashCallRequestParameters startVerificationFlashCallRequest = - StartVerificationFlashCallRequestParameters.builder() - .setCustom("a custom") - .setReference(VerificationReference.valueOf("a reference")) - .setIdentity(NumberIdentity.builder().setEndpoint("+endpoint").build()) - .setDialTimeOut(17) - .build(); - public static StartVerificationResponseFlashCall expectedStartVerificationFlashCallResponse = - StartVerificationResponseFlashCall.builder() - .setId(VerificationId.valueOf("the id")) - .setLinks(LinkDtoConverterTest.linksClient) - .setCliFilter("(.*)5312(.*)") - .setInterceptionTimeOut(45) - .setReportTimeout(75) - .setDenyCallAfter(0) - .build(); - public static StartVerificationSeamlessRequestParameters startVerificationDataRequest = - StartVerificationSeamlessRequestParameters.builder() - .setCustom("a custom") - .setReference(VerificationReference.valueOf("a reference")) - .setIdentity(NumberIdentity.builder().setEndpoint("+endpoint").build()) - .build(); - public static StartVerificationResponseSeamless expectedStartVerificationDataResponse = - StartVerificationResponseSeamless.builder() - .setId(VerificationId.valueOf("the id")) - .setLinks(LinkDtoConverterTest.linksClient) - .setTargetUri("target URI") - .build(); - public static StartVerificationSMSRequestParameters startVerificationSmsRequest = - StartVerificationSMSRequestParameters.builder() - .setCustom("a custom") - .setReference(VerificationReference.valueOf("a reference")) - .setIdentity(NumberIdentity.builder().setEndpoint("+endpoint").build()) - .setOptions( - StartVerificationSMSOptions.builder() - .setExpiry("01:02:03") - .setCodeType(SMSCodeType.ALPHANUMERIC) - .setTemplate("My template require to use '{{CODE}}' code") - .build()) - .build(); - public static StartVerificationResponseSMS expectedStartVerificationSmsResponse = - StartVerificationResponseSMS.builder() - .setId(VerificationId.valueOf("the id")) - .setLinks(LinkDtoConverterTest.linksClient) - .setTemplate("Your verification code is {{CODE}}. Verified by Sinch") - .setInterceptionTimeOut(298) - .build(); - - @Test - void convertStartPhoneCallRequest() { - - TestHelpers.recursiveEquals( - VerificationsDtoConverter.convert(startVerificationPhoneCallRequest), - VerificationStartRequestTest.startVerificationPhoneCallDto - .getVerificationStartRequestPhoneCallImpl()); - } - - @Test - void convertStartFlashCallRequest() { - - TestHelpers.recursiveEquals( - VerificationsDtoConverter.convert(startVerificationFlashCallRequest), - VerificationStartRequestTest.startVerificationFlashCallDto - .getVerificationStartRequestFlashCallImpl()); - } - - @Test - void convertStartDataRequest() { - - TestHelpers.recursiveEquals( - VerificationsDtoConverter.convert(startVerificationDataRequest), - VerificationStartRequestTest.startVerificationDataDto - .getVerificationStartRequestDataImpl()); - } - - @Test - void convertStartSmsRequest() { - - VerificationStartRequest expected = - VerificationStartRequestSms.builder() - .setCustom("a custom") - .setReference("a reference") - .setIdentity( - com.sinch.sdk.domains.verification.models.v1.NumberIdentity.valueOf("+endpoint")) - .setExpiry("01:02:03") - .setCodeType(VerificationStartRequestSms.CodeTypeEnum.ALPHANUMERIC) - .setTemplate("My template require to use '{{CODE}}' code") - .build(); - TestHelpers.recursiveEquals( - VerificationsDtoConverter.convert(startVerificationSmsRequest), expected); - } - - @Test - void convertStartPhoneCallResponse() { - - TestHelpers.recursiveEquals( - VerificationsDtoConverter.convert( - VerificationStartResponseTest.expectedStartVerificationPhoneCallDto - .getVerificationStartResponsePhoneCallImpl()), - expectedStartVerificationPhoneCallResponse); - } - - @Test - void convertStartFlashCallResponse() { - - TestHelpers.recursiveEquals( - VerificationsDtoConverter.convert( - VerificationStartResponseTest.expectedStartVerificationFlashCallDto - .getVerificationStartResponseFlashCallImpl()), - expectedStartVerificationFlashCallResponse); - } - - @Test - void convertStartDataResponse() { - - TestHelpers.recursiveEquals( - VerificationsDtoConverter.convert( - VerificationStartResponseTest.expectedStartVerificationDataDto - .getVerificationStartResponseDataImpl()), - expectedStartVerificationDataResponse); - } - - @Test - void convertStartSmsResponse() { - - TestHelpers.recursiveEquals( - VerificationsDtoConverter.convert( - VerificationStartResponseTest.expectedStartVerificationSmsDto - .getVerificationStartResponseSmsImpl()), - expectedStartVerificationSmsResponse); - } - - public static VerificationReportCalloutRequestParameters verificationReportPhoneCallRequest = - VerificationReportCalloutRequestParameters.builder().setCode("foo code").build(); - - public static VerificationReportCallout expectedVerificationReportPhoneCallResponse = - VerificationReportCallout.builder() - .setId(VerificationId.valueOf("the id")) - .setStatus(VerificationStatusType.FAIL) - .build(); - - public static VerificationStatusCallout expectedVerificationStatusPhoneCallResponse = - VerificationStatusCallout.builder() - .setId(VerificationId.valueOf("the id")) - .setStatus(VerificationStatusType.FAIL) - .setReason(VerificationStatusReasonType.FRAUD) - .setIdentity(NumberIdentity.valueOf("endpoint value")) - .setCountryId("es-ES") - .setVerificationTimeStamp(Instant.parse("2024-05-22T09:38:59.559043700Z")) - .setCallComplete(true) - .setReference(VerificationReference.valueOf("my reference")) - .setVerificationPrice( - Price.builder() - .setCurrencyId("verificationPrice currency id") - .setAmount(3.141516F) - .build()) - .setTerminationPrice( - Price.builder() - .setCurrencyId("terminationPrice currency id") - .setAmount(6.626070F) - .build()) - .setBillableDuration(34) - .build(); - - @Test - void convertReportPhoneCallRequest() { - - TestHelpers.recursiveEquals( - VerificationsDtoConverter.convert(verificationReportPhoneCallRequest), - VerificationReportRequestDtoTest.verificationReportPhoneCallDto - .getVerificationReportRequestPhoneCallImpl()); - } - - @Test - void convertReportPhoneCallResponse() { - - TestHelpers.recursiveEquals( - VerificationsDtoConverter.convert( - VerificationReportResponseDtoTest.verificationReportPhoneCallDto - .getVerificationReportResponsePhoneCallImpl()), - expectedVerificationReportPhoneCallResponse); - } - - @Test - void convertStatusPhoneCallResponse() { - - TestHelpers.recursiveEquals( - StatusDtoConverter.convert( - VerificationStatusResponseTest.expectedVerificationPhoneCallDto - .getVerificationStatusResponsePhoneCallImpl()), - expectedVerificationStatusPhoneCallResponse); - } - - public static VerificationReportFlashCallRequestParameters verificationReportFlashCallRequest = - VerificationReportFlashCallRequestParameters.builder().setCli("foo cli").build(); - - public static VerificationReportFlashCall expectedVerificationReportFlashCallResponse = - VerificationReportFlashCall.builder() - .setId(VerificationId.valueOf("the id")) - .setStatus(VerificationStatusType.FAIL) - .build(); - public static VerificationStatusFlashCall expectedVerificationStatusFlashCallResponse = - VerificationStatusFlashCall.builder() - .setId(VerificationId.valueOf("the id")) - .setStatus(VerificationStatusType.FAIL) - .setReason(VerificationStatusReasonType.FRAUD) - .setIdentity(NumberIdentity.valueOf("endpoint value")) - .setCountryId("es-ES") - .setVerificationTimeStamp(Instant.parse("2024-05-22T09:38:59.559043700Z")) - .setReference(VerificationReference.valueOf("my reference")) - .setSource(VerificationSourceType.MANUAL) - .setVerificationPrice( - Price.builder() - .setCurrencyId("verificationPrice currency id") - .setAmount(3.141516F) - .build()) - .setTerminationPrice( - Price.builder() - .setCurrencyId("terminationPrice currency id") - .setAmount(6.626070F) - .build()) - .setBillableDuration(34) - .build(); - - @Test - void convertReportFlashCallRequest() { - - TestHelpers.recursiveEquals( - VerificationsDtoConverter.convert(verificationReportFlashCallRequest), - VerificationReportRequestDtoTest.verificationReportFlashCallDto - .getVerificationReportRequestFlashCallImpl()); - } - - @Test - void convertReportFlashCallResponse() { - - TestHelpers.recursiveEquals( - VerificationsDtoConverter.convert( - VerificationReportResponseDtoTest.verificationReportFlashCallDto - .getVerificationReportResponseFlashCallImpl()), - expectedVerificationReportFlashCallResponse); - } - - @Test - void convertStatusFlashCallResponse() { - - TestHelpers.recursiveEquals( - StatusDtoConverter.convert( - VerificationStatusResponseTest.expectedVerificationFlashCallDto - .getVerificationStatusResponseFlashCallImpl()), - expectedVerificationStatusFlashCallResponse); - } - - public static VerificationReportSMSRequestParameters verificationReportSmsRequest = - VerificationReportSMSRequestParameters.builder() - .setCode("foo code") - .setCli("foo cli") - .build(); - - public static VerificationReportSMS expectedVerificationReportSmsResponse = - VerificationReportSMS.builder() - .setId(VerificationId.valueOf("the id")) - .setStatus(VerificationStatusType.FAIL) - .build(); - public static VerificationStatusSMS expectedVerificationStatusSmsResponse = - VerificationStatusSMS.builder() - .setId(VerificationId.valueOf("the id")) - .setStatus(VerificationStatusType.FAIL) - .setReason(VerificationStatusReasonType.FRAUD) - .setReference(VerificationReference.valueOf("my reference")) - .setIdentity(NumberIdentity.valueOf("endpoint value")) - .setCountryId("es-ES") - .setVerificationTimeStamp(Instant.parse("2024-05-22T09:38:59.559043700Z")) - .setSource(VerificationSourceType.INTERCEPTED) - .setVerificationPrice( - Price.builder() - .setCurrencyId("verificationPrice currency id") - .setAmount(3.141516F) - .build()) - .build(); - - @Test - void convertReportSmsRequest() { - - TestHelpers.recursiveEquals( - VerificationsDtoConverter.convert(verificationReportSmsRequest), - VerificationReportRequestDtoTest.verificationReportSmsDto - .getVerificationReportRequestSmsImpl()); - } - - @Test - void convertReportSmsResponse() { - - TestHelpers.recursiveEquals( - VerificationsDtoConverter.convert( - VerificationReportResponseDtoTest.verificationReportSmsDto - .getVerificationReportResponseSmsImpl()), - expectedVerificationReportSmsResponse); - } - - @Test - void convertStatusSmsResponse() { - - TestHelpers.recursiveEquals( - StatusDtoConverter.convert( - VerificationStatusResponseTest.expectedVerificationSmsDto - .getVerificationStatusResponseSmsImpl()), - expectedVerificationStatusSmsResponse); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/verification/adapters/converters/WebhooksDtoConverterTest.java b/client/src/test/java/com/sinch/sdk/domains/verification/adapters/converters/WebhooksDtoConverterTest.java deleted file mode 100644 index 23135143e..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/verification/adapters/converters/WebhooksDtoConverterTest.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.sinch.sdk.domains.verification.adapters.converters; - -import com.adelean.inject.resources.junit.jupiter.TestWithResources; -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.domains.verification.adapters.VerificationBaseTest; -import com.sinch.sdk.domains.verification.models.NumberIdentity; -import com.sinch.sdk.domains.verification.models.Price; -import com.sinch.sdk.domains.verification.models.VerificationMethodType; -import com.sinch.sdk.domains.verification.models.VerificationReference; -import com.sinch.sdk.domains.verification.models.VerificationSourceType; -import com.sinch.sdk.domains.verification.models.VerificationStatusReasonType; -import com.sinch.sdk.domains.verification.models.VerificationStatusType; -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.models.webhooks.VerificationRequestEvent; -import com.sinch.sdk.domains.verification.models.webhooks.VerificationResponse; -import com.sinch.sdk.domains.verification.models.webhooks.VerificationResponseActionType; -import com.sinch.sdk.domains.verification.models.webhooks.VerificationResponseCallout; -import com.sinch.sdk.domains.verification.models.webhooks.VerificationResponseCalloutSpeech; -import com.sinch.sdk.domains.verification.models.webhooks.VerificationResponseFlashCall; -import com.sinch.sdk.domains.verification.models.webhooks.VerificationResponseSMS; -import com.sinch.sdk.domains.verification.models.webhooks.VerificationResultEvent; -import java.util.Collections; -import org.junit.jupiter.api.Test; - -@TestWithResources -public class WebhooksDtoConverterTest extends VerificationBaseTest { - - public static VerificationRequestEvent verificationRequestEvent = - new VerificationRequestEvent( - "1234567890", - VerificationMethodType.SMS, - NumberIdentity.valueOf("+11235551234"), - Price.builder().setAmount(10.5F).setCurrencyId("USD").build(), - VerificationReference.valueOf("reference string"), - "custom string", - null); - - public static VerificationResultEvent verificationResultEvent = - new VerificationResultEvent( - "1234567890", - VerificationMethodType.SMS, - NumberIdentity.valueOf("+11235551234"), - VerificationReference.valueOf("reference string"), - "custom string", - VerificationStatusType.DENIED, - VerificationStatusReasonType.FRAUD, - VerificationSourceType.MANUAL); - - public static VerificationResponse verificationResponsePhoneCall = - VerificationResponseCallout.builder() - .setAction(VerificationResponseActionType.ALLOW) - .setCode("4567") - .setSpeech(VerificationResponseCalloutSpeech.builder().setLocale("the locale").build()) - .build(); - - public static VerificationResponse verificationResponseFlashCall = - VerificationResponseFlashCall.builder() - .setAction(VerificationResponseActionType.ALLOW) - .setCli("cli code") - .setDialTimeout(123) - .build(); - - public static VerificationResponse verificationResponseSms = - VerificationResponseSMS.builder() - .setAction(VerificationResponseActionType.ALLOW) - .setCode("5666") - .setAcceptLanguage(Collections.singletonList("a language")) - .build(); - - @Test - void convertVerificationRequestEvent() { - TestHelpers.recursiveEquals( - verificationRequestEvent, - WebHooksDtoConverter.convert( - VerificationRequestEventDtoTest.expectedRequestEventDto - .getVerificationRequestEventImpl())); - } - - @Test - void convertVerificationResultEvent() { - TestHelpers.recursiveEquals( - verificationResultEvent, - WebHooksDtoConverter.convert( - VerificationResultEventDtoTest.expectedResultEvent.getVerificationResultEventImpl())); - } - - @Test - void convertVerificationPhoneCallResponse() { - TestHelpers.recursiveEquals( - VerificationResponseEventDtoTest.expectedPhoneCallRequestEventResponseDto, - WebHooksDtoConverter.convert(verificationResponsePhoneCall)); - } - - @Test - void convertVerificationFlashCallResponse() { - TestHelpers.recursiveEquals( - VerificationResponseEventDtoTest.expectedFlashCallRequestEventResponseDto, - WebHooksDtoConverter.convert(verificationResponseFlashCall)); - } - - @Test - void convertVerificationSmsResponse() { - TestHelpers.recursiveEquals( - VerificationResponseEventDtoTest.expectedSmsRequestEventResponseDto, - WebHooksDtoConverter.convert(verificationResponseSms)); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/verification/models/requests/StartVerificationCalloutRequestParametersTest.java b/client/src/test/java/com/sinch/sdk/domains/verification/models/requests/StartVerificationCalloutRequestParametersTest.java deleted file mode 100644 index dbaac6bba..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/verification/models/requests/StartVerificationCalloutRequestParametersTest.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.sinch.sdk.domains.verification.models.requests; - -import com.sinch.sdk.domains.verification.models.NumberIdentity; -import com.sinch.sdk.domains.verification.models.VerificationMethodType; -import com.sinch.sdk.domains.verification.models.VerificationReference; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class StartVerificationCalloutRequestParametersTest { - - final NumberIdentity identity = NumberIdentity.builder().setEndpoint("foo identity").build(); - final VerificationMethodType method = VerificationMethodType.CALLOUT; - final String reference = "foo reference"; - final String custom = "foo custom"; - - final StartVerificationCalloutRequestParameters value = - StartVerificationCalloutRequestParameters.builder() - .setIdentity(identity) - .setReference(VerificationReference.valueOf(reference)) - .setCustom(custom) - .build(); - - @Test - void getIdentity() { - Assertions.assertThat(value.getIdentity().get()).isEqualTo(identity); - } - - @Test - void getMethod() { - Assertions.assertThat(value.getMethod()).isEqualTo(method); - } - - @Test - void getReference() { - Assertions.assertThat(value.getReference().get().getReference()).isEqualTo(reference); - } - - @Test - void getCustom() { - Assertions.assertThat(value.getCustom().get()).isEqualTo(custom); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/verification/models/requests/StartVerificationFlashCallRequestParametersTest.java b/client/src/test/java/com/sinch/sdk/domains/verification/models/requests/StartVerificationFlashCallRequestParametersTest.java deleted file mode 100644 index 72411f7c3..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/verification/models/requests/StartVerificationFlashCallRequestParametersTest.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.sinch.sdk.domains.verification.models.requests; - -import com.sinch.sdk.domains.verification.models.NumberIdentity; -import com.sinch.sdk.domains.verification.models.VerificationMethodType; -import com.sinch.sdk.domains.verification.models.VerificationReference; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class StartVerificationFlashCallRequestParametersTest { - - final NumberIdentity identity = NumberIdentity.builder().setEndpoint("foo identity").build(); - final VerificationMethodType method = VerificationMethodType.FLASH_CALL; - final String reference = "foo reference"; - final String custom = "foo custom"; - - final Integer dialTimeOut = 123; - final StartVerificationFlashCallRequestParameters value = - StartVerificationFlashCallRequestParameters.builder() - .setIdentity(identity) - .setReference(VerificationReference.valueOf(reference)) - .setCustom(custom) - .setDialTimeOut(dialTimeOut) - .build(); - - @Test - void getIdentity() { - Assertions.assertThat(value.getIdentity().get()).isEqualTo(identity); - } - - @Test - void getMethod() { - Assertions.assertThat(value.getMethod()).isEqualTo(method); - } - - @Test - void getReference() { - Assertions.assertThat(value.getReference().get().getReference()).isEqualTo(reference); - } - - @Test - void getCustom() { - Assertions.assertThat(value.getCustom().get()).isEqualTo(custom); - } - - @Test - void getDialTimeOut() { - Assertions.assertThat(value.getDialTimeOut().get()).isEqualTo(dialTimeOut); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/verification/models/requests/StartVerificationSMSRequestParametersTest.java b/client/src/test/java/com/sinch/sdk/domains/verification/models/requests/StartVerificationSMSRequestParametersTest.java deleted file mode 100644 index aa4b955b9..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/verification/models/requests/StartVerificationSMSRequestParametersTest.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.sinch.sdk.domains.verification.models.requests; - -import com.sinch.sdk.domains.verification.models.NumberIdentity; -import com.sinch.sdk.domains.verification.models.VerificationMethodType; -import com.sinch.sdk.domains.verification.models.VerificationReference; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class StartVerificationSMSRequestParametersTest { - - final NumberIdentity identity = NumberIdentity.builder().setEndpoint("foo identity").build(); - final VerificationMethodType method = VerificationMethodType.SMS; - final String reference = "foo reference"; - final String custom = "foo custom"; - - final StartVerificationSMSRequestParameters value = - StartVerificationSMSRequestParameters.builder() - .setIdentity(identity) - .setReference(VerificationReference.valueOf(reference)) - .setCustom(custom) - .build(); - - @Test - void getIdentity() { - Assertions.assertThat(value.getIdentity().get()).isEqualTo(identity); - } - - @Test - void getMethod() { - Assertions.assertThat(value.getMethod()).isEqualTo(method); - } - - @Test - void getReference() { - Assertions.assertThat(value.getReference().get().getReference()).isEqualTo(reference); - } - - @Test - void getCustom() { - Assertions.assertThat(value.getCustom().get()).isEqualTo(custom); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/verification/models/requests/StartVerificationSeamlessRequestParametersTest.java b/client/src/test/java/com/sinch/sdk/domains/verification/models/requests/StartVerificationSeamlessRequestParametersTest.java deleted file mode 100644 index 3b121e283..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/verification/models/requests/StartVerificationSeamlessRequestParametersTest.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.sinch.sdk.domains.verification.models.requests; - -import com.sinch.sdk.domains.verification.models.NumberIdentity; -import com.sinch.sdk.domains.verification.models.VerificationMethodType; -import com.sinch.sdk.domains.verification.models.VerificationReference; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class StartVerificationSeamlessRequestParametersTest { - - final NumberIdentity identity = NumberIdentity.builder().setEndpoint("foo identity").build(); - final VerificationMethodType method = VerificationMethodType.SEAMLESS; - final String reference = "foo reference"; - final String custom = "foo custom"; - - final StartVerificationSeamlessRequestParameters value = - StartVerificationSeamlessRequestParameters.builder() - .setIdentity(identity) - .setReference(VerificationReference.valueOf(reference)) - .setCustom(custom) - .build(); - - @Test - void getIdentity() { - Assertions.assertThat(value.getIdentity().get()).isEqualTo(identity); - } - - @Test - void getMethod() { - Assertions.assertThat(value.getMethod()).isEqualTo(method); - } - - @Test - void getReference() { - Assertions.assertThat(value.getReference().get().getReference()).isEqualTo(reference); - } - - @Test - void getCustom() { - Assertions.assertThat(value.getCustom().get()).isEqualTo(custom); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/verification/models/requests/VerificationReportFlashCallRequestParametersTest.java b/client/src/test/java/com/sinch/sdk/domains/verification/models/requests/VerificationReportFlashCallRequestParametersTest.java deleted file mode 100644 index d6dd33371..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/verification/models/requests/VerificationReportFlashCallRequestParametersTest.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.sinch.sdk.domains.verification.models.requests; - -import com.sinch.sdk.domains.verification.models.VerificationMethodType; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class VerificationReportFlashCallRequestParametersTest { - - final String cli = "foo cli"; - - final VerificationReportFlashCallRequestParameters value = - VerificationReportFlashCallRequestParameters.builder().setCli(cli).build(); - - @Test - void getMethod() { - Assertions.assertThat(value.getMethod().get()).isEqualTo(VerificationMethodType.FLASH_CALL); - } - - @Test - void getCli() { - Assertions.assertThat(value.getCli().get()).isEqualTo(cli); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/verification/models/requests/VerificationStatusCalloutRequestParametersTest.java b/client/src/test/java/com/sinch/sdk/domains/verification/models/requests/VerificationStatusCalloutRequestParametersTest.java deleted file mode 100644 index 87306a8c2..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/verification/models/requests/VerificationStatusCalloutRequestParametersTest.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.sinch.sdk.domains.verification.models.requests; - -import com.sinch.sdk.domains.verification.models.VerificationMethodType; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class VerificationStatusCalloutRequestParametersTest { - - final String code = "foo code"; - - final VerificationReportCalloutRequestParameters value = - VerificationReportCalloutRequestParameters.builder().setCode(code).build(); - - @Test - void getMethod() { - Assertions.assertThat(value.getMethod().get()).isEqualTo(VerificationMethodType.CALLOUT); - } - - @Test - void getCode() { - Assertions.assertThat(value.getCode().get()).isEqualTo(code); - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/verification/models/requests/VerificationStatusSMSRequestParametersTest.java b/client/src/test/java/com/sinch/sdk/domains/verification/models/requests/VerificationStatusSMSRequestParametersTest.java deleted file mode 100644 index c1189d42a..000000000 --- a/client/src/test/java/com/sinch/sdk/domains/verification/models/requests/VerificationStatusSMSRequestParametersTest.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.sinch.sdk.domains.verification.models.requests; - -import com.sinch.sdk.domains.verification.models.VerificationMethodType; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -class VerificationStatusSMSRequestParametersTest { - - final String code = "foo code"; - final String cli = "foo cli"; - - final VerificationReportSMSRequestParameters value = - VerificationReportSMSRequestParameters.builder().setCode(code).setCli(cli).build(); - - @Test - void getMethod() { - Assertions.assertThat(value.getMethod().get()).isEqualTo(VerificationMethodType.SMS); - } - - @Test - void getCode() { - Assertions.assertThat(value.getCode().get()).isEqualTo(code); - } - - @Test - void getCli() { - Assertions.assertThat(value.getCli().get()).isEqualTo(cli); - } -} diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/verification/v0/ReportSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/verification/v0/ReportSteps.java deleted file mode 100644 index 553992822..000000000 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/verification/v0/ReportSteps.java +++ /dev/null @@ -1,157 +0,0 @@ -package com.sinch.sdk.e2e.domains.verification.v0; - -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.domains.verification.VerificationsService; -import com.sinch.sdk.domains.verification.models.NumberIdentity; -import com.sinch.sdk.domains.verification.models.VerificationId; -import com.sinch.sdk.domains.verification.models.VerificationReport; -import com.sinch.sdk.domains.verification.models.VerificationReportCallout; -import com.sinch.sdk.domains.verification.models.VerificationReportFlashCall; -import com.sinch.sdk.domains.verification.models.VerificationReportSMS; -import com.sinch.sdk.domains.verification.models.VerificationStatusType; -import com.sinch.sdk.domains.verification.models.requests.VerificationReportCalloutRequestParameters; -import com.sinch.sdk.domains.verification.models.requests.VerificationReportFlashCallRequestParameters; -import com.sinch.sdk.domains.verification.models.requests.VerificationReportSMSRequestParameters; -import com.sinch.sdk.e2e.Config; -import io.cucumber.java.en.Given; -import io.cucumber.java.en.Then; -import io.cucumber.java.en.When; - -public class ReportSteps { - - VerificationsService service; - VerificationReport reportSmsByIdResponse; - VerificationReport reportSmsByIdentityResponse; - VerificationReport reportPhoneCallByIdResponse; - VerificationReport reportPhoneCallByIdentityResponse; - VerificationReport reportFlashCallByIdResponse; - VerificationReport reportFlashCallByIdentityResponse; - - @Given("^the Verification service \"Report\" is available$") - public void serviceAvailable() { - service = Config.getSinchClient().verification().verifications(); - } - - @When( - "I send a request to report an SMS verification by \"ID\" with the verification ID {string}") - public void reportSmsById(String id) { - - VerificationReportSMSRequestParameters request = - VerificationReportSMSRequestParameters.builder().setCode("OQP1").build(); - - reportSmsByIdResponse = service.reportSmsById(VerificationId.valueOf(id), request); - } - - @When( - "I send a request to report an SMS verification by \"identity\" with the phone number" - + " {string}") - public void reportSmsByIdentity(String phoneNumber) { - - VerificationReportSMSRequestParameters request = - VerificationReportSMSRequestParameters.builder().setCode("OQP1").build(); - - reportSmsByIdentityResponse = - service.reportSmsByIdentity(NumberIdentity.valueOf(phoneNumber), request); - } - - @When( - "I send a request to report a Phone Call verification by \"ID\" with the verification ID" - + " {string}") - public void reportCalloutById(String id) { - - VerificationReportCalloutRequestParameters request = - VerificationReportCalloutRequestParameters.builder().setCode("123456").build(); - - reportPhoneCallByIdResponse = service.reportCalloutById(VerificationId.valueOf(id), request); - } - - @When( - "I send a request to report a Phone Call verification by \"identity\" with the phone number" - + " {string}") - public void reportPhoneCallByIdentity(String phoneNumber) { - - VerificationReportCalloutRequestParameters request = - VerificationReportCalloutRequestParameters.builder().setCode("123456").build(); - - reportPhoneCallByIdentityResponse = - service.reportCalloutByIdentity(NumberIdentity.valueOf(phoneNumber), request); - } - - @When( - "I send a request to report a Flash Call verification by \"ID\" with the verification ID" - + " {string}") - public void reportFlashCallById(String id) { - - VerificationReportFlashCallRequestParameters request = - VerificationReportFlashCallRequestParameters.builder().setCli("+18156540001").build(); - - reportFlashCallByIdResponse = service.reportFlashCallById(VerificationId.valueOf(id), request); - } - - @When( - "I send a request to report a Flash Call verification by \"identity\" with the phone number" - + " {string}") - public void reportFlashCallByIdentity(String phoneNumber) { - - VerificationReportFlashCallRequestParameters request = - VerificationReportFlashCallRequestParameters.builder().setCli("+18156540001").build(); - - reportFlashCallByIdentityResponse = - service.reportFlashCallByIdentity(NumberIdentity.valueOf(phoneNumber), request); - } - - @Then("the response by {string} contains the details of an SMS verification report") - public void reportSmsResult(String by) { - VerificationReport expected = null; - if (by.equals("ID")) { - expected = reportSmsByIdResponse; - } else if (by.equals("identity")) { - expected = reportSmsByIdentityResponse; - } - TestHelpers.recursiveEquals( - expected, - VerificationReportSMS.builder() - .setId(VerificationId.valueOf("1ce0ffee-c0de-5eed-d00d-f00dfeed1337")) - .setStatus(VerificationStatusType.SUCCESSFUL) - .build()); - } - - @Then("the response by {string} contains the details of a Phone Call verification report") - public void reportPhoneCallResult(String by) { - VerificationReport expected = null; - if (by.equals("ID")) { - expected = reportPhoneCallByIdResponse; - } else if (by.equals("identity")) { - expected = reportPhoneCallByIdentityResponse; - } - TestHelpers.recursiveEquals( - expected, - VerificationReportCallout.builder() - .setId(VerificationId.valueOf("1ce0ffee-c0de-5eed-d11d-f00dfeed1337")) - .setStatus(VerificationStatusType.SUCCESSFUL) - .build()); - } - - @Then("the response by \"ID\" contains the details of a Flash Call verification report") - public void reportFlashCallResult() { - TestHelpers.recursiveEquals( - reportFlashCallByIdResponse, - VerificationReportFlashCall.builder() - .setId(VerificationId.valueOf("1ce0ffee-c0de-5eed-d22d-f00dfeed1337")) - .setStatus(VerificationStatusType.SUCCESSFUL) - .build()); - } - - @Then( - "the response by \"identity\" contains the details of a failed Flash Call verification" - + " report") - public void reportFlashCallFailedResult() { - - TestHelpers.recursiveEquals( - reportFlashCallByIdentityResponse, - VerificationReportFlashCall.builder() - .setId(VerificationId.valueOf("1ce0ffee-c0de-5eed-d22d-f00dfeed1337")) - .setStatus(VerificationStatusType.FAIL) - .build()); - } -} diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/verification/v0/StartSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/verification/v0/StartSteps.java deleted file mode 100644 index 00c56d778..000000000 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/verification/v0/StartSteps.java +++ /dev/null @@ -1,173 +0,0 @@ -package com.sinch.sdk.e2e.domains.verification.v0; - -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.core.http.HttpMethod; -import com.sinch.sdk.domains.verification.VerificationsService; -import com.sinch.sdk.domains.verification.models.Link; -import com.sinch.sdk.domains.verification.models.LinkRelType; -import com.sinch.sdk.domains.verification.models.NumberIdentity; -import com.sinch.sdk.domains.verification.models.VerificationId; -import com.sinch.sdk.domains.verification.models.VerificationReference; -import com.sinch.sdk.domains.verification.models.requests.StartVerificationCalloutOptions; -import com.sinch.sdk.domains.verification.models.requests.StartVerificationCalloutRequestParameters; -import com.sinch.sdk.domains.verification.models.requests.StartVerificationCalloutSpeechOptions; -import com.sinch.sdk.domains.verification.models.requests.StartVerificationFlashCallRequestParameters; -import com.sinch.sdk.domains.verification.models.requests.StartVerificationSeamlessRequestParameters; -import com.sinch.sdk.domains.verification.models.response.StartVerificationResponse; -import com.sinch.sdk.domains.verification.models.response.StartVerificationResponseCallout; -import com.sinch.sdk.domains.verification.models.response.StartVerificationResponseFlashCall; -import com.sinch.sdk.e2e.Config; -import com.sinch.sdk.models.E164PhoneNumber; -import io.cucumber.java.en.Given; -import io.cucumber.java.en.Then; -import io.cucumber.java.en.When; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public class StartSteps { - - VerificationsService service; - StartVerificationResponse startVerificationBySmsResponse; - StartVerificationResponse startVerificationByPhoneCallResponse; - StartVerificationResponse startVerificationByFlashCallResponse; - ApiException startSeamlessException; - - @Given("^the Verification service \"Start\" is available$") - public void serviceAvailable() { - service = Config.getSinchClient().verification().verifications(); - } - - @When("^I send a request to start a verification with a SMS$") - public void startSms() { - - // "accept-languages" was added after v0 service was marked as deprecated - // so cannot test it against mockserver conditions - - // DO NOTHING - /*StartVerificationSMSRequestParameters request = - StartVerificationSMSRequestParameters.builder() - - .setIdentity(NumberIdentity.valueOf("+46123456789")) - .setOptions(StartVerificationSMSOptions.builder().setCodeType( SMSCodeType.ALPHANUMERIC).build()).build(); - - startVerificationBySmsResponse = service.startSms(request);*/ - } - - @When("^I send a request to start a verification with a Phone Call$") - public void startPhoneCall() { - - StartVerificationCalloutRequestParameters request = - StartVerificationCalloutRequestParameters.builder() - .setIdentity(NumberIdentity.valueOf("+33612345678")) - .setOptions( - StartVerificationCalloutOptions.builder() - .setSpeech( - StartVerificationCalloutSpeechOptions.builder().setLocale("fr-FR").build()) - .build()) - .build(); - - startVerificationByPhoneCallResponse = service.startCallout(request); - } - - @When("^I send a request to start a verification with a Flash Call$") - public void startFlashCall() { - - StartVerificationFlashCallRequestParameters request = - StartVerificationFlashCallRequestParameters.builder() - .setIdentity(NumberIdentity.valueOf(E164PhoneNumber.valueOf("+33612345678"))) - .setDialTimeOut(10) - .setReference(VerificationReference.valueOf("flashcall-verification-test-e2e")) - .build(); - - startVerificationByFlashCallResponse = service.startFlashCall(request); - } - - @When("^I send a request to start a Data verification for a not available destination$") - public void startData() { - - StartVerificationSeamlessRequestParameters request = - StartVerificationSeamlessRequestParameters.builder() - .setIdentity(NumberIdentity.valueOf("+17818880008")) - .build(); - try { - service.startSeamless(request); - } catch (ApiException e) { - startSeamlessException = e; - } - } - - @Then("the response contains the details of a verification started with a SMS") - public void startSmsResult() { - - // "accept-languages" was added after v0 service was marked as deprecated - // so cannot test it against mockserver conditions - - // DO NOTHING - Assertions.assertTrue(true); - } - - @Then("the response contains the details of a verification started with a Phone Call") - public void startPhoneCallResult() { - - TestHelpers.recursiveEquals( - startVerificationByPhoneCallResponse, - StartVerificationResponseCallout.builder() - .setId(VerificationId.valueOf("1ce0ffee-c0de-5eed-d11d-f00dfeed1337")) - .setLinks( - Arrays.asList( - Link.builder() - .setRel(LinkRelType.STATUS) - .setHref( - "http://localhost:3018/verification/v1/verifications/id/1ce0ffee-c0de-5eed-d11d-f00dfeed1337") - .setMethod(HttpMethod.GET) - .build(), - Link.builder() - .setRel(LinkRelType.REPORT) - .setHref( - "http://localhost:3018/verification/v1/verifications/id/1ce0ffee-c0de-5eed-d11d-f00dfeed1337") - .setMethod(HttpMethod.PUT) - .build())) - .build()); - } - - @Then("the response contains the details of a verification started with a Flash Call") - public void startFlashCallResult() { - - TestHelpers.recursiveEquals( - startVerificationByFlashCallResponse, - StartVerificationResponseFlashCall.builder() - .setId(VerificationId.valueOf("1ce0ffee-c0de-5eed-d22d-f00dfeed1337")) - .setCliFilter("(.*)8156(.*)") - .setInterceptionTimeOut(45) - .setReportTimeout(75) - .setDenyCallAfter(0) - .setLinks( - Arrays.asList( - Link.builder() - .setRel(LinkRelType.STATUS) - .setHref( - "http://localhost:3018/verification/v1/verifications/id/1ce0ffee-c0de-5eed-d22d-f00dfeed1337") - .setMethod(HttpMethod.GET) - .build(), - Link.builder() - .setRel(LinkRelType.REPORT) - .setHref( - "http://localhost:3018/verification/v1/verifications/id/1ce0ffee-c0de-5eed-d22d-f00dfeed1337") - .setMethod(HttpMethod.PUT) - .build())) - .build()); - } - - @Then("the response contains the error details of a Data verification") - public void startDataResult() { - - Assertions.assertEquals(startSeamlessException.getCode(), 40300); - Assertions.assertTrue( - startSeamlessException - .getMessage() - .equals( - "Seamless verification not available for given destination." - + " (reference=c01dc0de-c4db-44f1-5ca1-da9159d21c191)")); - } -} diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/verification/v0/StatusSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/verification/v0/StatusSteps.java deleted file mode 100644 index fcb076f30..000000000 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/verification/v0/StatusSteps.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.sinch.sdk.e2e.domains.verification.v0; - -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.domains.verification.VerificationStatusService; -import com.sinch.sdk.domains.verification.models.NumberIdentity; -import com.sinch.sdk.domains.verification.models.Price; -import com.sinch.sdk.domains.verification.models.VerificationId; -import com.sinch.sdk.domains.verification.models.VerificationMethodType; -import com.sinch.sdk.domains.verification.models.VerificationReference; -import com.sinch.sdk.domains.verification.models.VerificationStatus; -import com.sinch.sdk.domains.verification.models.VerificationStatusCallout; -import com.sinch.sdk.domains.verification.models.VerificationStatusFlashCall; -import com.sinch.sdk.domains.verification.models.VerificationStatusSMS; -import com.sinch.sdk.domains.verification.models.VerificationStatusType; -import com.sinch.sdk.e2e.Config; -import io.cucumber.java.en.Given; -import io.cucumber.java.en.Then; -import io.cucumber.java.en.When; -import java.time.Instant; - -public class StatusSteps { - - VerificationStatusService service; - VerificationStatus statusByIdResponse; - VerificationStatus statusByIdentityResponse; - VerificationStatus statusByReferenceResponse; - - @Given("^the Verification service \"Status\" is available$") - public void serviceAvailable() { - service = Config.getSinchClient().verification().verificationStatus(); - } - - @When("^I send a request to retrieve a SMS verification status by its verification ID$") - public void statusById() { - - statusByIdResponse = service.getById(VerificationId.valueOf("123456789")); - } - - @When( - "^I send a request to retrieve a Phone Call verification status by the phone number to" - + " verify$") - public void statusByIdentity() { - - statusByIdentityResponse = - service.getByIdentity(NumberIdentity.valueOf("+123456789"), VerificationMethodType.CALLOUT); - } - - @When("^I send a request to retrieve a Flash Call verification status by its reference$") - public void statusByReference() { - - statusByReferenceResponse = - service.getByReference(VerificationReference.valueOf("flashcall-verification-test-e2e")); - } - - @Then("the response contains the details of the SMS verification status") - public void statusByIdResult() { - TestHelpers.recursiveEquals( - statusByIdResponse, - VerificationStatusSMS.builder() - .setId(VerificationId.valueOf("1ce0ffee-c0de-5eed-d00d-f00dfeed1337")) - .setStatus(VerificationStatusType.SUCCESSFUL) - .setVerificationPrice(Price.builder().setCurrencyId("EUR").setAmount(0.0453F).build()) - .setIdentity(NumberIdentity.valueOf("+33612345678")) - .setCountryId("FR") - .setVerificationTimeStamp(Instant.parse("2024-06-06T09:08:41.4784877Z")) - .build()); - } - - @Then("the response contains the details of the Phone Call verification status") - public void statusByIdentityResult() { - TestHelpers.recursiveEquals( - statusByIdentityResponse, - VerificationStatusCallout.builder() - .setId(VerificationId.valueOf("1ce0ffee-c0de-5eed-d11d-f00dfeed1337")) - .setStatus(VerificationStatusType.SUCCESSFUL) - .setVerificationPrice(Price.builder().setCurrencyId("EUR").setAmount(0.1852F).build()) - .setTerminationPrice(Price.builder().setCurrencyId("EUR").setAmount(0.0F).build()) - .setIdentity(NumberIdentity.valueOf("+33612345678")) - .setCountryId("FR") - .setVerificationTimeStamp(Instant.parse("2024-06-06T09:10:27.7264837Z")) - .setCallComplete(true) - .build()); - } - - @Then("the response contains the details of the Flash Call verification status") - public void statusByIReferenceResult() { - TestHelpers.recursiveEquals( - statusByReferenceResponse, - VerificationStatusFlashCall.builder() - .setId(VerificationId.valueOf("1ce0ffee-c0de-5eed-d22d-f00dfeed1337")) - .setStatus(VerificationStatusType.SUCCESSFUL) - .setVerificationPrice(Price.builder().setCurrencyId("EUR").setAmount(0.0205F).build()) - .setTerminationPrice(Price.builder().setCurrencyId("EUR").setAmount(0.0F).build()) - .setIdentity(NumberIdentity.valueOf("+33612345678")) - .setCountryId("FR") - .setVerificationTimeStamp(Instant.parse("2024-06-06T09:07:32.3554646Z")) - .setReference(VerificationReference.valueOf("flashcall-verification-test-e2e")) - .build()); - } -} diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/verification/v0/VerificationIT.java b/client/src/test/java/com/sinch/sdk/e2e/domains/verification/v0/VerificationIT.java deleted file mode 100644 index d9ecaa87e..000000000 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/verification/v0/VerificationIT.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.sinch.sdk.e2e.domains.verification.v0; - -import static io.cucumber.junit.platform.engine.Constants.GLUE_PROPERTY_NAME; - -import org.junit.platform.suite.api.ConfigurationParameter; -import org.junit.platform.suite.api.IncludeEngines; -import org.junit.platform.suite.api.SelectClasspathResource; -import org.junit.platform.suite.api.Suite; -import org.junit.platform.suite.api.SuiteDisplayName; - -@Suite -@SuiteDisplayName("Verification V0") -@IncludeEngines("cucumber") -@SelectClasspathResource("features/verification") -@ConfigurationParameter( - key = GLUE_PROPERTY_NAME, - value = "com.sinch.sdk.e2e.domains.verification.v0") -public class VerificationIT {} diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/verification/v0/WebhooksEventsSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/verification/v0/WebhooksEventsSteps.java deleted file mode 100644 index cf0453c8a..000000000 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/verification/v0/WebhooksEventsSteps.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.sinch.sdk.e2e.domains.verification.v0; - -import com.sinch.sdk.core.TestHelpers; -import com.sinch.sdk.domains.verification.WebHooksService; -import com.sinch.sdk.domains.verification.models.NumberIdentity; -import com.sinch.sdk.domains.verification.models.Price; -import com.sinch.sdk.domains.verification.models.VerificationMethodType; -import com.sinch.sdk.domains.verification.models.VerificationStatusType; -import com.sinch.sdk.domains.verification.models.webhooks.VerificationEvent; -import com.sinch.sdk.domains.verification.models.webhooks.VerificationRequestEvent; -import com.sinch.sdk.domains.verification.models.webhooks.VerificationResultEvent; -import com.sinch.sdk.e2e.Config; -import com.sinch.sdk.e2e.domains.WebhooksHelper; -import io.cucumber.java.en.Given; -import io.cucumber.java.en.Then; -import io.cucumber.java.en.When; -import java.io.IOException; -import java.net.URL; -import java.util.AbstractMap; -import java.util.AbstractMap.SimpleEntry; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.junit.jupiter.api.Assertions; - -public class WebhooksEventsSteps { - - static final String WEBHOOKS_PATH = Config.VERIFICATION_HOST_NAME + "/webhooks/verification/"; - - WebHooksService service; - - static VerificationEvent expectedVerificationRequestEvent = - new VerificationRequestEvent( - "1ce0ffee-c0de-5eed-d00d-f00dfeed1337", - VerificationMethodType.SMS, - NumberIdentity.builder().setEndpoint("+33612345678").build(), - Price.builder().setCurrencyId("EUR").setAmount(0.0453F).build(), - null, - null, - null); - - static VerificationEvent expectedVerificationResultEvent = - new VerificationResultEvent( - "1ce0ffee-c0de-5eed-d00d-f00dfeed1337", - VerificationMethodType.SMS, - NumberIdentity.builder().setEndpoint("+33612345678").build(), - null, - null, - VerificationStatusType.SUCCESSFUL, - null, - null); - - static Map triggerToURL = - Stream.of( - new AbstractMap.SimpleEntry<>( - "Verification Request", WEBHOOKS_PATH + "verification-request-event"), - new AbstractMap.SimpleEntry<>( - "Verification Result", WEBHOOKS_PATH + "verification-result-event")) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); - - static Map triggerToExpectedEvents = - Stream.of( - new AbstractMap.SimpleEntry<>( - "Verification Request", expectedVerificationRequestEvent), - new AbstractMap.SimpleEntry<>("Verification Result", expectedVerificationResultEvent)) - .collect(Collectors.toMap(SimpleEntry::getKey, SimpleEntry::getValue)); - - Map> receivedEvents = - new ConcurrentHashMap<>(); - - @Given("^the Verification Webhooks handler is available$") - public void serviceAvailable() { - - service = Config.getSinchClient().verification().webhooks(); - } - - @When("I send a request to trigger a {string} event") - public void triggerEvent(String trigger) throws IOException { - - WebhooksHelper.Response response = - WebhooksHelper.callURL(new URL(triggerToURL.get(trigger)), service::parseEvent); - receivedEvents.put(trigger, response); - } - - @Then("the header of the Verification event {string} contains a valid authorization") - public void validateEventSignature(String trigger) { - - WebhooksHelper.Response receivedEvent = receivedEvents.get(trigger); - - boolean validated = - service.validateAuthenticationHeader( - "POST", "/webhooks/verification", receivedEvent.headers, receivedEvent.rawPayload); - Assertions.assertTrue(validated); - } - - @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; - - TestHelpers.recursiveEquals(receivedEvent, expected); - } -} diff --git a/pom.xml b/pom.xml index c4ec08967..fae2802ae 100644 --- a/pom.xml +++ b/pom.xml @@ -140,13 +140,6 @@ **/*Mapper.java **/mailgun/models/v1/response/GenericResponse.java - - - - com/sinch/sdk/domains/verification/models/*.java - com/sinch/sdk/domains/verification/VerificationsService.java - com/sinch/sdk/domains/verification/VerificationStatusService.java - com/sinch/sdk/domains/verification/WebHooksService.java @@ -308,7 +301,6 @@ com.sinch.sdk.e2e.domains.conversation.ConversationIT com.sinch.sdk.e2e.domains.sms.v1.SmsIT com.sinch.sdk.e2e.domains.voice.v1.VoiceIT - com.sinch.sdk.e2e.domains.verification.v0.VerificationIT com.sinch.sdk.e2e.domains.verification.v1.VerificationIT From 5f604e158e3a4076bf501c48f1707400930f318e Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier Date: Mon, 28 Jul 2025 17:41:14 +0200 Subject: [PATCH 007/122] feat (Conversation/Messages): Removed deprecated 'com.sinch.sdk.domains.conversation.models.v1.messages.types.media.MediaMessage' class --- MIGRATION-GUIDE.md | 6 +++ .../messages/types/card/CardMessageMedia.java | 29 ------------- .../types/card/CardMessageMediaImpl.java | 42 ------------------- .../types/card/CardMessageDtoTest.java | 38 ----------------- 4 files changed, 6 insertions(+), 109 deletions(-) delete mode 100644 client/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/card/CardMessageMedia.java delete mode 100644 client/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/card/CardMessageMediaImpl.java diff --git a/MIGRATION-GUIDE.md b/MIGRATION-GUIDE.md index 8885e9343..2bd7309c5 100644 --- a/MIGRATION-GUIDE.md +++ b/MIGRATION-GUIDE.md @@ -6,6 +6,12 @@ This release removes legacy SDK support. This guide lists all removed classes and interfaces from V1 and how to migrate to their V2 equivalents. +### [`Conversation`](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/conversation/package-summary.html) + +#### Replacement models +| Old class | New class | +|--------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| models.v1.messages.types.card.CardMessageMedia | [com.sinch.sdk.domains.conversation.models.v1.messages.types.media.MediaMessage](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/conversation/models/v1/messages/types/media/MediaMessage.html) | ### [`Numbers`](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/package-summary.html) diff --git a/client/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/card/CardMessageMedia.java b/client/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/card/CardMessageMedia.java deleted file mode 100644 index 7babdc6d1..000000000 --- a/client/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/card/CardMessageMedia.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.sinch.sdk.domains.conversation.models.v1.messages.types.card; - -import com.sinch.sdk.domains.conversation.models.v1.messages.types.media.MediaMessage; - -/** - * Deprecated class, use - * - * @deprecated use {@link - * com.sinch.sdk.domains.conversation.models.v1.messages.types.media.MediaMessage} instead. - */ -@Deprecated -public interface CardMessageMedia extends MediaMessage { - /** - * Getting builder - * - * @return New Builder instance - * @deprecated use {@link MediaMessage#builder()} instead. - */ - @Deprecated - static Builder builder() { - return new CardMessageMediaImpl.Builder(); - } - - /** - * @deprecated use {@link MediaMessage.Builder} instead. - */ - @Deprecated - interface Builder extends MediaMessage.Builder {} -} diff --git a/client/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/card/CardMessageMediaImpl.java b/client/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/card/CardMessageMediaImpl.java deleted file mode 100644 index 6ae5d6f8e..000000000 --- a/client/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/card/CardMessageMediaImpl.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.sinch.sdk.domains.conversation.models.v1.messages.types.card; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.conversation.models.v1.messages.types.media.MediaMessage; -import com.sinch.sdk.domains.conversation.models.v1.messages.types.media.MediaMessage.Builder; -import com.sinch.sdk.domains.conversation.models.v1.messages.types.media.MediaMessageImpl; - -@Deprecated -public class CardMessageMediaImpl extends MediaMessageImpl implements CardMessageMedia { - - protected CardMessageMediaImpl(MediaMessageImpl mediaMessage) { - super(OptionalValue.of(mediaMessage.getMediaMessage())); - } - - static class Builder implements CardMessageMedia.Builder { - - MediaMessage.Builder builder = MediaMessage.builder(); - - @Override - public Builder setThumbnailUrl(String thumbnailUrl) { - builder.setThumbnailUrl(thumbnailUrl); - return this; - } - - @Override - public Builder setUrl(String url) { - builder.setUrl(url); - return this; - } - - @Override - public Builder setFilenameOverride(String filenameOverride) { - builder.setFilenameOverride(filenameOverride); - return this; - } - - public CardMessageMedia build() { - - return new CardMessageMediaImpl((MediaMessageImpl) builder.build()); - } - } -} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/conversation/models/v1/messages/types/card/CardMessageDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/conversation/models/v1/messages/types/card/CardMessageDtoTest.java index cab80aaed..61793d5c1 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/conversation/models/v1/messages/types/card/CardMessageDtoTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/conversation/models/v1/messages/types/card/CardMessageDtoTest.java @@ -48,37 +48,6 @@ public class CardMessageDtoTest extends ConversationBaseTest { .build())) .build(); - public static CardMessage cardMessageMediaDto = - CardMessage.builder() - .setTitle("title value") - .setDescription("description value") - .setMedia( - CardMessageMedia.builder() - .setUrl(MediaMessageDtoTest.mediaMessageDto.getUrl()) - .setThumbnailUrl(MediaMessageDtoTest.mediaMessageDto.getThumbnailUrl()) - .setFilenameOverride(MediaMessageDtoTest.mediaMessageDto.getFilenameOverride()) - .build()) - .setHeight(CardHeight.MEDIUM) - .setChoices( - Arrays.asList( - ChoiceTextMessage.builder() - .setMessage(TextMessageDtoTest.textMessageDto) - .setPostbackData("postback_data text") - .build(), - ChoiceCallMessage.builder() - .setMessage(CallMessageDtoTest.callMessageDto) - .setPostbackData("postback_data call") - .build(), - ChoiceLocationMessage.builder() - .setMessage(LocationMessageDtoTest.locationMessageDto) - .setPostbackData("postback_data location") - .build(), - ChoiceURLMessage.builder() - .setMessage(UrlMessageDtoTest.urlMessageDto) - .setPostbackData("postback_data url") - .build())) - .build(); - @GivenTextResource("/domains/conversation/v1/messages/types/card/CardMessageDto.json") String jsonCardMessageDto; @@ -95,11 +64,4 @@ void deserializeMessageDto() throws JsonProcessingException { Assertions.assertThat(deserialized).usingRecursiveComparison().isEqualTo(cardMessageDto); } - - @Test - void serializeMessageMediaBodyDto() throws JsonProcessingException, JSONException { - String serializedString = objectMapper.writeValueAsString(cardMessageMediaDto); - - JSONAssert.assertEquals(jsonCardMessageDto, serializedString, true); - } } From bc8084f75473e6cd4c194a35b763aca7227eab12 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier Date: Fri, 1 Aug 2025 17:35:17 +0200 Subject: [PATCH 008/122] feat (SMS): Remove support of deprecated 'encoding' and 'DeliveryReceiptErrorCode' --- MIGRATION-GUIDE.md | 3 + .../adapters/DeliveryReportsServiceTest.java | 9 ++- .../sdk/e2e/domains/sms/v1/BatchesSteps.java | 7 +- .../domains/sms/v1/DeliveryReportsSteps.java | 15 ++-- .../sdk/e2e/domains/sms/v1/WebhooksSteps.java | 8 +- .../response/DryRunPerRecipientDetails.java | 24 ++---- .../DryRunPerRecipientDetailsImpl.java | 39 ++++------ ...de.java => DeliveryReceiptStatusCode.java} | 74 ++++++++++--------- .../MessageDeliveryStatus.java | 4 +- .../MessageDeliveryStatusImpl.java | 12 +-- .../RecipientDeliveryReportMMS.java | 4 +- .../RecipientDeliveryReportMMSImpl.java | 12 +-- .../RecipientDeliveryReportSMS.java | 4 +- .../RecipientDeliveryReportSMSImpl.java | 12 +-- .../BatchDeliveryReportQueryParameters.java | 6 +- ...atchDeliveryReportQueryParametersImpl.java | 12 +-- .../ListDeliveryReportsQueryParameters.java | 6 +- ...istDeliveryReportsQueryParametersImpl.java | 12 +-- .../response/DryRunResponseDtoTest.java | 3 +- .../BatchDeliveryReportDtoTest.java | 4 +- .../RecipientDeliveryReportDtoTest.java | 4 +- .../sample/sms/v1/deliveryReports/List.java | 4 +- 22 files changed, 133 insertions(+), 145 deletions(-) rename openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/{DeliveryReceiptErrorCode.java => DeliveryReceiptStatusCode.java} (60%) diff --git a/MIGRATION-GUIDE.md b/MIGRATION-GUIDE.md index 2bd7309c5..abf3a73b9 100644 --- a/MIGRATION-GUIDE.md +++ b/MIGRATION-GUIDE.md @@ -118,6 +118,8 @@ Use the new versioned API under `numbers().v1()` to get access to [NumbersServic | models/requests/UpdateSmsBatchTextRequest | [com.sinch.sdk.domains.sms.models.v1.batches.request.UpdateTextRequest](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/batches/request/UpdateTextRequest.html) | | models/responses/BatchesListResponse | [com.sinch.sdk.domains.sms.models.v1.batches.response.ListBatchesResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/batches/response/ListBatchesResponse.html) | +- The deprecated `getEncoding`/`setEncoding` APIs accepting `String` parameter are removed from [com.sinch.sdk.domains.sms.models.v1.batches.response.DryRunPerRecipientDetails](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/batches/response/DryRunPerRecipientDetails.html) + ##### Delivery Reports | Old class | New class | |---------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| @@ -136,6 +138,7 @@ Use the new versioned API under `numbers().v1()` to get access to [NumbersServic | models/requests/DeliveryReportBatchGetRequestParameters | [com.sinch.sdk.domains.sms.models.v1.deliveryreports.request.BatchDeliveryReportQueryParameters](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/deliveryreports/request/BatchDeliveryReportQueryParameters.html) | | models/requests/DeliveryReportListRequestParameters | [com.sinch.sdk.domains.sms.models.v1.deliveryreports.request.ListDeliveryReportsQueryParameters](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/deliveryreports/request/ListDeliveryReportsQueryParameters.html) | | models/responses/DeliveryReportsListResponse | [com.sinch.sdk.domains.sms.models.v1.deliveryreports.response.ListDeliveryReportsResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/deliveryreports/response/ListDeliveryReportsResponse.html) | +| models/v1/deliveryreports/DeliveryReceiptErrorCode | Renamed to [com.sinch.sdk.domains.sms.models.v1.deliveryreports.DeliveryReceiptStatusCode](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/deliveryreports/deliveryreports/DeliveryReceiptStatusCode.html) | ##### Groups | Old class | New class | diff --git a/client/src/test/java/com/sinch/sdk/domains/sms/api/v1/adapters/DeliveryReportsServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/sms/api/v1/adapters/DeliveryReportsServiceTest.java index ef18f589f..ae39a0dd7 100644 --- a/client/src/test/java/com/sinch/sdk/domains/sms/api/v1/adapters/DeliveryReportsServiceTest.java +++ b/client/src/test/java/com/sinch/sdk/domains/sms/api/v1/adapters/DeliveryReportsServiceTest.java @@ -24,7 +24,7 @@ import com.sinch.sdk.core.models.ServerConfiguration; import com.sinch.sdk.domains.sms.api.v1.DeliveryReportsService; import com.sinch.sdk.domains.sms.models.v1.deliveryreports.BatchDeliveryReport; -import com.sinch.sdk.domains.sms.models.v1.deliveryreports.DeliveryReceiptErrorCode; +import com.sinch.sdk.domains.sms.models.v1.deliveryreports.DeliveryReceiptStatusCode; import com.sinch.sdk.domains.sms.models.v1.deliveryreports.DeliveryStatus; import com.sinch.sdk.domains.sms.models.v1.deliveryreports.RecipientDeliveryReport; import com.sinch.sdk.domains.sms.models.v1.deliveryreports.request.ListDeliveryReportsQueryParameters; @@ -214,7 +214,8 @@ void list() throws ApiException { false, "code", Arrays.asList( - DeliveryReceiptErrorCode.DISPATCHED, DeliveryReceiptErrorCode.UNPROVISIONED_REGION), + DeliveryReceiptStatusCode.DISPATCHED, + DeliveryReceiptStatusCode.UNPROVISIONED_REGION), STYLE.FORM, false, "client_reference", @@ -293,8 +294,8 @@ void list() throws ApiException { .setStatus(Arrays.asList(DeliveryStatus.QUEUED, DeliveryStatus.DISPATCHED)) .setCode( Arrays.asList( - DeliveryReceiptErrorCode.DISPATCHED, - DeliveryReceiptErrorCode.UNPROVISIONED_REGION)) + DeliveryReceiptStatusCode.DISPATCHED, + DeliveryReceiptStatusCode.UNPROVISIONED_REGION)) .setClientReference("client reference") .build(); diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v1/BatchesSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v1/BatchesSteps.java index a73724315..a614257fa 100644 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v1/BatchesSteps.java +++ b/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v1/BatchesSteps.java @@ -10,6 +10,7 @@ import com.sinch.sdk.domains.sms.models.v1.batches.request.UpdateTextRequest; import com.sinch.sdk.domains.sms.models.v1.batches.response.BatchResponse; import com.sinch.sdk.domains.sms.models.v1.batches.response.DryRunPerRecipientDetails; +import com.sinch.sdk.domains.sms.models.v1.batches.response.DryRunPerRecipientDetails.EncodingEnum; import com.sinch.sdk.domains.sms.models.v1.batches.response.DryRunResponse; import com.sinch.sdk.domains.sms.models.v1.batches.response.ListBatchesResponse; import com.sinch.sdk.domains.sms.models.v1.batches.response.TextResponse; @@ -268,19 +269,19 @@ public void dryRunResult() { .setRecipient("12017777777") .setNumberOfParts(1) .setBody("Hello John!") - .setEncoding("text") + .setEncoding(EncodingEnum.TEXT) .build(), DryRunPerRecipientDetails.builder() .setRecipient("12019999999") .setNumberOfParts(1) .setBody("Hello there!") - .setEncoding("text") + .setEncoding(EncodingEnum.TEXT) .build(), DryRunPerRecipientDetails.builder() .setRecipient("12018888888") .setNumberOfParts(1) .setBody("Hello there!") - .setEncoding("text") + .setEncoding(EncodingEnum.TEXT) .build())) .build(); diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v1/DeliveryReportsSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v1/DeliveryReportsSteps.java index a7dfb1ca7..c9744996c 100644 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v1/DeliveryReportsSteps.java +++ b/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v1/DeliveryReportsSteps.java @@ -4,7 +4,7 @@ import com.sinch.sdk.domains.sms.api.v1.DeliveryReportsService; import com.sinch.sdk.domains.sms.models.v1.deliveryreports.BatchDeliveryReport; import com.sinch.sdk.domains.sms.models.v1.deliveryreports.BatchDeliveryReportSMS; -import com.sinch.sdk.domains.sms.models.v1.deliveryreports.DeliveryReceiptErrorCode; +import com.sinch.sdk.domains.sms.models.v1.deliveryreports.DeliveryReceiptStatusCode; import com.sinch.sdk.domains.sms.models.v1.deliveryreports.DeliveryStatus; import com.sinch.sdk.domains.sms.models.v1.deliveryreports.MessageDeliveryStatus; import com.sinch.sdk.domains.sms.models.v1.deliveryreports.RecipientDeliveryReport; @@ -48,7 +48,8 @@ public void getSummary() { .setType(QueryReportType.SUMMARY) .setStatus(Arrays.asList(DeliveryStatus.DELIVERED, DeliveryStatus.FAILED)) .setCode( - Arrays.asList(DeliveryReceiptErrorCode.from(15), DeliveryReceiptErrorCode.from(0))) + Arrays.asList( + DeliveryReceiptStatusCode.from(15), DeliveryReceiptStatusCode.from(0))) .build(); summaryReport = service.get("foo", request); @@ -101,12 +102,12 @@ public void getSummaryResult() { .setStatuses( Arrays.asList( MessageDeliveryStatus.builder() - .setCode(DeliveryReceiptErrorCode.from(15)) + .setCode(DeliveryReceiptStatusCode.from(15)) .setCount(1) .setStatus(DeliveryStatus.FAILED) .build(), MessageDeliveryStatus.builder() - .setCode(DeliveryReceiptErrorCode.from(0)) + .setCode(DeliveryReceiptStatusCode.from(0)) .setCount(1) .setStatus(DeliveryStatus.DELIVERED) .build())) @@ -124,13 +125,13 @@ public void getFullResult() { .setStatuses( Arrays.asList( MessageDeliveryStatus.builder() - .setCode(DeliveryReceiptErrorCode.from(0)) + .setCode(DeliveryReceiptStatusCode.from(0)) .setCount(1) .setStatus(DeliveryStatus.DELIVERED) .setRecipients(new HashSet<>(Collections.singletonList("12017777777"))) .build(), MessageDeliveryStatus.builder() - .setCode(DeliveryReceiptErrorCode.from(15)) + .setCode(DeliveryReceiptStatusCode.from(15)) .setCount(1) .setStatus(DeliveryStatus.FAILED) .setRecipients(new HashSet<>(Collections.singletonList("12018888888"))) @@ -147,7 +148,7 @@ public void getRecipientResult() { .setCreatedAt(Instant.parse("2024-06-06T13:06:27.833Z")) .setBatchId("01W4FFL35P4NC4K35SMSBATCH1") .setClientReference("reference_e2e") - .setCode(DeliveryReceiptErrorCode.from(0)) + .setCode(DeliveryReceiptStatusCode.from(0)) .setOperatorStatusAt(Instant.parse("2024-06-06T13:06:00Z")) .setRecipient("12017777777") .setStatus(DeliveryStatus.DELIVERED) diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v1/WebhooksSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v1/WebhooksSteps.java index 8334f1bda..8a51eb504 100644 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v1/WebhooksSteps.java +++ b/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v1/WebhooksSteps.java @@ -3,7 +3,7 @@ import com.sinch.sdk.core.TestHelpers; import com.sinch.sdk.domains.sms.api.v1.WebHooksService; import com.sinch.sdk.domains.sms.models.v1.deliveryreports.BatchDeliveryReportSMS; -import com.sinch.sdk.domains.sms.models.v1.deliveryreports.DeliveryReceiptErrorCode; +import com.sinch.sdk.domains.sms.models.v1.deliveryreports.DeliveryReceiptStatusCode; import com.sinch.sdk.domains.sms.models.v1.deliveryreports.DeliveryStatus; import com.sinch.sdk.domains.sms.models.v1.deliveryreports.MessageDeliveryStatus; import com.sinch.sdk.domains.sms.models.v1.deliveryreports.RecipientDeliveryReportSMS; @@ -98,7 +98,7 @@ public void deliveryReportResult() { .setStatuses( Arrays.asList( MessageDeliveryStatus.builder() - .setCode(DeliveryReceiptErrorCode.from(0)) + .setCode(DeliveryReceiptStatusCode.from(0)) .setCount(2) .setRecipients(new HashSet<>(Arrays.asList("12017777777", "33612345678"))) .setStatus(DeliveryStatus.DELIVERED) @@ -118,7 +118,7 @@ public void deliveryReportRecipientDeliveredResult() { .setCreatedAt(Instant.parse("2024-06-06T08:17:19.210Z")) .setBatchId("01W4FFL35P4NC4K35SMSBATCH9") .setClientReference("client-ref") - .setCode(DeliveryReceiptErrorCode.from(0)) + .setCode(DeliveryReceiptStatusCode.from(0)) .setOperatorStatusAt(Instant.parse("2024-06-06T08:17:00Z")) .setRecipient("12017777777") .setStatus(DeliveryStatus.DELIVERED) @@ -135,7 +135,7 @@ public void deliveryReportRecipientAbortedResult() { .setCreatedAt(Instant.parse("2024-06-06T08:17:15.603Z")) .setBatchId("01W4FFL35P4NC4K35SMSBATCH9") .setClientReference("client-ref") - .setCode(DeliveryReceiptErrorCode.UNPROVISIONED_REGION) + .setCode(DeliveryReceiptStatusCode.UNPROVISIONED_REGION) .setRecipient("12010000000") .setStatus(DeliveryStatus.ABORTED) .build(); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/response/DryRunPerRecipientDetails.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/response/DryRunPerRecipientDetails.java index 46acb51e2..9e106710f 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/response/DryRunPerRecipientDetails.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/response/DryRunPerRecipientDetails.java @@ -23,13 +23,6 @@ @JsonDeserialize(builder = DryRunPerRecipientDetailsImpl.Builder.class) public interface DryRunPerRecipientDetails { - /** - * @see #getEncodingEnum - * @deprecated - */ - @Deprecated - String getEncoding(); - /** * Sender number. Required if Automatic Default Originator not configured. * @@ -57,7 +50,7 @@ public interface DryRunPerRecipientDetails { */ Integer getNumberOfParts(); - /** Gets or Sets encodingEnum */ + /** Gets or Sets encoding */ public class EncodingEnum extends EnumDynamic { public static final EncodingEnum TEXT = new EncodingEnum("text"); public static final EncodingEnum UNICODE = new EncodingEnum("unicode"); @@ -84,13 +77,13 @@ public static String valueOf(EncodingEnum e) { } /** - * Get encodingEnum + * Get encoding * *

Field is required * - * @return encodingEnum + * @return encoding */ - EncodingEnum getEncodingEnum(); + EncodingEnum getEncoding(); /** * Getting builder @@ -104,9 +97,6 @@ static Builder builder() { /** Dedicated Builder */ interface Builder { - @Deprecated - Builder setEncoding(String encoding); - /** * see getter * @@ -137,11 +127,11 @@ interface Builder { /** * see getter * - * @param encodingEnum see getter + * @param encoding see getter * @return Current builder - * @see #getEncodingEnum + * @see #getEncoding */ - Builder setEncodingEnum(EncodingEnum encodingEnum); + Builder setEncoding(EncodingEnum encoding); /** * Create instance diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/response/DryRunPerRecipientDetailsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/response/DryRunPerRecipientDetailsImpl.java index e1157678d..92ccb1836 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/response/DryRunPerRecipientDetailsImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/response/DryRunPerRecipientDetailsImpl.java @@ -7,7 +7,6 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.core.utils.EnumDynamic; import java.util.Objects; @JsonPropertyOrder({ @@ -35,7 +34,7 @@ public class DryRunPerRecipientDetailsImpl implements DryRunPerRecipientDetails public static final String JSON_PROPERTY_ENCODING = "encoding"; - private OptionalValue encodingEnum; + private OptionalValue encoding; public DryRunPerRecipientDetailsImpl() {} @@ -43,16 +42,11 @@ protected DryRunPerRecipientDetailsImpl( OptionalValue recipient, OptionalValue body, OptionalValue numberOfParts, - OptionalValue encodingEnum) { + OptionalValue encoding) { this.recipient = recipient; this.body = body; this.numberOfParts = numberOfParts; - this.encodingEnum = encodingEnum; - } - - @JsonIgnore - public String getEncoding() { - return encodingEnum.map(EnumDynamic::value).orElse(null); + this.encoding = encoding; } @JsonIgnore @@ -89,14 +83,14 @@ public OptionalValue numberOfParts() { } @JsonIgnore - public EncodingEnum getEncodingEnum() { - return encodingEnum.orElse(null); + public EncodingEnum getEncoding() { + return encoding.orElse(null); } @JsonProperty(JSON_PROPERTY_ENCODING) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public OptionalValue encodingEnum() { - return encodingEnum; + public OptionalValue encoding() { + return encoding; } /** Return true if this ApiRecipientDryRun object is equal to o. */ @@ -112,12 +106,12 @@ public boolean equals(Object o) { return Objects.equals(this.recipient, apiRecipientDryRun.recipient) && Objects.equals(this.body, apiRecipientDryRun.body) && Objects.equals(this.numberOfParts, apiRecipientDryRun.numberOfParts) - && Objects.equals(this.encodingEnum, apiRecipientDryRun.encodingEnum); + && Objects.equals(this.encoding, apiRecipientDryRun.encoding); } @Override public int hashCode() { - return Objects.hash(recipient, body, numberOfParts, encodingEnum); + return Objects.hash(recipient, body, numberOfParts, encoding); } @Override @@ -127,7 +121,7 @@ public String toString() { sb.append(" recipient: ").append(toIndentedString(recipient)).append("\n"); sb.append(" body: ").append(toIndentedString(body)).append("\n"); sb.append(" numberOfParts: ").append(toIndentedString(numberOfParts)).append("\n"); - sb.append(" encodingEnum: ").append(toIndentedString(encodingEnum)).append("\n"); + sb.append(" encoding: ").append(toIndentedString(encoding)).append("\n"); sb.append("}"); return sb.toString(); } @@ -147,12 +141,7 @@ static class Builder implements DryRunPerRecipientDetails.Builder { OptionalValue recipient = OptionalValue.empty(); OptionalValue body = OptionalValue.empty(); OptionalValue numberOfParts = OptionalValue.empty(); - OptionalValue encodingEnum = OptionalValue.empty(); - - public Builder setEncoding(String encoding) { - this.encodingEnum = OptionalValue.of(EncodingEnum.from(encoding)); - return this; - } + OptionalValue encoding = OptionalValue.empty(); @JsonProperty(value = JSON_PROPERTY_RECIPIENT, required = true) public Builder setRecipient(String recipient) { @@ -173,13 +162,13 @@ public Builder setNumberOfParts(Integer numberOfParts) { } @JsonProperty(value = JSON_PROPERTY_ENCODING, required = true) - public Builder setEncodingEnum(EncodingEnum encodingEnum) { - this.encodingEnum = OptionalValue.of(encodingEnum); + public Builder setEncoding(EncodingEnum encoding) { + this.encoding = OptionalValue.of(encoding); return this; } public DryRunPerRecipientDetails build() { - return new DryRunPerRecipientDetailsImpl(recipient, body, numberOfParts, encodingEnum); + return new DryRunPerRecipientDetailsImpl(recipient, body, numberOfParts, encoding); } } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/DeliveryReceiptErrorCode.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/DeliveryReceiptStatusCode.java similarity index 60% rename from openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/DeliveryReceiptErrorCode.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/DeliveryReceiptStatusCode.java index 140bcd008..84a649a08 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/DeliveryReceiptErrorCode.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/DeliveryReceiptStatusCode.java @@ -11,110 +11,112 @@ * href="/docs/sms/smpp/error-codes/#status-reports-error-codes">SMPP error codes, MMS error codes and custom codes. */ -public class DeliveryReceiptErrorCode extends EnumDynamic { +public class DeliveryReceiptStatusCode extends EnumDynamic { /** * Queued. Message is queued within REST API system and will be dispatched according to the rate * of the account. */ - public static final DeliveryReceiptErrorCode QUEUED = new DeliveryReceiptErrorCode(400); + public static final DeliveryReceiptStatusCode QUEUED = new DeliveryReceiptStatusCode(400); /** Dispatched. Message has been dispatched to SMSC. */ - public static final DeliveryReceiptErrorCode DISPATCHED = new DeliveryReceiptErrorCode(401); + public static final DeliveryReceiptStatusCode DISPATCHED = new DeliveryReceiptStatusCode(401); /** Message unroutable. SMSC rejected message. Retrying is likely to cause the same error. */ - public static final DeliveryReceiptErrorCode MESSAGE_UNROUTABLE = - new DeliveryReceiptErrorCode(402); + public static final DeliveryReceiptStatusCode MESSAGE_UNROUTABLE = + new DeliveryReceiptStatusCode(402); /** Internal error. An unexpected error caused the message to fail. */ - public static final DeliveryReceiptErrorCode INTERNAL_ERROR = new DeliveryReceiptErrorCode(403); + public static final DeliveryReceiptStatusCode INTERNAL_ERROR = new DeliveryReceiptStatusCode(403); /** * Temporary delivery. failure` Message failed because of temporary delivery failure. Message can * be retried. */ - public static final DeliveryReceiptErrorCode TEMPORARY_DELIVERY_FAILURE = - new DeliveryReceiptErrorCode(404); + public static final DeliveryReceiptStatusCode TEMPORARY_DELIVERY_FAILURE = + new DeliveryReceiptStatusCode(404); /** * Unmatched Parameter. One or more parameters in the message body has no mapping for this * recipient. See Message * Parameterization */ - public static final DeliveryReceiptErrorCode UNMATCHED_PARAMETER = - new DeliveryReceiptErrorCode(405); + public static final DeliveryReceiptStatusCode UNMATCHED_PARAMETER = + new DeliveryReceiptStatusCode(405); /** * Internal Expiry. Message was expired before reaching SMSC. This may happen if the expiry time * for the message was very short. */ - public static final DeliveryReceiptErrorCode INTERNAL_EXPIRY = new DeliveryReceiptErrorCode(406); + public static final DeliveryReceiptStatusCode INTERNAL_EXPIRY = + new DeliveryReceiptStatusCode(406); /** Cancelled. Message was cancelled by user before reaching SMSC. */ - public static final DeliveryReceiptErrorCode CANCELLED = new DeliveryReceiptErrorCode(407); + public static final DeliveryReceiptStatusCode CANCELLED = new DeliveryReceiptStatusCode(407); /** Internal Reject. SMSC rejected the message. Retrying is likely to cause the same error. */ - public static final DeliveryReceiptErrorCode INTERNAL_REJECT = new DeliveryReceiptErrorCode(408); + public static final DeliveryReceiptStatusCode INTERNAL_REJECT = + new DeliveryReceiptStatusCode(408); /** * Unmatched default originator. No default originator exists/configured for this recipient when * sending message without originator. */ - public static final DeliveryReceiptErrorCode UNMATCHED_DEFAULT_ORIGINATOR = - new DeliveryReceiptErrorCode(410); + public static final DeliveryReceiptStatusCode UNMATCHED_DEFAULT_ORIGINATOR = + new DeliveryReceiptStatusCode(410); /** * Exceeded parts limit. Message failed as the number of message parts exceeds the defined max * number of message parts. */ - public static final DeliveryReceiptErrorCode EXCEEDED_PARTS_LIMIT = - new DeliveryReceiptErrorCode(411); + public static final DeliveryReceiptStatusCode EXCEEDED_PARTS_LIMIT = + new DeliveryReceiptStatusCode(411); /** * Unprovisioned region. SMSC rejected the message. The account hasn't been provisioned for this * region. */ - public static final DeliveryReceiptErrorCode UNPROVISIONED_REGION = - new DeliveryReceiptErrorCode(412); + public static final DeliveryReceiptStatusCode UNPROVISIONED_REGION = + new DeliveryReceiptStatusCode(412); /** Blocked. The account is blocked. Reach out to support for help. Potentially out of credits. */ - public static final DeliveryReceiptErrorCode BLOCKED = new DeliveryReceiptErrorCode(413); + public static final DeliveryReceiptStatusCode BLOCKED = new DeliveryReceiptStatusCode(413); /** * Bad Media. MMS only, the request failed due to a bad media URL. It is possible that the URL was * unreachable, or sent a bad response. */ - public static final DeliveryReceiptErrorCode BAD_MEDIA = new DeliveryReceiptErrorCode(414); + public static final DeliveryReceiptStatusCode BAD_MEDIA = new DeliveryReceiptStatusCode(414); /** * Delivery report Rejected. MMS only, message reached MMSC but was rejected by MMS gateway or * mobile network. */ - public static final DeliveryReceiptErrorCode DELIVERY_REPORT_REJECTED = - new DeliveryReceiptErrorCode(415); + public static final DeliveryReceiptStatusCode DELIVERY_REPORT_REJECTED = + new DeliveryReceiptStatusCode(415); /** Delivery report Not Supported. MMS only, message reached MMSC but it is not supported. */ - public static final DeliveryReceiptErrorCode DELIVERY_REPORT_NOT_SUPPORTED = - new DeliveryReceiptErrorCode(416); + public static final DeliveryReceiptStatusCode DELIVERY_REPORT_NOT_SUPPORTED = + new DeliveryReceiptStatusCode(416); /** * Delivery report Unreachable. MMS only, message reached MMSC but the destination network or the * mobile subscriber cannot be reached. */ - public static final DeliveryReceiptErrorCode DELIVERY_REPORT_UNREACHABLE = - new DeliveryReceiptErrorCode(417); + public static final DeliveryReceiptStatusCode DELIVERY_REPORT_UNREACHABLE = + new DeliveryReceiptStatusCode(417); /** * Delivery report Unrecognized. MMS only, message reached MMSC but the handset of the mobile * subscriber does not recognize the message content. */ - public static final DeliveryReceiptErrorCode DELIVERY_REPORT_UNRECOGNIZED = - new DeliveryReceiptErrorCode(418); + public static final DeliveryReceiptStatusCode DELIVERY_REPORT_UNRECOGNIZED = + new DeliveryReceiptStatusCode(418); - private static final EnumSupportDynamic ENUM_SUPPORT = + private static final EnumSupportDynamic ENUM_SUPPORT = new EnumSupportDynamic<>( - DeliveryReceiptErrorCode.class, - DeliveryReceiptErrorCode::new, + DeliveryReceiptStatusCode.class, + DeliveryReceiptStatusCode::new, Arrays.asList( QUEUED, DISPATCHED, @@ -135,19 +137,19 @@ public class DeliveryReceiptErrorCode extends EnumDynamic values() { + public static Stream values() { return ENUM_SUPPORT.values(); } - public static DeliveryReceiptErrorCode from(Integer value) { + public static DeliveryReceiptStatusCode from(Integer value) { return ENUM_SUPPORT.from(value); } - public static Integer valueOf(DeliveryReceiptErrorCode e) { + public static Integer valueOf(DeliveryReceiptStatusCode e) { return ENUM_SUPPORT.valueOf(e); } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/MessageDeliveryStatus.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/MessageDeliveryStatus.java index 1be10fc00..f14c99980 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/MessageDeliveryStatus.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/MessageDeliveryStatus.java @@ -26,7 +26,7 @@ public interface MessageDeliveryStatus { * * @return code */ - DeliveryReceiptErrorCode getCode(); + DeliveryReceiptStatusCode getCode(); /** * The number of messages that currently has this code. @@ -75,7 +75,7 @@ interface Builder { * @return Current builder * @see #getCode */ - Builder setCode(DeliveryReceiptErrorCode code); + Builder setCode(DeliveryReceiptStatusCode code); /** * see getter diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/MessageDeliveryStatusImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/MessageDeliveryStatusImpl.java index 4b76b588c..54e70468f 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/MessageDeliveryStatusImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/MessageDeliveryStatusImpl.java @@ -23,7 +23,7 @@ public class MessageDeliveryStatusImpl implements MessageDeliveryStatus { public static final String JSON_PROPERTY_CODE = "code"; - private OptionalValue code; + private OptionalValue code; public static final String JSON_PROPERTY_COUNT = "count"; @@ -40,7 +40,7 @@ public class MessageDeliveryStatusImpl implements MessageDeliveryStatus { public MessageDeliveryStatusImpl() {} protected MessageDeliveryStatusImpl( - OptionalValue code, + OptionalValue code, OptionalValue count, OptionalValue> recipients, OptionalValue status) { @@ -51,13 +51,13 @@ protected MessageDeliveryStatusImpl( } @JsonIgnore - public DeliveryReceiptErrorCode getCode() { + public DeliveryReceiptStatusCode getCode() { return code.orElse(null); } @JsonProperty(JSON_PROPERTY_CODE) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public OptionalValue code() { + public OptionalValue code() { return code; } @@ -139,13 +139,13 @@ private String toIndentedString(Object o) { @JsonPOJOBuilder(withPrefix = "set") static class Builder implements MessageDeliveryStatus.Builder { - OptionalValue code = OptionalValue.empty(); + OptionalValue code = OptionalValue.empty(); OptionalValue count = OptionalValue.empty(); OptionalValue> recipients = OptionalValue.empty(); OptionalValue status = OptionalValue.empty(); @JsonProperty(value = JSON_PROPERTY_CODE, required = true) - public Builder setCode(DeliveryReceiptErrorCode code) { + public Builder setCode(DeliveryReceiptStatusCode code) { this.code = OptionalValue.of(code); return this; } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/RecipientDeliveryReportMMS.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/RecipientDeliveryReportMMS.java index ac292898f..4ff2f3954 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/RecipientDeliveryReportMMS.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/RecipientDeliveryReportMMS.java @@ -63,7 +63,7 @@ public interface RecipientDeliveryReportMMS extends RecipientDeliveryReport { * * @return code */ - DeliveryReceiptErrorCode getCode(); + DeliveryReceiptStatusCode getCode(); /** * Get encoding @@ -171,7 +171,7 @@ interface Builder { * @return Current builder * @see #getCode */ - Builder setCode(DeliveryReceiptErrorCode code); + Builder setCode(DeliveryReceiptStatusCode code); /** * see getter diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/RecipientDeliveryReportMMSImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/RecipientDeliveryReportMMSImpl.java index f19d2c5c2..bbbc6f1b8 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/RecipientDeliveryReportMMSImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/RecipientDeliveryReportMMSImpl.java @@ -78,7 +78,7 @@ public static String valueOf(TypeEnum e) { public static final String JSON_PROPERTY_CODE = "code"; - private OptionalValue code; + private OptionalValue code; public static final String JSON_PROPERTY_ENCODING = "encoding"; @@ -115,7 +115,7 @@ protected RecipientDeliveryReportMMSImpl( OptionalValue createdAt, OptionalValue batchId, OptionalValue clientReference, - OptionalValue code, + OptionalValue code, OptionalValue encoding, OptionalValue numberOfMessageParts, OptionalValue operator, @@ -181,13 +181,13 @@ public OptionalValue clientReference() { } @JsonIgnore - public DeliveryReceiptErrorCode getCode() { + public DeliveryReceiptStatusCode getCode() { return code.orElse(null); } @JsonProperty(JSON_PROPERTY_CODE) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public OptionalValue code() { + public OptionalValue code() { return code; } @@ -347,7 +347,7 @@ static class Builder implements RecipientDeliveryReportMMS.Builder { OptionalValue createdAt = OptionalValue.empty(); OptionalValue batchId = OptionalValue.empty(); OptionalValue clientReference = OptionalValue.empty(); - OptionalValue code = OptionalValue.empty(); + OptionalValue code = OptionalValue.empty(); OptionalValue encoding = OptionalValue.empty(); OptionalValue numberOfMessageParts = OptionalValue.empty(); OptionalValue operator = OptionalValue.empty(); @@ -381,7 +381,7 @@ public Builder setClientReference(String clientReference) { } @JsonProperty(value = JSON_PROPERTY_CODE, required = true) - public Builder setCode(DeliveryReceiptErrorCode code) { + public Builder setCode(DeliveryReceiptStatusCode code) { this.code = OptionalValue.of(code); return this; } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/RecipientDeliveryReportSMS.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/RecipientDeliveryReportSMS.java index a03d51ae1..a0c23221e 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/RecipientDeliveryReportSMS.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/RecipientDeliveryReportSMS.java @@ -63,7 +63,7 @@ public interface RecipientDeliveryReportSMS extends RecipientDeliveryReport { * * @return code */ - DeliveryReceiptErrorCode getCode(); + DeliveryReceiptStatusCode getCode(); /** * Get encoding @@ -171,7 +171,7 @@ interface Builder { * @return Current builder * @see #getCode */ - Builder setCode(DeliveryReceiptErrorCode code); + Builder setCode(DeliveryReceiptStatusCode code); /** * see getter diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/RecipientDeliveryReportSMSImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/RecipientDeliveryReportSMSImpl.java index 321981f00..97fe7e8e9 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/RecipientDeliveryReportSMSImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/RecipientDeliveryReportSMSImpl.java @@ -78,7 +78,7 @@ public static String valueOf(TypeEnum e) { public static final String JSON_PROPERTY_CODE = "code"; - private OptionalValue code; + private OptionalValue code; public static final String JSON_PROPERTY_ENCODING = "encoding"; @@ -115,7 +115,7 @@ protected RecipientDeliveryReportSMSImpl( OptionalValue createdAt, OptionalValue batchId, OptionalValue clientReference, - OptionalValue code, + OptionalValue code, OptionalValue encoding, OptionalValue numberOfMessageParts, OptionalValue operator, @@ -181,13 +181,13 @@ public OptionalValue clientReference() { } @JsonIgnore - public DeliveryReceiptErrorCode getCode() { + public DeliveryReceiptStatusCode getCode() { return code.orElse(null); } @JsonProperty(JSON_PROPERTY_CODE) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public OptionalValue code() { + public OptionalValue code() { return code; } @@ -347,7 +347,7 @@ static class Builder implements RecipientDeliveryReportSMS.Builder { OptionalValue createdAt = OptionalValue.empty(); OptionalValue batchId = OptionalValue.empty(); OptionalValue clientReference = OptionalValue.empty(); - OptionalValue code = OptionalValue.empty(); + OptionalValue code = OptionalValue.empty(); OptionalValue encoding = OptionalValue.empty(); OptionalValue numberOfMessageParts = OptionalValue.empty(); OptionalValue operator = OptionalValue.empty(); @@ -381,7 +381,7 @@ public Builder setClientReference(String clientReference) { } @JsonProperty(value = JSON_PROPERTY_CODE, required = true) - public Builder setCode(DeliveryReceiptErrorCode code) { + public Builder setCode(DeliveryReceiptStatusCode code) { this.code = OptionalValue.of(code); return this; } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/request/BatchDeliveryReportQueryParameters.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/request/BatchDeliveryReportQueryParameters.java index 3186733ea..ef6ec35c2 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/request/BatchDeliveryReportQueryParameters.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/request/BatchDeliveryReportQueryParameters.java @@ -11,7 +11,7 @@ package com.sinch.sdk.domains.sms.models.v1.deliveryreports.request; import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.sms.models.v1.deliveryreports.DeliveryReceiptErrorCode; +import com.sinch.sdk.domains.sms.models.v1.deliveryreports.DeliveryReceiptStatusCode; import com.sinch.sdk.domains.sms.models.v1.deliveryreports.DeliveryStatus; import java.util.List; @@ -37,7 +37,7 @@ public interface BatchDeliveryReportQueryParameters { * * @return code */ - OptionalValue> getCode(); + OptionalValue> getCode(); /** * Getting builder @@ -85,7 +85,7 @@ interface Builder { * @return Current builder * @see #getCode */ - Builder setCode(List code); + Builder setCode(List code); /** * Create instance diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/request/BatchDeliveryReportQueryParametersImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/request/BatchDeliveryReportQueryParametersImpl.java index 8d7e4c835..c6bf688fb 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/request/BatchDeliveryReportQueryParametersImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/request/BatchDeliveryReportQueryParametersImpl.java @@ -1,7 +1,7 @@ package com.sinch.sdk.domains.sms.models.v1.deliveryreports.request; import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.sms.models.v1.deliveryreports.DeliveryReceiptErrorCode; +import com.sinch.sdk.domains.sms.models.v1.deliveryreports.DeliveryReceiptStatusCode; import com.sinch.sdk.domains.sms.models.v1.deliveryreports.DeliveryStatus; import java.util.List; import java.util.Objects; @@ -10,12 +10,12 @@ public class BatchDeliveryReportQueryParametersImpl implements BatchDeliveryRepo private final OptionalValue type; private final OptionalValue> status; - private final OptionalValue> code; + private final OptionalValue> code; private BatchDeliveryReportQueryParametersImpl( OptionalValue type, OptionalValue> status, - OptionalValue> code) { + OptionalValue> code) { this.type = type; this.status = status; this.code = code; @@ -29,7 +29,7 @@ public OptionalValue> getStatus() { return status; } - public OptionalValue> getCode() { + public OptionalValue> getCode() { return code; } @@ -78,7 +78,7 @@ private String toIndentedString(Object o) { static class Builder implements BatchDeliveryReportQueryParameters.Builder { OptionalValue type = OptionalValue.empty(); OptionalValue> status = OptionalValue.empty(); - OptionalValue> code = OptionalValue.empty(); + OptionalValue> code = OptionalValue.empty(); protected Builder() {} @@ -103,7 +103,7 @@ public Builder setStatus(List status) { return this; } - public Builder setCode(List code) { + public Builder setCode(List code) { this.code = OptionalValue.of(code); return this; } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/request/ListDeliveryReportsQueryParameters.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/request/ListDeliveryReportsQueryParameters.java index 2f6f4f144..fe97e9259 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/request/ListDeliveryReportsQueryParameters.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/request/ListDeliveryReportsQueryParameters.java @@ -11,7 +11,7 @@ package com.sinch.sdk.domains.sms.models.v1.deliveryreports.request; import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.sms.models.v1.deliveryreports.DeliveryReceiptErrorCode; +import com.sinch.sdk.domains.sms.models.v1.deliveryreports.DeliveryReceiptStatusCode; import com.sinch.sdk.domains.sms.models.v1.deliveryreports.DeliveryStatus; import java.time.Instant; import java.util.List; @@ -59,7 +59,7 @@ public interface ListDeliveryReportsQueryParameters { * * @return code */ - OptionalValue> getCode(); + OptionalValue> getCode(); /** * Get clientReference @@ -141,7 +141,7 @@ interface Builder { * @return Current builder * @see #getCode */ - Builder setCode(List code); + Builder setCode(List code); /** * see getter diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/request/ListDeliveryReportsQueryParametersImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/request/ListDeliveryReportsQueryParametersImpl.java index 26bc6b5fa..4885286e4 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/request/ListDeliveryReportsQueryParametersImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/request/ListDeliveryReportsQueryParametersImpl.java @@ -1,7 +1,7 @@ package com.sinch.sdk.domains.sms.models.v1.deliveryreports.request; import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.sms.models.v1.deliveryreports.DeliveryReceiptErrorCode; +import com.sinch.sdk.domains.sms.models.v1.deliveryreports.DeliveryReceiptStatusCode; import com.sinch.sdk.domains.sms.models.v1.deliveryreports.DeliveryStatus; import java.time.Instant; import java.util.List; @@ -14,7 +14,7 @@ public class ListDeliveryReportsQueryParametersImpl implements ListDeliveryRepor private final OptionalValue startDate; private final OptionalValue endDate; private final OptionalValue> status; - private final OptionalValue> code; + private final OptionalValue> code; private final OptionalValue clientReference; private ListDeliveryReportsQueryParametersImpl( @@ -23,7 +23,7 @@ private ListDeliveryReportsQueryParametersImpl( OptionalValue startDate, OptionalValue endDate, OptionalValue> status, - OptionalValue> code, + OptionalValue> code, OptionalValue clientReference) { this.page = page; this.pageSize = pageSize; @@ -54,7 +54,7 @@ public OptionalValue> getStatus() { return status; } - public OptionalValue> getCode() { + public OptionalValue> getCode() { return code; } @@ -118,7 +118,7 @@ static class Builder implements ListDeliveryReportsQueryParameters.Builder { OptionalValue startDate = OptionalValue.empty(); OptionalValue endDate = OptionalValue.empty(); OptionalValue> status = OptionalValue.empty(); - OptionalValue> code = OptionalValue.empty(); + OptionalValue> code = OptionalValue.empty(); OptionalValue clientReference = OptionalValue.empty(); protected Builder() {} @@ -163,7 +163,7 @@ public Builder setStatus(List status) { return this; } - public Builder setCode(List code) { + public Builder setCode(List code) { this.code = OptionalValue.of(code); return this; } diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/v1/batches/response/DryRunResponseDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/v1/batches/response/DryRunResponseDtoTest.java index ae46b43bd..07c709494 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/v1/batches/response/DryRunResponseDtoTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/v1/batches/response/DryRunResponseDtoTest.java @@ -4,6 +4,7 @@ import com.adelean.inject.resources.junit.jupiter.TestWithResources; import com.sinch.sdk.BaseTest; import com.sinch.sdk.core.TestHelpers; +import com.sinch.sdk.domains.sms.models.v1.batches.response.DryRunPerRecipientDetails.EncodingEnum; import java.util.Collections; import org.junit.jupiter.api.Test; @@ -23,7 +24,7 @@ class DryRunResponseDtoTest extends BaseTest { .setRecipient("recipient string") .setNumberOfParts(1) .setBody("body string") - .setEncoding("encoding string") + .setEncoding(EncodingEnum.from("encoding string")) .build())) .build(); diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/v1/deliveryreports/BatchDeliveryReportDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/v1/deliveryreports/BatchDeliveryReportDtoTest.java index ff88f67bd..c07afc076 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/v1/deliveryreports/BatchDeliveryReportDtoTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/v1/deliveryreports/BatchDeliveryReportDtoTest.java @@ -22,7 +22,7 @@ public class BatchDeliveryReportDtoTest extends BaseTest { .setStatuses( Collections.singletonList( MessageDeliveryStatus.builder() - .setCode(DeliveryReceiptErrorCode.from(0)) + .setCode(DeliveryReceiptStatusCode.from(0)) .setCount(1) .setRecipients(Collections.singleton("44231235674")) .setStatus(DeliveryStatus.DELIVERED) @@ -37,7 +37,7 @@ public class BatchDeliveryReportDtoTest extends BaseTest { .setStatuses( Collections.singletonList( MessageDeliveryStatus.builder() - .setCode(DeliveryReceiptErrorCode.from(0)) + .setCode(DeliveryReceiptStatusCode.from(0)) .setCount(1) .setRecipients(Collections.singleton("44231235674")) .setStatus(DeliveryStatus.DELIVERED) diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/v1/deliveryreports/RecipientDeliveryReportDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/v1/deliveryreports/RecipientDeliveryReportDtoTest.java index 75a2ab47c..ce80b95f7 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/v1/deliveryreports/RecipientDeliveryReportDtoTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/sms/models/v1/deliveryreports/RecipientDeliveryReportDtoTest.java @@ -21,7 +21,7 @@ public class RecipientDeliveryReportDtoTest extends BaseTest { .setBatchId("01FC66621XXXXX119Z8PMV1QPQ") .setClientReference("client reference") .setCreatedAt(Instant.parse("2022-08-30T08:16:08.930Z")) - .setCode(DeliveryReceiptErrorCode.DISPATCHED) + .setCode(DeliveryReceiptStatusCode.DISPATCHED) .setRecipient("+44231235674") .setStatus(DeliveryStatus.DISPATCHED) .setAppliedOriginator("applied originator") @@ -36,7 +36,7 @@ public class RecipientDeliveryReportDtoTest extends BaseTest { .setBatchId("01FC66621XXXXX119Z8PMV1QPQ") .setClientReference("client reference") .setCreatedAt(Instant.parse("2022-08-30T08:16:08.930Z")) - .setCode(DeliveryReceiptErrorCode.DISPATCHED) + .setCode(DeliveryReceiptStatusCode.DISPATCHED) .setRecipient("+44231235674") .setStatus(DeliveryStatus.DISPATCHED) .setAppliedOriginator("applied originator") diff --git a/sample-app/src/main/java/com/sinch/sample/sms/v1/deliveryReports/List.java b/sample-app/src/main/java/com/sinch/sample/sms/v1/deliveryReports/List.java index 0cd7577a6..6429f61d5 100644 --- a/sample-app/src/main/java/com/sinch/sample/sms/v1/deliveryReports/List.java +++ b/sample-app/src/main/java/com/sinch/sample/sms/v1/deliveryReports/List.java @@ -2,7 +2,7 @@ import com.sinch.sample.BaseApplication; import com.sinch.sdk.domains.sms.api.v1.DeliveryReportsService; -import com.sinch.sdk.domains.sms.models.v1.deliveryreports.DeliveryReceiptErrorCode; +import com.sinch.sdk.domains.sms.models.v1.deliveryreports.DeliveryReceiptStatusCode; import com.sinch.sdk.domains.sms.models.v1.deliveryreports.DeliveryStatus; import com.sinch.sdk.domains.sms.models.v1.deliveryreports.request.ListDeliveryReportsQueryParameters; import java.io.IOException; @@ -37,7 +37,7 @@ public void run() { .setStatus(Arrays.asList(DeliveryStatus.CANCELLED, DeliveryStatus.FAILED)) .setCode( Arrays.asList( - DeliveryReceiptErrorCode.from(0), DeliveryReceiptErrorCode.DISPATCHED)) + DeliveryReceiptStatusCode.from(0), DeliveryReceiptStatusCode.DISPATCHED)) .build()) .iterator() .forEachRemaining(f -> LOGGER.info(f.toString())); From 766f288940230092adc21325cf93a6556548800f Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier Date: Fri, 1 Aug 2025 17:54:03 +0200 Subject: [PATCH 009/122] feat (Numbers): Renamed 'numbers.v1().callback' to 'numbers.v1().callbackConfiguration' --- MIGRATION-GUIDE.md | 15 ++++++++------- .../domains/numbers/api/v1/NumbersService.java | 4 ++-- .../numbers/api/v1/adapters/NumbersService.java | 10 +++++----- .../api/v1/adapters/NumbersServiceTest.java | 3 ++- .../sdk/e2e/domains/numbers/v1/WebhooksSteps.java | 2 +- .../com/sinch/sample/numbers/callback/Get.java | 2 +- .../com/sinch/sample/numbers/callback/Update.java | 2 +- 7 files changed, 20 insertions(+), 18 deletions(-) diff --git a/MIGRATION-GUIDE.md b/MIGRATION-GUIDE.md index 2bd7309c5..abf34bdcd 100644 --- a/MIGRATION-GUIDE.md +++ b/MIGRATION-GUIDE.md @@ -84,13 +84,14 @@ This guide lists all removed classes and interfaces from V1 and how to migrate t Use the new versioned API under `numbers().v1()` to get access to [NumbersService](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/NumbersService.html): [`sinchClient.numbers().v1()`](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0./com/sinch/sdk/domains/numbers/NumbersService.html#v1()) -| Old interface | New Equivalent in `numbers().v1()` | -|---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------| -| active() | [Direct access from v1()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/NumbersService.html) | -| available() | [Direct access from v1()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/NumbersService.html) | -| regions() | [v1().regions()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/AvailableRegionsService.html) | -| callback() | [v1().callback()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/CallbackConfigurationService.html) | -| webhook() | [v1().webhooks()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/WebHooksService.html) | +| Old interface | New Equivalent in `numbers().v1()` | +|------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| active() | [Direct access from v1()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/NumbersService.html) | +| available() | [Direct access from v1()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/NumbersService.html) | +| regions() | [v1().regions()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/AvailableRegionsService.html) | +| callback() | [v1().callback()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/CallbackConfigurationService.html) | +| webhook() | [v1().webhooks()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/WebHooksService.html) | +| v1().callback() | [v1().callbackConfiguration()](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/api/v1/CallbackConfigurationService.html) | ### [`SMS`](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/package-summary.html) diff --git a/client/src/main/com/sinch/sdk/domains/numbers/api/v1/NumbersService.java b/client/src/main/com/sinch/sdk/domains/numbers/api/v1/NumbersService.java index 908abf1d9..9cdf4c772 100644 --- a/client/src/main/com/sinch/sdk/domains/numbers/api/v1/NumbersService.java +++ b/client/src/main/com/sinch/sdk/domains/numbers/api/v1/NumbersService.java @@ -34,9 +34,9 @@ public interface NumbersService extends ActiveNumberService, AvailableNumberServ * Callbacks Configuration Service instance * * @return service instance for project - * @since 1.2 + * @since 2.0 */ - CallbackConfigurationService callback(); + CallbackConfigurationService callbackConfiguration(); /** * Webhooks helpers instance diff --git a/client/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/NumbersService.java b/client/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/NumbersService.java index f530cee27..e1261a0b2 100644 --- a/client/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/NumbersService.java +++ b/client/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/NumbersService.java @@ -46,7 +46,7 @@ public class NumbersService implements com.sinch.sdk.domains.numbers.api.v1.Numb private volatile AvailableNumberServiceFacade available; private volatile ActiveNumberServiceFacade active; private volatile AvailableRegionsService regions; - private volatile CallbackConfigurationService callback; + private volatile CallbackConfigurationService callbackConfiguration; private volatile WebHooksService webhooks; static { @@ -96,10 +96,10 @@ ActiveNumberServiceFacade active() { return this.active; } - public CallbackConfigurationService callback() { - if (null == this.callback) { + public CallbackConfigurationService callbackConfiguration() { + if (null == this.callbackConfiguration) { instanceLazyInit(); - this.callback = + this.callbackConfiguration = new CallbackConfigurationServiceImpl( httpClientSupplier.get(), context.getNumbersServer(), @@ -107,7 +107,7 @@ public CallbackConfigurationService callback() { HttpMapper.getInstance(), uriUUID); } - return this.callback; + return this.callbackConfiguration; } public WebHooksService webhooks() { diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/api/v1/adapters/NumbersServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/api/v1/adapters/NumbersServiceTest.java index ae50283a4..5bd3a2b98 100644 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/api/v1/adapters/NumbersServiceTest.java +++ b/client/src/test/java/com/sinch/sdk/domains/numbers/api/v1/adapters/NumbersServiceTest.java @@ -27,7 +27,8 @@ void checkCredentialsRegions() { @Test void checkCredentialsCallback() { - CredentialsValidationHelper.checkCredentials(() -> httpClient, NumbersService::callback); + CredentialsValidationHelper.checkCredentials( + () -> httpClient, NumbersService::callbackConfiguration); } @Test diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/numbers/v1/WebhooksSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/numbers/v1/WebhooksSteps.java index eb2295052..a26085883 100644 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/numbers/v1/WebhooksSteps.java +++ b/client/src/test/java/com/sinch/sdk/e2e/domains/numbers/v1/WebhooksSteps.java @@ -20,7 +20,7 @@ public class WebhooksSteps { @Given("^the Numbers service \"Callback Configuration\" is available$") public void serviceAvailable() { - service = Config.getSinchClient().numbers().v1().callback(); + service = Config.getSinchClient().numbers().v1().callbackConfiguration(); } @When("^I send a request to retrieve the callback configuration$") diff --git a/sample-app/src/main/java/com/sinch/sample/numbers/callback/Get.java b/sample-app/src/main/java/com/sinch/sample/numbers/callback/Get.java index 0cf4dbbc7..f8d605124 100644 --- a/sample-app/src/main/java/com/sinch/sample/numbers/callback/Get.java +++ b/sample-app/src/main/java/com/sinch/sample/numbers/callback/Get.java @@ -22,7 +22,7 @@ public static void main(String[] args) { public void run() { - CallbackConfigurationService service = client.numbers().v1().callback(); + CallbackConfigurationService service = client.numbers().v1().callbackConfiguration(); LOGGER.info("Get"); diff --git a/sample-app/src/main/java/com/sinch/sample/numbers/callback/Update.java b/sample-app/src/main/java/com/sinch/sample/numbers/callback/Update.java index 1b3a21075..9377a424f 100644 --- a/sample-app/src/main/java/com/sinch/sample/numbers/callback/Update.java +++ b/sample-app/src/main/java/com/sinch/sample/numbers/callback/Update.java @@ -23,7 +23,7 @@ public static void main(String[] args) { public void run() { - CallbackConfigurationService service = client.numbers().v1().callback(); + CallbackConfigurationService service = client.numbers().v1().callbackConfiguration(); LOGGER.info("Update"); From 6c9d9df2aa1bd696323f319beae746386fefdc97 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier Date: Mon, 4 Aug 2025 12:35:27 +0200 Subject: [PATCH 010/122] feat (Mailgun/Messages): Support 'o:archive-to' field --- .../v1/emails/request/OverrideProperties.java | 18 ++++++++++ .../request/OverridePropertiesImpl.java | 34 ++++++++++++++++--- .../emails/request/SendEmailRequestTest.java | 4 +++ .../request/SendMimeEmailRequestTest.java | 2 ++ 4 files changed, 54 insertions(+), 4 deletions(-) diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/OverrideProperties.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/OverrideProperties.java index 1a834a675..21767a9bd 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/OverrideProperties.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/OverrideProperties.java @@ -172,6 +172,15 @@ public interface OverrideProperties { */ Boolean getTestMode(); + /** + * If a message is successfully delivered, then a copy of the message is submitted in an HTTP POST + * request to the URL provided in this parameter. The Content-Type of the POST requests is + * application/mime and the request body is exactly what the recipient SMTP server received. + * + * @return archiveTo + */ + String getArchiveTo(); + /** * Getting builder * @@ -328,6 +337,15 @@ interface Builder { */ Builder setTestMode(Boolean testMode); + /** + * see getter + * + * @param archiveTo see getter + * @return Current builder + * @see #getArchiveTo + */ + Builder setArchiveTo(String archiveTo); + /** * Create instance * diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/OverridePropertiesImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/OverridePropertiesImpl.java index d5a5f5514..ff73d93d9 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/OverridePropertiesImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/OverridePropertiesImpl.java @@ -75,6 +75,10 @@ public class OverridePropertiesImpl implements OverrideProperties { private OptionalValue testMode; + public static final String PROPERTY_ARCHIVE_TO = "o:archive-to"; + + private OptionalValue archiveTo; + public OverridePropertiesImpl() {} protected OverridePropertiesImpl( @@ -93,7 +97,8 @@ protected OverridePropertiesImpl( OptionalValue sendingIpPool, OptionalValue requireTls, OptionalValue skipVerification, - OptionalValue testMode) { + OptionalValue testMode, + OptionalValue archiveTo) { this.tag = tag; this.deliveryTimeOptimizePeriod = deliveryTimeOptimizePeriod; this.enableDkimSignature = enableDkimSignature; @@ -110,6 +115,7 @@ protected OverridePropertiesImpl( this.requireTls = requireTls; this.skipVerification = skipVerification; this.testMode = testMode; + this.archiveTo = archiveTo; } public List getTag() { @@ -264,6 +270,15 @@ public OptionalValue testMode() { return testMode; } + public String getArchiveTo() { + return archiveTo.orElse(null); + } + + @Property(PROPERTY_ARCHIVE_TO) + public OptionalValue archiveTo() { + return archiveTo; + } + /** Return true if this overrideProperties object is equal to o. */ @Override public boolean equals(Object o) { @@ -291,7 +306,8 @@ public boolean equals(Object o) { && Objects.equals(this.sendingIpPool, overrideProperties.sendingIpPool) && Objects.equals(this.requireTls, overrideProperties.requireTls) && Objects.equals(this.skipVerification, overrideProperties.skipVerification) - && Objects.equals(this.testMode, overrideProperties.testMode); + && Objects.equals(this.testMode, overrideProperties.testMode) + && Objects.equals(this.archiveTo, overrideProperties.archiveTo); } @Override @@ -312,7 +328,8 @@ public int hashCode() { sendingIpPool, requireTls, skipVerification, - testMode); + testMode, + archiveTo); } @Override @@ -343,6 +360,7 @@ public String toString() { sb.append(" requireTls: ").append(toIndentedString(requireTls)).append("\n"); sb.append(" skipVerification: ").append(toIndentedString(skipVerification)).append("\n"); sb.append(" testMode: ").append(toIndentedString(testMode)).append("\n"); + sb.append(" archiveTo: ").append(toIndentedString(archiveTo)).append("\n"); sb.append("}"); return sb.toString(); } @@ -374,6 +392,7 @@ static class Builder implements OverrideProperties.Builder { OptionalValue requireTls = OptionalValue.empty(); OptionalValue skipVerification = OptionalValue.empty(); OptionalValue testMode = OptionalValue.empty(); + OptionalValue archiveTo = OptionalValue.empty(); @Property(value = PROPERTY_TAG) public Builder setTag(List tag) { @@ -471,6 +490,12 @@ public Builder setTestMode(Boolean testMode) { return this; } + @Property(value = PROPERTY_ARCHIVE_TO) + public Builder setArchiveTo(String archiveTo) { + this.archiveTo = OptionalValue.of(archiveTo); + return this; + } + public OverrideProperties build() { return new OverridePropertiesImpl( tag, @@ -488,7 +513,8 @@ public OverrideProperties build() { sendingIpPool, requireTls, skipVerification, - testMode); + testMode, + archiveTo); } } } diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailRequestTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailRequestTest.java index 12237f782..6f7a4254f 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailRequestTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailRequestTest.java @@ -65,6 +65,7 @@ public class SendEmailRequestTest extends BaseTest { "o:dkim","true", "o:secondary-dkim","example.com/s1", "o:secondary-dkim-public","public.example.com/s1", + "o:archive-to","http://an-archive-to-dest.com", "o:deliverytime", "Sat, 22 Jan 2000 11:23:45 GMT", "o:deliverytime-optimize-period", "29h", "o:time-zone-localize","02:04PM", @@ -105,6 +106,7 @@ public class SendEmailRequestTest extends BaseTest { "o:dkim","true", "o:secondary-dkim","example.com/s1", "o:secondary-dkim-public","public.example.com/s1", + "o:archive-to","http://an-archive-to-dest.com", "o:deliverytime", "Sat, 22 Jan 2000 11:23:45 GMT", "o:deliverytime-optimize-period", "29h", "o:time-zone-localize","02:04PM", @@ -157,6 +159,7 @@ public class SendEmailRequestTest extends BaseTest { .setSendingIp("192.168.0.10") .setSendingIpPool("sending pool ID") .setTrackingPixelLocationTop(TrueFalseHtmlonlyEnum.HTMLONLY) + .setArchiveTo("http://an-archive-to-dest.com") .build()) .setCustomVariables(CUSTOM_VARIABLES) .setCustomHeaders(CUSTOM_HEADERS) @@ -193,6 +196,7 @@ public class SendEmailRequestTest extends BaseTest { .setSendingIp("192.168.0.10") .setSendingIpPool("sending pool ID") .setTrackingPixelLocationTop(TrueFalseHtmlonlyEnum.HTMLONLY) + .setArchiveTo("http://an-archive-to-dest.com") .build()) .setTemplateProperties( TemplateProperties.builder() diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendMimeEmailRequestTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendMimeEmailRequestTest.java index fe971ea97..550796643 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendMimeEmailRequestTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendMimeEmailRequestTest.java @@ -41,6 +41,7 @@ public class SendMimeEmailRequestTest extends BaseTest { "o:dkim","true", "o:secondary-dkim","example.com/s1", "o:secondary-dkim-public","public.example.com/s1", + "o:archive-to","http://an-archive-to-dest.com", "o:deliverytime", "Sat, 22 Jan 2000 11:23:45 GMT", "o:deliverytime-optimize-period", "29h", "o:time-zone-localize","02:04PM", @@ -86,6 +87,7 @@ public class SendMimeEmailRequestTest extends BaseTest { .setSendingIp("192.168.0.10") .setSendingIpPool("sending pool ID") .setTrackingPixelLocationTop(TrueFalseHtmlonlyEnum.HTMLONLY) + .setArchiveTo("http://an-archive-to-dest.com") .build()) .setTemplateProperties( TemplateProperties.builder() From 4882bc638e938e425c79bdb27daf533cca669a69 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier Date: Mon, 28 Jul 2025 16:36:31 +0200 Subject: [PATCH 011/122] feat (Verication/webhooks): Support 'VerificationSmsDeliveredEvent' and common webhook fields --- MIGRATION-GUIDE.md | 3 + .../api/v1/VerificationStartService.java | 12 +- .../verification/v1/WebhooksEventsSteps.java | 25 +- .../v1/internal/VerificationsReportApi.java | 4 +- .../models/v1/VerificationMethod.java | 12 +- .../models/v1/VerificationStatusReason.java | 2 +- .../VerificationReportRequestFlashCall.java | 4 +- ...ficationReportRequestFlashCallOptions.java | 4 +- .../internal/VerificationMethodStart.java | 53 ++++ .../request/VerificationStartRequest.java | 10 +- .../request/VerificationStartRequestData.java | 10 +- .../VerificationStartRequestDataImpl.java | 12 +- .../VerificationStartRequestFlashCall.java | 10 +- ...VerificationStartRequestFlashCallImpl.java | 13 +- .../VerificationStartRequestPhoneCall.java | 10 +- ...VerificationStartRequestPhoneCallImpl.java | 13 +- .../request/VerificationStartRequestSms.java | 10 +- .../VerificationStartRequestSmsImpl.java | 12 +- .../VerificationStartFlashCallOptions.java | 3 +- .../VerificationStartResponseDataImpl.java | 12 +- ...erificationStartResponseFlashCallImpl.java | 13 +- ...erificationStartResponsePhoneCallImpl.java | 13 +- .../VerificationStartResponseSmsImpl.java | 12 +- .../models/v1/status/StatusSource.java | 10 +- .../response/VerificationStatusResponse.java | 7 +- .../VerificationStatusResponseFlashCall.java | 7 +- .../VerificationStatusResponsePhoneCall.java | 7 +- .../VerificationStatusResponseSms.java | 7 +- .../models/v1/webhooks/VerificationEvent.java | 29 +- .../v1/webhooks/VerificationRequestEvent.java | 68 ++--- .../VerificationRequestEventImpl.java | 61 ++--- ...ficationRequestEventResponsePhoneCall.java | 6 +- .../VerificationRequestEventResponseSms.java | 6 +- .../v1/webhooks/VerificationResultEvent.java | 40 +-- .../webhooks/VerificationResultEventImpl.java | 60 ++--- .../VerificationSmsDeliveredEvent.java | 208 ++++++++++++++ .../VerificationSmsDeliveredEventImpl.java | 255 ++++++++++++++++++ .../VerificationEventInternalImpl.java | 88 +++++- ...nRequestEventResponsePhoneCallContent.java | 6 +- ...icationRequestEventResponseSmsContent.java | 6 +- .../VerificationRequestEventDtoTest.java | 4 +- .../VerificationResultEventDtoTest.java | 2 - .../VerificationSmsDeliveredEventDtoTest.java | 38 +++ .../VerificationSmsDeliveryEventEventDto.json | 12 + .../sample/verification/start/Start.java | 2 +- 45 files changed, 935 insertions(+), 266 deletions(-) create mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/internal/VerificationMethodStart.java create mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationSmsDeliveredEvent.java create mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationSmsDeliveredEventImpl.java create mode 100644 openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/webhooks/VerificationSmsDeliveredEventDtoTest.java create mode 100644 openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationSmsDeliveryEventEventDto.json diff --git a/MIGRATION-GUIDE.md b/MIGRATION-GUIDE.md index abf34bdcd..9805c6205 100644 --- a/MIGRATION-GUIDE.md +++ b/MIGRATION-GUIDE.md @@ -368,6 +368,9 @@ Use the new versioned API under `voice().v1()` to get access to [VoiceService](h | 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) | +- `event` field removed from `VerificationRequestEvent`, `VerificationResultEvent` events. +- `method` values based onto common `VerificationMethod` class. +- `VerificationMethod.DATA` enum no longer defined. No need to be replaced because not public definition is required. #### Replacement APIs diff --git a/client/src/main/com/sinch/sdk/domains/verification/api/v1/VerificationStartService.java b/client/src/main/com/sinch/sdk/domains/verification/api/v1/VerificationStartService.java index d26bc7e48..61b6ca263 100644 --- a/client/src/main/com/sinch/sdk/domains/verification/api/v1/VerificationStartService.java +++ b/client/src/main/com/sinch/sdk/domains/verification/api/v1/VerificationStartService.java @@ -24,8 +24,7 @@ public interface VerificationStartService { /** - * Start verification by {@link - * com.sinch.sdk.domains.verification.models.v1.VerificationMethod#SMS} + * Start verification by SMS * * @param parameters Parameters to be used to start verification * @return Verification response @@ -34,8 +33,7 @@ public interface VerificationStartService { VerificationStartResponseSms startSms(VerificationStartRequestSms parameters); /** - * Start verification by {@link - * com.sinch.sdk.domains.verification.models.v1.VerificationMethod#FLASH_CALL} + * Start verification by FLASH_CALL * * @param parameters Parameters to be used to start verification * @return Verification response @@ -44,8 +42,7 @@ public interface VerificationStartService { VerificationStartResponseFlashCall startFlashCall(VerificationStartRequestFlashCall parameters); /** - * Start verification by {@link - * com.sinch.sdk.domains.verification.models.v1.VerificationMethod#PHONE_CALL} + * Start verification by PHONE_CALL * * @param parameters Parameters to be used to start verification * @return Verification response @@ -54,8 +51,7 @@ public interface VerificationStartService { VerificationStartResponsePhoneCall startPhoneCall(VerificationStartRequestPhoneCall parameters); /** - * Start verification by {@link - * com.sinch.sdk.domains.verification.models.v1.VerificationMethod#DATA} + * Start verification by DATA * * @param parameters Parameters to be used to start verification * @return Verification response 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/WebhooksEventsSteps.java index d54b89681..69f984eaf 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/WebhooksEventsSteps.java @@ -8,9 +8,9 @@ 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.VerificationRequestEvent.MethodEnum; import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationResultEvent; -import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationResultEvent.EventEnum; +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.e2e.Config; import com.sinch.sdk.e2e.domains.WebhooksHelper; import io.cucumber.java.en.Given; @@ -34,10 +34,9 @@ public class WebhooksEventsSteps { static VerificationEvent expectedVerificationRequestEvent = VerificationRequestEvent.builder() .setId("1ce0ffee-c0de-5eed-d00d-f00dfeed1337") - .setMethod(MethodEnum.SMS) + .setMethod(VerificationMethod.SMS) .setIdentity(NumberIdentity.builder().setEndpoint("+33612345678").build()) .setPrice(Price.builder().setCurrencyId("EUR").setAmount(0.0453F).build()) - .setEvent(VerificationRequestEvent.EventEnum.VERIFICATION_REQUEST_EVENT) .build(); static VerificationEvent expectedVerificationResultEvent = @@ -46,20 +45,32 @@ public class WebhooksEventsSteps { .setMethod(VerificationMethod.SMS) .setIdentity(NumberIdentity.builder().setEndpoint("+33612345678").build()) .setStatus(VerificationStatus.SUCCESSFUL) - .setEvent(EventEnum.VERIFICATION_RESULT_EVENT) + .build(); + + static VerificationEvent expectedVerificationSMSDeliveredEvent = + VerificationSmsDeliveredEvent.builder() + .setSmsResult(SmsResultEnum.SUCCESSFUL) + .setId("0198511c-d1d1-8bf3-109b-85455d310123") + .setMethod(VerificationMethod.SMS) + .setIdentity(NumberIdentity.valueOf("+33123456789")) .build(); static Map triggerToURL = Stream.of( new SimpleEntry<>( "Verification Request", WEBHOOKS_PATH + "verification-request-event"), - new SimpleEntry<>("Verification Result", WEBHOOKS_PATH + "verification-result-event")) + new SimpleEntry<>("Verification Result", WEBHOOKS_PATH + "verification-result-event"), + new SimpleEntry<>( + "Verification SMS Delivered Event", + WEBHOOKS_PATH + "verification-sms-delivery-event")) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); static Map triggerToExpectedEvents = Stream.of( new SimpleEntry<>("Verification Request", expectedVerificationRequestEvent), - new SimpleEntry<>("Verification Result", expectedVerificationResultEvent)) + new SimpleEntry<>("Verification Result", expectedVerificationResultEvent), + new SimpleEntry<>( + "Verification SMS Delivered Event", expectedVerificationSMSDeliveredEvent)) .collect(Collectors.toMap(SimpleEntry::getKey, SimpleEntry::getValue)); Map> receivedEvents = diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/api/v1/internal/VerificationsReportApi.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/api/v1/internal/VerificationsReportApi.java index a2f90d0f0..328e2c422 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/api/v1/internal/VerificationsReportApi.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/api/v1/internal/VerificationsReportApi.java @@ -139,8 +139,8 @@ private HttpRequest reportVerificationByIdRequestBuilder( /** * Report a verification using Identity Report the received verification code to verify it, using - * the identity of the user (in most cases, the phone number). For an SMS PIN verification or - * Phone Call verification, this is the OTP code. For FlashCall, this is the CLI. + * the identity of the user (in most cases, the phone number). For an SMS verification or Phone + * Call verification, this is the OTP code. For FlashCall, this is the CLI. * * @param endpoint For type `number` use a * [E.164](https://community.sinch.com/t5/Glossary/E-164/ta-p/7537)-compatible phone number. diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/VerificationMethod.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/VerificationMethod.java index 6d966ab29..fad8631ea 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/VerificationMethod.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/VerificationMethod.java @@ -5,10 +5,10 @@ import java.util.Arrays; import java.util.stream.Stream; -/** The type of the verification request. */ +/** The type of the verification. */ public class VerificationMethod extends EnumDynamic { - /** Verification by SMS message with a PIN code. */ + /** Verification by SMS message with an OTP code. */ public static final VerificationMethod SMS = new VerificationMethod("sms"); /** @@ -23,17 +23,11 @@ public class VerificationMethod extends EnumDynamic */ public static final VerificationMethod PHONE_CALL = new VerificationMethod("callout"); - /** - * Data verification. Verification by accessing internal infrastructure of mobile carriers to - * verify if given verification attempt was originated from device with matching phone number. - */ - public static final VerificationMethod DATA = new VerificationMethod("seamless"); - private static final EnumSupportDynamic ENUM_SUPPORT = new EnumSupportDynamic<>( VerificationMethod.class, VerificationMethod::new, - Arrays.asList(SMS, FLASH_CALL, PHONE_CALL, DATA)); + Arrays.asList(SMS, FLASH_CALL, PHONE_CALL)); private VerificationMethod(String value) { super(value); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/VerificationStatusReason.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/VerificationStatusReason.java index eea39c42d..69cc10a62 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/VerificationStatusReason.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/VerificationStatusReason.java @@ -33,7 +33,7 @@ public class VerificationStatusReason extends EnumDynamicField is required * diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/internal/VerificationReportRequestFlashCallOptions.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/internal/VerificationReportRequestFlashCallOptions.java index f24c0f3c1..0530b0b1b 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/internal/VerificationReportRequestFlashCallOptions.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/internal/VerificationReportRequestFlashCallOptions.java @@ -17,7 +17,9 @@ public interface VerificationReportRequestFlashCallOptions { /** - * The caller ID of the flash call. + * The caller ID of the flash call. Caller ID in flash call verification refers to the phone + * number from which the call was made to the user's device. The verification system uses this + * incoming number as One Time Password (OTP) * *

Field is required * diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/internal/VerificationMethodStart.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/internal/VerificationMethodStart.java new file mode 100644 index 000000000..ff96feb5a --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/internal/VerificationMethodStart.java @@ -0,0 +1,53 @@ +package com.sinch.sdk.domains.verification.models.v1.start.internal; + +import com.sinch.sdk.core.utils.EnumDynamic; +import com.sinch.sdk.core.utils.EnumSupportDynamic; +import java.util.Arrays; +import java.util.stream.Stream; + +/** The type of the verification request. */ +public class VerificationMethodStart extends EnumDynamic { + + /** Verification by SMS message with an OTP code. */ + public static final VerificationMethodStart SMS = new VerificationMethodStart("sms"); + + /** + * Verification by placing a flashVerificationResultEvent call (missed call) and detecting the + * incoming calling number (CLI). + */ + public static final VerificationMethodStart FLASH_CALL = new VerificationMethodStart("flashcall"); + + /** + * Verification by placing a PSTN call to the user's phone and playing an announcement, asking the + * user to press a particular digit to verify the phone number. + */ + public static final VerificationMethodStart PHONE_CALL = new VerificationMethodStart("callout"); + + /** + * Data verification. Verification by accessing internal infrastructure of mobile carriers to + * verify if given verification attempt was originated from device with matching phone number. + */ + public static final VerificationMethodStart DATA = new VerificationMethodStart("seamless"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>( + VerificationMethodStart.class, + VerificationMethodStart::new, + Arrays.asList(SMS, FLASH_CALL, PHONE_CALL, DATA)); + + private VerificationMethodStart(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static VerificationMethodStart from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(VerificationMethodStart e) { + return ENUM_SUPPORT.valueOf(e); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequest.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequest.java index b13190462..c416045f0 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequest.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequest.java @@ -25,14 +25,20 @@ public interface VerificationStartRequest { Identity getIdentity(); /** - * Used to pass your own reference in the request for tracking purposes. + * Used to pass your own reference in the request for tracking purposes. Must be a unique value + * for each started verification request. The value must be encodable in the URL path segment. + * This value is passed to all events and returned from the status and report endpoints. The + * reference can be used to check the status + * of verifications, like with ID or identity. * * @return reference */ String getReference(); /** - * Can be used to pass custom data in the request. + * Can be used to pass custom data in the request. Will be passed to all events. Max length 4096 + * characters, can be arbitrary text data. * * @return custom */ diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestData.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestData.java index 6454deaab..bbe2e47dc 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestData.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestData.java @@ -28,14 +28,20 @@ public interface VerificationStartRequestData Identity getIdentity(); /** - * Used to pass your own reference in the request for tracking purposes. + * Used to pass your own reference in the request for tracking purposes. Must be a unique value + * for each started verification request. The value must be encodable in the URL path segment. + * This value is passed to all events and returned from the status and report endpoints. The + * reference can be used to check the status + * of verifications, like with ID or identity. * * @return reference */ String getReference(); /** - * Can be used to pass custom data in the request. + * Can be used to pass custom data in the request. Will be passed to all events. Max length 4096 + * characters, can be arbitrary text data. * * @return custom */ diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestDataImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestDataImpl.java index 3df0d3eec..356216d44 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestDataImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestDataImpl.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; import com.sinch.sdk.core.models.OptionalValue; import com.sinch.sdk.domains.verification.models.v1.Identity; -import com.sinch.sdk.domains.verification.models.v1.VerificationMethod; +import com.sinch.sdk.domains.verification.models.v1.start.internal.VerificationMethodStart; import java.util.Objects; @JsonPropertyOrder({ @@ -30,7 +30,7 @@ public class VerificationStartRequestDataImpl public static final String JSON_PROPERTY_METHOD = "method"; - private OptionalValue method; + private OptionalValue method; public static final String JSON_PROPERTY_REFERENCE = "reference"; @@ -44,7 +44,7 @@ public VerificationStartRequestDataImpl() {} protected VerificationStartRequestDataImpl( OptionalValue identity, - OptionalValue method, + OptionalValue method, OptionalValue reference, OptionalValue custom) { this.identity = identity; @@ -65,13 +65,13 @@ public OptionalValue identity() { } @JsonIgnore - public VerificationMethod getMethod() { + public VerificationMethodStart getMethod() { return method.orElse(null); } @JsonProperty(JSON_PROPERTY_METHOD) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public OptionalValue method() { + public OptionalValue method() { return method; } @@ -144,7 +144,7 @@ private String toIndentedString(Object o) { @JsonPOJOBuilder(withPrefix = "set") static class Builder implements VerificationStartRequestData.Builder { OptionalValue identity = OptionalValue.empty(); - OptionalValue method = OptionalValue.of(VerificationMethod.DATA); + OptionalValue method = OptionalValue.of(VerificationMethodStart.DATA); OptionalValue reference = OptionalValue.empty(); OptionalValue custom = OptionalValue.empty(); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestFlashCall.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestFlashCall.java index d91c5f486..d4e4a5aa1 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestFlashCall.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestFlashCall.java @@ -28,14 +28,20 @@ public interface VerificationStartRequestFlashCall Identity getIdentity(); /** - * Used to pass your own reference in the request for tracking purposes. + * Used to pass your own reference in the request for tracking purposes. Must be a unique value + * for each started verification request. The value must be encodable in the URL path segment. + * This value is passed to all events and returned from the status and report endpoints. The + * reference can be used to check the status + * of verifications, like with ID or identity. * * @return reference */ String getReference(); /** - * Can be used to pass custom data in the request. + * Can be used to pass custom data in the request. Will be passed to all events. Max length 4096 + * characters, can be arbitrary text data. * * @return custom */ diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestFlashCallImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestFlashCallImpl.java index 7e4734a47..814bbd043 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestFlashCallImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestFlashCallImpl.java @@ -14,7 +14,7 @@ import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; import com.sinch.sdk.core.models.OptionalValue; import com.sinch.sdk.domains.verification.models.v1.Identity; -import com.sinch.sdk.domains.verification.models.v1.VerificationMethod; +import com.sinch.sdk.domains.verification.models.v1.start.internal.VerificationMethodStart; import com.sinch.sdk.domains.verification.models.v1.start.request.internal.VerificationStartFlashCallOptions; import com.sinch.sdk.domains.verification.models.v1.start.request.internal.VerificationStartFlashCallOptionsImpl; import java.io.IOException; @@ -41,7 +41,7 @@ public class VerificationStartRequestFlashCallImpl public static final String JSON_PROPERTY_METHOD = "method"; - private OptionalValue method; + private OptionalValue method; public static final String JSON_PROPERTY_REFERENCE = "reference"; @@ -59,7 +59,7 @@ public VerificationStartRequestFlashCallImpl() {} protected VerificationStartRequestFlashCallImpl( OptionalValue identity, - OptionalValue method, + OptionalValue method, OptionalValue reference, OptionalValue custom, OptionalValue flashCallOptions) { @@ -82,13 +82,13 @@ public OptionalValue identity() { } @JsonIgnore - public VerificationMethod getMethod() { + public VerificationMethodStart getMethod() { return method.orElse(null); } @JsonProperty(JSON_PROPERTY_METHOD) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public OptionalValue method() { + public OptionalValue method() { return method; } @@ -193,7 +193,8 @@ private String toIndentedString(Object o) { @JsonPOJOBuilder(withPrefix = "set") static class Builder implements VerificationStartRequestFlashCall.Builder { OptionalValue identity = OptionalValue.empty(); - OptionalValue method = OptionalValue.of(VerificationMethod.FLASH_CALL); + OptionalValue method = + OptionalValue.of(VerificationMethodStart.FLASH_CALL); OptionalValue reference = OptionalValue.empty(); OptionalValue custom = OptionalValue.empty(); OptionalValue flashCallOptions = OptionalValue.empty(); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestPhoneCall.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestPhoneCall.java index 0dd7aec1b..c7af748d3 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestPhoneCall.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestPhoneCall.java @@ -28,14 +28,20 @@ public interface VerificationStartRequestPhoneCall Identity getIdentity(); /** - * Used to pass your own reference in the request for tracking purposes. + * Used to pass your own reference in the request for tracking purposes. Must be a unique value + * for each started verification request. The value must be encodable in the URL path segment. + * This value is passed to all events and returned from the status and report endpoints. The + * reference can be used to check the status + * of verifications, like with ID or identity. * * @return reference */ String getReference(); /** - * Can be used to pass custom data in the request. + * Can be used to pass custom data in the request. Will be passed to all events. Max length 4096 + * characters, can be arbitrary text data. * * @return custom */ diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestPhoneCallImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestPhoneCallImpl.java index ed18debe1..25e87b600 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestPhoneCallImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestPhoneCallImpl.java @@ -14,7 +14,7 @@ import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; import com.sinch.sdk.core.models.OptionalValue; import com.sinch.sdk.domains.verification.models.v1.Identity; -import com.sinch.sdk.domains.verification.models.v1.VerificationMethod; +import com.sinch.sdk.domains.verification.models.v1.start.internal.VerificationMethodStart; import com.sinch.sdk.domains.verification.models.v1.start.request.internal.VerificationStartPhoneCallOptions; import com.sinch.sdk.domains.verification.models.v1.start.request.internal.VerificationStartPhoneCallOptionsImpl; import java.io.IOException; @@ -41,7 +41,7 @@ public class VerificationStartRequestPhoneCallImpl public static final String JSON_PROPERTY_METHOD = "method"; - private OptionalValue method; + private OptionalValue method; public static final String JSON_PROPERTY_REFERENCE = "reference"; @@ -59,7 +59,7 @@ public VerificationStartRequestPhoneCallImpl() {} protected VerificationStartRequestPhoneCallImpl( OptionalValue identity, - OptionalValue method, + OptionalValue method, OptionalValue reference, OptionalValue custom, OptionalValue calloutOptions) { @@ -82,13 +82,13 @@ public OptionalValue identity() { } @JsonIgnore - public VerificationMethod getMethod() { + public VerificationMethodStart getMethod() { return method.orElse(null); } @JsonProperty(JSON_PROPERTY_METHOD) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public OptionalValue method() { + public OptionalValue method() { return method; } @@ -192,7 +192,8 @@ private String toIndentedString(Object o) { @JsonPOJOBuilder(withPrefix = "set") static class Builder implements VerificationStartRequestPhoneCall.Builder { OptionalValue identity = OptionalValue.empty(); - OptionalValue method = OptionalValue.of(VerificationMethod.PHONE_CALL); + OptionalValue method = + OptionalValue.of(VerificationMethodStart.PHONE_CALL); OptionalValue reference = OptionalValue.empty(); OptionalValue custom = OptionalValue.empty(); OptionalValue calloutOptions = OptionalValue.empty(); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestSms.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestSms.java index 0b2857db5..933b9c872 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestSms.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestSms.java @@ -32,14 +32,20 @@ public interface VerificationStartRequestSms Identity getIdentity(); /** - * Used to pass your own reference in the request for tracking purposes. + * Used to pass your own reference in the request for tracking purposes. Must be a unique value + * for each started verification request. The value must be encodable in the URL path segment. + * This value is passed to all events and returned from the status and report endpoints. The + * reference can be used to check the status + * of verifications, like with ID or identity. * * @return reference */ String getReference(); /** - * Can be used to pass custom data in the request. + * Can be used to pass custom data in the request. Will be passed to all events. Max length 4096 + * characters, can be arbitrary text data. * * @return custom */ diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestSmsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestSmsImpl.java index 9cfd56321..e8fc71a55 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestSmsImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestSmsImpl.java @@ -14,7 +14,7 @@ import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; import com.sinch.sdk.core.models.OptionalValue; import com.sinch.sdk.domains.verification.models.v1.Identity; -import com.sinch.sdk.domains.verification.models.v1.VerificationMethod; +import com.sinch.sdk.domains.verification.models.v1.start.internal.VerificationMethodStart; import com.sinch.sdk.domains.verification.models.v1.start.request.internal.VerificationStartSmsOptions; import com.sinch.sdk.domains.verification.models.v1.start.request.internal.VerificationStartSmsOptionsImpl; import java.io.IOException; @@ -41,7 +41,7 @@ public class VerificationStartRequestSmsImpl public static final String JSON_PROPERTY_METHOD = "method"; - private OptionalValue method; + private OptionalValue method; public static final String JSON_PROPERTY_REFERENCE = "reference"; @@ -59,7 +59,7 @@ public VerificationStartRequestSmsImpl() {} protected VerificationStartRequestSmsImpl( OptionalValue identity, - OptionalValue method, + OptionalValue method, OptionalValue reference, OptionalValue custom, OptionalValue smsOptions) { @@ -82,13 +82,13 @@ public OptionalValue identity() { } @JsonIgnore - public VerificationMethod getMethod() { + public VerificationMethodStart getMethod() { return method.orElse(null); } @JsonProperty(JSON_PROPERTY_METHOD) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public OptionalValue method() { + public OptionalValue method() { return method; } @@ -243,7 +243,7 @@ private String toIndentedString(Object o) { @JsonPOJOBuilder(withPrefix = "set") static class Builder implements VerificationStartRequestSms.Builder { OptionalValue identity = OptionalValue.empty(); - OptionalValue method = OptionalValue.of(VerificationMethod.SMS); + OptionalValue method = OptionalValue.of(VerificationMethodStart.SMS); OptionalValue reference = OptionalValue.empty(); OptionalValue custom = OptionalValue.empty(); OptionalValue smsOptions = OptionalValue.empty(); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartFlashCallOptions.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartFlashCallOptions.java index 76189cc6f..cc6a762a2 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartFlashCallOptions.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartFlashCallOptions.java @@ -15,7 +15,8 @@ /** * An optional object for Flash Call Verification, considered only when the verification request * originates from your backend (not an SDK client) via an Application signed request. + * href="https://developers.sinch.com/docs/voice/api-reference/authentication/signed-request">Application + * signed request. */ @JsonDeserialize(builder = VerificationStartFlashCallOptionsImpl.Builder.class) public interface VerificationStartFlashCallOptions { diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseDataImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseDataImpl.java index ef8cf4715..0d2cef702 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseDataImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseDataImpl.java @@ -13,7 +13,7 @@ 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.VerificationMethod; +import com.sinch.sdk.domains.verification.models.v1.start.internal.VerificationMethodStart; import com.sinch.sdk.domains.verification.models.v1.start.response.internal.VerificationStartResponseDataContent; import com.sinch.sdk.domains.verification.models.v1.start.response.internal.VerificationStartResponseDataContentImpl; import java.io.IOException; @@ -40,7 +40,7 @@ public class VerificationStartResponseDataImpl public static final String JSON_PROPERTY_METHOD = "method"; - private OptionalValue method; + private OptionalValue method; public static final String JSON_PROPERTY_LINKS = "_links"; @@ -54,7 +54,7 @@ public VerificationStartResponseDataImpl() {} protected VerificationStartResponseDataImpl( OptionalValue id, - OptionalValue method, + OptionalValue method, OptionalValue> links, OptionalValue seamless) { this.id = id; @@ -75,13 +75,13 @@ public OptionalValue id() { } @JsonIgnore - public VerificationMethod getMethod() { + public VerificationMethodStart getMethod() { return method.orElse(null); } @JsonProperty(JSON_PROPERTY_METHOD) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public OptionalValue method() { + public OptionalValue method() { return method; } @@ -170,7 +170,7 @@ private String toIndentedString(Object o) { @JsonPOJOBuilder(withPrefix = "set") static class Builder implements VerificationStartResponseData.Builder { OptionalValue id = OptionalValue.empty(); - OptionalValue method = OptionalValue.of(VerificationMethod.DATA); + OptionalValue method = OptionalValue.of(VerificationMethodStart.DATA); OptionalValue> links = OptionalValue.empty(); OptionalValue seamless = OptionalValue.empty(); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseFlashCallImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseFlashCallImpl.java index 55c54250a..78ff0eb65 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseFlashCallImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseFlashCallImpl.java @@ -13,7 +13,7 @@ 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.VerificationMethod; +import com.sinch.sdk.domains.verification.models.v1.start.internal.VerificationMethodStart; import com.sinch.sdk.domains.verification.models.v1.start.response.internal.VerificationStartResponseFlashCallContent; import com.sinch.sdk.domains.verification.models.v1.start.response.internal.VerificationStartResponseFlashCallContentImpl; import java.io.IOException; @@ -40,7 +40,7 @@ public class VerificationStartResponseFlashCallImpl public static final String JSON_PROPERTY_METHOD = "method"; - private OptionalValue method; + private OptionalValue method; public static final String JSON_PROPERTY_LINKS = "_links"; @@ -54,7 +54,7 @@ public VerificationStartResponseFlashCallImpl() {} protected VerificationStartResponseFlashCallImpl( OptionalValue id, - OptionalValue method, + OptionalValue method, OptionalValue> links, OptionalValue flashCall) { this.id = id; @@ -75,13 +75,13 @@ public OptionalValue id() { } @JsonIgnore - public VerificationMethod getMethod() { + public VerificationMethodStart getMethod() { return method.orElse(null); } @JsonProperty(JSON_PROPERTY_METHOD) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public OptionalValue method() { + public OptionalValue method() { return method; } @@ -220,7 +220,8 @@ private String toIndentedString(Object o) { @JsonPOJOBuilder(withPrefix = "set") static class Builder implements VerificationStartResponseFlashCall.Builder { OptionalValue id = OptionalValue.empty(); - OptionalValue method = OptionalValue.of(VerificationMethod.FLASH_CALL); + OptionalValue method = + OptionalValue.of(VerificationMethodStart.FLASH_CALL); OptionalValue> links = OptionalValue.empty(); OptionalValue flashCall = OptionalValue.empty(); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponsePhoneCallImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponsePhoneCallImpl.java index 91cf8e565..5fa39f28d 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponsePhoneCallImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponsePhoneCallImpl.java @@ -7,7 +7,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.verification.models.v1.VerificationMethod; +import com.sinch.sdk.domains.verification.models.v1.start.internal.VerificationMethodStart; import java.util.List; import java.util.Objects; @@ -29,7 +29,7 @@ public class VerificationStartResponsePhoneCallImpl public static final String JSON_PROPERTY_METHOD = "method"; - private OptionalValue method; + private OptionalValue method; public static final String JSON_PROPERTY_LINKS = "_links"; @@ -39,7 +39,7 @@ public VerificationStartResponsePhoneCallImpl() {} protected VerificationStartResponsePhoneCallImpl( OptionalValue id, - OptionalValue method, + OptionalValue method, OptionalValue> links) { this.id = id; this.method = method; @@ -58,13 +58,13 @@ public OptionalValue id() { } @JsonIgnore - public VerificationMethod getMethod() { + public VerificationMethodStart getMethod() { return method.orElse(null); } @JsonProperty(JSON_PROPERTY_METHOD) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public OptionalValue method() { + public OptionalValue method() { return method; } @@ -124,7 +124,8 @@ private String toIndentedString(Object o) { @JsonPOJOBuilder(withPrefix = "set") static class Builder implements VerificationStartResponsePhoneCall.Builder { OptionalValue id = OptionalValue.empty(); - OptionalValue method = OptionalValue.of(VerificationMethod.PHONE_CALL); + OptionalValue method = + OptionalValue.of(VerificationMethodStart.PHONE_CALL); OptionalValue> links = OptionalValue.empty(); @JsonProperty(value = JSON_PROPERTY_ID, required = true) diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseSmsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseSmsImpl.java index cb82ee2a2..d252843ee 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseSmsImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseSmsImpl.java @@ -13,7 +13,7 @@ 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.VerificationMethod; +import com.sinch.sdk.domains.verification.models.v1.start.internal.VerificationMethodStart; import com.sinch.sdk.domains.verification.models.v1.start.response.internal.VerificationStartResponseSmsContent; import com.sinch.sdk.domains.verification.models.v1.start.response.internal.VerificationStartResponseSmsContentImpl; import java.io.IOException; @@ -40,7 +40,7 @@ public class VerificationStartResponseSmsImpl public static final String JSON_PROPERTY_METHOD = "method"; - private OptionalValue method; + private OptionalValue method; public static final String JSON_PROPERTY_LINKS = "_links"; @@ -54,7 +54,7 @@ public VerificationStartResponseSmsImpl() {} protected VerificationStartResponseSmsImpl( OptionalValue id, - OptionalValue method, + OptionalValue method, OptionalValue> links, OptionalValue sms) { this.id = id; @@ -75,13 +75,13 @@ public OptionalValue id() { } @JsonIgnore - public VerificationMethod getMethod() { + public VerificationMethodStart getMethod() { return method.orElse(null); } @JsonProperty(JSON_PROPERTY_METHOD) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public OptionalValue method() { + public OptionalValue method() { return method; } @@ -184,7 +184,7 @@ private String toIndentedString(Object o) { @JsonPOJOBuilder(withPrefix = "set") static class Builder implements VerificationStartResponseSms.Builder { OptionalValue id = OptionalValue.empty(); - OptionalValue method = OptionalValue.of(VerificationMethod.SMS); + OptionalValue method = OptionalValue.of(VerificationMethodStart.SMS); OptionalValue> links = OptionalValue.empty(); OptionalValue sms = OptionalValue.empty(); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/StatusSource.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/StatusSource.java index b67003f83..d0d09ecbd 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/StatusSource.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/StatusSource.java @@ -6,16 +6,16 @@ import java.util.stream.Stream; /** - * With the PIN SMS verification method, a user's phone number is verified by sending an SMS - * containing a PIN code that must be manually returned. If you are are using an Android handset, - * you could instead intercept the SMS message delivery and capture the PIN code automatically. + * With the SMS verification method, a user's phone number is verified by sending an SMS containing + * an OTP code that must be manually returned. If you are are using an Android handset, you could + * instead intercept the SMS message delivery and capture the OTP code automatically. */ public class StatusSource extends EnumDynamic { - /** PIN verification was performed automatically */ + /** OTP verification was performed automatically */ public static final StatusSource INTERCEPTED = new StatusSource("intercepted"); - /** PIN verification was manually performed */ + /** OTP verification was manually performed */ public static final StatusSource MANUAL = new StatusSource("manual"); private static final EnumSupportDynamic ENUM_SUPPORT = diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponse.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponse.java index aec7f6b16..655e1025e 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponse.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponse.java @@ -40,7 +40,12 @@ public interface VerificationStatusResponse { VerificationStatusReason getReason(); /** - * The reference ID that was optionally passed together with the verification request. + * Used to pass your own reference in the request for tracking purposes. Must be a unique value + * for each started verification request. The value must be encodable in the URL path segment. + * This value is passed to all events and returned from the status and report endpoints. The + * reference can be used to check the status + * of verifications, like with ID or identity. * * @return reference */ diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponseFlashCall.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponseFlashCall.java index 85bede12a..a869f33ff 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponseFlashCall.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponseFlashCall.java @@ -51,7 +51,12 @@ public interface VerificationStatusResponseFlashCall VerificationStatusReason getReason(); /** - * The reference ID that was optionally passed together with the verification request. + * Used to pass your own reference in the request for tracking purposes. Must be a unique value + * for each started verification request. The value must be encodable in the URL path segment. + * This value is passed to all events and returned from the status and report endpoints. The + * reference can be used to check the status + * of verifications, like with ID or identity. * * @return reference */ diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponsePhoneCall.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponsePhoneCall.java index b0bd3aa48..fda41784d 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponsePhoneCall.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponsePhoneCall.java @@ -50,7 +50,12 @@ public interface VerificationStatusResponsePhoneCall VerificationStatusReason getReason(); /** - * The reference ID that was optionally passed together with the verification request. + * Used to pass your own reference in the request for tracking purposes. Must be a unique value + * for each started verification request. The value must be encodable in the URL path segment. + * This value is passed to all events and returned from the status and report endpoints. The + * reference can be used to check the status + * of verifications, like with ID or identity. * * @return reference */ diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponseSms.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponseSms.java index 426c33afd..5dfb98fef 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponseSms.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponseSms.java @@ -49,7 +49,12 @@ public interface VerificationStatusResponseSms VerificationStatusReason getReason(); /** - * The reference ID that was optionally passed together with the verification request. + * Used to pass your own reference in the request for tracking purposes. Must be a unique value + * for each started verification request. The value must be encodable in the URL path segment. + * This value is passed to all events and returned from the status and report endpoints. The + * reference can be used to check the status + * of verifications, like with ID or identity. * * @return reference */ 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/webhooks/VerificationEvent.java index ebeee3b5e..e6e3d57f3 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/webhooks/VerificationEvent.java @@ -11,6 +11,7 @@ package com.sinch.sdk.domains.verification.models.v1.webhooks; import com.sinch.sdk.domains.verification.models.v1.Identity; +import com.sinch.sdk.domains.verification.models.v1.VerificationMethod; /** VerificationEvent */ public interface VerificationEvent { @@ -24,6 +25,15 @@ public interface VerificationEvent { */ String getId(); + /** + * Get method + * + *

Field is required + * + * @return method + */ + VerificationMethod getMethod(); + /** * Get identity * @@ -34,14 +44,20 @@ public interface VerificationEvent { Identity getIdentity(); /** - * Used to pass your own reference in the request for tracking purposes. + * Used to pass your own reference in the request for tracking purposes. Must be a unique value + * for each started verification request. The value must be encodable in the URL path segment. + * This value is passed to all events and returned from the status and report endpoints. The + * reference can be used to check the status + * of verifications, like with ID or identity. * * @return reference */ String getReference(); /** - * Can be used to pass custom data in the request. + * Can be used to pass custom data in the request. Will be passed to all events. Max length 4096 + * characters, can be arbitrary text data. * * @return custom */ @@ -59,6 +75,15 @@ interface Builder { */ Builder setId(String id); + /** + * see getter + * + * @param method see getter + * @return Current builder + * @see #getMethod + */ + Builder setMethod(VerificationMethod method); + /** * see getter * 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/webhooks/VerificationRequestEvent.java index 72434f800..92634412f 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/webhooks/VerificationRequestEvent.java @@ -15,6 +15,7 @@ import com.sinch.sdk.core.utils.EnumSupportDynamic; import com.sinch.sdk.domains.verification.models.v1.Identity; import com.sinch.sdk.domains.verification.models.v1.Price; +import com.sinch.sdk.domains.verification.models.v1.VerificationMethod; import java.util.Arrays; import java.util.List; import java.util.stream.Stream; @@ -60,13 +61,13 @@ public static String valueOf(EventEnum e) { } /** - * The type of the event. + * Get method * *

Field is required * - * @return event + * @return method */ - EventEnum getEvent(); + VerificationMethod getMethod(); /** * Get identity @@ -78,55 +79,25 @@ public static String valueOf(EventEnum e) { Identity getIdentity(); /** - * Used to pass your own reference in the request for tracking purposes. + * Used to pass your own reference in the request for tracking purposes. Must be a unique value + * for each started verification request. The value must be encodable in the URL path segment. + * This value is passed to all events and returned from the status and report endpoints. The + * reference can be used to check the status + * of verifications, like with ID or identity. * * @return reference */ String getReference(); /** - * Can be used to pass custom data in the request. + * Can be used to pass custom data in the request. Will be passed to all events. Max length 4096 + * characters, can be arbitrary text data. * * @return custom */ String getCustom(); - /** The verification method. */ - public class MethodEnum extends EnumDynamic { - public static final MethodEnum SMS = new MethodEnum("sms"); - public static final MethodEnum FLASH_CALL = new MethodEnum("flashcall"); - public static final MethodEnum PHONE_CALL = new MethodEnum("callout"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - MethodEnum.class, MethodEnum::new, Arrays.asList(SMS, FLASH_CALL, PHONE_CALL)); - - private MethodEnum(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static MethodEnum from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(MethodEnum e) { - return ENUM_SUPPORT.valueOf(e); - } - } - - /** - * The verification method. - * - *

Field is required - * - * @return method - */ - MethodEnum getMethod(); - /** * Get price * @@ -173,11 +144,11 @@ interface Builder /** * see getter * - * @param event see getter + * @param method see getter * @return Current builder - * @see #getEvent + * @see #getMethod */ - Builder setEvent(EventEnum event); + Builder setMethod(VerificationMethod method); /** * see getter @@ -206,15 +177,6 @@ interface Builder */ Builder setCustom(String custom); - /** - * see getter - * - * @param method see getter - * @return Current builder - * @see #getMethod - */ - Builder setMethod(MethodEnum method); - /** * see getter * 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/webhooks/VerificationRequestEventImpl.java index 0f0c97fb0..21d8e1cda 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/webhooks/VerificationRequestEventImpl.java @@ -9,16 +9,17 @@ import com.sinch.sdk.core.models.OptionalValue; import com.sinch.sdk.domains.verification.models.v1.Identity; import com.sinch.sdk.domains.verification.models.v1.Price; +import com.sinch.sdk.domains.verification.models.v1.VerificationMethod; import java.util.List; 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_METHOD, VerificationRequestEventImpl.JSON_PROPERTY_PRICE, VerificationRequestEventImpl.JSON_PROPERTY_ACCEPT_LANGUAGE }) @@ -37,6 +38,10 @@ public class VerificationRequestEventImpl private OptionalValue event; + public static final String JSON_PROPERTY_METHOD = "method"; + + private OptionalValue method; + public static final String JSON_PROPERTY_IDENTITY = "identity"; private OptionalValue identity; @@ -49,10 +54,6 @@ public class VerificationRequestEventImpl private OptionalValue custom; - public static final String JSON_PROPERTY_METHOD = "method"; - - private OptionalValue method; - public static final String JSON_PROPERTY_PRICE = "price"; private OptionalValue price; @@ -66,18 +67,18 @@ public VerificationRequestEventImpl() {} protected VerificationRequestEventImpl( OptionalValue id, OptionalValue event, + OptionalValue method, OptionalValue identity, OptionalValue reference, OptionalValue custom, - OptionalValue method, OptionalValue price, OptionalValue> acceptLanguage) { this.id = id; this.event = event; + this.method = method; this.identity = identity; this.reference = reference; this.custom = custom; - this.method = method; this.price = price; this.acceptLanguage = acceptLanguage; } @@ -104,6 +105,17 @@ public OptionalValue event() { return event; } + @JsonIgnore + public VerificationMethod getMethod() { + return method.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_METHOD) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue method() { + return method; + } + @JsonIgnore public Identity getIdentity() { return identity.orElse(null); @@ -137,17 +149,6 @@ public OptionalValue custom() { return custom; } - @JsonIgnore - public MethodEnum getMethod() { - return method.orElse(null); - } - - @JsonProperty(JSON_PROPERTY_METHOD) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public OptionalValue method() { - return method; - } - @JsonIgnore public Price getPrice() { return price.orElse(null); @@ -182,17 +183,17 @@ public boolean equals(Object o) { VerificationRequestEventImpl verificationRequestEvent = (VerificationRequestEventImpl) o; return Objects.equals(this.id, verificationRequestEvent.id) && Objects.equals(this.event, verificationRequestEvent.event) + && Objects.equals(this.method, verificationRequestEvent.method) && Objects.equals(this.identity, verificationRequestEvent.identity) && Objects.equals(this.reference, verificationRequestEvent.reference) && Objects.equals(this.custom, verificationRequestEvent.custom) - && Objects.equals(this.method, verificationRequestEvent.method) && Objects.equals(this.price, verificationRequestEvent.price) && Objects.equals(this.acceptLanguage, verificationRequestEvent.acceptLanguage); } @Override public int hashCode() { - return Objects.hash(id, event, identity, reference, custom, method, price, acceptLanguage); + return Objects.hash(id, event, method, identity, reference, custom, price, acceptLanguage); } @Override @@ -201,10 +202,10 @@ public String toString() { sb.append("class VerificationRequestEventImpl {\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"); sb.append(" identity: ").append(toIndentedString(identity)).append("\n"); sb.append(" reference: ").append(toIndentedString(reference)).append("\n"); sb.append(" custom: ").append(toIndentedString(custom)).append("\n"); - sb.append(" method: ").append(toIndentedString(method)).append("\n"); sb.append(" price: ").append(toIndentedString(price)).append("\n"); sb.append(" acceptLanguage: ").append(toIndentedString(acceptLanguage)).append("\n"); sb.append("}"); @@ -224,11 +225,11 @@ private String toIndentedString(Object o) { @JsonPOJOBuilder(withPrefix = "set") static class Builder implements VerificationRequestEvent.Builder { OptionalValue id = OptionalValue.empty(); - OptionalValue event = OptionalValue.empty(); + OptionalValue event = OptionalValue.of(EventEnum.VERIFICATION_REQUEST_EVENT); + OptionalValue method = OptionalValue.empty(); OptionalValue identity = OptionalValue.empty(); OptionalValue reference = OptionalValue.empty(); OptionalValue custom = OptionalValue.empty(); - OptionalValue method = OptionalValue.empty(); OptionalValue price = OptionalValue.empty(); OptionalValue> acceptLanguage = OptionalValue.empty(); @@ -238,9 +239,9 @@ public Builder setId(String id) { return this; } - @JsonProperty(value = JSON_PROPERTY_EVENT, required = true) - public Builder setEvent(EventEnum event) { - this.event = OptionalValue.of(event); + @JsonProperty(value = JSON_PROPERTY_METHOD, required = true) + public Builder setMethod(VerificationMethod method) { + this.method = OptionalValue.of(method); return this; } @@ -262,12 +263,6 @@ public Builder setCustom(String custom) { return this; } - @JsonProperty(value = JSON_PROPERTY_METHOD, required = true) - public Builder setMethod(MethodEnum method) { - this.method = OptionalValue.of(method); - return this; - } - @JsonProperty(JSON_PROPERTY_PRICE) public Builder setPrice(Price price) { this.price = OptionalValue.of(price); @@ -282,7 +277,7 @@ public Builder setAcceptLanguage(List acceptLanguage) { public VerificationRequestEvent build() { return new VerificationRequestEventImpl( - id, event, identity, reference, custom, method, price, acceptLanguage); + id, event, method, identity, reference, custom, price, acceptLanguage); } } } 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/webhooks/VerificationRequestEventResponsePhoneCall.java index b60b20418..50159528e 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/webhooks/VerificationRequestEventResponsePhoneCall.java @@ -28,9 +28,9 @@ public interface VerificationRequestEventResponsePhoneCall VerificationEventResponseAction getAction(); /** - * The Phone Call PIN that should be entered by the user. Sinch servers automatically generate PIN - * codes for Phone Call verification. If you want to set your own code, you can specify it in the - * response to the Verification Request Event. + * The Phone Call OTP code that should be entered by the user. Sinch servers automatically + * generate OTP codes for Phone Call verification. If you want to set your own code, you can + * specify it in the response to the Verification Request Event. * * @return code */ 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/webhooks/VerificationRequestEventResponseSms.java index 2d9b78709..01e8f2cfc 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/webhooks/VerificationRequestEventResponseSms.java @@ -28,9 +28,9 @@ public interface VerificationRequestEventResponseSms VerificationEventResponseAction getAction(); /** - * The SMS PIN that should be used. By default, the Sinch dashboard will automatically generate - * PIN codes for SMS verification. If you want to set your own PIN, you can specify it in the - * response to the Verification Request Event. + * The SMS OTP code that should be used. By default, the Sinch dashboard will automatically + * generate OTP codes for SMS verification. If you want to set your own OTP, you can specify it in + * the response to the Verification Request Event. * * @return code */ 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/webhooks/VerificationResultEvent.java index 45af2878b..b32259d41 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/webhooks/VerificationResultEvent.java @@ -62,13 +62,13 @@ public static String valueOf(EventEnum e) { } /** - * The type of the event. + * Get method * *

Field is required * - * @return event + * @return method */ - EventEnum getEvent(); + VerificationMethod getMethod(); /** * Get identity @@ -80,28 +80,25 @@ public static String valueOf(EventEnum e) { Identity getIdentity(); /** - * Used to pass your own reference in the request for tracking purposes. + * Used to pass your own reference in the request for tracking purposes. Must be a unique value + * for each started verification request. The value must be encodable in the URL path segment. + * This value is passed to all events and returned from the status and report endpoints. The + * reference can be used to check the status + * of verifications, like with ID or identity. * * @return reference */ String getReference(); /** - * Can be used to pass custom data in the request. + * Can be used to pass custom data in the request. Will be passed to all events. Max length 4096 + * characters, can be arbitrary text data. * * @return custom */ String getCustom(); - /** - * Get method - * - *

Field is required - * - * @return method - */ - VerificationMethod getMethod(); - /** * Get status * @@ -150,11 +147,11 @@ interface Builder /** * see getter * - * @param event see getter + * @param method see getter * @return Current builder - * @see #getEvent + * @see #getMethod */ - Builder setEvent(EventEnum event); + Builder setMethod(VerificationMethod method); /** * see getter @@ -183,15 +180,6 @@ interface Builder */ Builder setCustom(String custom); - /** - * see getter - * - * @param method see getter - * @return Current builder - * @see #getMethod - */ - Builder setMethod(VerificationMethod method); - /** * 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/webhooks/VerificationResultEventImpl.java index e6c35c772..d89066546 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/webhooks/VerificationResultEventImpl.java @@ -17,10 +17,10 @@ @JsonPropertyOrder({ VerificationResultEventImpl.JSON_PROPERTY_ID, VerificationResultEventImpl.JSON_PROPERTY_EVENT, + VerificationResultEventImpl.JSON_PROPERTY_METHOD, VerificationResultEventImpl.JSON_PROPERTY_IDENTITY, VerificationResultEventImpl.JSON_PROPERTY_REFERENCE, VerificationResultEventImpl.JSON_PROPERTY_CUSTOM, - VerificationResultEventImpl.JSON_PROPERTY_METHOD, VerificationResultEventImpl.JSON_PROPERTY_STATUS, VerificationResultEventImpl.JSON_PROPERTY_REASON, VerificationResultEventImpl.JSON_PROPERTY_SOURCE @@ -40,6 +40,10 @@ public class VerificationResultEventImpl private OptionalValue event; + public static final String JSON_PROPERTY_METHOD = "method"; + + private OptionalValue method; + public static final String JSON_PROPERTY_IDENTITY = "identity"; private OptionalValue identity; @@ -52,10 +56,6 @@ public class VerificationResultEventImpl private OptionalValue custom; - public static final String JSON_PROPERTY_METHOD = "method"; - - private OptionalValue method; - public static final String JSON_PROPERTY_STATUS = "status"; private OptionalValue status; @@ -73,19 +73,19 @@ public VerificationResultEventImpl() {} protected VerificationResultEventImpl( OptionalValue id, OptionalValue event, + OptionalValue method, OptionalValue identity, OptionalValue reference, OptionalValue custom, - OptionalValue method, OptionalValue status, OptionalValue reason, OptionalValue source) { this.id = id; this.event = event; + this.method = method; this.identity = identity; this.reference = reference; this.custom = custom; - this.method = method; this.status = status; this.reason = reason; this.source = source; @@ -113,6 +113,17 @@ public OptionalValue event() { return event; } + @JsonIgnore + public VerificationMethod getMethod() { + return method.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_METHOD) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue method() { + return method; + } + @JsonIgnore public Identity getIdentity() { return identity.orElse(null); @@ -146,17 +157,6 @@ public OptionalValue custom() { return custom; } - @JsonIgnore - public VerificationMethod getMethod() { - return method.orElse(null); - } - - @JsonProperty(JSON_PROPERTY_METHOD) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public OptionalValue method() { - return method; - } - @JsonIgnore public VerificationStatus getStatus() { return status.orElse(null); @@ -202,10 +202,10 @@ public boolean equals(Object o) { VerificationResultEventImpl verificationResultEvent = (VerificationResultEventImpl) o; return Objects.equals(this.id, verificationResultEvent.id) && Objects.equals(this.event, verificationResultEvent.event) + && Objects.equals(this.method, verificationResultEvent.method) && Objects.equals(this.identity, verificationResultEvent.identity) && Objects.equals(this.reference, verificationResultEvent.reference) && Objects.equals(this.custom, verificationResultEvent.custom) - && Objects.equals(this.method, verificationResultEvent.method) && Objects.equals(this.status, verificationResultEvent.status) && Objects.equals(this.reason, verificationResultEvent.reason) && Objects.equals(this.source, verificationResultEvent.source); @@ -213,7 +213,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(id, event, identity, reference, custom, method, status, reason, source); + return Objects.hash(id, event, method, identity, reference, custom, status, reason, source); } @Override @@ -222,10 +222,10 @@ public String toString() { sb.append("class VerificationResultEventImpl {\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"); sb.append(" identity: ").append(toIndentedString(identity)).append("\n"); sb.append(" reference: ").append(toIndentedString(reference)).append("\n"); sb.append(" custom: ").append(toIndentedString(custom)).append("\n"); - sb.append(" method: ").append(toIndentedString(method)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); sb.append(" source: ").append(toIndentedString(source)).append("\n"); @@ -246,11 +246,11 @@ private String toIndentedString(Object o) { @JsonPOJOBuilder(withPrefix = "set") static class Builder implements VerificationResultEvent.Builder { OptionalValue id = OptionalValue.empty(); - OptionalValue event = OptionalValue.empty(); + OptionalValue event = OptionalValue.of(EventEnum.VERIFICATION_RESULT_EVENT); + OptionalValue method = OptionalValue.empty(); OptionalValue identity = OptionalValue.empty(); OptionalValue reference = OptionalValue.empty(); OptionalValue custom = OptionalValue.empty(); - OptionalValue method = OptionalValue.empty(); OptionalValue status = OptionalValue.empty(); OptionalValue reason = OptionalValue.empty(); OptionalValue source = OptionalValue.empty(); @@ -261,9 +261,9 @@ public Builder setId(String id) { return this; } - @JsonProperty(value = JSON_PROPERTY_EVENT, required = true) - public Builder setEvent(EventEnum event) { - this.event = OptionalValue.of(event); + @JsonProperty(value = JSON_PROPERTY_METHOD, required = true) + public Builder setMethod(VerificationMethod method) { + this.method = OptionalValue.of(method); return this; } @@ -285,12 +285,6 @@ public Builder setCustom(String custom) { return this; } - @JsonProperty(value = JSON_PROPERTY_METHOD, required = true) - public Builder setMethod(VerificationMethod method) { - this.method = OptionalValue.of(method); - return this; - } - @JsonProperty(value = JSON_PROPERTY_STATUS, required = true) public Builder setStatus(VerificationStatus status) { this.status = OptionalValue.of(status); @@ -311,7 +305,7 @@ public Builder setSource(StatusSource source) { public VerificationResultEvent build() { return new VerificationResultEventImpl( - id, event, identity, reference, custom, method, status, reason, source); + id, event, method, identity, reference, custom, status, reason, source); } } } 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/webhooks/VerificationSmsDeliveredEvent.java new file mode 100644 index 000000000..8bdaccec2 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationSmsDeliveredEvent.java @@ -0,0 +1,208 @@ +/* + * Verification | Sinch + * + * OpenAPI document version: 2.0.1 + * Contact: support@sinch.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit the class manually. + */ + +package com.sinch.sdk.domains.verification.models.v1.webhooks; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.sinch.sdk.core.utils.EnumDynamic; +import com.sinch.sdk.core.utils.EnumSupportDynamic; +import com.sinch.sdk.domains.verification.models.v1.Identity; +import com.sinch.sdk.domains.verification.models.v1.VerificationMethod; +import java.util.Arrays; +import java.util.stream.Stream; + +/** VerificationSmsDeliveredEvent */ +@JsonDeserialize(builder = VerificationSmsDeliveredEventImpl.Builder.class) +public interface VerificationSmsDeliveredEvent + extends com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationEvent { + + /** + * The ID of the verification request. + * + *

Field is required + * + * @return id + */ + String getId(); + + /** The type of the event. */ + public class EventEnum extends EnumDynamic { + public static final EventEnum VERIFICATION_SMS_DELIVERED_EVENT = + new EventEnum("VerificationSmsDeliveredEvent"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>( + EventEnum.class, EventEnum::new, Arrays.asList(VERIFICATION_SMS_DELIVERED_EVENT)); + + private EventEnum(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static EventEnum from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(EventEnum e) { + return ENUM_SUPPORT.valueOf(e); + } + } + + /** + * Get method + * + *

Field is required + * + * @return method + */ + VerificationMethod getMethod(); + + /** + * Get identity + * + *

Field is required + * + * @return identity + */ + Identity getIdentity(); + + /** + * Used to pass your own reference in the request for tracking purposes. Must be a unique value + * for each started verification request. The value must be encodable in the URL path segment. + * This value is passed to all events and returned from the status and report endpoints. The + * reference can be used to check the status + * of verifications, like with ID or identity. + * + * @return reference + */ + String getReference(); + + /** + * Can be used to pass custom data in the request. Will be passed to all events. Max length 4096 + * characters, can be arbitrary text data. + * + * @return custom + */ + String getCustom(); + + /** The result of the SMS delivery. Possible values can be extended in the future. */ + public class SmsResultEnum extends EnumDynamic { + public static final SmsResultEnum SUCCESSFUL = new SmsResultEnum("Successful"); + public static final SmsResultEnum FAILED = new SmsResultEnum("Failed"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>( + SmsResultEnum.class, SmsResultEnum::new, Arrays.asList(SUCCESSFUL, FAILED)); + + private SmsResultEnum(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static SmsResultEnum from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(SmsResultEnum e) { + return ENUM_SUPPORT.valueOf(e); + } + } + + /** + * The result of the SMS delivery. Possible values can be extended in the future. + * + *

Field is required + * + * @return smsResult + */ + SmsResultEnum getSmsResult(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new VerificationSmsDeliveredEventImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder + extends com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationEvent.Builder { + + /** + * see getter + * + * @param id see getter + * @return Current builder + * @see #getId + */ + Builder setId(String id); + + /** + * see getter + * + * @param method see getter + * @return Current builder + * @see #getMethod + */ + Builder setMethod(VerificationMethod method); + + /** + * see getter + * + * @param identity see getter + * @return Current builder + * @see #getIdentity + */ + Builder setIdentity(Identity identity); + + /** + * see getter + * + * @param reference see getter + * @return Current builder + * @see #getReference + */ + Builder setReference(String reference); + + /** + * see getter + * + * @param custom see getter + * @return Current builder + * @see #getCustom + */ + Builder setCustom(String custom); + + /** + * see getter + * + * @param smsResult see getter + * @return Current builder + * @see #getSmsResult + */ + Builder setSmsResult(SmsResultEnum smsResult); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + VerificationSmsDeliveredEvent build(); + } +} 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/webhooks/VerificationSmsDeliveredEventImpl.java new file mode 100644 index 000000000..9c41a27f6 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationSmsDeliveredEventImpl.java @@ -0,0 +1,255 @@ +package com.sinch.sdk.domains.verification.models.v1.webhooks; + +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; +import com.sinch.sdk.core.models.OptionalValue; +import com.sinch.sdk.domains.verification.models.v1.Identity; +import com.sinch.sdk.domains.verification.models.v1.VerificationMethod; +import java.util.Objects; + +@JsonPropertyOrder({ + VerificationSmsDeliveredEventImpl.JSON_PROPERTY_ID, + VerificationSmsDeliveredEventImpl.JSON_PROPERTY_EVENT, + VerificationSmsDeliveredEventImpl.JSON_PROPERTY_METHOD, + VerificationSmsDeliveredEventImpl.JSON_PROPERTY_IDENTITY, + VerificationSmsDeliveredEventImpl.JSON_PROPERTY_REFERENCE, + VerificationSmsDeliveredEventImpl.JSON_PROPERTY_CUSTOM, + VerificationSmsDeliveredEventImpl.JSON_PROPERTY_SMS_RESULT +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class VerificationSmsDeliveredEventImpl + implements VerificationSmsDeliveredEvent, + com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationEvent { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_ID = "id"; + + private OptionalValue id; + + public static final String JSON_PROPERTY_EVENT = "event"; + + private OptionalValue event; + + public static final String JSON_PROPERTY_METHOD = "method"; + + private OptionalValue method; + + public static final String JSON_PROPERTY_IDENTITY = "identity"; + + private OptionalValue identity; + + public static final String JSON_PROPERTY_REFERENCE = "reference"; + + private OptionalValue reference; + + public static final String JSON_PROPERTY_CUSTOM = "custom"; + + private OptionalValue custom; + + public static final String JSON_PROPERTY_SMS_RESULT = "smsResult"; + + private OptionalValue smsResult; + + public VerificationSmsDeliveredEventImpl() {} + + protected VerificationSmsDeliveredEventImpl( + OptionalValue id, + OptionalValue event, + OptionalValue method, + OptionalValue identity, + OptionalValue reference, + OptionalValue custom, + OptionalValue smsResult) { + this.id = id; + this.event = event; + this.method = method; + this.identity = identity; + this.reference = reference; + this.custom = custom; + this.smsResult = smsResult; + } + + @JsonIgnore + public String getId() { + return id.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue id() { + return id; + } + + @JsonIgnore + public EventEnum getEvent() { + return event.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_EVENT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue event() { + return event; + } + + @JsonIgnore + public VerificationMethod getMethod() { + return method.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_METHOD) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue method() { + return method; + } + + @JsonIgnore + public Identity getIdentity() { + return identity.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_IDENTITY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue identity() { + return identity; + } + + @JsonIgnore + public String getReference() { + return reference.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_REFERENCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue reference() { + return reference; + } + + @JsonIgnore + public String getCustom() { + return custom.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CUSTOM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue custom() { + return custom; + } + + @JsonIgnore + public SmsResultEnum getSmsResult() { + return smsResult.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_SMS_RESULT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue smsResult() { + return smsResult; + } + + /** Return true if this VerificationSmsDeliveredEvent object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerificationSmsDeliveredEventImpl verificationSmsDeliveredEvent = + (VerificationSmsDeliveredEventImpl) o; + return Objects.equals(this.id, verificationSmsDeliveredEvent.id) + && Objects.equals(this.event, verificationSmsDeliveredEvent.event) + && Objects.equals(this.method, verificationSmsDeliveredEvent.method) + && Objects.equals(this.identity, verificationSmsDeliveredEvent.identity) + && Objects.equals(this.reference, verificationSmsDeliveredEvent.reference) + && Objects.equals(this.custom, verificationSmsDeliveredEvent.custom) + && Objects.equals(this.smsResult, verificationSmsDeliveredEvent.smsResult); + } + + @Override + public int hashCode() { + return Objects.hash(id, event, method, identity, reference, custom, smsResult); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerificationSmsDeliveredEventImpl {\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"); + sb.append(" identity: ").append(toIndentedString(identity)).append("\n"); + sb.append(" reference: ").append(toIndentedString(reference)).append("\n"); + sb.append(" custom: ").append(toIndentedString(custom)).append("\n"); + sb.append(" smsResult: ").append(toIndentedString(smsResult)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + @JsonPOJOBuilder(withPrefix = "set") + static class Builder implements VerificationSmsDeliveredEvent.Builder { + OptionalValue id = OptionalValue.empty(); + OptionalValue event = OptionalValue.of(EventEnum.VERIFICATION_SMS_DELIVERED_EVENT); + OptionalValue method = OptionalValue.empty(); + OptionalValue identity = OptionalValue.empty(); + OptionalValue reference = OptionalValue.empty(); + OptionalValue custom = OptionalValue.empty(); + OptionalValue smsResult = OptionalValue.empty(); + + @JsonProperty(value = JSON_PROPERTY_ID, required = true) + public Builder setId(String id) { + this.id = OptionalValue.of(id); + return this; + } + + @JsonProperty(value = JSON_PROPERTY_METHOD, required = true) + public Builder setMethod(VerificationMethod method) { + this.method = OptionalValue.of(method); + return this; + } + + @JsonProperty(value = JSON_PROPERTY_IDENTITY, required = true) + public Builder setIdentity(Identity identity) { + this.identity = OptionalValue.of(identity); + return this; + } + + @JsonProperty(JSON_PROPERTY_REFERENCE) + public Builder setReference(String reference) { + this.reference = OptionalValue.of(reference); + return this; + } + + @JsonProperty(JSON_PROPERTY_CUSTOM) + public Builder setCustom(String custom) { + this.custom = OptionalValue.of(custom); + return this; + } + + @JsonProperty(value = JSON_PROPERTY_SMS_RESULT, required = true) + public Builder setSmsResult(SmsResultEnum smsResult) { + this.smsResult = OptionalValue.of(smsResult); + return this; + } + + public VerificationSmsDeliveredEvent build() { + return new VerificationSmsDeliveredEventImpl( + id, event, method, identity, reference, custom, smsResult); + } + } +} 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/webhooks/internal/VerificationEventInternalImpl.java index b2658774c..294ee3116 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/webhooks/internal/VerificationEventInternalImpl.java @@ -18,6 +18,7 @@ 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 java.io.IOException; import java.util.Collections; import java.util.HashMap; @@ -87,12 +88,18 @@ public VerificationEventInternalImpl deserialize(JsonParser jp, DeserializationC tree.traverse(jp.getCodec()).readValueAs(VerificationResultEventImpl.class); newVerificationEventInternalImpl.setActualInstance(deserialized); return newVerificationEventInternalImpl; + case "VerificationSmsDeliveredEvent": + deserialized = + tree.traverse(jp.getCodec()).readValueAs(VerificationSmsDeliveredEventImpl.class); + newVerificationEventInternalImpl.setActualInstance(deserialized); + return newVerificationEventInternalImpl; default: log.log( Level.WARNING, String.format( "Failed to lookup discriminator value `%s` for VerificationEventInternalImpl." - + " Possible values: VerificationRequestEvent VerificationResultEvent", + + " Possible values: VerificationRequestEvent VerificationResultEvent" + + " VerificationSmsDeliveredEvent", discriminatorValue)); } @@ -183,6 +190,49 @@ public VerificationEventInternalImpl deserialize(JsonParser jp, DeserializationC log.log(Level.FINER, "Input data does not match schema 'VerificationResultEventImpl'", e); } + // deserialize VerificationSmsDeliveredEventImpl + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (VerificationSmsDeliveredEventImpl.class.equals(Integer.class) + || VerificationSmsDeliveredEventImpl.class.equals(Long.class) + || VerificationSmsDeliveredEventImpl.class.equals(Float.class) + || VerificationSmsDeliveredEventImpl.class.equals(Double.class) + || VerificationSmsDeliveredEventImpl.class.equals(Boolean.class) + || VerificationSmsDeliveredEventImpl.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((VerificationSmsDeliveredEventImpl.class.equals(Integer.class) + || VerificationSmsDeliveredEventImpl.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((VerificationSmsDeliveredEventImpl.class.equals(Float.class) + || VerificationSmsDeliveredEventImpl.class.equals(Double.class)) + && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= + (VerificationSmsDeliveredEventImpl.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (VerificationSmsDeliveredEventImpl.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = + tree.traverse(jp.getCodec()).readValueAs(VerificationSmsDeliveredEventImpl.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 'VerificationSmsDeliveredEventImpl'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, "Input data does not match schema 'VerificationSmsDeliveredEventImpl'", e); + } + if (match == 1) { VerificationEventInternalImpl ret = new VerificationEventInternalImpl(); ret.setActualInstance(deserialized); @@ -221,15 +271,22 @@ public VerificationEventInternalImpl(VerificationResultEventImpl o) { setActualInstance(o); } + public VerificationEventInternalImpl(VerificationSmsDeliveredEventImpl o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + static { schemas.put("VerificationRequestEventImpl", VerificationRequestEventImpl.class); schemas.put("VerificationResultEventImpl", VerificationResultEventImpl.class); + schemas.put("VerificationSmsDeliveredEventImpl", VerificationSmsDeliveredEventImpl.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("VerificationResultEvent", VerificationResultEventImpl.class); + mappings.put("VerificationSmsDeliveredEvent", VerificationSmsDeliveredEventImpl.class); mappings.put("VerificationEvent", VerificationEventInternalImpl.class); JSONNavigator.registerDiscriminator(VerificationEventInternalImpl.class, "event", mappings); } @@ -241,7 +298,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 + * against the oneOf child schemas: VerificationRequestEventImpl, VerificationResultEventImpl, + * VerificationSmsDeliveredEventImpl * *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a * composed schema (allOf, anyOf, oneOf). @@ -260,15 +318,23 @@ public void setActualInstance(Object instance) { return; } + if (JSONNavigator.isInstanceOf( + VerificationSmsDeliveredEventImpl.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException( - "Invalid instance type. Must be VerificationRequestEventImpl, VerificationResultEventImpl"); + "Invalid instance type. Must be VerificationRequestEventImpl, VerificationResultEventImpl," + + " VerificationSmsDeliveredEventImpl"); } /** * Get the actual instance, which can be the following: VerificationRequestEventImpl, - * VerificationResultEventImpl + * VerificationResultEventImpl, VerificationSmsDeliveredEventImpl * - * @return The actual instance (VerificationRequestEventImpl, VerificationResultEventImpl) + * @return The actual instance (VerificationRequestEventImpl, VerificationResultEventImpl, + * VerificationSmsDeliveredEventImpl) */ @Override public Object getActualInstance() { @@ -296,4 +362,16 @@ public VerificationRequestEventImpl getVerificationRequestEventImpl() throws Cla public VerificationResultEventImpl getVerificationResultEventImpl() throws ClassCastException { return (VerificationResultEventImpl) super.getActualInstance(); } + + /** + * Get the actual instance of `VerificationSmsDeliveredEventImpl`. If the actual instance is not + * `VerificationSmsDeliveredEventImpl`, the ClassCastException will be thrown. + * + * @return The actual instance of `VerificationSmsDeliveredEventImpl` + * @throws ClassCastException if the instance is not `VerificationSmsDeliveredEventImpl` + */ + public VerificationSmsDeliveredEventImpl getVerificationSmsDeliveredEventImpl() + throws ClassCastException { + return (VerificationSmsDeliveredEventImpl) super.getActualInstance(); + } } 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/webhooks/internal/VerificationRequestEventResponsePhoneCallContent.java index d4cc347a7..11ef28758 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/webhooks/internal/VerificationRequestEventResponsePhoneCallContent.java @@ -18,9 +18,9 @@ public interface VerificationRequestEventResponsePhoneCallContent { /** - * The Phone Call PIN that should be entered by the user. Sinch servers automatically generate PIN - * codes for Phone Call verification. If you want to set your own code, you can specify it in the - * response to the Verification Request Event. + * The Phone Call OTP code that should be entered by the user. Sinch servers automatically + * generate OTP codes for Phone Call verification. If you want to set your own code, you can + * specify it in the response to the Verification Request Event. * * @return code */ 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/webhooks/internal/VerificationRequestEventResponseSmsContent.java index 44d2b03a0..105be5fdf 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/webhooks/internal/VerificationRequestEventResponseSmsContent.java @@ -18,9 +18,9 @@ public interface VerificationRequestEventResponseSmsContent { /** - * The SMS PIN that should be used. By default, the Sinch dashboard will automatically generate - * PIN codes for SMS verification. If you want to set your own PIN, you can specify it in the - * response to the Verification Request Event. + * The SMS OTP code that should be used. By default, the Sinch dashboard will automatically + * generate OTP codes for SMS verification. If you want to set your own OTP, you can specify it in + * the response to the Verification Request Event. * * @return code */ 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/webhooks/VerificationRequestEventDtoTest.java index 684e98668..e92dcd03f 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/webhooks/VerificationRequestEventDtoTest.java @@ -6,6 +6,7 @@ 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.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; @@ -23,8 +24,7 @@ public class VerificationRequestEventDtoTest extends VerificationBaseTest { (VerificationRequestEventImpl) VerificationRequestEvent.builder() .setId("1234567890") - .setEvent(VerificationRequestEvent.EventEnum.VERIFICATION_REQUEST_EVENT) - .setMethod(VerificationRequestEvent.MethodEnum.SMS) + .setMethod(VerificationMethod.SMS) .setIdentity(NumberIdentity.valueOf("+11235551234")) .setReference("reference string") .setCustom("custom string") 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/webhooks/VerificationResultEventDtoTest.java index 73d066765..956897048 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/webhooks/VerificationResultEventDtoTest.java @@ -10,7 +10,6 @@ import com.sinch.sdk.domains.verification.models.v1.VerificationStatusReason; 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.VerificationResultEvent.EventEnum; 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; @@ -27,7 +26,6 @@ public class VerificationResultEventDtoTest extends VerificationBaseTest { (VerificationResultEventImpl) VerificationResultEvent.builder() .setId("1234567890") - .setEvent(EventEnum.VERIFICATION_RESULT_EVENT) .setMethod(VerificationMethod.SMS) .setIdentity(NumberIdentity.valueOf("+11235551234")) .setReference("reference string") 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/webhooks/VerificationSmsDeliveredEventDtoTest.java new file mode 100644 index 000000000..7fd0d26d7 --- /dev/null +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/webhooks/VerificationSmsDeliveredEventDtoTest.java @@ -0,0 +1,38 @@ +package com.sinch.sdk.domains.verification.models.dto.v1.webhooks; + +import com.adelean.inject.resources.junit.jupiter.GivenJsonResource; +import com.adelean.inject.resources.junit.jupiter.TestWithResources; +import com.sinch.sdk.core.TestHelpers; +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 org.junit.jupiter.api.Test; + +@TestWithResources +public class VerificationSmsDeliveredEventDtoTest extends VerificationBaseTest { + + @GivenJsonResource("/domains/verification/v1/webhooks/VerificationSmsDeliveryEventEventDto.json") + VerificationEventInternal resultEventDto; + + public static VerificationEventInternalImpl expectedResultEvent = + new VerificationEventInternalImpl( + (VerificationSmsDeliveredEventImpl) + VerificationSmsDeliveredEvent.builder() + .setId("1234567890") + .setMethod(VerificationMethod.SMS) + .setIdentity(NumberIdentity.valueOf("+11235551234")) + .setReference("reference string") + .setCustom("custom string") + .setSmsResult(SmsResultEnum.FAILED) + .build()); + + @Test + void deserialize() { + TestHelpers.recursiveEquals(resultEventDto, expectedResultEvent); + } +} diff --git a/openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationSmsDeliveryEventEventDto.json b/openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationSmsDeliveryEventEventDto.json new file mode 100644 index 000000000..12b209926 --- /dev/null +++ b/openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationSmsDeliveryEventEventDto.json @@ -0,0 +1,12 @@ +{ + "id": "1234567890", + "event": "VerificationSmsDeliveredEvent", + "method": "sms", + "identity": { + "type": "number", + "endpoint": "+11235551234" + }, + "reference": "reference string", + "custom": "custom string", + "smsResult": "Failed" +} diff --git a/sample-app/src/main/java/com/sinch/sample/verification/start/Start.java b/sample-app/src/main/java/com/sinch/sample/verification/start/Start.java index 3ece68bd3..0ae3f707c 100644 --- a/sample-app/src/main/java/com/sinch/sample/verification/start/Start.java +++ b/sample-app/src/main/java/com/sinch/sample/verification/start/Start.java @@ -54,7 +54,7 @@ public void run() { .setCodeType(CodeTypeEnum.ALPHANUMERIC) .setAcceptLanguage("fr-FR") .build()); - } else if (method == VerificationMethod.DATA) { + } else if (method.value().equals("seamless")) { response = service.startData(VerificationStartRequestData.builder().setIdentity(identity).build()); } else if (method == VerificationMethod.FLASH_CALL) { From f76042d670287367f94e728e278d392741aa2c31 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier Date: Tue, 12 Aug 2025 17:57:35 +0200 Subject: [PATCH 012/122] feat (Mailgun/Message): Support 'o:suppress-headers' field --- .../domains/mailgun/api/v1/EmailsService.java | 2 +- .../mailgun/api/v1/TemplatesService.java | 2 +- .../api/v1/adapters/EmailsServiceImpl.java | 2 +- .../api/v1/adapters/TemplatesServiceImpl.java | 2 +- .../v1/emails/request/OverrideProperties.java | 79 +++++++++++-------- .../request/OverridePropertiesImpl.java | 34 +++++++- .../SendEmailHtmlInTemplateRequest.java | 33 +++++--- .../request/SendEmailHtmlInlineRequest.java | 28 ++++--- .../emails/request/SendMimeEmailRequest.java | 23 ++++-- .../v1/emails/request/TemplateProperties.java | 10 ++- .../emails/request/TrueFalseHtmlonlyEnum.java | 2 +- .../models/v1/emails/response/BadRequest.java | 2 +- .../v1/emails/response/EmailNotFound.java | 2 +- .../emails/response/ExceededQueueQuota.java | 2 +- .../response/GetStoredEmailResponse.java | 2 +- .../response/QueueStatusDisabledDetails.java | 2 +- .../v1/emails/response/SendEmailResponse.java | 2 +- .../response/SendingQueuesStatusResponse.java | 2 +- .../models/v1/response/GenericResponse.java | 2 +- .../v1/response/internal/PagingResponse.java | 2 +- .../mailgun/models/v1/templates/Template.java | 2 +- .../mailgun/models/v1/templates/Version.java | 2 +- .../models/v1/templates/VersionDetails.java | 2 +- .../internal/GetTemplateResponseInternal.java | 2 +- .../request/CopyVersionQueryParameters.java | 2 +- .../request/CreateTemplateRequest.java | 2 +- .../CreateTemplateWithVersionRequest.java | 2 +- .../request/CreateVersionRequest.java | 2 +- .../request/GetTemplateQueryParameters.java | 2 +- .../request/ListTemplatesQueryParameters.java | 2 +- .../request/ListVersionsQueryParameters.java | 2 +- .../request/UpdateTemplateRequest.java | 2 +- .../request/UpdateVersionRequest.java | 2 +- .../response/ListTemplatesResponse.java | 2 +- .../response/ListVersionsResponse.java | 2 +- .../internal/CopyVersionResponseInternal.java | 2 +- .../internal/CreateResponseInternal.java | 2 +- .../ListTemplatesResponseInternal.java | 2 +- .../internal/ListVersionResponseInternal.java | 2 +- .../internal/UpdateResponseInternal.java | 2 +- .../internal/UpdatedTemplateInternal.java | 2 +- .../internal/UpdatedVersionInternal.java | 2 +- .../emails/request/SendEmailRequestTest.java | 4 + .../request/SendMimeEmailRequestTest.java | 2 + 44 files changed, 181 insertions(+), 104 deletions(-) diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/api/v1/EmailsService.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/api/v1/EmailsService.java index 882607a83..358be75a5 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/api/v1/EmailsService.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/api/v1/EmailsService.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/api/v1/TemplatesService.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/api/v1/TemplatesService.java index aa63a3039..74167b1dc 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/api/v1/TemplatesService.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/api/v1/TemplatesService.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/api/v1/adapters/EmailsServiceImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/api/v1/adapters/EmailsServiceImpl.java index 62c6c4f97..543c4e150 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/api/v1/adapters/EmailsServiceImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/api/v1/adapters/EmailsServiceImpl.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/api/v1/adapters/TemplatesServiceImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/api/v1/adapters/TemplatesServiceImpl.java index 8ef011dfa..a49252ac9 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/api/v1/adapters/TemplatesServiceImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/api/v1/adapters/TemplatesServiceImpl.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/OverrideProperties.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/OverrideProperties.java index 21767a9bd..ac69192d6 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/OverrideProperties.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/OverrideProperties.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -33,16 +33,18 @@ public interface OverrideProperties { * Toggles Send Time Optimization (STO) on a per-message basis. String should be set to the number * of hours in [0-9]+h format, with the minimum being 24h and the * maximum being 72h. This value defines the time window in which Mailgun will run - * the optimization algorithm based on prior engagement data of a given recipient. See - * Sending a Message with STO for details. Please note that STO is only - * available on certain plans. See www.mailgun.com/pricing for more info + * the optimization algorithm based on prior engagement data of a given recipient. See Sending + * a Message with STO for details. Please note that STO is only available on certain + * plans. See www.mailgun.com/pricing for more info * * @return deliveryTimeOptimizePeriod */ Integer getDeliveryTimeOptimizePeriod(); /** - * Enables/disables DKIM signatures on a per-message basis + * Enables or disables DKIM signatures on a per-message basis. Overrides the domain-level DKIM + * setting for this specific message. * * @return enableDkimSignature */ @@ -70,11 +72,11 @@ public interface OverrideProperties { String getSecondaryDkimPublic(); /** - * Specifies the scheduled delivery time in RFC-2822 format - * (https://documentation.mailgun.com/docs/mailgun/user-manual/get-started/#date-format). - * Depending on your plan, you can schedule messages up to 3 or 7 days in advance. If your domain - * has a custom message_ttl (time-to-live) setting, this value determines the maximum scheduling - * duration. + * Specifies the scheduled delivery time in RFC-2822 + * format. Depending on your plan, you can schedule messages up to 3 or 7 days in advance. If + * your domain has a custom message_ttl (time-to-live) setting, this value determines the maximum + * scheduling duration. Example: 'Fri, 14 Oct 2011 12:00:00 +0000' * * @return deliveryTime */ @@ -83,9 +85,10 @@ public interface OverrideProperties { /** * Toggles Timezone Optimization (TZO) on a per message basis. String should be set to preferred * delivery time in HH:mm or hh:mmaa format, where HH:mm is - * used for 24 hour format without AM/PM and hh:mmaa is used for 12 hour format with AM/PM. See - * Sending a Message with TZO for details. Please note that TZO is only - * available on certain plans. See www.mailgun.com/pricing for more info + * used for 24 hour format without AM/PM and hh:mmaa is used for 12 hour format with AM/PM. See Sending + * a Message with TZO for details. Please note that TZO is only available on certain + * plans. See www.mailgun.com/pricing for more info * * @return timeZoneLocalize */ @@ -94,16 +97,14 @@ public interface OverrideProperties { /** * Toggles click tracking on a per-message basis, see Tracking - * Clicks. Has higher priority than domain-level setting. + * Clicks. This overrides the domain-level click tracking setting. * * @return trackingClicks */ TrueFalseHtmlonlyEnum getTrackingClicks(); /** - * Toggles both click and open tracking on a per-message basis, see Tracking - * Messages for details. + * Toggles both click and open tracking on a per-message basis * * @return tracking */ @@ -119,9 +120,8 @@ public interface OverrideProperties { Boolean getTrackingOpens(); /** - * If you send long emails that experience truncation or other rendering issues at the recipient, - * you can ensure opens are being tracked accurately with placement of the tracking pixel at the - * top of your emails + * Places the tracking pixel at the top of emails instead of the bottom. Useful for long emails + * that may be truncated or have rendering issues, ensuring open tracking works accurately. * * @return trackingPixelLocationTop */ @@ -142,12 +142,9 @@ public interface OverrideProperties { String getSendingIpPool(); /** - * Requires the message only be sent over a TLS connection, see TLS Sending - * Connection Settings. If a TLS connection can not be established, Mailgun will not deliver - * the message. If set to false or no, Mailgun will still try and - * upgrade the connection, but if Mailgun cannot, the message will be delivered over a plaintext - * SMTP connection. The default is false + * When set to 'yes', requires the message to be sent only over a TLS connection to the Email + * Service Provider. If TLS cannot be established, the message will not be delivered. When set to + * 'no' (default), Mailgun attempts TLS but falls back to plaintext SMTP if needed. * * @return requireTls */ @@ -164,8 +161,9 @@ public interface OverrideProperties { Boolean getSkipVerification(); /** - * Enables sending in test mode. See Sending + * Enables sending in test mode. Messages are processed normally but not actually delivered to + * recipients. Useful for testing without sending real emails. See Sending * in Test Mode * * @return testMode @@ -173,14 +171,24 @@ public interface OverrideProperties { Boolean getTestMode(); /** - * If a message is successfully delivered, then a copy of the message is submitted in an HTTP POST - * request to the URL provided in this parameter. The Content-Type of the POST requests is - * application/mime and the request body is exactly what the recipient SMTP server received. + * Sends a copy of successfully delivered messages to the specified URL via HTTP POST. The request + * uses Content-Type: application/mime and contains the exact message the recipient's SMTP server + * received. NOTE: These are accounted for and billed as delivered messages * * @return archiveTo */ String getArchiveTo(); + /** + * Removes specified X-Mailgun headers from the delivered message. Provide header names separated + * by commas (e.g., 'X-Mailgun-Variables,X-Mailgun-Tag') or use 'all' to remove all X-Mailgun + * headers.Note: X-Mailgun-Sid header is currently used to process complains received via feedback + * loops. + * + * @return suppressHeaders + */ + String getSuppressHeaders(); + /** * Getting builder * @@ -346,6 +354,15 @@ interface Builder { */ Builder setArchiveTo(String archiveTo); + /** + * see getter + * + * @param suppressHeaders see getter + * @return Current builder + * @see #getSuppressHeaders + */ + Builder setSuppressHeaders(String suppressHeaders); + /** * Create instance * diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/OverridePropertiesImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/OverridePropertiesImpl.java index ff73d93d9..e9555b233 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/OverridePropertiesImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/OverridePropertiesImpl.java @@ -79,6 +79,10 @@ public class OverridePropertiesImpl implements OverrideProperties { private OptionalValue archiveTo; + public static final String PROPERTY_SUPPRESS_HEADERS = "o:suppress-headers"; + + private OptionalValue suppressHeaders; + public OverridePropertiesImpl() {} protected OverridePropertiesImpl( @@ -98,7 +102,8 @@ protected OverridePropertiesImpl( OptionalValue requireTls, OptionalValue skipVerification, OptionalValue testMode, - OptionalValue archiveTo) { + OptionalValue archiveTo, + OptionalValue suppressHeaders) { this.tag = tag; this.deliveryTimeOptimizePeriod = deliveryTimeOptimizePeriod; this.enableDkimSignature = enableDkimSignature; @@ -116,6 +121,7 @@ protected OverridePropertiesImpl( this.skipVerification = skipVerification; this.testMode = testMode; this.archiveTo = archiveTo; + this.suppressHeaders = suppressHeaders; } public List getTag() { @@ -279,6 +285,15 @@ public OptionalValue archiveTo() { return archiveTo; } + public String getSuppressHeaders() { + return suppressHeaders.orElse(null); + } + + @Property(PROPERTY_SUPPRESS_HEADERS) + public OptionalValue suppressHeaders() { + return suppressHeaders; + } + /** Return true if this overrideProperties object is equal to o. */ @Override public boolean equals(Object o) { @@ -307,7 +322,8 @@ public boolean equals(Object o) { && Objects.equals(this.requireTls, overrideProperties.requireTls) && Objects.equals(this.skipVerification, overrideProperties.skipVerification) && Objects.equals(this.testMode, overrideProperties.testMode) - && Objects.equals(this.archiveTo, overrideProperties.archiveTo); + && Objects.equals(this.archiveTo, overrideProperties.archiveTo) + && Objects.equals(this.suppressHeaders, overrideProperties.suppressHeaders); } @Override @@ -329,7 +345,8 @@ public int hashCode() { requireTls, skipVerification, testMode, - archiveTo); + archiveTo, + suppressHeaders); } @Override @@ -361,6 +378,7 @@ public String toString() { sb.append(" skipVerification: ").append(toIndentedString(skipVerification)).append("\n"); sb.append(" testMode: ").append(toIndentedString(testMode)).append("\n"); sb.append(" archiveTo: ").append(toIndentedString(archiveTo)).append("\n"); + sb.append(" suppressHeaders: ").append(toIndentedString(suppressHeaders)).append("\n"); sb.append("}"); return sb.toString(); } @@ -393,6 +411,7 @@ static class Builder implements OverrideProperties.Builder { OptionalValue skipVerification = OptionalValue.empty(); OptionalValue testMode = OptionalValue.empty(); OptionalValue archiveTo = OptionalValue.empty(); + OptionalValue suppressHeaders = OptionalValue.empty(); @Property(value = PROPERTY_TAG) public Builder setTag(List tag) { @@ -496,6 +515,12 @@ public Builder setArchiveTo(String archiveTo) { return this; } + @Property(value = PROPERTY_SUPPRESS_HEADERS) + public Builder setSuppressHeaders(String suppressHeaders) { + this.suppressHeaders = OptionalValue.of(suppressHeaders); + return this; + } + public OverrideProperties build() { return new OverridePropertiesImpl( tag, @@ -514,7 +539,8 @@ public OverrideProperties build() { requireTls, skipVerification, testMode, - archiveTo); + archiveTo, + suppressHeaders); } } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailHtmlInTemplateRequest.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailHtmlInTemplateRequest.java index 027025301..12a1a91b7 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailHtmlInTemplateRequest.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailHtmlInTemplateRequest.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -23,8 +23,9 @@ public interface SendEmailHtmlInTemplateRequest extends SendEmailRequest { /** - * Email address of the recipient(s). Example: \"Bob <bob@host.com>\" - * . You can use commas to separate multiple recipients + * Email address of the recipient(s). Supports friendly name format. Example: + * \"Bob <bob@host.com>\". Use commas to separate multiple recipients. + * Duplicate addresses are automatically ignored. * *

Field is required * @@ -33,8 +34,10 @@ public interface SendEmailHtmlInTemplateRequest extends SendEmailRequest { List getTo(); /** - * Email address for the From header. Note: not required if sending with a template - * that has a pre-set From header, but it will override it if provided. + * Email address of the From header. Can include a friendly name using the format + * \"Friendly Name <email@domain.com>\". Note: not required if + * sending with a template that has a pre-set From header, but will override the template's From + * header if provided. * *

Field is required * @@ -43,14 +46,14 @@ public interface SendEmailHtmlInTemplateRequest extends SendEmailRequest { String getFrom(); /** - * Same as To but for Cc + * Same as to but for carbon copy recipients. Supports friendly name format. * * @return cc */ List getCc(); /** - * Same as To but for Bcc + * Same as to but for blind carbon copy recipients. Supports friendly name format. * * @return bcc */ @@ -98,9 +101,14 @@ public interface SendEmailHtmlInTemplateRequest extends SendEmailRequest { List getInline(); /** - * A valid JSON-encoded dictionary, where key is a plain recipient address and value is a - * dictionary with variables that can be referenced in the message body. See Batch - * Sending for more information + * A JSON-encoded dictionary for batch sending with personalized variables per recipient. Each key + * is a recipient email address, each value is a dictionary of variables for that recipient. + * Variables can be referenced in the message using %recipient.variablename%. Example: + * '{"alice@example.com": {"name":"Alice", "id":1}, + * "bob@example.com": {"name":"Bob", "id":2}}'. Maximum + * 1,000 recipients per batch. See Batch + * Sending for more information * * @return recipientVariables */ @@ -128,8 +136,9 @@ public interface SendEmailHtmlInTemplateRequest extends SendEmailRequest { List> getCustomHeaders(); /** - * Name of a template stored via template API to use to render the email body. See - * Templates for more information + * Name of a template stored via the Templates API to use to render the email body. See Templates + * for more information * * @return template */ diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailHtmlInlineRequest.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailHtmlInlineRequest.java index f33118aa4..fc305f80a 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailHtmlInlineRequest.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailHtmlInlineRequest.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -20,8 +20,9 @@ public interface SendEmailHtmlInlineRequest extends SendEmailRequest { /** - * Email address of the recipient(s). Example: \"Bob <bob@host.com>\" - * . You can use commas to separate multiple recipients + * Email address of the recipient(s). Supports friendly name format. Example: + * \"Bob <bob@host.com>\". Use commas to separate multiple recipients. + * Duplicate addresses are automatically ignored. * *

Field is required * @@ -30,8 +31,10 @@ public interface SendEmailHtmlInlineRequest extends SendEmailRequest { List getTo(); /** - * Email address for the From header. Note: not required if sending with a template - * that has a pre-set From header, but it will override it if provided. + * Email address of the From header. Can include a friendly name using the format + * \"Friendly Name <email@domain.com>\". Note: not required if + * sending with a template that has a pre-set From header, but will override the template's From + * header if provided. * *

Field is required * @@ -40,14 +43,14 @@ public interface SendEmailHtmlInlineRequest extends SendEmailRequest { String getFrom(); /** - * Same as To but for Cc + * Same as to but for carbon copy recipients. Supports friendly name format. * * @return cc */ List getCc(); /** - * Same as To but for Bcc + * Same as to but for blind carbon copy recipients. Supports friendly name format. * * @return bcc */ @@ -95,9 +98,14 @@ public interface SendEmailHtmlInlineRequest extends SendEmailRequest { List getInline(); /** - * A valid JSON-encoded dictionary, where key is a plain recipient address and value is a - * dictionary with variables that can be referenced in the message body. See Batch - * Sending for more information + * A JSON-encoded dictionary for batch sending with personalized variables per recipient. Each key + * is a recipient email address, each value is a dictionary of variables for that recipient. + * Variables can be referenced in the message using %recipient.variablename%. Example: + * '{"alice@example.com": {"name":"Alice", "id":1}, + * "bob@example.com": {"name":"Bob", "id":2}}'. Maximum + * 1,000 recipients per batch. See Batch + * Sending for more information * * @return recipientVariables */ diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendMimeEmailRequest.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendMimeEmailRequest.java index a1fe60777..5d88ac569 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendMimeEmailRequest.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendMimeEmailRequest.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -23,8 +23,9 @@ public interface SendMimeEmailRequest { /** - * Email address of the recipient(s). Example: \"Bob <bob@host.com>\" - * . You can use commas to separate multiple recipients + * Email address of the recipient(s). Supports friendly name format. Example: + * \"Bob <bob@host.com>\". Use commas to separate multiple recipients. + * Duplicate addresses are automatically ignored. * *

Field is required * @@ -43,17 +44,23 @@ public interface SendMimeEmailRequest { File getMessage(); /** - * Name of a template stored via template API to use to render the email body. See - * Templates for more information + * Name of a template stored via template API to use to render the email body. See Templates + * for more information * * @return template */ String getTemplate(); /** - * A valid JSON-encoded dictionary, where key is a plain recipient address and value is a - * dictionary with variables that can be referenced in the message body. See Batch - * Sending for more information + * A JSON-encoded dictionary for batch sending with personalized variables per recipient. Each key + * is a recipient email address, each value is a dictionary of variables for that recipient. + * Variables can be referenced in the message using %recipient.variablename%. Example: + * '{"alice@example.com": {"name":"Alice", "id":1}, + * "bob@example.com": {"name":"Bob", "id":2}}'. Maximum + * 1,000 recipients per batch. See Batch + * Sending for more information. * * @return recipientVariables */ diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/TemplateProperties.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/TemplateProperties.java index 81d330b55..d2dd08c14 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/TemplateProperties.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/TemplateProperties.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -19,14 +19,18 @@ public interface TemplateProperties { /** - * Render template in case of template sending + * Generates a plain text version of the template alongside the HTML version when sending + * templated emails. When set to 'yes', instructs Mailgun to create a text/plain MIME part based + * on the template content, ensuring compatibility with email clients that don't support HTML or + * have HTML rendering disabled. This improves email deliverability and accessibility by providing + * a fallback text version in multipart emails. * * @return text */ Boolean getText(); /** - * Render a specific version of the given template instead of the latest version. o:template + * Render a specific version of the given template instead of the latest version. template * option must also be provided. * * @return version diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/TrueFalseHtmlonlyEnum.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/TrueFalseHtmlonlyEnum.java index b060f5c78..6a655fd7d 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/TrueFalseHtmlonlyEnum.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/TrueFalseHtmlonlyEnum.java @@ -8,7 +8,7 @@ /** * Toggles click tracking on a per-message basis, see Tracking - * Clicks. Has higher priority than domain-level setting. + * Clicks. This overrides the domain-level click tracking setting. */ public class TrueFalseHtmlonlyEnum extends EnumDynamic { diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/response/BadRequest.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/response/BadRequest.java index 65166f753..4fe19a8e4 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/response/BadRequest.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/response/BadRequest.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/response/EmailNotFound.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/response/EmailNotFound.java index 94cf5c54d..20642ac27 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/response/EmailNotFound.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/response/EmailNotFound.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/response/ExceededQueueQuota.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/response/ExceededQueueQuota.java index b67551fe6..422ffd842 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/response/ExceededQueueQuota.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/response/ExceededQueueQuota.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/response/GetStoredEmailResponse.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/response/GetStoredEmailResponse.java index 629bcef98..a6c46ff66 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/response/GetStoredEmailResponse.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/response/GetStoredEmailResponse.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/response/QueueStatusDisabledDetails.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/response/QueueStatusDisabledDetails.java index 99356f4a5..f9bf46f51 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/response/QueueStatusDisabledDetails.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/response/QueueStatusDisabledDetails.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/response/SendEmailResponse.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/response/SendEmailResponse.java index c2f9ff1fc..4aef6fed7 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/response/SendEmailResponse.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/response/SendEmailResponse.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/response/SendingQueuesStatusResponse.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/response/SendingQueuesStatusResponse.java index f21f3e294..cfdac2a0c 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/response/SendingQueuesStatusResponse.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/response/SendingQueuesStatusResponse.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/response/GenericResponse.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/response/GenericResponse.java index d6ace1ef9..77c7ee45e 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/response/GenericResponse.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/response/GenericResponse.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/response/internal/PagingResponse.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/response/internal/PagingResponse.java index 1b298ea1f..48650e070 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/response/internal/PagingResponse.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/response/internal/PagingResponse.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/Template.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/Template.java index 58c366f72..acd81122f 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/Template.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/Template.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/Version.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/Version.java index e2792c10c..5e00d65c6 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/Version.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/Version.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/VersionDetails.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/VersionDetails.java index 36f3eb5b3..bddc5d597 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/VersionDetails.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/VersionDetails.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/internal/GetTemplateResponseInternal.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/internal/GetTemplateResponseInternal.java index f418a40cf..fb4f3bdd5 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/internal/GetTemplateResponseInternal.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/internal/GetTemplateResponseInternal.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/request/CopyVersionQueryParameters.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/request/CopyVersionQueryParameters.java index 02d6fa73d..79d223106 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/request/CopyVersionQueryParameters.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/request/CopyVersionQueryParameters.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/request/CreateTemplateRequest.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/request/CreateTemplateRequest.java index 6933fd2ea..3de913999 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/request/CreateTemplateRequest.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/request/CreateTemplateRequest.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/request/CreateTemplateWithVersionRequest.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/request/CreateTemplateWithVersionRequest.java index c0dfa2a4d..f907fd0bc 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/request/CreateTemplateWithVersionRequest.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/request/CreateTemplateWithVersionRequest.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/request/CreateVersionRequest.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/request/CreateVersionRequest.java index a21c33bfa..e7e022e78 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/request/CreateVersionRequest.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/request/CreateVersionRequest.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/request/GetTemplateQueryParameters.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/request/GetTemplateQueryParameters.java index 38001d155..19d8ef187 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/request/GetTemplateQueryParameters.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/request/GetTemplateQueryParameters.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/request/ListTemplatesQueryParameters.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/request/ListTemplatesQueryParameters.java index 0b37ec38a..fc00b2c9b 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/request/ListTemplatesQueryParameters.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/request/ListTemplatesQueryParameters.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/request/ListVersionsQueryParameters.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/request/ListVersionsQueryParameters.java index a4325545b..14fc448f7 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/request/ListVersionsQueryParameters.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/request/ListVersionsQueryParameters.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/request/UpdateTemplateRequest.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/request/UpdateTemplateRequest.java index 97c1e15ad..e79a4380e 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/request/UpdateTemplateRequest.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/request/UpdateTemplateRequest.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/request/UpdateVersionRequest.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/request/UpdateVersionRequest.java index 6af86fed0..0b80b6789 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/request/UpdateVersionRequest.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/request/UpdateVersionRequest.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/ListTemplatesResponse.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/ListTemplatesResponse.java index 8b719e747..49ff5c8ed 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/ListTemplatesResponse.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/ListTemplatesResponse.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/ListVersionsResponse.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/ListVersionsResponse.java index f2aa4c2ba..b56bd09d3 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/ListVersionsResponse.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/ListVersionsResponse.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/internal/CopyVersionResponseInternal.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/internal/CopyVersionResponseInternal.java index 19f9a61f0..77c977f22 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/internal/CopyVersionResponseInternal.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/internal/CopyVersionResponseInternal.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/internal/CreateResponseInternal.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/internal/CreateResponseInternal.java index 726588b7b..433a65fb9 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/internal/CreateResponseInternal.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/internal/CreateResponseInternal.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/internal/ListTemplatesResponseInternal.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/internal/ListTemplatesResponseInternal.java index 6d9833fc6..caaecd7c5 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/internal/ListTemplatesResponseInternal.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/internal/ListTemplatesResponseInternal.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/internal/ListVersionResponseInternal.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/internal/ListVersionResponseInternal.java index 6ae2748c3..8cf231339 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/internal/ListVersionResponseInternal.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/internal/ListVersionResponseInternal.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/internal/UpdateResponseInternal.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/internal/UpdateResponseInternal.java index 6c8c37dab..6fc80a824 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/internal/UpdateResponseInternal.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/internal/UpdateResponseInternal.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/internal/UpdatedTemplateInternal.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/internal/UpdatedTemplateInternal.java index 678b60eb9..46f30b1bf 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/internal/UpdatedTemplateInternal.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/internal/UpdatedTemplateInternal.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/internal/UpdatedVersionInternal.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/internal/UpdatedVersionInternal.java index 367b44993..610e97590 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/internal/UpdatedVersionInternal.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/internal/UpdatedVersionInternal.java @@ -1,7 +1,7 @@ /* * Mailgun API * - * OpenAPI document version: 0.0.0 + * OpenAPI document version: 3.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailRequestTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailRequestTest.java index 6f7a4254f..3d43de7be 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailRequestTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailRequestTest.java @@ -75,6 +75,7 @@ public class SendEmailRequestTest extends BaseTest { "o:tracking-opens","false", "o:require-tls","true", "o:skip-verification","true", + "o:suppress-headers","header-1, header-2", "o:sending-ip","192.168.0.10", "o:sending-ip-pool","sending pool ID", "o:tracking-pixel-location-top","htmlonly", @@ -116,6 +117,7 @@ public class SendEmailRequestTest extends BaseTest { "o:tracking-opens","false", "o:require-tls","true", "o:skip-verification","true", + "o:suppress-headers","header-1, header-2", "o:sending-ip","192.168.0.10", "o:sending-ip-pool","sending pool ID", "o:tracking-pixel-location-top","htmlonly", @@ -160,6 +162,7 @@ public class SendEmailRequestTest extends BaseTest { .setSendingIpPool("sending pool ID") .setTrackingPixelLocationTop(TrueFalseHtmlonlyEnum.HTMLONLY) .setArchiveTo("http://an-archive-to-dest.com") + .setSuppressHeaders("header-1, header-2") .build()) .setCustomVariables(CUSTOM_VARIABLES) .setCustomHeaders(CUSTOM_HEADERS) @@ -197,6 +200,7 @@ public class SendEmailRequestTest extends BaseTest { .setSendingIpPool("sending pool ID") .setTrackingPixelLocationTop(TrueFalseHtmlonlyEnum.HTMLONLY) .setArchiveTo("http://an-archive-to-dest.com") + .setSuppressHeaders("header-1, header-2") .build()) .setTemplateProperties( TemplateProperties.builder() diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendMimeEmailRequestTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendMimeEmailRequestTest.java index 550796643..8b394c67f 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendMimeEmailRequestTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendMimeEmailRequestTest.java @@ -51,6 +51,7 @@ public class SendMimeEmailRequestTest extends BaseTest { "o:tracking-opens","false", "o:require-tls","true", "o:skip-verification","false", + "o:suppress-headers","header-1, header-2", "o:sending-ip","192.168.0.10", "o:sending-ip-pool","sending pool ID", "o:tracking-pixel-location-top","htmlonly", @@ -88,6 +89,7 @@ public class SendMimeEmailRequestTest extends BaseTest { .setSendingIpPool("sending pool ID") .setTrackingPixelLocationTop(TrueFalseHtmlonlyEnum.HTMLONLY) .setArchiveTo("http://an-archive-to-dest.com") + .setSuppressHeaders("header-1, header-2") .build()) .setTemplateProperties( TemplateProperties.builder() From 76bfa3dadd632f92f01598761f972eb504ffed81 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier Date: Mon, 25 Aug 2025 12:31:04 +0200 Subject: [PATCH 013/122] [feat] (Verification): W35 OAS synch - FlashCall - [feat] `VerificationStartRequestFlashCall` support `interceptionTimeout` and additionalProperties - [feat] `VerificationStartResponseFlashCall` support additionalProperties - [feat] `VerificationRequestEventResponseFlashCall` support `interceptionTimeout` and additionalProperties - PhoneCall - [feat] `VerificationStartRequestPhoneCall` support additionalProperties - [feat] `VerificationRequestEventResponsePhoneCall` support additionalProperties - SMS - [feat] `VerificationStartResponseSms` support `codeType` and additionalProperties - [feat] `VerificationRequestEventResponseSms` support `codeType`, `expiry` and additionalProperties --- MIGRATION-GUIDE.md | 36 +++--- .../VerificationStartServiceTest.java | 16 ++- .../domains/verification/v1/StartSteps.java | 5 +- .../sdk/core/models/ModelArgMatcher.java | 23 ++++ .../verification/models/v1/SmsCodeType.java | 39 ++++++ .../VerificationStartRequestFlashCall.java | 41 ++++++- ...VerificationStartRequestFlashCallImpl.java | 36 ++++++ .../VerificationStartRequestPhoneCall.java | 16 +++ ...VerificationStartRequestPhoneCallImpl.java | 12 ++ .../request/VerificationStartRequestSms.java | 58 +++------ .../VerificationStartRequestSmsImpl.java | 35 +++--- .../VerificationStartFlashCallOptions.java | 42 ++++++- ...VerificationStartFlashCallOptionsImpl.java | 92 +++++++++++++- .../VerificationStartPhoneCallOptions.java | 18 ++- ...VerificationStartPhoneCallOptionsImpl.java | 56 ++++++++- .../internal/VerificationStartSmsOptions.java | 63 +++------- .../VerificationStartSmsOptionsImpl.java | 59 ++++----- .../VerificationStartResponseFlashCall.java | 20 +++- ...erificationStartResponseFlashCallImpl.java | 10 ++ .../VerificationStartResponseSms.java | 33 +++++ .../VerificationStartResponseSmsImpl.java | 32 +++++ ...ficationStartResponseFlashCallContent.java | 17 ++- ...tionStartResponseFlashCallContentImpl.java | 61 +++++++++- .../VerificationStartResponseSmsContent.java | 30 ++++- ...rificationStartResponseSmsContentImpl.java | 87 +++++++++++++- ...ficationRequestEventResponseFlashCall.java | 43 ++++++- ...tionRequestEventResponseFlashCallImpl.java | 37 ++++++ ...ficationRequestEventResponsePhoneCall.java | 16 +++ ...tionRequestEventResponsePhoneCallImpl.java | 10 ++ .../VerificationRequestEventResponseSms.java | 50 ++++++++ ...rificationRequestEventResponseSmsImpl.java | 53 ++++++++ ...nRequestEventResponseFlashCallContent.java | 40 ++++++- ...uestEventResponseFlashCallContentImpl.java | 91 +++++++++++++- ...nRequestEventResponsePhoneCallContent.java | 13 +- ...uestEventResponsePhoneCallContentImpl.java | 56 ++++++++- ...icationRequestEventResponseSmsContent.java | 47 +++++++- ...ionRequestEventResponseSmsContentImpl.java | 113 +++++++++++++++++- .../request/VerificationStartRequestTest.java | 8 +- .../VerificationStartSmsOptionsTest.java | 7 +- .../VerificationStartResponseTest.java | 4 + .../VerificationResponseEventDtoTest.java | 7 ++ .../VerificationStartRequestFlashCallDto.json | 4 +- .../VerificationStartRequestPhoneCallDto.json | 3 +- ...VerificationStartResponseFlashCallDto.json | 3 +- .../VerificationStartResponseSmsDto.json | 4 +- .../VerificationResponseFlashCall.json | 4 +- .../VerificationResponsePhoneCall.json | 3 +- .../v1/webhooks/VerificationResponseSms.json | 5 +- .../sample/verification/start/Start.java | 4 +- 49 files changed, 1323 insertions(+), 239 deletions(-) create mode 100644 core/src/test/java/com/sinch/sdk/core/models/ModelArgMatcher.java create mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/SmsCodeType.java diff --git a/MIGRATION-GUIDE.md b/MIGRATION-GUIDE.md index 1ef0b43d8..3d151801c 100644 --- a/MIGRATION-GUIDE.md +++ b/MIGRATION-GUIDE.md @@ -329,24 +329,24 @@ Use the new versioned API under `voice().v1()` to get access to [VoiceService](h | models/VerificationReportSMS | [com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponseSms](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/report/response/VerificationReportResponseSms.html) | ##### Verification Start -| Old class | New class | -|-------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| models/requests/StartVerificationCalloutOptions | N/A (direct access to `PhoneCallSpeech` from `VerificationStartRequestPhoneCall`) | -| models/requests/StartVerificationCalloutRequestParameters | [com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestPhoneCall](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestPhoneCall.html) | -| models/requests/StartVerificationCalloutSpeechOptions | [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/requests/StartVerificationFlashCallRequestParameters | [com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestFlashCall](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestFlashCall.html) | -| models/requests/StartVerificationRequestParameters | [com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequest](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequest.html) | -| models/requests/StartVerificationSMSOptions | N/A (direct access to dedicated `fields` from `VerificationStartRequestSms`) | -| models/requests/StartVerificationSMSRequestParameters | [com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestSms](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestSms.html) | -| models/requests/StartVerificationSeamlessRequestParameters | [com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestData](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestData.html) | -| models/requests/SMSCodeType | [com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestSms.CodeTypeEnum](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestSms.CodeTypeEnum.html) | -| models/response/StartVerificationResponse | [com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponse.html) | -| models/response/StartVerificationResponseCallout | [com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponsePhoneCall](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponsePhoneCall.html) | -| models/response/StartVerificationResponseFlashCall | [com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseFlashCall](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseFlashCall.html) | -| models/response/StartVerificationResponseSMS | [com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseSms](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseSms.html) | -| models/response/StartVerificationResponseSeamless | [com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseData](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseData.html) | -| models/Link | [com.sinch.sdk.domains.verification.models.v1.start.response.Link](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/response/Link.html) | -| models/LinkRelType | [com.sinch.sdk.domains.verification.models.v1.start.response.Link.RelEnum](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/response/Link.RelEnum.html) | +| Old class | New class | +|-------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| models/requests/StartVerificationCalloutOptions | N/A (direct access to `PhoneCallSpeech` from `VerificationStartRequestPhoneCall`) | +| models/requests/StartVerificationCalloutRequestParameters | [com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestPhoneCall](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestPhoneCall.html) | +| models/requests/StartVerificationCalloutSpeechOptions | [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/requests/StartVerificationFlashCallRequestParameters | [com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestFlashCall](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestFlashCall.html) | +| models/requests/StartVerificationRequestParameters | [com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequest](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequest.html) | +| models/requests/StartVerificationSMSOptions | N/A (direct access to dedicated `fields` from `VerificationStartRequestSms`) | +| models/requests/StartVerificationSMSRequestParameters | [com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestSms](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestSms.html) | +| models/requests/StartVerificationSeamlessRequestParameters | [com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestData](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestData.html) | +| models/requests/SMSCodeType | [com.sinch.sdk.domains.verification.models.v1.SmsCodeType](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/SmsCodeType.html) | +| models/response/StartVerificationResponse | [com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponse.html) | +| models/response/StartVerificationResponseCallout | [com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponsePhoneCall](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponsePhoneCall.html) | +| models/response/StartVerificationResponseFlashCall | [com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseFlashCall](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseFlashCall.html) | +| models/response/StartVerificationResponseSMS | [com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseSms](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseSms.html) | +| models/response/StartVerificationResponseSeamless | [com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseData](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseData.html) | +| models/Link | [com.sinch.sdk.domains.verification.models.v1.start.response.Link](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/response/Link.html) | +| models/LinkRelType | [com.sinch.sdk.domains.verification.models.v1.start.response.Link.RelEnum](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/response/Link.RelEnum.html) | ##### Verification Status | Old class | New class | diff --git a/client/src/test/java/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationStartServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationStartServiceTest.java index 89629faba..b14d23e61 100644 --- a/client/src/test/java/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationStartServiceTest.java +++ b/client/src/test/java/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationStartServiceTest.java @@ -1,6 +1,6 @@ package com.sinch.sdk.domains.verification.api.v1.adapters; -import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.argThat; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.spy; @@ -12,6 +12,7 @@ import com.sinch.sdk.core.exceptions.ApiException; import com.sinch.sdk.core.http.AuthManager; import com.sinch.sdk.core.http.HttpClient; +import com.sinch.sdk.core.models.ModelArgMatcher; import com.sinch.sdk.domains.verification.adapters.VerificationBaseTest; import com.sinch.sdk.domains.verification.api.v1.internal.VerificationsStartApi; import com.sinch.sdk.domains.verification.models.dto.v1.start.request.VerificationStartRequestTest; @@ -65,7 +66,8 @@ public void initMocks() { @Test void startSms() throws ApiException { - when(api.startVerification(any(VerificationStartRequestInternal.class), eq(null))) + when(api.startVerification( + argThat(new ModelArgMatcher<>(startVerificationSmsRequestDto)), eq(null))) .thenReturn(VerificationStartResponseTest.expectedStartVerificationSmsDto); VerificationStartResponseSms response = @@ -93,12 +95,14 @@ void startSmsWithAcceptLanguage() throws ApiException { .setCodeType(startVerificationSmsRequestDtoImpl.getCodeType()) .setTemplate(startVerificationSmsRequestDtoImpl.getTemplate()) .setAcceptLanguage("es-ES") + .putExtraOption("my key", startVerificationSmsRequestDtoImpl.getExtraOption("my key")) .build(); VerificationStartRequestInternalImpl internalWithAcceptLanguage = new VerificationStartRequestInternalImpl(); internalWithAcceptLanguage.setActualInstance(withAcceptLanguage); - when(api.startVerification(any(VerificationStartRequestInternal.class), eq("es-ES"))) + when(api.startVerification( + argThat(new ModelArgMatcher<>(internalWithAcceptLanguage)), eq("es-ES"))) .thenReturn(VerificationStartResponseTest.expectedStartVerificationSmsDto); VerificationStartResponseSms response = @@ -115,7 +119,8 @@ void startSmsWithAcceptLanguage() throws ApiException { @Test void startFlashCall() throws ApiException { - when(api.startVerification(eq(startVerificationFlashCallRequestDto), eq(null))) + when(api.startVerification( + argThat(new ModelArgMatcher<>(startVerificationFlashCallRequestDto)), eq(null))) .thenReturn(VerificationStartResponseTest.expectedStartVerificationFlashCallDto); VerificationStartResponseFlashCall response = @@ -132,7 +137,8 @@ void startFlashCall() throws ApiException { @Test void startPhoneCall() throws ApiException { - when(api.startVerification(eq(startVerificationPhoneCallRequestDto), eq(null))) + when(api.startVerification( + argThat(new ModelArgMatcher<>(startVerificationPhoneCallRequestDto)), eq(null))) .thenReturn(VerificationStartResponseTest.expectedStartVerificationPhoneCallDto); VerificationStartResponsePhoneCall response = diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/verification/v1/StartSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/verification/v1/StartSteps.java index 1bb442606..16136574a 100644 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/verification/v1/StartSteps.java +++ b/client/src/test/java/com/sinch/sdk/e2e/domains/verification/v1/StartSteps.java @@ -4,12 +4,12 @@ import com.sinch.sdk.core.exceptions.ApiException; import com.sinch.sdk.domains.verification.api.v1.VerificationStartService; import com.sinch.sdk.domains.verification.models.v1.NumberIdentity; +import com.sinch.sdk.domains.verification.models.v1.SmsCodeType; import com.sinch.sdk.domains.verification.models.v1.start.request.PhoneCallSpeech; import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestData; import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestFlashCall; import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestPhoneCall; import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestSms; -import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestSms.CodeTypeEnum; import com.sinch.sdk.domains.verification.models.v1.start.response.Link; import com.sinch.sdk.domains.verification.models.v1.start.response.Link.RelEnum; import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponse; @@ -43,7 +43,7 @@ public void startSms() { VerificationStartRequestSms request = VerificationStartRequestSms.builder() .setIdentity(NumberIdentity.valueOf("+46123456789")) - .setCodeType(CodeTypeEnum.ALPHANUMERIC) + .setCodeType(SmsCodeType.ALPHANUMERIC) .setAcceptLanguage("sv-SE") .build(); @@ -150,6 +150,7 @@ public void startFlashCallResult() { .setInterceptionTimeout(45) .setReportTimeout(75) .setDenyCallAfter(0) + .putExtraOption("callId", "1ce0ffee-c0de-5eed-d22d-f00dfeed1337") .setLinks( Arrays.asList( Link.builder() diff --git a/core/src/test/java/com/sinch/sdk/core/models/ModelArgMatcher.java b/core/src/test/java/com/sinch/sdk/core/models/ModelArgMatcher.java new file mode 100644 index 000000000..0936ccaa4 --- /dev/null +++ b/core/src/test/java/com/sinch/sdk/core/models/ModelArgMatcher.java @@ -0,0 +1,23 @@ +package com.sinch.sdk.core.models; + +import com.sinch.sdk.core.TestHelpers; +import org.mockito.ArgumentMatcher; + +public class ModelArgMatcher implements ArgumentMatcher { + + private final T left; + + public ModelArgMatcher(T left) { + this.left = left; + } + + @Override + public boolean matches(T right) { + try { + TestHelpers.recursiveEquals(right, left); + } catch (AssertionError e) { + return false; + } + return true; + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/SmsCodeType.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/SmsCodeType.java new file mode 100644 index 000000000..58228f73d --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/SmsCodeType.java @@ -0,0 +1,39 @@ +package com.sinch.sdk.domains.verification.models.v1; + +import com.sinch.sdk.core.utils.EnumDynamic; +import com.sinch.sdk.core.utils.EnumSupportDynamic; +import java.util.Arrays; +import java.util.stream.Stream; + +/** Selects type of code which will be sent to customer */ +public class SmsCodeType extends EnumDynamic { + + /** Code contains numbers only. */ + public static final SmsCodeType NUMERIC = new SmsCodeType("Numeric"); + + /** Code contains letters only. */ + public static final SmsCodeType ALPHA = new SmsCodeType("Alpha"); + + /** Code contains both numbers and letters. */ + public static final SmsCodeType ALPHANUMERIC = new SmsCodeType("Alphanumeric"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>( + SmsCodeType.class, SmsCodeType::new, Arrays.asList(NUMERIC, ALPHA, ALPHANUMERIC)); + + private SmsCodeType(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static SmsCodeType from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(SmsCodeType e) { + return ENUM_SUPPORT.valueOf(e); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestFlashCall.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestFlashCall.java index d4e4a5aa1..9070c5148 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestFlashCall.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestFlashCall.java @@ -48,12 +48,34 @@ public interface VerificationStartRequestFlashCall String getCustom(); /** - * The dial timeout in seconds. + * The amount of time that a phone will ring. + * + *

minimum: 5 maximum: 120 * * @return dialTimeout */ Integer getDialTimeout(); + /** + * The maximum time that a phone call verification will be active and can be completed. If the + * phone number hasn't been verified successfully during this time, then the verification request + * will fail. By default, the Sinch dashboard will automatically optimize dial time out during a + * phone call. + * + *

minimum: 5 maximum: 120 + * + * @return interceptionTimeout + */ + Integer getInterceptionTimeout(); + + /** + * Return the additional "flashCallOptions" with the specified name. + * + * @param key the name of the property + * @return the additional property with the specified name + */ + Object getExtraOption(String key); + /** * Getting builder * @@ -104,6 +126,23 @@ interface Builder */ Builder setDialTimeout(Integer dialTimeout); + /** + * see getter + * + * @param interceptionTimeout see getter + * @return Current builder + * @see #getInterceptionTimeout + */ + Builder setInterceptionTimeout(Integer interceptionTimeout); + + /** + * see getter + * + * @return Current builder + * @see #getExtraOption + */ + Builder putExtraOption(String key, Object value); + /** * Create instance * diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestFlashCallImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestFlashCallImpl.java index 814bbd043..16ebfe298 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestFlashCallImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestFlashCallImpl.java @@ -143,6 +143,31 @@ public OptionalValue dialTimeout() { : OptionalValue.empty(); } + @JsonIgnore + public Integer getInterceptionTimeout() { + if (null == flashCallOptions + || !flashCallOptions.isPresent() + || null == flashCallOptions.get().getInterceptionTimeout()) { + return null; + } + return flashCallOptions.get().getInterceptionTimeout(); + } + + public OptionalValue interceptionTimeout() { + return null != flashCallOptions && flashCallOptions.isPresent() + ? flashCallOptions + .map(f -> ((VerificationStartFlashCallOptionsImpl) f).interceptionTimeout()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public Object getExtraOption(String key) { + return null != flashCallOptions && flashCallOptions.isPresent() + ? flashCallOptions.get().get(key) + : null; + } + /** Return true if this VerificationStartRequestFlashCall object is equal to o. */ @Override public boolean equals(Object o) { @@ -231,6 +256,17 @@ public Builder setDialTimeout(Integer dialTimeout) { return this; } + @JsonIgnore + public Builder setInterceptionTimeout(Integer interceptionTimeout) { + getDelegatedBuilder().setInterceptionTimeout(interceptionTimeout); + return this; + } + + public Builder putExtraOption(String key, Object value) { + getDelegatedBuilder().put(key, value); + return this; + } + private VerificationStartFlashCallOptions.Builder getDelegatedBuilder() { if (null == _delegatedBuilder) { this._delegatedBuilder = VerificationStartFlashCallOptions.builder(); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestPhoneCall.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestPhoneCall.java index c7af748d3..e7e53fb96 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestPhoneCall.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestPhoneCall.java @@ -54,6 +54,14 @@ public interface VerificationStartRequestPhoneCall */ PhoneCallSpeech getSpeech(); + /** + * Return the additional "calloutOptions" with the specified name. + * + * @param key the name of the property + * @return the additional property with the specified name + */ + Object getExtraOption(String key); + /** * Getting builder * @@ -104,6 +112,14 @@ interface Builder */ Builder setSpeech(PhoneCallSpeech speech); + /** + * see getter + * + * @return Current builder + * @see #getExtraOption + */ + Builder putExtraOption(String key, Object value); + /** * Create instance * diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestPhoneCallImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestPhoneCallImpl.java index 25e87b600..baf341afd 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestPhoneCallImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestPhoneCallImpl.java @@ -143,6 +143,13 @@ public OptionalValue speech() { : OptionalValue.empty(); } + @JsonIgnore + public Object getExtraOption(String key) { + return null != calloutOptions && calloutOptions.isPresent() + ? calloutOptions.get().get(key) + : null; + } + /** Return true if this VerificationStartRequestPhoneCall object is equal to o. */ @Override public boolean equals(Object o) { @@ -230,6 +237,11 @@ public Builder setSpeech(PhoneCallSpeech speech) { return this; } + public Builder putExtraOption(String key, Object value) { + getDelegatedBuilder().put(key, value); + return this; + } + private VerificationStartPhoneCallOptions.Builder getDelegatedBuilder() { if (null == _delegatedBuilder) { this._delegatedBuilder = VerificationStartPhoneCallOptions.builder(); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestSms.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestSms.java index 933b9c872..dd2bf9b1b 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestSms.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestSms.java @@ -11,11 +11,8 @@ package com.sinch.sdk.domains.verification.models.v1.start.request; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; import com.sinch.sdk.domains.verification.models.v1.Identity; -import java.util.Arrays; -import java.util.stream.Stream; +import com.sinch.sdk.domains.verification.models.v1.SmsCodeType; /** VerificationStartRequestSms */ @JsonDeserialize(builder = VerificationStartRequestSmsImpl.Builder.class) @@ -52,46 +49,19 @@ public interface VerificationStartRequestSms String getCustom(); /** - * The expiration time for a verification process is represented in the format HH:MM:SS - * . + * Get codeType * - * @return expiry + * @return codeType */ - String getExpiry(); - - /** Accepted values for the type of code to be generated are Numeric, Alpha, and Alphanumeric. */ - public class CodeTypeEnum extends EnumDynamic { - public static final CodeTypeEnum NUMERIC = new CodeTypeEnum("Numeric"); - public static final CodeTypeEnum ALPHA = new CodeTypeEnum("Alpha"); - public static final CodeTypeEnum ALPHANUMERIC = new CodeTypeEnum("Alphanumeric"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - CodeTypeEnum.class, CodeTypeEnum::new, Arrays.asList(NUMERIC, ALPHA, ALPHANUMERIC)); - - private CodeTypeEnum(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static CodeTypeEnum from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(CodeTypeEnum e) { - return ENUM_SUPPORT.valueOf(e); - } - } + SmsCodeType getCodeType(); /** - * Accepted values for the type of code to be generated are Numeric, Alpha, and Alphanumeric. + * The expiration time for a verification process is represented in the format HH:MM:SS + * . * - * @return codeType + * @return expiry */ - CodeTypeEnum getCodeType(); + String getExpiry(); /** * The SMS template must include a placeholder {{CODE}} where the verification code @@ -162,20 +132,20 @@ interface Builder /** * see getter * - * @param expiry see getter + * @param codeType see getter * @return Current builder - * @see #getExpiry + * @see #getCodeType */ - Builder setExpiry(String expiry); + Builder setCodeType(SmsCodeType codeType); /** * see getter * - * @param codeType see getter + * @param expiry see getter * @return Current builder - * @see #getCodeType + * @see #getExpiry */ - Builder setCodeType(CodeTypeEnum codeType); + Builder setExpiry(String expiry); /** * see getter diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestSmsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestSmsImpl.java index e8fc71a55..f65ca1f9b 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestSmsImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestSmsImpl.java @@ -14,6 +14,7 @@ import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; import com.sinch.sdk.core.models.OptionalValue; import com.sinch.sdk.domains.verification.models.v1.Identity; +import com.sinch.sdk.domains.verification.models.v1.SmsCodeType; import com.sinch.sdk.domains.verification.models.v1.start.internal.VerificationMethodStart; import com.sinch.sdk.domains.verification.models.v1.start.request.internal.VerificationStartSmsOptions; import com.sinch.sdk.domains.verification.models.v1.start.request.internal.VerificationStartSmsOptionsImpl; @@ -126,32 +127,34 @@ public OptionalValue smsOptions() { } @JsonIgnore - public String getExpiry() { - if (null == smsOptions || !smsOptions.isPresent() || null == smsOptions.get().getExpiry()) { + public SmsCodeType getCodeType() { + if (null == smsOptions || !smsOptions.isPresent() || null == smsOptions.get().getCodeType()) { return null; } - return smsOptions.get().getExpiry(); + return smsOptions.get().getCodeType(); } - public OptionalValue expiry() { + public OptionalValue codeType() { return null != smsOptions && smsOptions.isPresent() ? smsOptions - .map(f -> ((VerificationStartSmsOptionsImpl) f).expiry()) + .map(f -> ((VerificationStartSmsOptionsImpl) f).codeType()) .orElse(OptionalValue.empty()) : OptionalValue.empty(); } @JsonIgnore - public CodeTypeEnum getCodeType() { - if (null == smsOptions || !smsOptions.isPresent() || null == smsOptions.get().getCodeType()) { + public String getExpiry() { + if (null == smsOptions || !smsOptions.isPresent() || null == smsOptions.get().getExpiry()) { return null; } - return CodeTypeEnum.from(smsOptions.get().getCodeType().value()); + return smsOptions.get().getExpiry(); } - public OptionalValue codeType() { + public OptionalValue expiry() { return null != smsOptions && smsOptions.isPresent() - ? smsOptions.map(f -> CodeTypeEnum.from(smsOptions.get().getCodeType().value())) + ? smsOptions + .map(f -> ((VerificationStartSmsOptionsImpl) f).expiry()) + .orElse(OptionalValue.empty()) : OptionalValue.empty(); } @@ -275,18 +278,14 @@ public Builder setSmsOptions(VerificationStartSmsOptions smsOptions) { } @JsonIgnore - public Builder setExpiry(String expiry) { - getDelegatedBuilder().setExpiry(expiry); + public Builder setCodeType(SmsCodeType codeType) { + getDelegatedBuilder().setCodeType(codeType); return this; } @JsonIgnore - public Builder setCodeType(CodeTypeEnum codeType) { - getDelegatedBuilder() - .setCodeType( - null != codeType - ? VerificationStartSmsOptionsImpl.CodeTypeEnum.from(codeType.value()) - : null); + public Builder setExpiry(String expiry) { + getDelegatedBuilder().setExpiry(expiry); return this; } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartFlashCallOptions.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartFlashCallOptions.java index cc6a762a2..a53051a0c 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartFlashCallOptions.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartFlashCallOptions.java @@ -11,23 +11,38 @@ package com.sinch.sdk.domains.verification.models.v1.start.request.internal; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.sinch.sdk.core.models.AdditionalProperties; /** - * An optional object for Flash Call Verification, considered only when the verification request - * originates from your backend (not an SDK client) via an Application * signed request. */ @JsonDeserialize(builder = VerificationStartFlashCallOptionsImpl.Builder.class) -public interface VerificationStartFlashCallOptions { +public interface VerificationStartFlashCallOptions extends AdditionalProperties { /** - * The dial timeout in seconds. + * The amount of time that a phone will ring. + * + *

minimum: 5 maximum: 120 * * @return dialTimeout */ Integer getDialTimeout(); + /** + * The maximum time that a phone call verification will be active and can be completed. If the + * phone number hasn't been verified successfully during this time, then the verification request + * will fail. By default, the Sinch dashboard will automatically optimize dial time out during a + * phone call. + * + *

minimum: 5 maximum: 120 + * + * @return interceptionTimeout + */ + Integer getInterceptionTimeout(); + /** * Getting builder * @@ -38,7 +53,7 @@ static Builder builder() { } /** Dedicated Builder */ - interface Builder { + interface Builder extends AdditionalProperties.Builder { /** * see getter @@ -49,6 +64,23 @@ interface Builder { */ Builder setDialTimeout(Integer dialTimeout); + /** + * see getter + * + * @param interceptionTimeout see getter + * @return Current builder + * @see #getInterceptionTimeout + */ + Builder setInterceptionTimeout(Integer interceptionTimeout); + + /** + * see getter + * + * @return Current builder + * @see #get + */ + Builder put(String key, Object value); + /** * Create instance * diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartFlashCallOptionsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartFlashCallOptionsImpl.java index bfff7785a..f2c56899f 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartFlashCallOptionsImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartFlashCallOptionsImpl.java @@ -1,5 +1,7 @@ package com.sinch.sdk.domains.verification.models.v1.start.request.internal; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonFilter; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; @@ -7,9 +9,14 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; import com.sinch.sdk.core.models.OptionalValue; +import java.util.HashMap; +import java.util.Map; import java.util.Objects; -@JsonPropertyOrder({VerificationStartFlashCallOptionsImpl.JSON_PROPERTY_DIAL_TIMEOUT}) +@JsonPropertyOrder({ + VerificationStartFlashCallOptionsImpl.JSON_PROPERTY_DIAL_TIMEOUT, + VerificationStartFlashCallOptionsImpl.JSON_PROPERTY_INTERCEPTION_TIMEOUT +}) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) public class VerificationStartFlashCallOptionsImpl implements VerificationStartFlashCallOptions { @@ -19,10 +26,25 @@ public class VerificationStartFlashCallOptionsImpl implements VerificationStartF private OptionalValue dialTimeout; + public static final String JSON_PROPERTY_INTERCEPTION_TIMEOUT = "interceptionTimeout"; + + private OptionalValue interceptionTimeout; + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private OptionalValue> additionalProperties; + public VerificationStartFlashCallOptionsImpl() {} - protected VerificationStartFlashCallOptionsImpl(OptionalValue dialTimeout) { + protected VerificationStartFlashCallOptionsImpl( + OptionalValue dialTimeout, + OptionalValue interceptionTimeout, + OptionalValue> additionalProperties) { this.dialTimeout = dialTimeout; + this.interceptionTimeout = interceptionTimeout; + this.additionalProperties = additionalProperties; } @JsonIgnore @@ -36,6 +58,34 @@ public OptionalValue dialTimeout() { return dialTimeout; } + @JsonIgnore + public Integer getInterceptionTimeout() { + return interceptionTimeout.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_INTERCEPTION_TIMEOUT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue interceptionTimeout() { + return interceptionTimeout; + } + + @JsonIgnore + public Object get(String key) { + + if (null == this.additionalProperties || !additionalProperties.isPresent()) { + return null; + } + return this.additionalProperties.get().get(key); + } + + @JsonAnyGetter + public Map additionalProperties() { + if (null == this.additionalProperties || !additionalProperties.isPresent()) { + return null; + } + return additionalProperties.get(); + } + /** * Return true if this VerificationStartRequestFlashCall_allOf_flashCallOptions object is equal to * o. @@ -51,19 +101,33 @@ public boolean equals(Object o) { VerificationStartFlashCallOptionsImpl verificationStartRequestFlashCallAllOfFlashCallOptions = (VerificationStartFlashCallOptionsImpl) o; return Objects.equals( - this.dialTimeout, verificationStartRequestFlashCallAllOfFlashCallOptions.dialTimeout); + this.dialTimeout, verificationStartRequestFlashCallAllOfFlashCallOptions.dialTimeout) + && Objects.equals( + this.interceptionTimeout, + verificationStartRequestFlashCallAllOfFlashCallOptions.interceptionTimeout) + && Objects.equals( + this.additionalProperties, + verificationStartRequestFlashCallAllOfFlashCallOptions.additionalProperties) + && super.equals(o); } @Override public int hashCode() { - return Objects.hash(dialTimeout); + return Objects.hash(dialTimeout, interceptionTimeout, super.hashCode(), additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class VerificationStartFlashCallOptionsImpl {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" dialTimeout: ").append(toIndentedString(dialTimeout)).append("\n"); + sb.append(" interceptionTimeout: ") + .append(toIndentedString(interceptionTimeout)) + .append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); sb.append("}"); return sb.toString(); } @@ -81,6 +145,8 @@ private String toIndentedString(Object o) { @JsonPOJOBuilder(withPrefix = "set") static class Builder implements VerificationStartFlashCallOptions.Builder { OptionalValue dialTimeout = OptionalValue.empty(); + OptionalValue interceptionTimeout = OptionalValue.empty(); + OptionalValue> additionalProperties = OptionalValue.empty(); @JsonProperty(JSON_PROPERTY_DIAL_TIMEOUT) public Builder setDialTimeout(Integer dialTimeout) { @@ -88,8 +154,24 @@ public Builder setDialTimeout(Integer dialTimeout) { return this; } + @JsonProperty(JSON_PROPERTY_INTERCEPTION_TIMEOUT) + public Builder setInterceptionTimeout(Integer interceptionTimeout) { + this.interceptionTimeout = OptionalValue.of(interceptionTimeout); + return this; + } + + @JsonAnySetter + public Builder put(String key, Object value) { + if (!this.additionalProperties.isPresent()) { + this.additionalProperties = OptionalValue.of(new HashMap()); + } + this.additionalProperties.get().put(key, value); + return this; + } + public VerificationStartFlashCallOptions build() { - return new VerificationStartFlashCallOptionsImpl(dialTimeout); + return new VerificationStartFlashCallOptionsImpl( + dialTimeout, interceptionTimeout, additionalProperties); } } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartPhoneCallOptions.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartPhoneCallOptions.java index 251237e92..e42ed61e9 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartPhoneCallOptions.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartPhoneCallOptions.java @@ -11,14 +11,16 @@ package com.sinch.sdk.domains.verification.models.v1.start.request.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; /** - * An optional object for Phone Call Verification, with default values assumed for all contained - * values if not provided. + * An optional configuration for Phone Call Verification, should be used only when the verification + * request originates from your backend (not an end user device) and request is signed via an Application signed request. */ @JsonDeserialize(builder = VerificationStartPhoneCallOptionsImpl.Builder.class) -public interface VerificationStartPhoneCallOptions { +public interface VerificationStartPhoneCallOptions extends AdditionalProperties { /** * Get speech @@ -37,7 +39,7 @@ static Builder builder() { } /** Dedicated Builder */ - interface Builder { + interface Builder extends AdditionalProperties.Builder { /** * see getter @@ -48,6 +50,14 @@ interface Builder { */ Builder setSpeech(PhoneCallSpeech speech); + /** + * see getter + * + * @return Current builder + * @see #get + */ + Builder put(String key, Object value); + /** * Create instance * diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartPhoneCallOptionsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartPhoneCallOptionsImpl.java index fc5ddc197..6dccf2018 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartPhoneCallOptionsImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartPhoneCallOptionsImpl.java @@ -1,5 +1,7 @@ package com.sinch.sdk.domains.verification.models.v1.start.request.internal; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonFilter; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; @@ -8,6 +10,8 @@ import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; import com.sinch.sdk.core.models.OptionalValue; import com.sinch.sdk.domains.verification.models.v1.start.request.PhoneCallSpeech; +import java.util.HashMap; +import java.util.Map; import java.util.Objects; @JsonPropertyOrder({VerificationStartPhoneCallOptionsImpl.JSON_PROPERTY_SPEECH}) @@ -20,10 +24,19 @@ public class VerificationStartPhoneCallOptionsImpl implements VerificationStartP private OptionalValue speech; + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private OptionalValue> additionalProperties; + public VerificationStartPhoneCallOptionsImpl() {} - protected VerificationStartPhoneCallOptionsImpl(OptionalValue speech) { + protected VerificationStartPhoneCallOptionsImpl( + OptionalValue speech, + OptionalValue> additionalProperties) { this.speech = speech; + this.additionalProperties = additionalProperties; } @JsonIgnore @@ -37,6 +50,23 @@ public OptionalValue speech() { return speech; } + @JsonIgnore + public Object get(String key) { + + if (null == this.additionalProperties || !additionalProperties.isPresent()) { + return null; + } + return this.additionalProperties.get().get(key); + } + + @JsonAnyGetter + public Map additionalProperties() { + if (null == this.additionalProperties || !additionalProperties.isPresent()) { + return null; + } + return additionalProperties.get(); + } + /** * Return true if this VerificationStartRequestPhoneCall_allOf_calloutOptions object is equal to * o. @@ -51,19 +81,27 @@ public boolean equals(Object o) { } VerificationStartPhoneCallOptionsImpl verificationStartRequestPhoneCallAllOfCalloutOptions = (VerificationStartPhoneCallOptionsImpl) o; - return Objects.equals(this.speech, verificationStartRequestPhoneCallAllOfCalloutOptions.speech); + return Objects.equals(this.speech, verificationStartRequestPhoneCallAllOfCalloutOptions.speech) + && Objects.equals( + this.additionalProperties, + verificationStartRequestPhoneCallAllOfCalloutOptions.additionalProperties) + && super.equals(o); } @Override public int hashCode() { - return Objects.hash(speech); + return Objects.hash(speech, super.hashCode(), additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class VerificationStartPhoneCallOptionsImpl {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" speech: ").append(toIndentedString(speech)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); sb.append("}"); return sb.toString(); } @@ -81,6 +119,7 @@ private String toIndentedString(Object o) { @JsonPOJOBuilder(withPrefix = "set") static class Builder implements VerificationStartPhoneCallOptions.Builder { OptionalValue speech = OptionalValue.empty(); + OptionalValue> additionalProperties = OptionalValue.empty(); @JsonProperty(JSON_PROPERTY_SPEECH) public Builder setSpeech(PhoneCallSpeech speech) { @@ -88,8 +127,17 @@ public Builder setSpeech(PhoneCallSpeech speech) { return this; } + @JsonAnySetter + public Builder put(String key, Object value) { + if (!this.additionalProperties.isPresent()) { + this.additionalProperties = OptionalValue.of(new HashMap()); + } + this.additionalProperties.get().put(key, value); + return this; + } + public VerificationStartPhoneCallOptions build() { - return new VerificationStartPhoneCallOptionsImpl(speech); + return new VerificationStartPhoneCallOptionsImpl(speech, additionalProperties); } } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartSmsOptions.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartSmsOptions.java index f5b8eb1be..67ea17a8e 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartSmsOptions.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartSmsOptions.java @@ -12,59 +12,30 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.sinch.sdk.core.models.AdditionalProperties; -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; -import java.util.Arrays; -import java.util.stream.Stream; +import com.sinch.sdk.domains.verification.models.v1.SmsCodeType; /** - * An optional object for SMS Verification, with default values assumed for all contained values if - * not provided. + * An optional configuration for Sms Verification, should be used only when the verification request + * originates from your backend (not an end user device) and request is signed via an Application signed request. */ @JsonDeserialize(builder = VerificationStartSmsOptionsImpl.Builder.class) public interface VerificationStartSmsOptions extends AdditionalProperties { /** - * The expiration time for a verification process is represented in the format HH:MM:SS - * . + * Get codeType * - * @return expiry + * @return codeType */ - String getExpiry(); - - /** Accepted values for the type of code to be generated are Numeric, Alpha, and Alphanumeric. */ - public class CodeTypeEnum extends EnumDynamic { - public static final CodeTypeEnum NUMERIC = new CodeTypeEnum("Numeric"); - public static final CodeTypeEnum ALPHA = new CodeTypeEnum("Alpha"); - public static final CodeTypeEnum ALPHANUMERIC = new CodeTypeEnum("Alphanumeric"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - CodeTypeEnum.class, CodeTypeEnum::new, Arrays.asList(NUMERIC, ALPHA, ALPHANUMERIC)); - - private CodeTypeEnum(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static CodeTypeEnum from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(CodeTypeEnum e) { - return ENUM_SUPPORT.valueOf(e); - } - } + SmsCodeType getCodeType(); /** - * Accepted values for the type of code to be generated are Numeric, Alpha, and Alphanumeric. + * The expiration time for a verification process is represented in the format HH:MM:SS + * . * - * @return codeType + * @return expiry */ - CodeTypeEnum getCodeType(); + String getExpiry(); /** * The SMS template must include a placeholder {{CODE}} where the verification code @@ -98,20 +69,20 @@ interface Builder extends AdditionalProperties.Builder { /** * see getter * - * @param expiry see getter + * @param codeType see getter * @return Current builder - * @see #getExpiry + * @see #getCodeType */ - Builder setExpiry(String expiry); + Builder setCodeType(SmsCodeType codeType); /** * see getter * - * @param codeType see getter + * @param expiry see getter * @return Current builder - * @see #getCodeType + * @see #getExpiry */ - Builder setCodeType(CodeTypeEnum codeType); + Builder setExpiry(String expiry); /** * see getter diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartSmsOptionsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartSmsOptionsImpl.java index 9ed8e96f3..f027e34e3 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartSmsOptionsImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartSmsOptionsImpl.java @@ -9,13 +9,14 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; import com.sinch.sdk.core.models.OptionalValue; +import com.sinch.sdk.domains.verification.models.v1.SmsCodeType; import java.util.HashMap; import java.util.Map; import java.util.Objects; @JsonPropertyOrder({ - VerificationStartSmsOptionsImpl.JSON_PROPERTY_EXPIRY, VerificationStartSmsOptionsImpl.JSON_PROPERTY_CODE_TYPE, + VerificationStartSmsOptionsImpl.JSON_PROPERTY_EXPIRY, VerificationStartSmsOptionsImpl.JSON_PROPERTY_TEMPLATE }) @JsonFilter("uninitializedFilter") @@ -23,13 +24,13 @@ public class VerificationStartSmsOptionsImpl implements VerificationStartSmsOptions { private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_EXPIRY = "expiry"; + public static final String JSON_PROPERTY_CODE_TYPE = "codeType"; - private OptionalValue expiry; + private OptionalValue codeType; - public static final String JSON_PROPERTY_CODE_TYPE = "codeType"; + public static final String JSON_PROPERTY_EXPIRY = "expiry"; - private OptionalValue codeType; + private OptionalValue expiry; public static final String JSON_PROPERTY_TEMPLATE = "template"; @@ -46,38 +47,38 @@ public class VerificationStartSmsOptionsImpl implements VerificationStartSmsOpti public VerificationStartSmsOptionsImpl() {} protected VerificationStartSmsOptionsImpl( + OptionalValue codeType, OptionalValue expiry, - OptionalValue codeType, OptionalValue template, OptionalValue acceptLanguage, OptionalValue> additionalProperties) { - this.expiry = expiry; this.codeType = codeType; + this.expiry = expiry; this.template = template; this.acceptLanguage = acceptLanguage; this.additionalProperties = additionalProperties; } @JsonIgnore - public String getExpiry() { - return expiry.orElse(null); + public SmsCodeType getCodeType() { + return codeType.orElse(null); } - @JsonProperty(JSON_PROPERTY_EXPIRY) + @JsonProperty(JSON_PROPERTY_CODE_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OptionalValue expiry() { - return expiry; + public OptionalValue codeType() { + return codeType; } @JsonIgnore - public CodeTypeEnum getCodeType() { - return codeType.orElse(null); + public String getExpiry() { + return expiry.orElse(null); } - @JsonProperty(JSON_PROPERTY_CODE_TYPE) + @JsonProperty(JSON_PROPERTY_EXPIRY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OptionalValue codeType() { - return codeType; + public OptionalValue expiry() { + return expiry; } @JsonIgnore @@ -128,8 +129,8 @@ public boolean equals(Object o) { } VerificationStartSmsOptionsImpl verificationStartRequestSmsAllOfSmsOptions = (VerificationStartSmsOptionsImpl) o; - return Objects.equals(this.expiry, verificationStartRequestSmsAllOfSmsOptions.expiry) - && Objects.equals(this.codeType, verificationStartRequestSmsAllOfSmsOptions.codeType) + return Objects.equals(this.codeType, verificationStartRequestSmsAllOfSmsOptions.codeType) + && Objects.equals(this.expiry, verificationStartRequestSmsAllOfSmsOptions.expiry) && Objects.equals(this.template, verificationStartRequestSmsAllOfSmsOptions.template) && Objects.equals( this.acceptLanguage, verificationStartRequestSmsAllOfSmsOptions.acceptLanguage) @@ -142,7 +143,7 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash( - expiry, codeType, template, acceptLanguage, super.hashCode(), additionalProperties); + codeType, expiry, template, acceptLanguage, super.hashCode(), additionalProperties); } @Override @@ -150,8 +151,8 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class VerificationStartSmsOptionsImpl {\n"); sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" expiry: ").append(toIndentedString(expiry)).append("\n"); sb.append(" codeType: ").append(toIndentedString(codeType)).append("\n"); + sb.append(" expiry: ").append(toIndentedString(expiry)).append("\n"); sb.append(" template: ").append(toIndentedString(template)).append("\n"); sb.append(" acceptLanguage: ").append(toIndentedString(acceptLanguage)).append("\n"); sb.append(" additionalProperties: ") @@ -173,21 +174,21 @@ private String toIndentedString(Object o) { @JsonPOJOBuilder(withPrefix = "set") static class Builder implements VerificationStartSmsOptions.Builder { + OptionalValue codeType = OptionalValue.empty(); OptionalValue expiry = OptionalValue.empty(); - OptionalValue codeType = OptionalValue.empty(); OptionalValue template = OptionalValue.empty(); OptionalValue acceptLanguage = OptionalValue.empty(); OptionalValue> additionalProperties = OptionalValue.empty(); - @JsonProperty(JSON_PROPERTY_EXPIRY) - public Builder setExpiry(String expiry) { - this.expiry = OptionalValue.of(expiry); + @JsonProperty(JSON_PROPERTY_CODE_TYPE) + public Builder setCodeType(SmsCodeType codeType) { + this.codeType = OptionalValue.of(codeType); return this; } - @JsonProperty(JSON_PROPERTY_CODE_TYPE) - public Builder setCodeType(CodeTypeEnum codeType) { - this.codeType = OptionalValue.of(codeType); + @JsonProperty(JSON_PROPERTY_EXPIRY) + public Builder setExpiry(String expiry) { + this.expiry = OptionalValue.of(expiry); return this; } @@ -214,7 +215,7 @@ public Builder put(String key, Object value) { public VerificationStartSmsOptions build() { return new VerificationStartSmsOptionsImpl( - expiry, codeType, template, acceptLanguage, additionalProperties); + codeType, expiry, template, acceptLanguage, additionalProperties); } } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseFlashCall.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseFlashCall.java index 41f06690c..997d289a7 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseFlashCall.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseFlashCall.java @@ -60,13 +60,21 @@ public interface VerificationStartResponseFlashCall Integer getReportTimeout(); /** - * Used by the SDKs, this setting makes the handset deny the flash call after the set time in - * seconds. + * Used by the mobile SDKs, this setting makes the handset deny the flash call after the set time + * in seconds. * * @return denyCallAfter */ Integer getDenyCallAfter(); + /** + * Return the additional "flashCall" with the specified name. + * + * @param key the name of the property + * @return the additional property with the specified name + */ + Object getExtraOption(String key); + /** * Getting builder * @@ -135,6 +143,14 @@ interface Builder */ Builder setDenyCallAfter(Integer denyCallAfter); + /** + * see getter + * + * @return Current builder + * @see #getExtraOption + */ + Builder putExtraOption(String key, Object value); + /** * Create instance * diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseFlashCallImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseFlashCallImpl.java index 78ff0eb65..44820952b 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseFlashCallImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseFlashCallImpl.java @@ -173,6 +173,11 @@ public OptionalValue denyCallAfter() { : OptionalValue.empty(); } + @JsonIgnore + public Object getExtraOption(String key) { + return null != flashCall && flashCall.isPresent() ? flashCall.get().get(key) : null; + } + /** Return true if this VerificationStartResponseFlashCall object is equal to o. */ @Override public boolean equals(Object o) { @@ -269,6 +274,11 @@ public Builder setDenyCallAfter(Integer denyCallAfter) { return this; } + public Builder putExtraOption(String key, Object value) { + getDelegatedBuilder().put(key, value); + return this; + } + private VerificationStartResponseFlashCallContent.Builder getDelegatedBuilder() { if (null == _delegatedBuilder) { this._delegatedBuilder = VerificationStartResponseFlashCallContent.builder(); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseSms.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseSms.java index 10343c905..edb4078b7 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseSms.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseSms.java @@ -11,6 +11,7 @@ package com.sinch.sdk.domains.verification.models.v1.start.response; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.sinch.sdk.domains.verification.models.v1.SmsCodeType; import java.util.List; /** SMS Response */ @@ -48,6 +49,21 @@ public interface VerificationStartResponseSms */ Integer getInterceptionTimeout(); + /** + * Get codeType + * + * @return codeType + */ + SmsCodeType getCodeType(); + + /** + * Return the additional "sms" with the specified name. + * + * @param key the name of the property + * @return the additional property with the specified name + */ + Object getExtraOption(String key); + /** * Getting builder * @@ -98,6 +114,23 @@ interface Builder */ Builder setInterceptionTimeout(Integer interceptionTimeout); + /** + * see getter + * + * @param codeType see getter + * @return Current builder + * @see #getCodeType + */ + Builder setCodeType(SmsCodeType codeType); + + /** + * see getter + * + * @return Current builder + * @see #getExtraOption + */ + Builder putExtraOption(String key, Object value); + /** * Create instance * diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseSmsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseSmsImpl.java index d252843ee..e6abbad90 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseSmsImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseSmsImpl.java @@ -13,6 +13,7 @@ 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.SmsCodeType; import com.sinch.sdk.domains.verification.models.v1.start.internal.VerificationMethodStart; import com.sinch.sdk.domains.verification.models.v1.start.response.internal.VerificationStartResponseSmsContent; import com.sinch.sdk.domains.verification.models.v1.start.response.internal.VerificationStartResponseSmsContentImpl; @@ -137,6 +138,26 @@ public OptionalValue interceptionTimeout() { : OptionalValue.empty(); } + @JsonIgnore + public SmsCodeType getCodeType() { + if (null == sms || !sms.isPresent() || null == sms.get().getCodeType()) { + return null; + } + return sms.get().getCodeType(); + } + + public OptionalValue codeType() { + return null != sms && sms.isPresent() + ? sms.map(f -> ((VerificationStartResponseSmsContentImpl) f).codeType()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public Object getExtraOption(String key) { + return null != sms && sms.isPresent() ? sms.get().get(key) : null; + } + /** Return true if this VerificationStartResponseSms object is equal to o. */ @Override public boolean equals(Object o) { @@ -220,6 +241,17 @@ public Builder setInterceptionTimeout(Integer interceptionTimeout) { return this; } + @JsonIgnore + public Builder setCodeType(SmsCodeType codeType) { + getDelegatedBuilder().setCodeType(codeType); + return this; + } + + public Builder putExtraOption(String key, Object value) { + getDelegatedBuilder().put(key, value); + return this; + } + private VerificationStartResponseSmsContent.Builder getDelegatedBuilder() { if (null == _delegatedBuilder) { this._delegatedBuilder = VerificationStartResponseSmsContent.builder(); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseFlashCallContent.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseFlashCallContent.java index 59ace77cb..ac3dd00b3 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseFlashCallContent.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseFlashCallContent.java @@ -11,12 +11,13 @@ package com.sinch.sdk.domains.verification.models.v1.start.response.internal; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.sinch.sdk.core.models.AdditionalProperties; /** * The response contains the cliFilter and interceptionTimeout properties. */ @JsonDeserialize(builder = VerificationStartResponseFlashCallContentImpl.Builder.class) -public interface VerificationStartResponseFlashCallContent { +public interface VerificationStartResponseFlashCallContent extends AdditionalProperties { /** * Filter that should be applied for incoming calls to intercept the flash call. @@ -44,8 +45,8 @@ public interface VerificationStartResponseFlashCallContent { Integer getReportTimeout(); /** - * Used by the SDKs, this setting makes the handset deny the flash call after the set time in - * seconds. + * Used by the mobile SDKs, this setting makes the handset deny the flash call after the set time + * in seconds. * * @return denyCallAfter */ @@ -61,7 +62,7 @@ static Builder builder() { } /** Dedicated Builder */ - interface Builder { + interface Builder extends AdditionalProperties.Builder { /** * see getter @@ -99,6 +100,14 @@ interface Builder { */ Builder setDenyCallAfter(Integer denyCallAfter); + /** + * see getter + * + * @return Current builder + * @see #get + */ + Builder put(String key, Object value); + /** * Create instance * diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseFlashCallContentImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseFlashCallContentImpl.java index ba4251d32..d0790054e 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseFlashCallContentImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseFlashCallContentImpl.java @@ -1,5 +1,7 @@ package com.sinch.sdk.domains.verification.models.v1.start.response.internal; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonFilter; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; @@ -7,6 +9,8 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; import com.sinch.sdk.core.models.OptionalValue; +import java.util.HashMap; +import java.util.Map; import java.util.Objects; @JsonPropertyOrder({ @@ -37,17 +41,25 @@ public class VerificationStartResponseFlashCallContentImpl private OptionalValue denyCallAfter; + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private OptionalValue> additionalProperties; + public VerificationStartResponseFlashCallContentImpl() {} protected VerificationStartResponseFlashCallContentImpl( OptionalValue cliFilter, OptionalValue interceptionTimeout, OptionalValue reportTimeout, - OptionalValue denyCallAfter) { + OptionalValue denyCallAfter, + OptionalValue> additionalProperties) { this.cliFilter = cliFilter; this.interceptionTimeout = interceptionTimeout; this.reportTimeout = reportTimeout; this.denyCallAfter = denyCallAfter; + this.additionalProperties = additionalProperties; } @JsonIgnore @@ -94,6 +106,23 @@ public OptionalValue denyCallAfter() { return denyCallAfter; } + @JsonIgnore + public Object get(String key) { + + if (null == this.additionalProperties || !additionalProperties.isPresent()) { + return null; + } + return this.additionalProperties.get().get(key); + } + + @JsonAnyGetter + public Map additionalProperties() { + if (null == this.additionalProperties || !additionalProperties.isPresent()) { + return null; + } + return additionalProperties.get(); + } + /** * Return true if this VerificationStartResponseFlashCall_allOf_flashCall object is equal to o. */ @@ -115,24 +144,38 @@ public boolean equals(Object o) { && Objects.equals( this.reportTimeout, verificationStartResponseFlashCallAllOfFlashCall.reportTimeout) && Objects.equals( - this.denyCallAfter, verificationStartResponseFlashCallAllOfFlashCall.denyCallAfter); + this.denyCallAfter, verificationStartResponseFlashCallAllOfFlashCall.denyCallAfter) + && Objects.equals( + this.additionalProperties, + verificationStartResponseFlashCallAllOfFlashCall.additionalProperties) + && super.equals(o); } @Override public int hashCode() { - return Objects.hash(cliFilter, interceptionTimeout, reportTimeout, denyCallAfter); + return Objects.hash( + cliFilter, + interceptionTimeout, + reportTimeout, + denyCallAfter, + super.hashCode(), + additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class VerificationStartResponseFlashCallContentImpl {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" cliFilter: ").append(toIndentedString(cliFilter)).append("\n"); sb.append(" interceptionTimeout: ") .append(toIndentedString(interceptionTimeout)) .append("\n"); sb.append(" reportTimeout: ").append(toIndentedString(reportTimeout)).append("\n"); sb.append(" denyCallAfter: ").append(toIndentedString(denyCallAfter)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); sb.append("}"); return sb.toString(); } @@ -153,6 +196,7 @@ static class Builder implements VerificationStartResponseFlashCallContent.Builde OptionalValue interceptionTimeout = OptionalValue.empty(); OptionalValue reportTimeout = OptionalValue.empty(); OptionalValue denyCallAfter = OptionalValue.empty(); + OptionalValue> additionalProperties = OptionalValue.empty(); @JsonProperty(value = JSON_PROPERTY_CLI_FILTER, required = true) public Builder setCliFilter(String cliFilter) { @@ -178,9 +222,18 @@ public Builder setDenyCallAfter(Integer denyCallAfter) { return this; } + @JsonAnySetter + public Builder put(String key, Object value) { + if (!this.additionalProperties.isPresent()) { + this.additionalProperties = OptionalValue.of(new HashMap()); + } + this.additionalProperties.get().put(key, value); + return this; + } + public VerificationStartResponseFlashCallContent build() { return new VerificationStartResponseFlashCallContentImpl( - cliFilter, interceptionTimeout, reportTimeout, denyCallAfter); + cliFilter, interceptionTimeout, reportTimeout, denyCallAfter, additionalProperties); } } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseSmsContent.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseSmsContent.java index 07266cbb3..729eb6b5d 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseSmsContent.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseSmsContent.java @@ -11,10 +11,12 @@ package com.sinch.sdk.domains.verification.models.v1.start.response.internal; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.sinch.sdk.core.models.AdditionalProperties; +import com.sinch.sdk.domains.verification.models.v1.SmsCodeType; /** The response contains the template of the SMS to be expected and intercepted. */ @JsonDeserialize(builder = VerificationStartResponseSmsContentImpl.Builder.class) -public interface VerificationStartResponseSmsContent { +public interface VerificationStartResponseSmsContent extends AdditionalProperties { /** * The expected template for the SMS response. @@ -30,6 +32,13 @@ public interface VerificationStartResponseSmsContent { */ Integer getInterceptionTimeout(); + /** + * Get codeType + * + * @return codeType + */ + SmsCodeType getCodeType(); + /** * Getting builder * @@ -40,7 +49,7 @@ static Builder builder() { } /** Dedicated Builder */ - interface Builder { + interface Builder extends AdditionalProperties.Builder { /** * see getter @@ -60,6 +69,23 @@ interface Builder { */ Builder setInterceptionTimeout(Integer interceptionTimeout); + /** + * see getter + * + * @param codeType see getter + * @return Current builder + * @see #getCodeType + */ + Builder setCodeType(SmsCodeType codeType); + + /** + * see getter + * + * @return Current builder + * @see #get + */ + Builder put(String key, Object value); + /** * Create instance * diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseSmsContentImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseSmsContentImpl.java index 272ba4f41..8cad02c9e 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseSmsContentImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseSmsContentImpl.java @@ -1,5 +1,7 @@ package com.sinch.sdk.domains.verification.models.v1.start.response.internal; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonFilter; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; @@ -7,11 +9,15 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; import com.sinch.sdk.core.models.OptionalValue; +import com.sinch.sdk.domains.verification.models.v1.SmsCodeType; +import java.util.HashMap; +import java.util.Map; import java.util.Objects; @JsonPropertyOrder({ VerificationStartResponseSmsContentImpl.JSON_PROPERTY_TEMPLATE, - VerificationStartResponseSmsContentImpl.JSON_PROPERTY_INTERCEPTION_TIMEOUT + VerificationStartResponseSmsContentImpl.JSON_PROPERTY_INTERCEPTION_TIMEOUT, + VerificationStartResponseSmsContentImpl.JSON_PROPERTY_CODE_TYPE }) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) @@ -27,12 +33,27 @@ public class VerificationStartResponseSmsContentImpl private OptionalValue interceptionTimeout; + public static final String JSON_PROPERTY_CODE_TYPE = "codeType"; + + private OptionalValue codeType; + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private OptionalValue> additionalProperties; + public VerificationStartResponseSmsContentImpl() {} protected VerificationStartResponseSmsContentImpl( - OptionalValue template, OptionalValue interceptionTimeout) { + OptionalValue template, + OptionalValue interceptionTimeout, + OptionalValue codeType, + OptionalValue> additionalProperties) { this.template = template; this.interceptionTimeout = interceptionTimeout; + this.codeType = codeType; + this.additionalProperties = additionalProperties; } @JsonIgnore @@ -57,6 +78,34 @@ public OptionalValue interceptionTimeout() { return interceptionTimeout; } + @JsonIgnore + public SmsCodeType getCodeType() { + return codeType.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CODE_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue codeType() { + return codeType; + } + + @JsonIgnore + public Object get(String key) { + + if (null == this.additionalProperties || !additionalProperties.isPresent()) { + return null; + } + return this.additionalProperties.get().get(key); + } + + @JsonAnyGetter + public Map additionalProperties() { + if (null == this.additionalProperties || !additionalProperties.isPresent()) { + return null; + } + return additionalProperties.get(); + } + /** Return true if this VerificationStartResponseSms_allOf_sms object is equal to o. */ @Override public boolean equals(Object o) { @@ -70,22 +119,32 @@ public boolean equals(Object o) { (VerificationStartResponseSmsContentImpl) o; return Objects.equals(this.template, verificationStartResponseSmsAllOfSms.template) && Objects.equals( - this.interceptionTimeout, verificationStartResponseSmsAllOfSms.interceptionTimeout); + this.interceptionTimeout, verificationStartResponseSmsAllOfSms.interceptionTimeout) + && Objects.equals(this.codeType, verificationStartResponseSmsAllOfSms.codeType) + && Objects.equals( + this.additionalProperties, verificationStartResponseSmsAllOfSms.additionalProperties) + && super.equals(o); } @Override public int hashCode() { - return Objects.hash(template, interceptionTimeout); + return Objects.hash( + template, interceptionTimeout, codeType, super.hashCode(), additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class VerificationStartResponseSmsContentImpl {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" template: ").append(toIndentedString(template)).append("\n"); sb.append(" interceptionTimeout: ") .append(toIndentedString(interceptionTimeout)) .append("\n"); + sb.append(" codeType: ").append(toIndentedString(codeType)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); sb.append("}"); return sb.toString(); } @@ -104,6 +163,8 @@ private String toIndentedString(Object o) { static class Builder implements VerificationStartResponseSmsContent.Builder { OptionalValue template = OptionalValue.empty(); OptionalValue interceptionTimeout = OptionalValue.empty(); + OptionalValue codeType = OptionalValue.empty(); + OptionalValue> additionalProperties = OptionalValue.empty(); @JsonProperty(JSON_PROPERTY_TEMPLATE) public Builder setTemplate(String template) { @@ -117,8 +178,24 @@ public Builder setInterceptionTimeout(Integer interceptionTimeout) { return this; } + @JsonProperty(JSON_PROPERTY_CODE_TYPE) + public Builder setCodeType(SmsCodeType codeType) { + this.codeType = OptionalValue.of(codeType); + return this; + } + + @JsonAnySetter + public Builder put(String key, Object value) { + if (!this.additionalProperties.isPresent()) { + this.additionalProperties = OptionalValue.of(new HashMap()); + } + this.additionalProperties.get().put(key, value); + return this; + } + public VerificationStartResponseSmsContent build() { - return new VerificationStartResponseSmsContentImpl(template, interceptionTimeout); + return new VerificationStartResponseSmsContentImpl( + template, interceptionTimeout, codeType, additionalProperties); } } } 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/webhooks/VerificationRequestEventResponseFlashCall.java index bbb10f611..a025a81b6 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/webhooks/VerificationRequestEventResponseFlashCall.java @@ -36,16 +36,34 @@ public interface VerificationRequestEventResponseFlashCall */ String getCli(); + /** + * The amount of time that a phone will ring. + * + *

minimum: 5 maximum: 120 + * + * @return dialTimeout + */ + Integer getDialTimeout(); + /** * The maximum time that a phone call verification will be active and can be completed. If the * phone number hasn't been verified successfully during this time, then the verification request * will fail. By default, the Sinch dashboard will automatically optimize dial time out during a - * phone call. If you want to set your own dial time out for the phone call, you can specify it in - * the response to the Verification Request Event. + * phone call. * - * @return dialTimeout + *

minimum: 5 maximum: 120 + * + * @return interceptionTimeout */ - Integer getDialTimeout(); + Integer getInterceptionTimeout(); + + /** + * Return the additional "flashCall" with the specified name. + * + * @param key the name of the property + * @return the additional property with the specified name + */ + Object getExtraOption(String key); /** * Getting builder @@ -88,6 +106,23 @@ interface Builder */ Builder setDialTimeout(Integer dialTimeout); + /** + * see getter + * + * @param interceptionTimeout see getter + * @return Current builder + * @see #getInterceptionTimeout + */ + Builder setInterceptionTimeout(Integer interceptionTimeout); + + /** + * see getter + * + * @return Current builder + * @see #getExtraOption + */ + Builder putExtraOption(String key, Object value); + /** * Create instance * 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/webhooks/VerificationRequestEventResponseFlashCallImpl.java index eec0fe234..f696767e6 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/webhooks/VerificationRequestEventResponseFlashCallImpl.java @@ -101,6 +101,32 @@ public OptionalValue dialTimeout() { : OptionalValue.empty(); } + @JsonIgnore + public Integer getInterceptionTimeout() { + if (null == flashCall + || !flashCall.isPresent() + || null == flashCall.get().getInterceptionTimeout()) { + return null; + } + return flashCall.get().getInterceptionTimeout(); + } + + public OptionalValue interceptionTimeout() { + return null != flashCall && flashCall.isPresent() + ? flashCall + .map( + f -> + ((VerificationRequestEventResponseFlashCallContentImpl) f) + .interceptionTimeout()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public Object getExtraOption(String key) { + return null != flashCall && flashCall.isPresent() ? flashCall.get().get(key) : null; + } + /** Return true if this VerificationRequestEventResponseFlashCall object is equal to o. */ @Override public boolean equals(Object o) { @@ -173,6 +199,17 @@ public Builder setDialTimeout(Integer dialTimeout) { return this; } + @JsonIgnore + public Builder setInterceptionTimeout(Integer interceptionTimeout) { + getDelegatedBuilder().setInterceptionTimeout(interceptionTimeout); + return this; + } + + public Builder putExtraOption(String key, Object value) { + getDelegatedBuilder().put(key, value); + return this; + } + private VerificationRequestEventResponseFlashCallContent.Builder getDelegatedBuilder() { if (null == _delegatedBuilder) { this._delegatedBuilder = VerificationRequestEventResponseFlashCallContent.builder(); 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/webhooks/VerificationRequestEventResponsePhoneCall.java index 50159528e..6e2cca4b3 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/webhooks/VerificationRequestEventResponsePhoneCall.java @@ -43,6 +43,14 @@ public interface VerificationRequestEventResponsePhoneCall */ PhoneCallSpeech getSpeech(); + /** + * Return the additional "callout" with the specified name. + * + * @param key the name of the property + * @return the additional property with the specified name + */ + Object getExtraOption(String key); + /** * Getting builder * @@ -84,6 +92,14 @@ interface Builder */ Builder setSpeech(PhoneCallSpeech speech); + /** + * see getter + * + * @return Current builder + * @see #getExtraOption + */ + Builder putExtraOption(String key, Object value); + /** * Create instance * 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/webhooks/VerificationRequestEventResponsePhoneCallImpl.java index a5df5cf1c..39a39dab3 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/webhooks/VerificationRequestEventResponsePhoneCallImpl.java @@ -102,6 +102,11 @@ public OptionalValue speech() { : OptionalValue.empty(); } + @JsonIgnore + public Object getExtraOption(String key) { + return null != callout && callout.isPresent() ? callout.get().get(key) : null; + } + /** Return true if this VerificationRequestEventResponsePhoneCall object is equal to o. */ @Override public boolean equals(Object o) { @@ -173,6 +178,11 @@ public Builder setSpeech(PhoneCallSpeech speech) { return this; } + public Builder putExtraOption(String key, Object value) { + getDelegatedBuilder().put(key, value); + return this; + } + private VerificationRequestEventResponsePhoneCallContent.Builder getDelegatedBuilder() { if (null == _delegatedBuilder) { this._delegatedBuilder = VerificationRequestEventResponsePhoneCallContent.builder(); 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/webhooks/VerificationRequestEventResponseSms.java index 01e8f2cfc..53cc03285 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/webhooks/VerificationRequestEventResponseSms.java @@ -11,6 +11,7 @@ package com.sinch.sdk.domains.verification.models.v1.webhooks; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.sinch.sdk.domains.verification.models.v1.SmsCodeType; import java.util.List; /** SMS Request Event Response */ @@ -36,6 +37,21 @@ public interface VerificationRequestEventResponseSms */ String getCode(); + /** + * Get codeType + * + * @return codeType + */ + SmsCodeType getCodeType(); + + /** + * The expiration time for a verification process is represented in the format HH:MM:SS + * . + * + * @return expiry + */ + String getExpiry(); + /** * The SMS verification content language. Set in the verification request. * @@ -43,6 +59,14 @@ public interface VerificationRequestEventResponseSms */ List getAcceptLanguage(); + /** + * Return the additional "sms" with the specified name. + * + * @param key the name of the property + * @return the additional property with the specified name + */ + Object getExtraOption(String key); + /** * Getting builder * @@ -75,6 +99,24 @@ interface Builder */ Builder setCode(String code); + /** + * see getter + * + * @param codeType see getter + * @return Current builder + * @see #getCodeType + */ + Builder setCodeType(SmsCodeType codeType); + + /** + * see getter + * + * @param expiry see getter + * @return Current builder + * @see #getExpiry + */ + Builder setExpiry(String expiry); + /** * see getter * @@ -84,6 +126,14 @@ interface Builder */ Builder setAcceptLanguage(List acceptLanguage); + /** + * see getter + * + * @return Current builder + * @see #getExtraOption + */ + Builder putExtraOption(String key, Object value); + /** * Create instance * 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/webhooks/VerificationRequestEventResponseSmsImpl.java index 430f120cc..c7b42ad42 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/webhooks/VerificationRequestEventResponseSmsImpl.java @@ -13,6 +13,7 @@ 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.SmsCodeType; import com.sinch.sdk.domains.verification.models.v1.webhooks.internal.VerificationRequestEventResponseSmsContent; import com.sinch.sdk.domains.verification.models.v1.webhooks.internal.VerificationRequestEventResponseSmsContentImpl; import java.io.IOException; @@ -85,6 +86,36 @@ public OptionalValue code() { : OptionalValue.empty(); } + @JsonIgnore + public SmsCodeType getCodeType() { + if (null == sms || !sms.isPresent() || null == sms.get().getCodeType()) { + return null; + } + return sms.get().getCodeType(); + } + + public OptionalValue codeType() { + return null != sms && sms.isPresent() + ? sms.map(f -> ((VerificationRequestEventResponseSmsContentImpl) f).codeType()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public String getExpiry() { + if (null == sms || !sms.isPresent() || null == sms.get().getExpiry()) { + return null; + } + return sms.get().getExpiry(); + } + + public OptionalValue expiry() { + return null != sms && sms.isPresent() + ? sms.map(f -> ((VerificationRequestEventResponseSmsContentImpl) f).expiry()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + @JsonIgnore public List getAcceptLanguage() { if (null == sms || !sms.isPresent() || null == sms.get().getAcceptLanguage()) { @@ -100,6 +131,11 @@ public OptionalValue> acceptLanguage() { : OptionalValue.empty(); } + @JsonIgnore + public Object getExtraOption(String key) { + return null != sms && sms.isPresent() ? sms.get().get(key) : null; + } + /** Return true if this VerificationRequestEventResponseSms object is equal to o. */ @Override public boolean equals(Object o) { @@ -165,12 +201,29 @@ public Builder setCode(String code) { return this; } + @JsonIgnore + public Builder setCodeType(SmsCodeType codeType) { + getDelegatedBuilder().setCodeType(codeType); + return this; + } + + @JsonIgnore + public Builder setExpiry(String expiry) { + getDelegatedBuilder().setExpiry(expiry); + return this; + } + @JsonIgnore public Builder setAcceptLanguage(List acceptLanguage) { getDelegatedBuilder().setAcceptLanguage(acceptLanguage); return this; } + public Builder putExtraOption(String key, Object value) { + getDelegatedBuilder().put(key, value); + return this; + } + private VerificationRequestEventResponseSmsContent.Builder getDelegatedBuilder() { if (null == _delegatedBuilder) { this._delegatedBuilder = VerificationRequestEventResponseSmsContent.builder(); 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/webhooks/internal/VerificationRequestEventResponseFlashCallContent.java index 07f27b45f..cb6ff0162 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/webhooks/internal/VerificationRequestEventResponseFlashCallContent.java @@ -11,10 +11,11 @@ package com.sinch.sdk.domains.verification.models.v1.webhooks.internal; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.sinch.sdk.core.models.AdditionalProperties; /** VerificationRequestEventResponseFlashCallContent */ @JsonDeserialize(builder = VerificationRequestEventResponseFlashCallContentImpl.Builder.class) -public interface VerificationRequestEventResponseFlashCallContent { +public interface VerificationRequestEventResponseFlashCallContent extends AdditionalProperties { /** * The phone number that will be displayed to the user when the flash call is received on the @@ -26,16 +27,26 @@ public interface VerificationRequestEventResponseFlashCallContent { */ String getCli(); + /** + * The amount of time that a phone will ring. + * + *

minimum: 5 maximum: 120 + * + * @return dialTimeout + */ + Integer getDialTimeout(); + /** * The maximum time that a phone call verification will be active and can be completed. If the * phone number hasn't been verified successfully during this time, then the verification request * will fail. By default, the Sinch dashboard will automatically optimize dial time out during a - * phone call. If you want to set your own dial time out for the phone call, you can specify it in - * the response to the Verification Request Event. + * phone call. * - * @return dialTimeout + *

minimum: 5 maximum: 120 + * + * @return interceptionTimeout */ - Integer getDialTimeout(); + Integer getInterceptionTimeout(); /** * Getting builder @@ -47,7 +58,7 @@ static Builder builder() { } /** Dedicated Builder */ - interface Builder { + interface Builder extends AdditionalProperties.Builder { /** * see getter @@ -67,6 +78,23 @@ interface Builder { */ Builder setDialTimeout(Integer dialTimeout); + /** + * see getter + * + * @param interceptionTimeout see getter + * @return Current builder + * @see #getInterceptionTimeout + */ + Builder setInterceptionTimeout(Integer interceptionTimeout); + + /** + * see getter + * + * @return Current builder + * @see #get + */ + Builder put(String key, Object value); + /** * Create instance * 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/webhooks/internal/VerificationRequestEventResponseFlashCallContentImpl.java index 748325f01..8736c592f 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/webhooks/internal/VerificationRequestEventResponseFlashCallContentImpl.java @@ -1,5 +1,7 @@ package com.sinch.sdk.domains.verification.models.v1.webhooks.internal; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonFilter; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; @@ -7,11 +9,14 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; import com.sinch.sdk.core.models.OptionalValue; +import java.util.HashMap; +import java.util.Map; import java.util.Objects; @JsonPropertyOrder({ VerificationRequestEventResponseFlashCallContentImpl.JSON_PROPERTY_CLI, - VerificationRequestEventResponseFlashCallContentImpl.JSON_PROPERTY_DIAL_TIMEOUT + VerificationRequestEventResponseFlashCallContentImpl.JSON_PROPERTY_DIAL_TIMEOUT, + VerificationRequestEventResponseFlashCallContentImpl.JSON_PROPERTY_INTERCEPTION_TIMEOUT }) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) @@ -27,12 +32,27 @@ public class VerificationRequestEventResponseFlashCallContentImpl private OptionalValue dialTimeout; + public static final String JSON_PROPERTY_INTERCEPTION_TIMEOUT = "interceptionTimeout"; + + private OptionalValue interceptionTimeout; + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private OptionalValue> additionalProperties; + public VerificationRequestEventResponseFlashCallContentImpl() {} protected VerificationRequestEventResponseFlashCallContentImpl( - OptionalValue cli, OptionalValue dialTimeout) { + OptionalValue cli, + OptionalValue dialTimeout, + OptionalValue interceptionTimeout, + OptionalValue> additionalProperties) { this.cli = cli; this.dialTimeout = dialTimeout; + this.interceptionTimeout = interceptionTimeout; + this.additionalProperties = additionalProperties; } @JsonIgnore @@ -57,6 +77,34 @@ public OptionalValue dialTimeout() { return dialTimeout; } + @JsonIgnore + public Integer getInterceptionTimeout() { + return interceptionTimeout.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_INTERCEPTION_TIMEOUT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue interceptionTimeout() { + return interceptionTimeout; + } + + @JsonIgnore + public Object get(String key) { + + if (null == this.additionalProperties || !additionalProperties.isPresent()) { + return null; + } + return this.additionalProperties.get().get(key); + } + + @JsonAnyGetter + public Map additionalProperties() { + if (null == this.additionalProperties || !additionalProperties.isPresent()) { + return null; + } + return additionalProperties.get(); + } + /** * Return true if this VerificationRequestEventResponseFlashCall_allOf_flashCall object is equal * to o. @@ -74,20 +122,35 @@ public boolean equals(Object o) { (VerificationRequestEventResponseFlashCallContentImpl) o; return Objects.equals(this.cli, verificationRequestEventResponseFlashCallAllOfFlashCall.cli) && Objects.equals( - this.dialTimeout, verificationRequestEventResponseFlashCallAllOfFlashCall.dialTimeout); + this.dialTimeout, verificationRequestEventResponseFlashCallAllOfFlashCall.dialTimeout) + && Objects.equals( + this.interceptionTimeout, + verificationRequestEventResponseFlashCallAllOfFlashCall.interceptionTimeout) + && Objects.equals( + this.additionalProperties, + verificationRequestEventResponseFlashCallAllOfFlashCall.additionalProperties) + && super.equals(o); } @Override public int hashCode() { - return Objects.hash(cli, dialTimeout); + return Objects.hash( + cli, dialTimeout, interceptionTimeout, super.hashCode(), additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class VerificationRequestEventResponseFlashCallContentImpl {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" cli: ").append(toIndentedString(cli)).append("\n"); sb.append(" dialTimeout: ").append(toIndentedString(dialTimeout)).append("\n"); + sb.append(" interceptionTimeout: ") + .append(toIndentedString(interceptionTimeout)) + .append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); sb.append("}"); return sb.toString(); } @@ -106,6 +169,8 @@ private String toIndentedString(Object o) { static class Builder implements VerificationRequestEventResponseFlashCallContent.Builder { OptionalValue cli = OptionalValue.empty(); OptionalValue dialTimeout = OptionalValue.empty(); + OptionalValue interceptionTimeout = OptionalValue.empty(); + OptionalValue> additionalProperties = OptionalValue.empty(); @JsonProperty(JSON_PROPERTY_CLI) public Builder setCli(String cli) { @@ -119,8 +184,24 @@ public Builder setDialTimeout(Integer dialTimeout) { return this; } + @JsonProperty(JSON_PROPERTY_INTERCEPTION_TIMEOUT) + public Builder setInterceptionTimeout(Integer interceptionTimeout) { + this.interceptionTimeout = OptionalValue.of(interceptionTimeout); + return this; + } + + @JsonAnySetter + public Builder put(String key, Object value) { + if (!this.additionalProperties.isPresent()) { + this.additionalProperties = OptionalValue.of(new HashMap()); + } + this.additionalProperties.get().put(key, value); + return this; + } + public VerificationRequestEventResponseFlashCallContent build() { - return new VerificationRequestEventResponseFlashCallContentImpl(cli, dialTimeout); + return new VerificationRequestEventResponseFlashCallContentImpl( + 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/webhooks/internal/VerificationRequestEventResponsePhoneCallContent.java index 11ef28758..8faedeeb9 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/webhooks/internal/VerificationRequestEventResponsePhoneCallContent.java @@ -11,11 +11,12 @@ package com.sinch.sdk.domains.verification.models.v1.webhooks.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 { +public interface VerificationRequestEventResponsePhoneCallContent extends AdditionalProperties { /** * The Phone Call OTP code that should be entered by the user. Sinch servers automatically @@ -43,7 +44,7 @@ static Builder builder() { } /** Dedicated Builder */ - interface Builder { + interface Builder extends AdditionalProperties.Builder { /** * see getter @@ -63,6 +64,14 @@ interface Builder { */ Builder setSpeech(PhoneCallSpeech speech); + /** + * see getter + * + * @return Current builder + * @see #get + */ + Builder put(String key, Object value); + /** * Create instance * 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/webhooks/internal/VerificationRequestEventResponsePhoneCallContentImpl.java index 125ea226f..03f54b24d 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/webhooks/internal/VerificationRequestEventResponsePhoneCallContentImpl.java @@ -1,5 +1,7 @@ package com.sinch.sdk.domains.verification.models.v1.webhooks.internal; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonFilter; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; @@ -8,6 +10,8 @@ import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; import com.sinch.sdk.core.models.OptionalValue; import com.sinch.sdk.domains.verification.models.v1.start.request.PhoneCallSpeech; +import java.util.HashMap; +import java.util.Map; import java.util.Objects; @JsonPropertyOrder({ @@ -28,12 +32,21 @@ public class VerificationRequestEventResponsePhoneCallContentImpl private OptionalValue speech; + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private OptionalValue> additionalProperties; + public VerificationRequestEventResponsePhoneCallContentImpl() {} protected VerificationRequestEventResponsePhoneCallContentImpl( - OptionalValue code, OptionalValue speech) { + OptionalValue code, + OptionalValue speech, + OptionalValue> additionalProperties) { this.code = code; this.speech = speech; + this.additionalProperties = additionalProperties; } @JsonIgnore @@ -58,6 +71,23 @@ public OptionalValue speech() { return speech; } + @JsonIgnore + public Object get(String key) { + + if (null == this.additionalProperties || !additionalProperties.isPresent()) { + return null; + } + return this.additionalProperties.get().get(key); + } + + @JsonAnyGetter + public Map additionalProperties() { + if (null == this.additionalProperties || !additionalProperties.isPresent()) { + return null; + } + return additionalProperties.get(); + } + /** * Return true if this VerificationRequestEventResponsePhoneCall_allOf_callout object is equal to * o. @@ -74,21 +104,28 @@ public boolean equals(Object o) { verificationRequestEventResponsePhoneCallAllOfCallout = (VerificationRequestEventResponsePhoneCallContentImpl) o; return Objects.equals(this.code, verificationRequestEventResponsePhoneCallAllOfCallout.code) + && Objects.equals(this.speech, verificationRequestEventResponsePhoneCallAllOfCallout.speech) && Objects.equals( - this.speech, verificationRequestEventResponsePhoneCallAllOfCallout.speech); + this.additionalProperties, + verificationRequestEventResponsePhoneCallAllOfCallout.additionalProperties) + && super.equals(o); } @Override public int hashCode() { - return Objects.hash(code, speech); + return Objects.hash(code, speech, super.hashCode(), additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class VerificationRequestEventResponsePhoneCallContentImpl {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" code: ").append(toIndentedString(code)).append("\n"); sb.append(" speech: ").append(toIndentedString(speech)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); sb.append("}"); return sb.toString(); } @@ -107,6 +144,7 @@ private String toIndentedString(Object o) { static class Builder implements VerificationRequestEventResponsePhoneCallContent.Builder { OptionalValue code = OptionalValue.empty(); OptionalValue speech = OptionalValue.empty(); + OptionalValue> additionalProperties = OptionalValue.empty(); @JsonProperty(JSON_PROPERTY_CODE) public Builder setCode(String code) { @@ -120,8 +158,18 @@ public Builder setSpeech(PhoneCallSpeech speech) { return this; } + @JsonAnySetter + public Builder put(String key, Object value) { + if (!this.additionalProperties.isPresent()) { + this.additionalProperties = OptionalValue.of(new HashMap()); + } + this.additionalProperties.get().put(key, value); + return this; + } + public VerificationRequestEventResponsePhoneCallContent build() { - return new VerificationRequestEventResponsePhoneCallContentImpl(code, speech); + return new VerificationRequestEventResponsePhoneCallContentImpl( + 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/webhooks/internal/VerificationRequestEventResponseSmsContent.java index 105be5fdf..f473fc71e 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/webhooks/internal/VerificationRequestEventResponseSmsContent.java @@ -11,11 +11,13 @@ package com.sinch.sdk.domains.verification.models.v1.webhooks.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 { +public interface VerificationRequestEventResponseSmsContent extends AdditionalProperties { /** * The SMS OTP code that should be used. By default, the Sinch dashboard will automatically @@ -26,6 +28,21 @@ public interface VerificationRequestEventResponseSmsContent { */ String getCode(); + /** + * Get codeType + * + * @return codeType + */ + SmsCodeType getCodeType(); + + /** + * The expiration time for a verification process is represented in the format HH:MM:SS + * . + * + * @return expiry + */ + String getExpiry(); + /** * The SMS verification content language. Set in the verification request. * @@ -43,7 +60,7 @@ static Builder builder() { } /** Dedicated Builder */ - interface Builder { + interface Builder extends AdditionalProperties.Builder { /** * see getter @@ -54,6 +71,24 @@ interface Builder { */ Builder setCode(String code); + /** + * see getter + * + * @param codeType see getter + * @return Current builder + * @see #getCodeType + */ + Builder setCodeType(SmsCodeType codeType); + + /** + * see getter + * + * @param expiry see getter + * @return Current builder + * @see #getExpiry + */ + Builder setExpiry(String expiry); + /** * see getter * @@ -63,6 +98,14 @@ interface Builder { */ Builder setAcceptLanguage(List acceptLanguage); + /** + * see getter + * + * @return Current builder + * @see #get + */ + Builder put(String key, Object value); + /** * Create instance * 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/webhooks/internal/VerificationRequestEventResponseSmsContentImpl.java index f39c59a4a..2de8637cb 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/webhooks/internal/VerificationRequestEventResponseSmsContentImpl.java @@ -1,5 +1,7 @@ package com.sinch.sdk.domains.verification.models.v1.webhooks.internal; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonFilter; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; @@ -7,11 +9,16 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; import com.sinch.sdk.core.models.OptionalValue; +import com.sinch.sdk.domains.verification.models.v1.SmsCodeType; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Objects; @JsonPropertyOrder({ VerificationRequestEventResponseSmsContentImpl.JSON_PROPERTY_CODE, + VerificationRequestEventResponseSmsContentImpl.JSON_PROPERTY_CODE_TYPE, + VerificationRequestEventResponseSmsContentImpl.JSON_PROPERTY_EXPIRY, VerificationRequestEventResponseSmsContentImpl.JSON_PROPERTY_ACCEPT_LANGUAGE }) @JsonFilter("uninitializedFilter") @@ -24,16 +31,37 @@ public class VerificationRequestEventResponseSmsContentImpl private OptionalValue code; + public static final String JSON_PROPERTY_CODE_TYPE = "codeType"; + + private OptionalValue codeType; + + public static final String JSON_PROPERTY_EXPIRY = "expiry"; + + private OptionalValue expiry; + public static final String JSON_PROPERTY_ACCEPT_LANGUAGE = "acceptLanguage"; private OptionalValue> acceptLanguage; + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private OptionalValue> additionalProperties; + public VerificationRequestEventResponseSmsContentImpl() {} protected VerificationRequestEventResponseSmsContentImpl( - OptionalValue code, OptionalValue> acceptLanguage) { + OptionalValue code, + OptionalValue codeType, + OptionalValue expiry, + OptionalValue> acceptLanguage, + OptionalValue> additionalProperties) { this.code = code; + this.codeType = codeType; + this.expiry = expiry; this.acceptLanguage = acceptLanguage; + this.additionalProperties = additionalProperties; } @JsonIgnore @@ -47,6 +75,28 @@ public OptionalValue code() { return code; } + @JsonIgnore + public SmsCodeType getCodeType() { + return codeType.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CODE_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue codeType() { + return codeType; + } + + @JsonIgnore + public String getExpiry() { + return expiry.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_EXPIRY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue expiry() { + return expiry; + } + @JsonIgnore public List getAcceptLanguage() { return acceptLanguage.orElse(null); @@ -58,6 +108,23 @@ public OptionalValue> acceptLanguage() { return acceptLanguage; } + @JsonIgnore + public Object get(String key) { + + if (null == this.additionalProperties || !additionalProperties.isPresent()) { + return null; + } + return this.additionalProperties.get().get(key); + } + + @JsonAnyGetter + public Map additionalProperties() { + if (null == this.additionalProperties || !additionalProperties.isPresent()) { + return null; + } + return additionalProperties.get(); + } + /** Return true if this VerificationRequestEventResponseSms_allOf_sms object is equal to o. */ @Override public boolean equals(Object o) { @@ -70,21 +137,34 @@ public boolean equals(Object o) { VerificationRequestEventResponseSmsContentImpl verificationRequestEventResponseSmsAllOfSms = (VerificationRequestEventResponseSmsContentImpl) o; return Objects.equals(this.code, verificationRequestEventResponseSmsAllOfSms.code) + && Objects.equals(this.codeType, verificationRequestEventResponseSmsAllOfSms.codeType) + && Objects.equals(this.expiry, verificationRequestEventResponseSmsAllOfSms.expiry) + && Objects.equals( + this.acceptLanguage, verificationRequestEventResponseSmsAllOfSms.acceptLanguage) && Objects.equals( - this.acceptLanguage, verificationRequestEventResponseSmsAllOfSms.acceptLanguage); + this.additionalProperties, + verificationRequestEventResponseSmsAllOfSms.additionalProperties) + && super.equals(o); } @Override public int hashCode() { - return Objects.hash(code, acceptLanguage); + return Objects.hash( + code, codeType, expiry, acceptLanguage, super.hashCode(), additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class VerificationRequestEventResponseSmsContentImpl {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\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"); sb.append(" acceptLanguage: ").append(toIndentedString(acceptLanguage)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); sb.append("}"); return sb.toString(); } @@ -102,7 +182,10 @@ private String toIndentedString(Object o) { @JsonPOJOBuilder(withPrefix = "set") static class Builder implements VerificationRequestEventResponseSmsContent.Builder { OptionalValue code = OptionalValue.empty(); + OptionalValue codeType = OptionalValue.empty(); + OptionalValue expiry = OptionalValue.empty(); OptionalValue> acceptLanguage = OptionalValue.empty(); + OptionalValue> additionalProperties = OptionalValue.empty(); @JsonProperty(JSON_PROPERTY_CODE) public Builder setCode(String code) { @@ -110,14 +193,36 @@ public Builder setCode(String code) { return this; } + @JsonProperty(JSON_PROPERTY_CODE_TYPE) + public Builder setCodeType(SmsCodeType codeType) { + this.codeType = OptionalValue.of(codeType); + return this; + } + + @JsonProperty(JSON_PROPERTY_EXPIRY) + public Builder setExpiry(String expiry) { + this.expiry = OptionalValue.of(expiry); + return this; + } + @JsonProperty(JSON_PROPERTY_ACCEPT_LANGUAGE) public Builder setAcceptLanguage(List acceptLanguage) { this.acceptLanguage = OptionalValue.of(acceptLanguage); return this; } + @JsonAnySetter + public Builder put(String key, Object value) { + if (!this.additionalProperties.isPresent()) { + this.additionalProperties = OptionalValue.of(new HashMap()); + } + this.additionalProperties.get().put(key, value); + return this; + } + public VerificationRequestEventResponseSmsContent build() { - return new VerificationRequestEventResponseSmsContentImpl(code, acceptLanguage); + return new VerificationRequestEventResponseSmsContentImpl( + code, codeType, expiry, acceptLanguage, additionalProperties); } } } diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/start/request/VerificationStartRequestTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/start/request/VerificationStartRequestTest.java index 52a730688..71719a6b1 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/start/request/VerificationStartRequestTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/start/request/VerificationStartRequestTest.java @@ -5,6 +5,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; 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.SmsCodeType; import com.sinch.sdk.domains.verification.models.v1.start.request.PhoneCallSpeech; import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestData; import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestDataImpl; @@ -30,6 +31,7 @@ public class VerificationStartRequestTest extends VerificationBaseTest { .setReference("a reference") .setIdentity(NumberIdentity.valueOf("+endpoint")) .setSpeech(PhoneCallSpeech.builder().setLocale("fr-FR").build()) + .putExtraOption("my key", "my value") .build()); public static VerificationStartRequestInternalImpl startVerificationFlashCallDto = @@ -40,6 +42,8 @@ public class VerificationStartRequestTest extends VerificationBaseTest { .setReference("a reference") .setIdentity(NumberIdentity.valueOf("+endpoint")) .setDialTimeout(17) + .setInterceptionTimeout(23) + .putExtraOption("my key", "my value") .build()); public static VerificationStartRequestInternalImpl startVerificationDataDto = new VerificationStartRequestInternalImpl( @@ -57,7 +61,7 @@ public class VerificationStartRequestTest extends VerificationBaseTest { .setReference("a reference") .setIdentity(NumberIdentity.valueOf("+endpoint")) .setExpiry("01:02:03") - .setCodeType(VerificationStartRequestSms.CodeTypeEnum.ALPHANUMERIC) + .setCodeType(SmsCodeType.ALPHANUMERIC) .setTemplate("My template require to use '{{CODE}}' code") .putExtraOption("my key", "my value") .build()); @@ -70,7 +74,7 @@ public class VerificationStartRequestTest extends VerificationBaseTest { .setReference("a reference") .setIdentity(NumberIdentity.valueOf("+endpoint")) .setExpiry("01:02:03") - .setCodeType(VerificationStartRequestSms.CodeTypeEnum.ALPHANUMERIC) + .setCodeType(SmsCodeType.ALPHANUMERIC) .setTemplate("My template require to use '{{CODE}}' code") .setAcceptLanguage("es-ES") .putExtraOption("my key", "my value") diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/start/request/internal/VerificationStartSmsOptionsTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/start/request/internal/VerificationStartSmsOptionsTest.java index 38c45b8cc..808861aae 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/start/request/internal/VerificationStartSmsOptionsTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/start/request/internal/VerificationStartSmsOptionsTest.java @@ -5,6 +5,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.sinch.sdk.core.TestHelpers; 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.start.request.internal.VerificationStartSmsOptions; import org.json.JSONException; import org.junit.jupiter.api.Test; @@ -16,14 +17,14 @@ public class VerificationStartSmsOptionsTest extends VerificationBaseTest { public static VerificationStartSmsOptions startVerificationSmsOptionDto = VerificationStartSmsOptions.builder() .setExpiry("01:02:03") - .setCodeType(VerificationStartSmsOptions.CodeTypeEnum.ALPHANUMERIC) + .setCodeType(SmsCodeType.ALPHANUMERIC) .setTemplate("My template requires to use '{{CODE}}' placeholder") .build(); public static VerificationStartSmsOptions startVerificationSmsOptionWithAdditionalPropertiesDto = VerificationStartSmsOptions.builder() .setExpiry("01:02:03") - .setCodeType(VerificationStartSmsOptions.CodeTypeEnum.ALPHANUMERIC) + .setCodeType(SmsCodeType.ALPHANUMERIC) .setTemplate("My template requires to use '{{CODE}}' placeholder") .put("a key", "a value") .put("secondKey", "second value") @@ -32,7 +33,7 @@ public class VerificationStartSmsOptionsTest extends VerificationBaseTest { public static VerificationStartSmsOptions startVerificationSmsOptionDtoWithAcceptLanguage = VerificationStartSmsOptions.builder() .setExpiry("01:02:03") - .setCodeType(VerificationStartSmsOptions.CodeTypeEnum.ALPHANUMERIC) + .setCodeType(SmsCodeType.ALPHANUMERIC) .setTemplate("My template requires to use '{{CODE}}' placeholder") .setAcceptLanguage("es-ES") .build(); diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/start/response/VerificationStartResponseTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/start/response/VerificationStartResponseTest.java index ab1edfd0e..2363addfe 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/start/response/VerificationStartResponseTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/start/response/VerificationStartResponseTest.java @@ -5,6 +5,7 @@ import com.sinch.sdk.BaseTest; import com.sinch.sdk.core.TestHelpers; import com.sinch.sdk.domains.verification.models.dto.v1.start.LinkTest; +import com.sinch.sdk.domains.verification.models.v1.SmsCodeType; import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseData; import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseDataImpl; import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseFlashCall; @@ -46,6 +47,7 @@ public class VerificationStartResponseTest extends BaseTest { .setInterceptionTimeout(45) .setReportTimeout(75) .setDenyCallAfter(0) + .putExtraOption("my key", "my value") .build()); @GivenJsonResource( @@ -72,6 +74,8 @@ public class VerificationStartResponseTest extends BaseTest { .setLinks(LinkTest.expectedLinks) .setTemplate("Your verification code is {{CODE}}. Verified by Sinch") .setInterceptionTimeout(298) + .setCodeType(SmsCodeType.NUMERIC) + .putExtraOption("my key", "my value") .build()); @Test 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 index f80b9765f..dc553dd59 100644 --- 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 @@ -4,6 +4,7 @@ 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.start.request.PhoneCallSpeech; import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationEventResponseAction; import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEventResponseFlashCall; @@ -22,18 +23,24 @@ public class VerificationResponseEventDtoTest extends VerificationBaseTest { .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(); @GivenTextResource("/domains/verification/v1/webhooks/VerificationResponseSms.json") diff --git a/openapi-contracts/src/test/resources/domains/verification/v1/start/request/VerificationStartRequestFlashCallDto.json b/openapi-contracts/src/test/resources/domains/verification/v1/start/request/VerificationStartRequestFlashCallDto.json index 4a294b66b..d0ea0d917 100644 --- a/openapi-contracts/src/test/resources/domains/verification/v1/start/request/VerificationStartRequestFlashCallDto.json +++ b/openapi-contracts/src/test/resources/domains/verification/v1/start/request/VerificationStartRequestFlashCallDto.json @@ -7,6 +7,8 @@ "custom": "a custom", "method": "flashcall", "flashCallOptions": { - "dialTimeout": 17 + "dialTimeout": 17, + "interceptionTimeout": 23, + "my key": "my value" } } diff --git a/openapi-contracts/src/test/resources/domains/verification/v1/start/request/VerificationStartRequestPhoneCallDto.json b/openapi-contracts/src/test/resources/domains/verification/v1/start/request/VerificationStartRequestPhoneCallDto.json index 119aa45c4..088fb0e70 100644 --- a/openapi-contracts/src/test/resources/domains/verification/v1/start/request/VerificationStartRequestPhoneCallDto.json +++ b/openapi-contracts/src/test/resources/domains/verification/v1/start/request/VerificationStartRequestPhoneCallDto.json @@ -9,6 +9,7 @@ "calloutOptions": { "speech": { "locale": "fr-FR" - } + }, + "my key": "my value" } } diff --git a/openapi-contracts/src/test/resources/domains/verification/v1/start/response/VerificationStartResponseFlashCallDto.json b/openapi-contracts/src/test/resources/domains/verification/v1/start/response/VerificationStartResponseFlashCallDto.json index d7dd0730a..e68b43da0 100644 --- a/openapi-contracts/src/test/resources/domains/verification/v1/start/response/VerificationStartResponseFlashCallDto.json +++ b/openapi-contracts/src/test/resources/domains/verification/v1/start/response/VerificationStartResponseFlashCallDto.json @@ -5,7 +5,8 @@ "cliFilter": "(.*)5312(.*)", "interceptionTimeout": 45, "reportTimeout": 75, - "denyCallAfter": 0 + "denyCallAfter": 0, + "my key": "my value" }, "_links": [ { diff --git a/openapi-contracts/src/test/resources/domains/verification/v1/start/response/VerificationStartResponseSmsDto.json b/openapi-contracts/src/test/resources/domains/verification/v1/start/response/VerificationStartResponseSmsDto.json index 5046187fb..b906e6b5b 100644 --- a/openapi-contracts/src/test/resources/domains/verification/v1/start/response/VerificationStartResponseSmsDto.json +++ b/openapi-contracts/src/test/resources/domains/verification/v1/start/response/VerificationStartResponseSmsDto.json @@ -3,7 +3,9 @@ "method": "sms", "sms": { "template": "Your verification code is {{CODE}}. Verified by Sinch", - "interceptionTimeout": 298 + "interceptionTimeout": 298, + "codeType": "Numeric", + "my key": "my value" }, "_links": [ { diff --git a/openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResponseFlashCall.json b/openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResponseFlashCall.json index 53f3e5657..c0cd98506 100644 --- a/openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResponseFlashCall.json +++ b/openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResponseFlashCall.json @@ -1,7 +1,9 @@ { "flashCall": { "cli": "cli code", - "dialTimeout": 123 + "dialTimeout": 123, + "interceptionTimeout": 456, + "my key": "my value" }, "action": "allow" } diff --git a/openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResponsePhoneCall.json b/openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResponsePhoneCall.json index 5b2dc4223..81e1c59d1 100644 --- a/openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResponsePhoneCall.json +++ b/openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResponsePhoneCall.json @@ -3,7 +3,8 @@ "code": "4567", "speech": { "locale": "the locale" - } + }, + "my key": "my value" }, "action": "allow" } diff --git a/openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResponseSms.json b/openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResponseSms.json index 81fb83535..76544c428 100644 --- a/openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResponseSms.json +++ b/openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResponseSms.json @@ -1,9 +1,12 @@ { "sms": { "code": "5666", + "codeType": "Numeric", + "expiry": "01:02:03", "acceptLanguage": [ "a language" - ] + ], + "my key": "my value" }, "action": "allow" } diff --git a/sample-app/src/main/java/com/sinch/sample/verification/start/Start.java b/sample-app/src/main/java/com/sinch/sample/verification/start/Start.java index 0ae3f707c..c9a441444 100644 --- a/sample-app/src/main/java/com/sinch/sample/verification/start/Start.java +++ b/sample-app/src/main/java/com/sinch/sample/verification/start/Start.java @@ -3,13 +3,13 @@ import com.sinch.sample.BaseApplication; import com.sinch.sdk.domains.verification.api.v1.VerificationStartService; import com.sinch.sdk.domains.verification.models.v1.NumberIdentity; +import com.sinch.sdk.domains.verification.models.v1.SmsCodeType; import com.sinch.sdk.domains.verification.models.v1.VerificationMethod; import com.sinch.sdk.domains.verification.models.v1.start.request.PhoneCallSpeech; import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestData; import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestFlashCall; import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestPhoneCall; import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestSms; -import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestSms.CodeTypeEnum; import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponse; import java.io.IOException; import java.util.logging.Logger; @@ -51,7 +51,7 @@ public void run() { service.startSms( VerificationStartRequestSms.builder() .setIdentity(identity) - .setCodeType(CodeTypeEnum.ALPHANUMERIC) + .setCodeType(SmsCodeType.ALPHANUMERIC) .setAcceptLanguage("fr-FR") .build()); } else if (method.value().equals("seamless")) { From 591760bffc3755a6d9bbc8e8c2687e76f8a4452a Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier Date: Mon, 25 Aug 2025 12:40:08 +0200 Subject: [PATCH 014/122] doc (Mailgun): W35 OAS Synch --- .../v1/emails/request/SendEmailHtmlInTemplateRequest.java | 2 +- .../models/v1/emails/request/SendEmailHtmlInlineRequest.java | 2 +- .../mailgun/models/v1/emails/request/SendMimeEmailRequest.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailHtmlInTemplateRequest.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailHtmlInTemplateRequest.java index 12a1a91b7..5ef03884c 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailHtmlInTemplateRequest.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailHtmlInTemplateRequest.java @@ -107,7 +107,7 @@ public interface SendEmailHtmlInTemplateRequest extends SendEmailRequest { * '{"alice@example.com": {"name":"Alice", "id":1}, * "bob@example.com": {"name":"Bob", "id":2}}'. Maximum * 1,000 recipients per batch. See Batch + * href="https://documentation.mailgun.com/docs/mailgun/user-manual/sending-messages/batch-sending">Batch * Sending for more information * * @return recipientVariables diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailHtmlInlineRequest.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailHtmlInlineRequest.java index fc305f80a..bd3067435 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailHtmlInlineRequest.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailHtmlInlineRequest.java @@ -104,7 +104,7 @@ public interface SendEmailHtmlInlineRequest extends SendEmailRequest { * '{"alice@example.com": {"name":"Alice", "id":1}, * "bob@example.com": {"name":"Bob", "id":2}}'. Maximum * 1,000 recipients per batch. See Batch + * href="https://documentation.mailgun.com/docs/mailgun/user-manual/sending-messages/batch-sending">Batch * Sending for more information * * @return recipientVariables diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendMimeEmailRequest.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendMimeEmailRequest.java index 5d88ac569..182070238 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendMimeEmailRequest.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendMimeEmailRequest.java @@ -59,7 +59,7 @@ public interface SendMimeEmailRequest { * '{"alice@example.com": {"name":"Alice", "id":1}, * "bob@example.com": {"name":"Bob", "id":2}}'. Maximum * 1,000 recipients per batch. See Batch + * href="https://documentation.mailgun.com/docs/mailgun/user-manual/sending-messages/batch-sending">Batch * Sending for more information. * * @return recipientVariables From bfa498973831c5aeb1e8f3265d38f04b6b3d53f1 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier Date: Tue, 26 Aug 2025 11:32:46 +0200 Subject: [PATCH 015/122] feat (Verification): [BETA] Support 'WhatsApp' verification method --- .../api/v1/VerificationReportService.java | 31 ++++++++++++++ .../api/v1/VerificationStartService.java | 12 ++++++ .../adapters/VerificationReportService.java | 22 ++++++++++ .../v1/adapters/VerificationStartService.java | 12 ++++++ .../adapters/VerificationStatusService.java | 3 ++ .../VerificationReportServiceTest.java | 41 +++++++++++++++++++ .../VerificationStartServiceTest.java | 22 ++++++++++ .../api/v1/adapters/WebhooksServiceTest.java | 13 ++++++ .../VerificationReportRequestDtoTest.java | 19 ++++++++- .../VerificationReportResponseDtoTest.java | 21 +++++++++- .../request/VerificationStartRequestTest.java | 31 ++++++++++++-- .../VerificationStartResponseTest.java | 23 +++++++++++ .../VerificationStatusResponseTest.java | 33 +++++++++++++++ .../VerificationResponseEventDtoTest.java | 39 ++++++++++++++++++ .../VerificationReportRequestSmsDto.json | 4 +- .../VerificationReportRequestWhatsAppDto.json | 6 +++ ...VerificationReportResponseWhatsAppDto.json | 6 +++ .../VerificationStartRequestWhatsAppDto.json | 13 ++++++ .../VerificationStartResponseWhatsAppDto.json | 20 +++++++++ ...VerificationStatusResponseWhatsAppDto.json | 20 +++++++++ .../VerificationResponseWhatsApp.json | 10 +++++ ...ficationResponseWhatsAppEmptyWhatsApp.json | 3 ++ 22 files changed, 396 insertions(+), 8 deletions(-) create mode 100644 openapi-contracts/src/test/resources/domains/verification/v1/report/VerificationReportRequestWhatsAppDto.json create mode 100644 openapi-contracts/src/test/resources/domains/verification/v1/report/VerificationReportResponseWhatsAppDto.json create mode 100644 openapi-contracts/src/test/resources/domains/verification/v1/start/request/VerificationStartRequestWhatsAppDto.json create mode 100644 openapi-contracts/src/test/resources/domains/verification/v1/start/response/VerificationStartResponseWhatsAppDto.json create mode 100644 openapi-contracts/src/test/resources/domains/verification/v1/status/VerificationStatusResponseWhatsAppDto.json create mode 100644 openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResponseWhatsApp.json create mode 100644 openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResponseWhatsAppEmptyWhatsApp.json diff --git a/client/src/main/com/sinch/sdk/domains/verification/api/v1/VerificationReportService.java b/client/src/main/com/sinch/sdk/domains/verification/api/v1/VerificationReportService.java index e82266886..c418aff61 100644 --- a/client/src/main/com/sinch/sdk/domains/verification/api/v1/VerificationReportService.java +++ b/client/src/main/com/sinch/sdk/domains/verification/api/v1/VerificationReportService.java @@ -4,9 +4,11 @@ import com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestFlashCall; import com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestPhoneCall; import com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestSms; +import com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestWhatsApp; import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponseFlashCall; import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponsePhoneCall; import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponseSms; +import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponseWhatsApp; /** * Verification Report Service @@ -64,6 +66,22 @@ VerificationReportResponseFlashCall reportFlashCallByIdentity( VerificationReportResponsePhoneCall reportPhoneCallByIdentity( NumberIdentity identity, VerificationReportRequestPhoneCall parameters); + /** + * Report a verification using {@link + * com.sinch.sdk.domains.verification.models.v1.VerificationMethod#WHATSAPP} & Identity + * + *

Report the received verification code to verify it, using the identity of the user + * + * @param identity Currently Only {@link + * com.sinch.sdk.domains.verification.models.v1.NumberIdentity NumberIdentity} is supported + * @param parameters Parameters to be used to get report + * @return Verification report response + * @apiNote This is a BETA feature and can be changed before GA + * @since 2.0 + */ + VerificationReportResponseWhatsApp reportWhatsAppByIdentity( + NumberIdentity identity, VerificationReportRequestWhatsApp parameters); + /** * Report the received verification code to verify it, using the Verification ID of the {@link * com.sinch.sdk.domains.verification.models.v1.VerificationMethod#SMS} Verification request @@ -100,4 +118,17 @@ VerificationReportResponseFlashCall reportFlashCallById( */ VerificationReportResponsePhoneCall reportPhoneCallById( String id, VerificationReportRequestPhoneCall parameters); + + /** + * Report the received verification code to verify it, using the Verification ID of the {@link + * com.sinch.sdk.domains.verification.models.v1.VerificationMethod#WHATSAPP} Verification request + * + * @param id ID returned from start verification + * @param parameters Parameters to be used to get report + * @return Verification report response + * @apiNote This is a BETA feature and can be changed before GA + * @since 2.0 + */ + VerificationReportResponseWhatsApp reportWhatsAppById( + String id, VerificationReportRequestWhatsApp parameters); } diff --git a/client/src/main/com/sinch/sdk/domains/verification/api/v1/VerificationStartService.java b/client/src/main/com/sinch/sdk/domains/verification/api/v1/VerificationStartService.java index 61b6ca263..6c880487a 100644 --- a/client/src/main/com/sinch/sdk/domains/verification/api/v1/VerificationStartService.java +++ b/client/src/main/com/sinch/sdk/domains/verification/api/v1/VerificationStartService.java @@ -4,10 +4,12 @@ import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestFlashCall; import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestPhoneCall; import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestSms; +import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestWhatsApp; import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseData; import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseFlashCall; import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponsePhoneCall; import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseSms; +import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseWhatsApp; /** * Verification Start Service @@ -58,4 +60,14 @@ public interface VerificationStartService { * @since 1.1 */ VerificationStartResponseData startData(VerificationStartRequestData parameters); + + /** + * Start verification by WhatsApp + * + * @apiNote This is a BETA feature and can be changed before GA + * @param parameters Parameters to be used to start verification + * @return Verification response + * @since 2.0 + */ + VerificationStartResponseWhatsApp startWhatsApp(VerificationStartRequestWhatsApp parameters); } diff --git a/client/src/main/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationReportService.java b/client/src/main/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationReportService.java index 64c2175c0..5f5feb974 100644 --- a/client/src/main/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationReportService.java +++ b/client/src/main/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationReportService.java @@ -9,11 +9,13 @@ import com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestFlashCall; import com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestPhoneCall; import com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestSms; +import com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestWhatsApp; import com.sinch.sdk.domains.verification.models.v1.report.request.internal.VerificationReportRequestInternalImpl; import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponse; import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponseFlashCall; import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponsePhoneCall; import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponseSms; +import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponseWhatsApp; import com.sinch.sdk.domains.verification.models.v1.report.response.internal.VerificationReportResponseInternalImpl; import com.sinch.sdk.models.VerificationContext; import java.util.Map; @@ -34,42 +36,62 @@ protected VerificationsReportApi getApi() { return this.api; } + @Override public VerificationReportResponseSms reportSmsByIdentity( NumberIdentity identity, VerificationReportRequestSms parameters) { return (VerificationReportResponseSms) reportByIdentity(identity, parameters); } + @Override public VerificationReportResponseFlashCall reportFlashCallByIdentity( NumberIdentity identity, VerificationReportRequestFlashCall parameters) { return (VerificationReportResponseFlashCall) reportByIdentity(identity, parameters); } + @Override public VerificationReportResponsePhoneCall reportPhoneCallByIdentity( NumberIdentity identity, VerificationReportRequestPhoneCall parameters) { return (VerificationReportResponsePhoneCall) reportByIdentity(identity, parameters); } + @Override + public VerificationReportResponseWhatsApp reportWhatsAppByIdentity( + NumberIdentity identity, VerificationReportRequestWhatsApp parameters) { + + return (VerificationReportResponseWhatsApp) reportByIdentity(identity, parameters); + } + + @Override public VerificationReportResponseSms reportSmsById( String id, VerificationReportRequestSms parameters) { return (VerificationReportResponseSms) reportById(id, parameters); } + @Override public VerificationReportResponseFlashCall reportFlashCallById( String id, VerificationReportRequestFlashCall parameters) { return (VerificationReportResponseFlashCall) reportById(id, parameters); } + @Override public VerificationReportResponsePhoneCall reportPhoneCallById( String id, VerificationReportRequestPhoneCall parameters) { return (VerificationReportResponsePhoneCall) reportById(id, parameters); } + @Override + public VerificationReportResponseWhatsApp reportWhatsAppById( + String id, VerificationReportRequestWhatsApp parameters) { + + return (VerificationReportResponseWhatsApp) reportById(id, parameters); + } + private VerificationReportResponse reportByIdentity( NumberIdentity identity, VerificationReportRequest parameters) { VerificationReportRequestInternalImpl internal = new VerificationReportRequestInternalImpl(); diff --git a/client/src/main/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationStartService.java b/client/src/main/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationStartService.java index 328099cc1..98e05ca4b 100644 --- a/client/src/main/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationStartService.java +++ b/client/src/main/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationStartService.java @@ -9,12 +9,14 @@ import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestFlashCall; import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestPhoneCall; import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestSms; +import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestWhatsApp; import com.sinch.sdk.domains.verification.models.v1.start.request.internal.VerificationStartRequestInternalImpl; import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponse; import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseData; import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseFlashCall; import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponsePhoneCall; import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseSms; +import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseWhatsApp; import com.sinch.sdk.domains.verification.models.v1.start.response.internal.VerificationStartResponseInternalImpl; import com.sinch.sdk.models.VerificationContext; import java.util.Map; @@ -36,25 +38,35 @@ protected VerificationsStartApi getApi() { return this.api; } + @Override public VerificationStartResponseSms startSms(VerificationStartRequestSms parameters) { String acceptLanguage = parameters.getAcceptLanguage(); return (VerificationStartResponseSms) start(parameters, acceptLanguage).orElse(null); } + @Override public VerificationStartResponseFlashCall startFlashCall( VerificationStartRequestFlashCall parameters) { return (VerificationStartResponseFlashCall) start(parameters).orElse(null); } + @Override public VerificationStartResponsePhoneCall startPhoneCall( VerificationStartRequestPhoneCall parameters) { return (VerificationStartResponsePhoneCall) start(parameters).orElse(null); } + @Override public VerificationStartResponseData startData(VerificationStartRequestData parameters) { return (VerificationStartResponseData) start(parameters).orElse(null); } + @Override + public VerificationStartResponseWhatsApp startWhatsApp( + VerificationStartRequestWhatsApp parameters) { + return (VerificationStartResponseWhatsApp) start(parameters).orElse(null); + } + private Optional start(VerificationStartRequest parameters) { return start(parameters, null); } diff --git a/client/src/main/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationStatusService.java b/client/src/main/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationStatusService.java index 8a2c63a78..64121f385 100644 --- a/client/src/main/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationStatusService.java +++ b/client/src/main/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationStatusService.java @@ -27,6 +27,7 @@ protected VerificationStatusApi getApi() { return this.api; } + @Override public VerificationStatusResponse getByIdentity( NumberIdentity identity, VerificationMethod method) { @@ -39,6 +40,7 @@ public VerificationStatusResponse getByIdentity( return (VerificationStatusResponse) response.getActualInstance(); } + @Override public VerificationStatusResponse getById(String id) { VerificationStatusResponseInternalImpl response = @@ -49,6 +51,7 @@ public VerificationStatusResponse getById(String id) { return (VerificationStatusResponse) response.getActualInstance(); } + @Override public VerificationStatusResponse getByReference(String reference) { VerificationStatusResponseInternalImpl response = diff --git a/client/src/test/java/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationReportServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationReportServiceTest.java index b05472994..9a5c92f07 100644 --- a/client/src/test/java/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationReportServiceTest.java +++ b/client/src/test/java/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationReportServiceTest.java @@ -20,6 +20,7 @@ import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponseFlashCall; import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponsePhoneCall; import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponseSms; +import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponseWhatsApp; import com.sinch.sdk.models.VerificationContext; import java.util.Map; import org.junit.jupiter.api.BeforeEach; @@ -38,6 +39,9 @@ public class VerificationReportServiceTest extends VerificationBaseTest { @GivenJsonResource("/domains/verification/v1/report/VerificationReportRequestSmsDto.json") public VerificationReportRequestInternal verificationReportSmsRequestDto; + @GivenJsonResource("/domains/verification/v1/report/VerificationReportRequestWhatsAppDto.json") + public VerificationReportRequestInternal verificationReportWhatsAppRequestDto; + @Mock VerificationsReportApi api; @Mock VerificationContext context; @Mock HttpClient httpClient; @@ -109,6 +113,25 @@ void reportPhoneCallByIdentity() throws ApiException { .getVerificationReportResponsePhoneCallImpl()); } + @Test + void reportWhatsAppByIdentity() throws ApiException { + + when(api.reportVerificationByIdentity( + eq("endpoint string"), eq(verificationReportWhatsAppRequestDto))) + .thenReturn(VerificationReportResponseDtoTest.verificationReportWhatsAppDto); + + VerificationReportResponseWhatsApp response = + service.reportWhatsAppByIdentity( + NumberIdentity.builder().setEndpoint("endpoint string").build(), + VerificationReportRequestDtoTest.verificationReportWhatsAppDto + .getVerificationReportRequestWhatsAppImpl()); + + TestHelpers.recursiveEquals( + response, + VerificationReportResponseDtoTest.verificationReportWhatsAppDto + .getVerificationReportResponseWhatsAppImpl()); + } + @Test void reportSmsById() throws ApiException { @@ -162,4 +185,22 @@ void reportPhoneCallById() throws ApiException { VerificationReportResponseDtoTest.verificationReportPhoneCallDto .getVerificationReportResponsePhoneCallImpl()); } + + @Test + void reportWhatsAppById() throws ApiException { + + when(api.reportVerificationById(eq("the id"), eq(verificationReportWhatsAppRequestDto))) + .thenReturn(VerificationReportResponseDtoTest.verificationReportWhatsAppDto); + + VerificationReportResponseWhatsApp response = + service.reportWhatsAppById( + "the id", + VerificationReportRequestDtoTest.verificationReportWhatsAppDto + .getVerificationReportRequestWhatsAppImpl()); + + TestHelpers.recursiveEquals( + response, + VerificationReportResponseDtoTest.verificationReportWhatsAppDto + .getVerificationReportResponseWhatsAppImpl()); + } } diff --git a/client/src/test/java/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationStartServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationStartServiceTest.java index b14d23e61..68ce9bb04 100644 --- a/client/src/test/java/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationStartServiceTest.java +++ b/client/src/test/java/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationStartServiceTest.java @@ -26,6 +26,7 @@ import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseFlashCall; import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponsePhoneCall; import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseSms; +import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseWhatsApp; import com.sinch.sdk.models.VerificationContext; import java.util.Map; import org.junit.jupiter.api.BeforeEach; @@ -49,6 +50,10 @@ public class VerificationStartServiceTest extends VerificationBaseTest { @GivenJsonResource("/domains/verification/v1/start/request/VerificationStartRequestSmsDto.json") public VerificationStartRequestInternal startVerificationSmsRequestDto; + @GivenJsonResource( + "/domains/verification/v1/start/request/VerificationStartRequestWhatsAppDto.json") + public VerificationStartRequestInternal startVerificationWhatsAppRequestDto; + @Mock VerificationsStartApi api; @Mock VerificationContext context; @Mock HttpClient httpClient; @@ -168,4 +173,21 @@ void startData() throws ApiException { VerificationStartResponseTest.expectedStartVerificationDataDto .getVerificationStartResponseDataImpl()); } + + @Test + void startWhatsApp() throws ApiException { + + when(api.startVerification( + argThat(new ModelArgMatcher<>(startVerificationWhatsAppRequestDto)), eq(null))) + .thenReturn(VerificationStartResponseTest.expectedStartVerificationWhatsAppDto); + + VerificationStartResponseWhatsApp response = + service.startWhatsApp( + VerificationStartRequestTest.startVerificationWhatsAppDto + .getVerificationStartRequestWhatsAppImpl()); + + TestHelpers.recursiveEquals( + response, + VerificationStartResponseTest.expectedStartVerificationWhatsAppDto.getActualInstance()); + } } 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/WebhooksServiceTest.java index 0115051e8..c8d585939 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/WebhooksServiceTest.java @@ -43,6 +43,9 @@ public class WebhooksServiceTest extends VerificationBaseTest { @GivenTextResource("/domains/verification/v1/webhooks/VerificationResponseSms.json") String jsonResponseSms; + @GivenTextResource("/domains/verification/v1/webhooks/VerificationResponseWhatsApp.json") + String jsonResponseWhatsApp; + WebHooksService webHooksService; @Test @@ -143,6 +146,16 @@ void checkSerializeResponseSms() throws JSONException { true); } + @Test + void checkSerializeResponseWhatsApp() throws JSONException { + + JSONAssert.assertEquals( + webHooksService.serializeResponse( + VerificationResponseEventDtoTest.expectedWhatsAppRequestEventResponseDto), + jsonResponseWhatsApp, + true); + } + @BeforeEach public void setUp() throws IOException { diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/report/VerificationReportRequestDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/report/VerificationReportRequestDtoTest.java index 905de491f..89727239a 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/report/VerificationReportRequestDtoTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/report/VerificationReportRequestDtoTest.java @@ -10,6 +10,8 @@ import com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestPhoneCallImpl; import com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestSms; import com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestSmsImpl; +import com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestWhatsApp; +import com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestWhatsAppImpl; import com.sinch.sdk.domains.verification.models.v1.report.request.internal.VerificationReportRequestInternalImpl; import org.json.JSONException; import org.junit.jupiter.api.Test; @@ -30,7 +32,12 @@ public class VerificationReportRequestDtoTest extends BaseTest { public static VerificationReportRequestInternalImpl verificationReportSmsDto = new VerificationReportRequestInternalImpl( (VerificationReportRequestSmsImpl) - VerificationReportRequestSms.builder().setCode("foo code").setCli("foo cli").build()); + VerificationReportRequestSms.builder().setCode("foo code").build()); + + public static VerificationReportRequestInternalImpl verificationReportWhatsAppDto = + new VerificationReportRequestInternalImpl( + (VerificationReportRequestWhatsAppImpl) + VerificationReportRequestWhatsApp.builder().setCode("foo code").build()); @GivenTextResource("/domains/verification/v1/report/VerificationReportRequestPhoneCallDto.json") String jsonVerificationReportPhoneCall; @@ -41,6 +48,9 @@ public class VerificationReportRequestDtoTest extends BaseTest { @GivenTextResource("/domains/verification/v1/report/VerificationReportRequestSmsDto.json") String jsonVerificationReportSms; + @GivenTextResource("/domains/verification/v1/report/VerificationReportRequestWhatsAppDto.json") + String jsonVerificationReportWhatsApp; + @Test void serializePhoneCall() throws JsonProcessingException, JSONException { String serializedString = objectMapper.writeValueAsString(verificationReportPhoneCallDto); @@ -61,4 +71,11 @@ void serializeSms() throws JsonProcessingException, JSONException { JSONAssert.assertEquals(jsonVerificationReportSms, serializedString, true); } + + @Test + void serializeWhatsApp() throws JsonProcessingException, JSONException { + String serializedString = objectMapper.writeValueAsString(verificationReportWhatsAppDto); + + JSONAssert.assertEquals(jsonVerificationReportWhatsApp, serializedString, true); + } } diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/report/VerificationReportResponseDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/report/VerificationReportResponseDtoTest.java index 77d278ee7..1bebe2d3f 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/report/VerificationReportResponseDtoTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/report/VerificationReportResponseDtoTest.java @@ -12,6 +12,8 @@ import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponsePhoneCallImpl; import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponseSms; import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponseSmsImpl; +import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponseWhatsApp; +import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponseWhatsAppImpl; import com.sinch.sdk.domains.verification.models.v1.report.response.internal.VerificationReportResponseInternal; import com.sinch.sdk.domains.verification.models.v1.report.response.internal.VerificationReportResponseInternalImpl; import org.junit.jupiter.api.Test; @@ -57,6 +59,18 @@ public class VerificationReportResponseDtoTest extends BaseTest { .setReason(VerificationStatusReason.EXPIRED) .build()); + @GivenJsonResource("/domains/verification/v1/report/VerificationReportResponseWhatsAppDto.json") + VerificationReportResponseInternal expectedVerificationReportWhatsApp; + + public static VerificationReportResponseInternalImpl verificationReportWhatsAppDto = + new VerificationReportResponseInternalImpl( + (VerificationReportResponseWhatsAppImpl) + VerificationReportResponseWhatsApp.builder() + .setId("the id") + .setStatus(VerificationStatus.FAIL) + .setReason(VerificationStatusReason.EXPIRED) + .build()); + @Test void deserializePhoneCall() { TestHelpers.recursiveEquals( @@ -70,7 +84,12 @@ void deserializeFlashCall() { } @Test - void serializeSms() { + void deserializeSms() { TestHelpers.recursiveEquals(verificationReportSmsDto, expectedVerificationReportSms); } + + @Test + void deserializeWhatsApp() { + TestHelpers.recursiveEquals(verificationReportWhatsAppDto, expectedVerificationReportWhatsApp); + } } diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/start/request/VerificationStartRequestTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/start/request/VerificationStartRequestTest.java index 71719a6b1..0342cb818 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/start/request/VerificationStartRequestTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/start/request/VerificationStartRequestTest.java @@ -6,6 +6,7 @@ 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.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.start.request.VerificationStartRequestData; import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestDataImpl; @@ -15,6 +16,8 @@ import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestPhoneCallImpl; import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestSms; import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestSmsImpl; +import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestWhatsApp; +import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestWhatsAppImpl; import com.sinch.sdk.domains.verification.models.v1.start.request.internal.VerificationStartRequestInternalImpl; import org.json.JSONException; import org.junit.jupiter.api.Test; @@ -80,6 +83,17 @@ public class VerificationStartRequestTest extends VerificationBaseTest { .putExtraOption("my key", "my value") .build()); + public static VerificationStartRequestInternalImpl startVerificationWhatsAppDto = + new VerificationStartRequestInternalImpl( + (VerificationStartRequestWhatsAppImpl) + VerificationStartRequestWhatsApp.builder() + .setCustom("a custom") + .setReference("a reference") + .setIdentity(NumberIdentity.valueOf("+33123456789")) + .setCodeType(WhatsAppCodeType.ALPHANUMERIC) + .putExtraOption("my key", "my value") + .build()); + @GivenTextResource( "/domains/verification/v1/start/request/VerificationStartRequestPhoneCallDto.json") String jsonStartVerificationPhoneCall; @@ -94,6 +108,10 @@ public class VerificationStartRequestTest extends VerificationBaseTest { @GivenTextResource("/domains/verification/v1/start/request/VerificationStartRequestSmsDto.json") String jsonStartVerificationSms; + @GivenTextResource( + "/domains/verification/v1/start/request/VerificationStartRequestWhatsAppDto.json") + String jsonStartVerificationWhatsApp; + @Test void serializeStartPhoneCall() throws JsonProcessingException, JSONException { String serializedString = objectMapper.writeValueAsString(startVerificationPhoneCallDto); @@ -109,24 +127,31 @@ void serializeStartFlashCall() throws JsonProcessingException, JSONException { } @Test - void serializeStartDataCall() throws JsonProcessingException, JSONException { + void serializeStartData() throws JsonProcessingException, JSONException { String serializedString = objectMapper.writeValueAsString(startVerificationDataDto); JSONAssert.assertEquals(jsonStartVerificationData, serializedString, true); } @Test - void serializeStartSmsCall() throws JsonProcessingException, JSONException { + void serializeStartSms() throws JsonProcessingException, JSONException { String serializedString = objectMapper.writeValueAsString(startVerificationSmsDto); JSONAssert.assertEquals(jsonStartVerificationSms, serializedString, true); } @Test - void serializeStartSmsCallWithAcceptLanguage() throws JsonProcessingException, JSONException { + void serializeStartSmsWithAcceptLanguage() throws JsonProcessingException, JSONException { String serializedString = objectMapper.writeValueAsString(startVerificationSmsDtoWithAcceptLanguage); // acceptLanguage do not have to be serialized JSONAssert.assertEquals(jsonStartVerificationSms, serializedString, true); } + + @Test + void serializeStartWhatsApp() throws JsonProcessingException, JSONException { + String serializedString = objectMapper.writeValueAsString(startVerificationWhatsAppDto); + + JSONAssert.assertEquals(jsonStartVerificationWhatsApp, serializedString, true); + } } diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/start/response/VerificationStartResponseTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/start/response/VerificationStartResponseTest.java index 2363addfe..0b083ff70 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/start/response/VerificationStartResponseTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/start/response/VerificationStartResponseTest.java @@ -6,6 +6,7 @@ import com.sinch.sdk.core.TestHelpers; import com.sinch.sdk.domains.verification.models.dto.v1.start.LinkTest; 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.response.VerificationStartResponseData; import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseDataImpl; import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseFlashCall; @@ -14,6 +15,8 @@ import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponsePhoneCallImpl; import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseSms; import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseSmsImpl; +import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseWhatsApp; +import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseWhatsAppImpl; import com.sinch.sdk.domains.verification.models.v1.start.response.internal.VerificationStartResponseInternal; import com.sinch.sdk.domains.verification.models.v1.start.response.internal.VerificationStartResponseInternalImpl; import org.junit.jupiter.api.Test; @@ -78,6 +81,20 @@ public class VerificationStartResponseTest extends BaseTest { .putExtraOption("my key", "my value") .build()); + @GivenJsonResource( + "/domains/verification/v1/start/response/VerificationStartResponseWhatsAppDto.json") + VerificationStartResponseInternal loadedStartVerificationWhatsAppDto; + + public static VerificationStartResponseInternalImpl expectedStartVerificationWhatsAppDto = + new VerificationStartResponseInternalImpl( + (VerificationStartResponseWhatsAppImpl) + VerificationStartResponseWhatsApp.builder() + .setId("the id") + .setLinks(LinkTest.expectedLinks) + .setCodeType(WhatsAppCodeType.NUMERIC) + .putExtraOption("my key", "my value") + .build()); + @Test void deserializeStartPhoneCall() { TestHelpers.recursiveEquals( @@ -99,4 +116,10 @@ void deserializeStartData() { void deserializeStartSms() { TestHelpers.recursiveEquals(loadedStartVerificationSmsDto, expectedStartVerificationSmsDto); } + + @Test + void deserializeStartWhatsApp() { + TestHelpers.recursiveEquals( + loadedStartVerificationWhatsAppDto, expectedStartVerificationWhatsAppDto); + } } diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/status/VerificationStatusResponseTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/status/VerificationStatusResponseTest.java index 925eff717..6f81a8d14 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/status/VerificationStatusResponseTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/status/VerificationStatusResponseTest.java @@ -19,6 +19,8 @@ import com.sinch.sdk.domains.verification.models.v1.status.response.VerificationStatusResponseSms; import com.sinch.sdk.domains.verification.models.v1.status.response.VerificationStatusResponseSmsImpl; import com.sinch.sdk.domains.verification.models.v1.status.response.VerificationStatusResponseSmsPrice; +import com.sinch.sdk.domains.verification.models.v1.status.response.VerificationStatusResponseWhatsApp; +import com.sinch.sdk.domains.verification.models.v1.status.response.VerificationStatusResponseWhatsAppImpl; import com.sinch.sdk.domains.verification.models.v1.status.response.internal.VerificationStatusResponseInternal; import com.sinch.sdk.domains.verification.models.v1.status.response.internal.VerificationStatusResponseInternalImpl; import org.junit.jupiter.api.Test; @@ -108,6 +110,29 @@ public class VerificationStatusResponseTest extends VerificationBaseTest { DateUtil.failSafeTimeStampToInstant("2024-05-22T09:38:59.5590437")) .build()); + public static VerificationStatusResponseInternalImpl expectedVerificationWhatsAppDto = + new VerificationStatusResponseInternalImpl( + (VerificationStatusResponseWhatsAppImpl) + VerificationStatusResponseWhatsApp.builder() + .setId("the id") + .setReference("my reference") + .setStatus(VerificationStatus.FAIL) + .setReason(VerificationStatusReason.FRAUD) + .setSource(StatusSource.INTERCEPTED) + .setPrice( + VerificationStatusResponseSmsPrice.builder() + .setVerificationPrice( + Price.builder() + .setCurrencyId("verificationPrice currency id") + .setAmount(3.141516F) + .build()) + .build()) + .setIdentity(NumberIdentity.valueOf("+33123456789")) + .setCountryId("es-ES") + .setVerificationTimestamp( + DateUtil.failSafeTimeStampToInstant("2024-05-22T09:38:59.5590437")) + .build()); + @GivenJsonResource("/domains/verification/v1/status/VerificationStatusResponsePhoneCallDto.json") VerificationStatusResponseInternal loadedVerificationPhoneCallDto; @@ -117,6 +142,9 @@ public class VerificationStatusResponseTest extends VerificationBaseTest { @GivenJsonResource("/domains/verification/v1/status/VerificationStatusResponseSmsDto.json") VerificationStatusResponseInternal loadedVerificationSmsDto; + @GivenJsonResource("/domains/verification/v1/status/VerificationStatusResponseWhatsAppDto.json") + VerificationStatusResponseInternal loadedVerificationWhatsAppDto; + @Test void deserializePhoneCall() { TestHelpers.recursiveEquals(loadedVerificationPhoneCallDto, expectedVerificationPhoneCallDto); @@ -131,4 +159,9 @@ void deserializeFlashCall() { void deserializeSms() { TestHelpers.recursiveEquals(loadedVerificationSmsDto, expectedVerificationSmsDto); } + + @Test + void deserializeWhatsApp() { + TestHelpers.recursiveEquals(loadedVerificationWhatsAppDto, expectedVerificationWhatsAppDto); + } } 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 index dc553dd59..d89ddf779 100644 --- 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 @@ -5,11 +5,13 @@ 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; @@ -43,6 +45,14 @@ public class VerificationResponseEventDtoTest extends VerificationBaseTest { .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; @@ -63,6 +73,13 @@ public class VerificationResponseEventDtoTest extends VerificationBaseTest { "/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 { @@ -127,4 +144,26 @@ void serializePhoneCallResponseEmptyCallout() throws JsonProcessingException, JS 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/report/VerificationReportRequestSmsDto.json b/openapi-contracts/src/test/resources/domains/verification/v1/report/VerificationReportRequestSmsDto.json index 2b4fe5602..95dde6813 100644 --- a/openapi-contracts/src/test/resources/domains/verification/v1/report/VerificationReportRequestSmsDto.json +++ b/openapi-contracts/src/test/resources/domains/verification/v1/report/VerificationReportRequestSmsDto.json @@ -1,8 +1,6 @@ { "method": "sms", "sms": { - "code": "foo code", - "cli": "foo cli" - + "code": "foo code" } } diff --git a/openapi-contracts/src/test/resources/domains/verification/v1/report/VerificationReportRequestWhatsAppDto.json b/openapi-contracts/src/test/resources/domains/verification/v1/report/VerificationReportRequestWhatsAppDto.json new file mode 100644 index 000000000..3fc1512b6 --- /dev/null +++ b/openapi-contracts/src/test/resources/domains/verification/v1/report/VerificationReportRequestWhatsAppDto.json @@ -0,0 +1,6 @@ +{ + "method": "whatsapp", + "whatsapp": { + "code": "foo code" + } +} diff --git a/openapi-contracts/src/test/resources/domains/verification/v1/report/VerificationReportResponseWhatsAppDto.json b/openapi-contracts/src/test/resources/domains/verification/v1/report/VerificationReportResponseWhatsAppDto.json new file mode 100644 index 000000000..886034b44 --- /dev/null +++ b/openapi-contracts/src/test/resources/domains/verification/v1/report/VerificationReportResponseWhatsAppDto.json @@ -0,0 +1,6 @@ +{ + "id": "the id", + "method": "whatsapp", + "status": "FAIL", + "reason": "Expired" +} diff --git a/openapi-contracts/src/test/resources/domains/verification/v1/start/request/VerificationStartRequestWhatsAppDto.json b/openapi-contracts/src/test/resources/domains/verification/v1/start/request/VerificationStartRequestWhatsAppDto.json new file mode 100644 index 000000000..eb20a2d31 --- /dev/null +++ b/openapi-contracts/src/test/resources/domains/verification/v1/start/request/VerificationStartRequestWhatsAppDto.json @@ -0,0 +1,13 @@ +{ + "identity": { + "type": "number", + "endpoint": "+33123456789" + }, + "reference": "a reference", + "custom": "a custom", + "method": "whatsapp", + "whatsappOptions": { + "codeType": "Alphanumeric", + "my key": "my value" + } +} diff --git a/openapi-contracts/src/test/resources/domains/verification/v1/start/response/VerificationStartResponseWhatsAppDto.json b/openapi-contracts/src/test/resources/domains/verification/v1/start/response/VerificationStartResponseWhatsAppDto.json new file mode 100644 index 000000000..0d851f24a --- /dev/null +++ b/openapi-contracts/src/test/resources/domains/verification/v1/start/response/VerificationStartResponseWhatsAppDto.json @@ -0,0 +1,20 @@ +{ + "id": "the id", + "method":"whatsapp", + "whatsapp": { + "codeType": "Numeric", + "my key": "my value" + }, + "_links": [ + { + "rel": "status", + "href": "an href for status", + "method": "GET" + }, + { + "rel": "report", + "href": "an href for report", + "method": "PUT" + } + ] +} diff --git a/openapi-contracts/src/test/resources/domains/verification/v1/status/VerificationStatusResponseWhatsAppDto.json b/openapi-contracts/src/test/resources/domains/verification/v1/status/VerificationStatusResponseWhatsAppDto.json new file mode 100644 index 000000000..797809422 --- /dev/null +++ b/openapi-contracts/src/test/resources/domains/verification/v1/status/VerificationStatusResponseWhatsAppDto.json @@ -0,0 +1,20 @@ +{ + "id": "the id", + "method": "whatsapp", + "status": "FAIL", + "reason": "Fraud", + "reference": "my reference", + "identity": { + "type": "number", + "endpoint": "+33123456789" + }, + "countryId": "es-ES", + "verificationTimestamp": "2024-05-22T09:38:59.5590437", + "source": "intercepted", + "price": { + "verificationPrice": { + "currencyId": "verificationPrice currency id", + "amount": 3.141516 + } + } +} diff --git a/openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResponseWhatsApp.json b/openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResponseWhatsApp.json new file mode 100644 index 000000000..3bd44204f --- /dev/null +++ b/openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResponseWhatsApp.json @@ -0,0 +1,10 @@ +{ + "whatsapp": { + "codeType": "Numeric", + "acceptLanguage": [ + "a language" + ], + "my key": "my value" + }, + "action": "allow" +} diff --git a/openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResponseWhatsAppEmptyWhatsApp.json b/openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResponseWhatsAppEmptyWhatsApp.json new file mode 100644 index 000000000..a4bbde33d --- /dev/null +++ b/openapi-contracts/src/test/resources/domains/verification/v1/webhooks/VerificationResponseWhatsAppEmptyWhatsApp.json @@ -0,0 +1,3 @@ +{ + "action": "allow" +} From a1b0a6b5a104450220c4926476da0a30ffff1aa5 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier Date: Thu, 28 Aug 2025 11:57:30 +0200 Subject: [PATCH 016/122] feat (Verification/WhatsApp): DTO files --- .../models/v1/VerificationMethod.java | 5 +- .../models/v1/WhatsAppCodeType.java | 41 ++ .../request/VerificationReportRequestSms.java | 16 - .../VerificationReportRequestSmsImpl.java | 21 - .../VerificationReportRequestWhatsApp.java | 85 +++++ ...VerificationReportRequestWhatsAppImpl.java | 203 ++++++++++ ...VerificationReportRequestInternalImpl.java | 100 ++++- .../VerificationReportRequestSmsOptions.java | 16 - ...rificationReportRequestSmsOptionsImpl.java | 39 +- ...ificationReportRequestWhatsAppOptions.java | 56 +++ ...ationReportRequestWhatsAppOptionsImpl.java | 92 +++++ .../VerificationReportResponseWhatsApp.java | 92 +++++ ...erificationReportResponseWhatsAppImpl.java | 174 +++++++++ ...erificationReportResponseInternalImpl.java | 105 ++++- .../internal/VerificationMethodStart.java | 5 +- .../VerificationStartRequestWhatsApp.java | 131 +++++++ .../VerificationStartRequestWhatsAppImpl.java | 303 +++++++++++++++ .../VerificationStartRequestInternalImpl.java | 94 ++++- .../VerificationStartWhatsAppOptions.java | 68 ++++ .../VerificationStartWhatsAppOptionsImpl.java | 144 +++++++ .../VerificationStartResponseWhatsApp.java | 109 ++++++ ...VerificationStartResponseWhatsAppImpl.java | 271 +++++++++++++ ...VerificationStartResponseInternalImpl.java | 95 ++++- ...ificationStartResponseWhatsAppContent.java | 64 ++++ ...ationStartResponseWhatsAppContentImpl.java | 141 +++++++ .../VerificationStatusResponseWhatsApp.java | 227 +++++++++++ ...erificationStatusResponseWhatsAppImpl.java | 361 ++++++++++++++++++ ...erificationStatusResponseInternalImpl.java | 105 ++++- ...ificationRequestEventResponseWhatsApp.java | 109 ++++++ ...ationRequestEventResponseWhatsAppImpl.java | 243 ++++++++++++ ...onRequestEventResponseWhatsAppContent.java | 81 ++++ ...questEventResponseWhatsAppContentImpl.java | 179 +++++++++ 32 files changed, 3656 insertions(+), 119 deletions(-) create mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/WhatsAppCodeType.java create mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/VerificationReportRequestWhatsApp.java create mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/VerificationReportRequestWhatsAppImpl.java create mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/internal/VerificationReportRequestWhatsAppOptions.java create mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/internal/VerificationReportRequestWhatsAppOptionsImpl.java create mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/response/VerificationReportResponseWhatsApp.java create mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/response/VerificationReportResponseWhatsAppImpl.java create mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestWhatsApp.java create mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestWhatsAppImpl.java create mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartWhatsAppOptions.java create mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartWhatsAppOptionsImpl.java create mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseWhatsApp.java create mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseWhatsAppImpl.java create mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseWhatsAppContent.java create mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseWhatsAppContentImpl.java create mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponseWhatsApp.java create mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponseWhatsAppImpl.java create mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventResponseWhatsApp.java create mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventResponseWhatsAppImpl.java create mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/internal/VerificationRequestEventResponseWhatsAppContent.java create mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/internal/VerificationRequestEventResponseWhatsAppContentImpl.java diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/VerificationMethod.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/VerificationMethod.java index fad8631ea..4c6a79a8f 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/VerificationMethod.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/VerificationMethod.java @@ -23,11 +23,14 @@ public class VerificationMethod extends EnumDynamic */ public static final VerificationMethod PHONE_CALL = new VerificationMethod("callout"); + /** Verification by WhatsApp message with an OTP code. */ + public static final VerificationMethod WHATSAPP = new VerificationMethod("whatsapp"); + private static final EnumSupportDynamic ENUM_SUPPORT = new EnumSupportDynamic<>( VerificationMethod.class, VerificationMethod::new, - Arrays.asList(SMS, FLASH_CALL, PHONE_CALL)); + Arrays.asList(SMS, FLASH_CALL, PHONE_CALL, WHATSAPP)); private VerificationMethod(String value) { super(value); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/WhatsAppCodeType.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/WhatsAppCodeType.java new file mode 100644 index 000000000..ee1a63d30 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/WhatsAppCodeType.java @@ -0,0 +1,41 @@ +package com.sinch.sdk.domains.verification.models.v1; + +import com.sinch.sdk.core.utils.EnumDynamic; +import com.sinch.sdk.core.utils.EnumSupportDynamic; +import java.util.Arrays; +import java.util.stream.Stream; + +/** Selects type of code which will be sent to customer */ +public class WhatsAppCodeType extends EnumDynamic { + + /** Code contains numbers only. */ + public static final WhatsAppCodeType NUMERIC = new WhatsAppCodeType("Numeric"); + + /** Code contains letters only. */ + public static final WhatsAppCodeType ALPHA = new WhatsAppCodeType("Alpha"); + + /** Code contains both numbers and letters. */ + public static final WhatsAppCodeType ALPHANUMERIC = new WhatsAppCodeType("Alphanumeric"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>( + WhatsAppCodeType.class, + WhatsAppCodeType::new, + Arrays.asList(NUMERIC, ALPHA, ALPHANUMERIC)); + + private WhatsAppCodeType(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static WhatsAppCodeType from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(WhatsAppCodeType e) { + return ENUM_SUPPORT.valueOf(e); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/VerificationReportRequestSms.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/VerificationReportRequestSms.java index c52c47931..692326612 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/VerificationReportRequestSms.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/VerificationReportRequestSms.java @@ -54,13 +54,6 @@ public static String valueOf(MethodEnum e) { */ String getCode(); - /** - * The sender ID of the SMS. - * - * @return cli - */ - String getCli(); - /** * Getting builder * @@ -82,15 +75,6 @@ interface Builder { */ Builder setCode(String code); - /** - * see getter - * - * @param cli see getter - * @return Current builder - * @see #getCli - */ - Builder setCli(String cli); - /** * Create instance * diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/VerificationReportRequestSmsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/VerificationReportRequestSmsImpl.java index b842f521c..3e5077e8a 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/VerificationReportRequestSmsImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/VerificationReportRequestSmsImpl.java @@ -83,21 +83,6 @@ public OptionalValue code() { : OptionalValue.empty(); } - @JsonIgnore - public String getCli() { - if (null == sms || !sms.isPresent() || null == sms.get().getCli()) { - return null; - } - return sms.get().getCli(); - } - - public OptionalValue cli() { - return null != sms && sms.isPresent() - ? sms.map(f -> ((VerificationReportRequestSmsOptionsImpl) f).cli()) - .orElse(OptionalValue.empty()) - : OptionalValue.empty(); - } - /** Return true if this VerificationReportRequestSms object is equal to o. */ @Override public boolean equals(Object o) { @@ -157,12 +142,6 @@ public Builder setCode(String code) { return this; } - @JsonIgnore - public Builder setCli(String cli) { - getDelegatedBuilder().setCli(cli); - return this; - } - private VerificationReportRequestSmsOptions.Builder getDelegatedBuilder() { if (null == _delegatedBuilder) { this._delegatedBuilder = VerificationReportRequestSmsOptions.builder(); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/VerificationReportRequestWhatsApp.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/VerificationReportRequestWhatsApp.java new file mode 100644 index 000000000..dafe0d8e9 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/VerificationReportRequestWhatsApp.java @@ -0,0 +1,85 @@ +/* + * Verification | Sinch + * + * OpenAPI document version: 2.0.1 + * Contact: support@sinch.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit the class manually. + */ + +package com.sinch.sdk.domains.verification.models.v1.report.request; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.sinch.sdk.core.utils.EnumDynamic; +import com.sinch.sdk.core.utils.EnumSupportDynamic; +import java.util.Arrays; +import java.util.stream.Stream; + +/** WhatsApp Verification Report Request */ +@JsonDeserialize(builder = VerificationReportRequestWhatsAppImpl.Builder.class) +public interface VerificationReportRequestWhatsApp + extends com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequest { + + /** The type of verification. */ + public class MethodEnum extends EnumDynamic { + public static final MethodEnum WHATSAPP = new MethodEnum("whatsapp"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>(MethodEnum.class, MethodEnum::new, Arrays.asList(WHATSAPP)); + + private MethodEnum(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static MethodEnum from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(MethodEnum e) { + return ENUM_SUPPORT.valueOf(e); + } + } + + /** + * The code which was received by the user submitting the WhatsApp verification. + * + *

Field is required + * + * @return code + */ + String getCode(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new VerificationReportRequestWhatsAppImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param code see getter + * @return Current builder + * @see #getCode + */ + Builder setCode(String code); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + VerificationReportRequestWhatsApp build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/VerificationReportRequestWhatsAppImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/VerificationReportRequestWhatsAppImpl.java new file mode 100644 index 000000000..f049d8926 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/VerificationReportRequestWhatsAppImpl.java @@ -0,0 +1,203 @@ +package com.sinch.sdk.domains.verification.models.v1.report.request; + +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonSerializer; +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.report.request.internal.VerificationReportRequestWhatsAppOptions; +import com.sinch.sdk.domains.verification.models.v1.report.request.internal.VerificationReportRequestWhatsAppOptionsImpl; +import java.io.IOException; +import java.util.Objects; +import java.util.Optional; + +@JsonPropertyOrder({ + VerificationReportRequestWhatsAppImpl.JSON_PROPERTY_METHOD, + VerificationReportRequestWhatsAppImpl.JSON_PROPERTY_WHATSAPP +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class VerificationReportRequestWhatsAppImpl + implements VerificationReportRequestWhatsApp, + com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequest { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_METHOD = "method"; + + private OptionalValue method; + + public static final String JSON_PROPERTY_WHATSAPP = "whatsapp"; + + private OptionalValue whatsapp; + + public VerificationReportRequestWhatsAppImpl() {} + + protected VerificationReportRequestWhatsAppImpl( + OptionalValue method, + OptionalValue whatsapp) { + this.method = method; + this.whatsapp = whatsapp; + } + + @JsonIgnore + public MethodEnum getMethod() { + return method.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_METHOD) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue method() { + return method; + } + + @JsonIgnore + public VerificationReportRequestWhatsAppOptions getWhatsapp() { + return whatsapp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_WHATSAPP) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue whatsapp() { + return whatsapp; + } + + @JsonIgnore + public String getCode() { + if (null == whatsapp || !whatsapp.isPresent() || null == whatsapp.get().getCode()) { + return null; + } + return whatsapp.get().getCode(); + } + + public OptionalValue code() { + return null != whatsapp && whatsapp.isPresent() + ? whatsapp + .map(f -> ((VerificationReportRequestWhatsAppOptionsImpl) f).code()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + /** Return true if this VerificationReportRequestWhatsApp object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerificationReportRequestWhatsAppImpl verificationReportRequestWhatsApp = + (VerificationReportRequestWhatsAppImpl) o; + return Objects.equals(this.method, verificationReportRequestWhatsApp.method) + && Objects.equals(this.whatsapp, verificationReportRequestWhatsApp.whatsapp); + } + + @Override + public int hashCode() { + return Objects.hash(method, whatsapp); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerificationReportRequestWhatsAppImpl {\n"); + sb.append(" method: ").append(toIndentedString(method)).append("\n"); + sb.append(" whatsapp: ").append(toIndentedString(whatsapp)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + @JsonPOJOBuilder(withPrefix = "set") + static class Builder implements VerificationReportRequestWhatsApp.Builder { + OptionalValue method = OptionalValue.of(MethodEnum.WHATSAPP); + OptionalValue whatsapp = OptionalValue.empty(); + + VerificationReportRequestWhatsAppOptions.Builder _delegatedBuilder = null; + + @JsonProperty(value = JSON_PROPERTY_WHATSAPP, required = true) + public Builder setWhatsapp(VerificationReportRequestWhatsAppOptions whatsapp) { + this.whatsapp = OptionalValue.of(whatsapp); + return this; + } + + @JsonIgnore + public Builder setCode(String code) { + getDelegatedBuilder().setCode(code); + return this; + } + + private VerificationReportRequestWhatsAppOptions.Builder getDelegatedBuilder() { + if (null == _delegatedBuilder) { + this._delegatedBuilder = VerificationReportRequestWhatsAppOptions.builder(); + } + return this._delegatedBuilder; + } + + public VerificationReportRequestWhatsApp 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 VerificationReportRequestWhatsAppImpl(method, whatsapp); + } + } + + public static class DelegatedSerializer + extends JsonSerializer> { + @Override + public void serialize( + OptionalValue value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException { + + if (!value.isPresent()) { + return; + } + VerificationReportRequestWhatsAppImpl impl = + (VerificationReportRequestWhatsAppImpl) value.get(); + jgen.writeObject(null != impl ? impl.getWhatsapp() : null); + } + } + + public static class DelegatedDeSerializer + extends JsonDeserializer { + @Override + public VerificationReportRequestWhatsApp deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException { + + VerificationReportRequestWhatsAppImpl.Builder builder = + new VerificationReportRequestWhatsAppImpl.Builder(); + VerificationReportRequestWhatsAppOptionsImpl deserialized = + jp.readValueAs(VerificationReportRequestWhatsAppOptionsImpl.class); + builder.setWhatsapp(deserialized); + return builder.build(); + } + } + + public static Optional delegatedConverter( + VerificationReportRequestWhatsAppOptions internal) { + if (null == internal) { + return Optional.empty(); + } + return Optional.of(new Builder().setWhatsapp(internal).build()); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/internal/VerificationReportRequestInternalImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/internal/VerificationReportRequestInternalImpl.java index 9407398f5..c72d1aa65 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/internal/VerificationReportRequestInternalImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/internal/VerificationReportRequestInternalImpl.java @@ -19,6 +19,7 @@ import com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestFlashCallImpl; import com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestPhoneCallImpl; import com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestSmsImpl; +import com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestWhatsAppImpl; import java.io.IOException; import java.util.Collections; import java.util.HashMap; @@ -103,6 +104,11 @@ public VerificationReportRequestInternalImpl deserialize( tree.traverse(jp.getCodec()).readValueAs(VerificationReportRequestSmsImpl.class); newVerificationReportRequestInternalImpl.setActualInstance(deserialized); return newVerificationReportRequestInternalImpl; + case "whatsapp": + deserialized = + tree.traverse(jp.getCodec()).readValueAs(VerificationReportRequestWhatsAppImpl.class); + newVerificationReportRequestInternalImpl.setActualInstance(deserialized); + return newVerificationReportRequestInternalImpl; case "VerificationReportRequestFlashCall": deserialized = tree.traverse(jp.getCodec()) @@ -120,14 +126,20 @@ public VerificationReportRequestInternalImpl deserialize( tree.traverse(jp.getCodec()).readValueAs(VerificationReportRequestSmsImpl.class); newVerificationReportRequestInternalImpl.setActualInstance(deserialized); return newVerificationReportRequestInternalImpl; + case "VerificationReportRequestWhatsApp": + deserialized = + tree.traverse(jp.getCodec()).readValueAs(VerificationReportRequestWhatsAppImpl.class); + newVerificationReportRequestInternalImpl.setActualInstance(deserialized); + return newVerificationReportRequestInternalImpl; default: log.log( Level.WARNING, String.format( "Failed to lookup discriminator value `%s` for" + " VerificationReportRequestInternalImpl. Possible values: callout flashcall" - + " sms VerificationReportRequestFlashCall VerificationReportRequestPhoneCall" - + " VerificationReportRequestSms", + + " sms whatsapp VerificationReportRequestFlashCall" + + " VerificationReportRequestPhoneCall VerificationReportRequestSms" + + " VerificationReportRequestWhatsApp", discriminatorValue)); } @@ -271,6 +283,51 @@ public VerificationReportRequestInternalImpl deserialize( Level.FINER, "Input data does not match schema 'VerificationReportRequestSmsImpl'", e); } + // deserialize VerificationReportRequestWhatsAppImpl + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (VerificationReportRequestWhatsAppImpl.class.equals(Integer.class) + || VerificationReportRequestWhatsAppImpl.class.equals(Long.class) + || VerificationReportRequestWhatsAppImpl.class.equals(Float.class) + || VerificationReportRequestWhatsAppImpl.class.equals(Double.class) + || VerificationReportRequestWhatsAppImpl.class.equals(Boolean.class) + || VerificationReportRequestWhatsAppImpl.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((VerificationReportRequestWhatsAppImpl.class.equals(Integer.class) + || VerificationReportRequestWhatsAppImpl.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((VerificationReportRequestWhatsAppImpl.class.equals(Float.class) + || VerificationReportRequestWhatsAppImpl.class.equals(Double.class)) + && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= + (VerificationReportRequestWhatsAppImpl.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (VerificationReportRequestWhatsAppImpl.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = + tree.traverse(jp.getCodec()).readValueAs(VerificationReportRequestWhatsAppImpl.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 'VerificationReportRequestWhatsAppImpl'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, + "Input data does not match schema 'VerificationReportRequestWhatsAppImpl'", + e); + } + if (match == 1) { VerificationReportRequestInternalImpl ret = new VerificationReportRequestInternalImpl(); ret.setActualInstance(deserialized); @@ -314,12 +371,19 @@ public VerificationReportRequestInternalImpl(VerificationReportRequestSmsImpl o) setActualInstance(o); } + public VerificationReportRequestInternalImpl(VerificationReportRequestWhatsAppImpl o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + static { schemas.put( "VerificationReportRequestFlashCallImpl", VerificationReportRequestFlashCallImpl.class); schemas.put( "VerificationReportRequestPhoneCallImpl", VerificationReportRequestPhoneCallImpl.class); schemas.put("VerificationReportRequestSmsImpl", VerificationReportRequestSmsImpl.class); + schemas.put( + "VerificationReportRequestWhatsAppImpl", VerificationReportRequestWhatsAppImpl.class); JSONNavigator.registerDescendants( VerificationReportRequestInternalImpl.class, Collections.unmodifiableMap(schemas)); // Initialize and register the discriminator mappings. @@ -327,11 +391,13 @@ public VerificationReportRequestInternalImpl(VerificationReportRequestSmsImpl o) mappings.put("callout", VerificationReportRequestPhoneCallImpl.class); mappings.put("flashcall", VerificationReportRequestFlashCallImpl.class); mappings.put("sms", VerificationReportRequestSmsImpl.class); + mappings.put("whatsapp", VerificationReportRequestWhatsAppImpl.class); mappings.put( "VerificationReportRequestFlashCall", VerificationReportRequestFlashCallImpl.class); mappings.put( "VerificationReportRequestPhoneCall", VerificationReportRequestPhoneCallImpl.class); mappings.put("VerificationReportRequestSms", VerificationReportRequestSmsImpl.class); + mappings.put("VerificationReportRequestWhatsApp", VerificationReportRequestWhatsAppImpl.class); mappings.put("VerificationReportRequest", VerificationReportRequestInternalImpl.class); JSONNavigator.registerDiscriminator( VerificationReportRequestInternalImpl.class, "method", mappings); @@ -345,7 +411,8 @@ public Map> getSchemas() { /** * Set the instance that matches the oneOf child schema, check the instance parameter is valid * against the oneOf child schemas: VerificationReportRequestFlashCallImpl, - * VerificationReportRequestPhoneCallImpl, VerificationReportRequestSmsImpl + * VerificationReportRequestPhoneCallImpl, VerificationReportRequestSmsImpl, + * VerificationReportRequestWhatsAppImpl * *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a * composed schema (allOf, anyOf, oneOf). @@ -370,17 +437,26 @@ public void setActualInstance(Object instance) { return; } + if (JSONNavigator.isInstanceOf( + VerificationReportRequestWhatsAppImpl.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException( "Invalid instance type. Must be VerificationReportRequestFlashCallImpl," - + " VerificationReportRequestPhoneCallImpl, VerificationReportRequestSmsImpl"); + + " VerificationReportRequestPhoneCallImpl, VerificationReportRequestSmsImpl," + + " VerificationReportRequestWhatsAppImpl"); } /** * Get the actual instance, which can be the following: VerificationReportRequestFlashCallImpl, - * VerificationReportRequestPhoneCallImpl, VerificationReportRequestSmsImpl + * VerificationReportRequestPhoneCallImpl, VerificationReportRequestSmsImpl, + * VerificationReportRequestWhatsAppImpl * * @return The actual instance (VerificationReportRequestFlashCallImpl, - * VerificationReportRequestPhoneCallImpl, VerificationReportRequestSmsImpl) + * VerificationReportRequestPhoneCallImpl, VerificationReportRequestSmsImpl, + * VerificationReportRequestWhatsAppImpl) */ @Override public Object getActualInstance() { @@ -422,4 +498,16 @@ public VerificationReportRequestSmsImpl getVerificationReportRequestSmsImpl() throws ClassCastException { return (VerificationReportRequestSmsImpl) super.getActualInstance(); } + + /** + * Get the actual instance of `VerificationReportRequestWhatsAppImpl`. If the actual instance is + * not `VerificationReportRequestWhatsAppImpl`, the ClassCastException will be thrown. + * + * @return The actual instance of `VerificationReportRequestWhatsAppImpl` + * @throws ClassCastException if the instance is not `VerificationReportRequestWhatsAppImpl` + */ + public VerificationReportRequestWhatsAppImpl getVerificationReportRequestWhatsAppImpl() + throws ClassCastException { + return (VerificationReportRequestWhatsAppImpl) super.getActualInstance(); + } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/internal/VerificationReportRequestSmsOptions.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/internal/VerificationReportRequestSmsOptions.java index f66135daf..5e5af61aa 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/internal/VerificationReportRequestSmsOptions.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/internal/VerificationReportRequestSmsOptions.java @@ -25,13 +25,6 @@ public interface VerificationReportRequestSmsOptions { */ String getCode(); - /** - * The sender ID of the SMS. - * - * @return cli - */ - String getCli(); - /** * Getting builder * @@ -53,15 +46,6 @@ interface Builder { */ Builder setCode(String code); - /** - * see getter - * - * @param cli see getter - * @return Current builder - * @see #getCli - */ - Builder setCli(String cli); - /** * Create instance * diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/internal/VerificationReportRequestSmsOptionsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/internal/VerificationReportRequestSmsOptionsImpl.java index eee052216..44199a81d 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/internal/VerificationReportRequestSmsOptionsImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/internal/VerificationReportRequestSmsOptionsImpl.java @@ -9,10 +9,7 @@ import com.sinch.sdk.core.models.OptionalValue; import java.util.Objects; -@JsonPropertyOrder({ - VerificationReportRequestSmsOptionsImpl.JSON_PROPERTY_CODE, - VerificationReportRequestSmsOptionsImpl.JSON_PROPERTY_CLI -}) +@JsonPropertyOrder({VerificationReportRequestSmsOptionsImpl.JSON_PROPERTY_CODE}) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) public class VerificationReportRequestSmsOptionsImpl @@ -23,16 +20,10 @@ public class VerificationReportRequestSmsOptionsImpl private OptionalValue code; - public static final String JSON_PROPERTY_CLI = "cli"; - - private OptionalValue cli; - public VerificationReportRequestSmsOptionsImpl() {} - protected VerificationReportRequestSmsOptionsImpl( - OptionalValue code, OptionalValue cli) { + protected VerificationReportRequestSmsOptionsImpl(OptionalValue code) { this.code = code; - this.cli = cli; } @JsonIgnore @@ -46,17 +37,6 @@ public OptionalValue code() { return code; } - @JsonIgnore - public String getCli() { - return cli.orElse(null); - } - - @JsonProperty(JSON_PROPERTY_CLI) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OptionalValue cli() { - return cli; - } - /** Return true if this VerificationReportRequestSms_sms object is equal to o. */ @Override public boolean equals(Object o) { @@ -68,13 +48,12 @@ public boolean equals(Object o) { } VerificationReportRequestSmsOptionsImpl verificationReportRequestSmsSms = (VerificationReportRequestSmsOptionsImpl) o; - return Objects.equals(this.code, verificationReportRequestSmsSms.code) - && Objects.equals(this.cli, verificationReportRequestSmsSms.cli); + return Objects.equals(this.code, verificationReportRequestSmsSms.code); } @Override public int hashCode() { - return Objects.hash(code, cli); + return Objects.hash(code); } @Override @@ -82,7 +61,6 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class VerificationReportRequestSmsOptionsImpl {\n"); sb.append(" code: ").append(toIndentedString(code)).append("\n"); - sb.append(" cli: ").append(toIndentedString(cli)).append("\n"); sb.append("}"); return sb.toString(); } @@ -100,7 +78,6 @@ private String toIndentedString(Object o) { @JsonPOJOBuilder(withPrefix = "set") static class Builder implements VerificationReportRequestSmsOptions.Builder { OptionalValue code = OptionalValue.empty(); - OptionalValue cli = OptionalValue.empty(); @JsonProperty(value = JSON_PROPERTY_CODE, required = true) public Builder setCode(String code) { @@ -108,14 +85,8 @@ public Builder setCode(String code) { return this; } - @JsonProperty(JSON_PROPERTY_CLI) - public Builder setCli(String cli) { - this.cli = OptionalValue.of(cli); - return this; - } - public VerificationReportRequestSmsOptions build() { - return new VerificationReportRequestSmsOptionsImpl(code, cli); + return new VerificationReportRequestSmsOptionsImpl(code); } } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/internal/VerificationReportRequestWhatsAppOptions.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/internal/VerificationReportRequestWhatsAppOptions.java new file mode 100644 index 000000000..6fa743946 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/internal/VerificationReportRequestWhatsAppOptions.java @@ -0,0 +1,56 @@ +/* + * Verification | Sinch + * + * OpenAPI document version: 2.0.1 + * Contact: support@sinch.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit the class manually. + */ + +package com.sinch.sdk.domains.verification.models.v1.report.request.internal; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** A configuration object containing settings specific to WhatsApp verifications. */ +@JsonDeserialize(builder = VerificationReportRequestWhatsAppOptionsImpl.Builder.class) +public interface VerificationReportRequestWhatsAppOptions { + + /** + * The code which was received by the user submitting the WhatsApp verification. + * + *

Field is required + * + * @return code + */ + String getCode(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new VerificationReportRequestWhatsAppOptionsImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param code see getter + * @return Current builder + * @see #getCode + */ + Builder setCode(String code); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + VerificationReportRequestWhatsAppOptions build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/internal/VerificationReportRequestWhatsAppOptionsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/internal/VerificationReportRequestWhatsAppOptionsImpl.java new file mode 100644 index 000000000..96827c8ba --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/internal/VerificationReportRequestWhatsAppOptionsImpl.java @@ -0,0 +1,92 @@ +package com.sinch.sdk.domains.verification.models.v1.report.request.internal; + +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; +import com.sinch.sdk.core.models.OptionalValue; +import java.util.Objects; + +@JsonPropertyOrder({VerificationReportRequestWhatsAppOptionsImpl.JSON_PROPERTY_CODE}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class VerificationReportRequestWhatsAppOptionsImpl + implements VerificationReportRequestWhatsAppOptions { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_CODE = "code"; + + private OptionalValue code; + + public VerificationReportRequestWhatsAppOptionsImpl() {} + + protected VerificationReportRequestWhatsAppOptionsImpl(OptionalValue code) { + this.code = code; + } + + @JsonIgnore + public String getCode() { + return code.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue code() { + return code; + } + + /** Return true if this VerificationReportRequestWhatsApp_whatsapp object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerificationReportRequestWhatsAppOptionsImpl verificationReportRequestWhatsAppWhatsapp = + (VerificationReportRequestWhatsAppOptionsImpl) o; + return Objects.equals(this.code, verificationReportRequestWhatsAppWhatsapp.code); + } + + @Override + public int hashCode() { + return Objects.hash(code); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerificationReportRequestWhatsAppOptionsImpl {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + @JsonPOJOBuilder(withPrefix = "set") + static class Builder implements VerificationReportRequestWhatsAppOptions.Builder { + OptionalValue code = OptionalValue.empty(); + + @JsonProperty(value = JSON_PROPERTY_CODE, required = true) + public Builder setCode(String code) { + this.code = OptionalValue.of(code); + return this; + } + + public VerificationReportRequestWhatsAppOptions build() { + return new VerificationReportRequestWhatsAppOptionsImpl(code); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/response/VerificationReportResponseWhatsApp.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/response/VerificationReportResponseWhatsApp.java new file mode 100644 index 000000000..bb17a783a --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/response/VerificationReportResponseWhatsApp.java @@ -0,0 +1,92 @@ +/* + * Verification | Sinch + * + * OpenAPI document version: 2.0.1 + * Contact: support@sinch.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit the class manually. + */ + +package com.sinch.sdk.domains.verification.models.v1.report.response; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.sinch.sdk.domains.verification.models.v1.VerificationStatus; +import com.sinch.sdk.domains.verification.models.v1.VerificationStatusReason; + +/** VerificationReportResponseWhatsApp */ +@JsonDeserialize(builder = VerificationReportResponseWhatsAppImpl.Builder.class) +public interface VerificationReportResponseWhatsApp + extends com.sinch.sdk.domains.verification.models.v1.report.response + .VerificationReportResponse { + + /** + * The unique ID of the verification request. + * + * @return id + */ + String getId(); + + /** + * Get status + * + * @return status + */ + VerificationStatus getStatus(); + + /** + * Get reason + * + * @return reason + */ + VerificationStatusReason getReason(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new VerificationReportResponseWhatsAppImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder + extends com.sinch.sdk.domains.verification.models.v1.report.response + .VerificationReportResponse.Builder { + + /** + * see getter + * + * @param id see getter + * @return Current builder + * @see #getId + */ + Builder setId(String id); + + /** + * see getter + * + * @param status see getter + * @return Current builder + * @see #getStatus + */ + Builder setStatus(VerificationStatus status); + + /** + * see getter + * + * @param reason see getter + * @return Current builder + * @see #getReason + */ + Builder setReason(VerificationStatusReason reason); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + VerificationReportResponseWhatsApp build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/response/VerificationReportResponseWhatsAppImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/response/VerificationReportResponseWhatsAppImpl.java new file mode 100644 index 000000000..b51eca4b0 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/response/VerificationReportResponseWhatsAppImpl.java @@ -0,0 +1,174 @@ +package com.sinch.sdk.domains.verification.models.v1.report.response; + +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; +import com.sinch.sdk.core.models.OptionalValue; +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 java.util.Objects; + +@JsonPropertyOrder({ + VerificationReportResponseWhatsAppImpl.JSON_PROPERTY_ID, + VerificationReportResponseWhatsAppImpl.JSON_PROPERTY_METHOD, + VerificationReportResponseWhatsAppImpl.JSON_PROPERTY_STATUS, + VerificationReportResponseWhatsAppImpl.JSON_PROPERTY_REASON +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class VerificationReportResponseWhatsAppImpl + implements VerificationReportResponseWhatsApp, + com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponse { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_ID = "id"; + + private OptionalValue id; + + public static final String JSON_PROPERTY_METHOD = "method"; + + private OptionalValue method; + + public static final String JSON_PROPERTY_STATUS = "status"; + + private OptionalValue status; + + public static final String JSON_PROPERTY_REASON = "reason"; + + private OptionalValue reason; + + public VerificationReportResponseWhatsAppImpl() {} + + protected VerificationReportResponseWhatsAppImpl( + OptionalValue id, + OptionalValue method, + OptionalValue status, + OptionalValue reason) { + this.id = id; + this.method = method; + this.status = status; + this.reason = reason; + } + + @JsonIgnore + public String getId() { + return id.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue id() { + return id; + } + + @JsonIgnore + public VerificationMethod getMethod() { + return method.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_METHOD) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue method() { + return method; + } + + @JsonIgnore + public VerificationStatus getStatus() { + return status.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue status() { + return status; + } + + @JsonIgnore + public VerificationStatusReason getReason() { + return reason.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_REASON) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue reason() { + return reason; + } + + /** Return true if this VerificationReportResponseWhatsApp object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerificationReportResponseWhatsAppImpl verificationReportResponseWhatsApp = + (VerificationReportResponseWhatsAppImpl) o; + return Objects.equals(this.id, verificationReportResponseWhatsApp.id) + && Objects.equals(this.method, verificationReportResponseWhatsApp.method) + && Objects.equals(this.status, verificationReportResponseWhatsApp.status) + && Objects.equals(this.reason, verificationReportResponseWhatsApp.reason); + } + + @Override + public int hashCode() { + return Objects.hash(id, method, status, reason); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerificationReportResponseWhatsAppImpl {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" method: ").append(toIndentedString(method)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + @JsonPOJOBuilder(withPrefix = "set") + static class Builder implements VerificationReportResponseWhatsApp.Builder { + OptionalValue id = OptionalValue.empty(); + OptionalValue method = OptionalValue.of(VerificationMethod.WHATSAPP); + OptionalValue status = OptionalValue.empty(); + OptionalValue reason = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_ID) + public Builder setId(String id) { + this.id = OptionalValue.of(id); + return this; + } + + @JsonProperty(JSON_PROPERTY_STATUS) + public Builder setStatus(VerificationStatus status) { + this.status = OptionalValue.of(status); + return this; + } + + @JsonProperty(JSON_PROPERTY_REASON) + public Builder setReason(VerificationStatusReason reason) { + this.reason = OptionalValue.of(reason); + return this; + } + + public VerificationReportResponseWhatsApp build() { + return new VerificationReportResponseWhatsAppImpl(id, method, status, reason); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/response/internal/VerificationReportResponseInternalImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/response/internal/VerificationReportResponseInternalImpl.java index 316c91dfd..b48c655e4 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/response/internal/VerificationReportResponseInternalImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/response/internal/VerificationReportResponseInternalImpl.java @@ -19,6 +19,7 @@ import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponseFlashCallImpl; import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponsePhoneCallImpl; import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponseSmsImpl; +import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponseWhatsAppImpl; import java.io.IOException; import java.util.Collections; import java.util.HashMap; @@ -104,6 +105,12 @@ public VerificationReportResponseInternalImpl deserialize( tree.traverse(jp.getCodec()).readValueAs(VerificationReportResponseSmsImpl.class); newVerificationReportResponseInternalImpl.setActualInstance(deserialized); return newVerificationReportResponseInternalImpl; + case "whatsapp": + deserialized = + tree.traverse(jp.getCodec()) + .readValueAs(VerificationReportResponseWhatsAppImpl.class); + newVerificationReportResponseInternalImpl.setActualInstance(deserialized); + return newVerificationReportResponseInternalImpl; case "VerificationReportResponseFlashCall": deserialized = tree.traverse(jp.getCodec()) @@ -121,14 +128,21 @@ public VerificationReportResponseInternalImpl deserialize( tree.traverse(jp.getCodec()).readValueAs(VerificationReportResponseSmsImpl.class); newVerificationReportResponseInternalImpl.setActualInstance(deserialized); return newVerificationReportResponseInternalImpl; + case "VerificationReportResponseWhatsApp": + deserialized = + tree.traverse(jp.getCodec()) + .readValueAs(VerificationReportResponseWhatsAppImpl.class); + newVerificationReportResponseInternalImpl.setActualInstance(deserialized); + return newVerificationReportResponseInternalImpl; default: log.log( Level.WARNING, String.format( "Failed to lookup discriminator value `%s` for" + " VerificationReportResponseInternalImpl. Possible values: callout" - + " flashcall sms VerificationReportResponseFlashCall" - + " VerificationReportResponsePhoneCall VerificationReportResponseSms", + + " flashcall sms whatsapp VerificationReportResponseFlashCall" + + " VerificationReportResponsePhoneCall VerificationReportResponseSms" + + " VerificationReportResponseWhatsApp", discriminatorValue)); } @@ -272,6 +286,53 @@ public VerificationReportResponseInternalImpl deserialize( Level.FINER, "Input data does not match schema 'VerificationReportResponseSmsImpl'", e); } + // deserialize VerificationReportResponseWhatsAppImpl + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (VerificationReportResponseWhatsAppImpl.class.equals(Integer.class) + || VerificationReportResponseWhatsAppImpl.class.equals(Long.class) + || VerificationReportResponseWhatsAppImpl.class.equals(Float.class) + || VerificationReportResponseWhatsAppImpl.class.equals(Double.class) + || VerificationReportResponseWhatsAppImpl.class.equals(Boolean.class) + || VerificationReportResponseWhatsAppImpl.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((VerificationReportResponseWhatsAppImpl.class.equals(Integer.class) + || VerificationReportResponseWhatsAppImpl.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((VerificationReportResponseWhatsAppImpl.class.equals(Float.class) + || VerificationReportResponseWhatsAppImpl.class.equals(Double.class)) + && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= + (VerificationReportResponseWhatsAppImpl.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (VerificationReportResponseWhatsAppImpl.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = + tree.traverse(jp.getCodec()) + .readValueAs(VerificationReportResponseWhatsAppImpl.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 'VerificationReportResponseWhatsAppImpl'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, + "Input data does not match schema 'VerificationReportResponseWhatsAppImpl'", + e); + } + if (match == 1) { VerificationReportResponseInternalImpl ret = new VerificationReportResponseInternalImpl(); ret.setActualInstance(deserialized); @@ -315,12 +376,19 @@ public VerificationReportResponseInternalImpl(VerificationReportResponseSmsImpl setActualInstance(o); } + public VerificationReportResponseInternalImpl(VerificationReportResponseWhatsAppImpl o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + static { schemas.put( "VerificationReportResponseFlashCallImpl", VerificationReportResponseFlashCallImpl.class); schemas.put( "VerificationReportResponsePhoneCallImpl", VerificationReportResponsePhoneCallImpl.class); schemas.put("VerificationReportResponseSmsImpl", VerificationReportResponseSmsImpl.class); + schemas.put( + "VerificationReportResponseWhatsAppImpl", VerificationReportResponseWhatsAppImpl.class); JSONNavigator.registerDescendants( VerificationReportResponseInternalImpl.class, Collections.unmodifiableMap(schemas)); // Initialize and register the discriminator mappings. @@ -328,11 +396,14 @@ public VerificationReportResponseInternalImpl(VerificationReportResponseSmsImpl mappings.put("callout", VerificationReportResponsePhoneCallImpl.class); mappings.put("flashcall", VerificationReportResponseFlashCallImpl.class); mappings.put("sms", VerificationReportResponseSmsImpl.class); + mappings.put("whatsapp", VerificationReportResponseWhatsAppImpl.class); mappings.put( "VerificationReportResponseFlashCall", VerificationReportResponseFlashCallImpl.class); mappings.put( "VerificationReportResponsePhoneCall", VerificationReportResponsePhoneCallImpl.class); mappings.put("VerificationReportResponseSms", VerificationReportResponseSmsImpl.class); + mappings.put( + "VerificationReportResponseWhatsApp", VerificationReportResponseWhatsAppImpl.class); mappings.put("VerificationReportResponse", VerificationReportResponseInternalImpl.class); JSONNavigator.registerDiscriminator( VerificationReportResponseInternalImpl.class, "method", mappings); @@ -346,7 +417,8 @@ public Map> getSchemas() { /** * Set the instance that matches the oneOf child schema, check the instance parameter is valid * against the oneOf child schemas: VerificationReportResponseFlashCallImpl, - * VerificationReportResponsePhoneCallImpl, VerificationReportResponseSmsImpl + * VerificationReportResponsePhoneCallImpl, VerificationReportResponseSmsImpl, + * VerificationReportResponseWhatsAppImpl * *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a * composed schema (allOf, anyOf, oneOf). @@ -371,17 +443,26 @@ public void setActualInstance(Object instance) { return; } + if (JSONNavigator.isInstanceOf( + VerificationReportResponseWhatsAppImpl.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException( "Invalid instance type. Must be VerificationReportResponseFlashCallImpl," - + " VerificationReportResponsePhoneCallImpl, VerificationReportResponseSmsImpl"); + + " VerificationReportResponsePhoneCallImpl, VerificationReportResponseSmsImpl," + + " VerificationReportResponseWhatsAppImpl"); } /** * Get the actual instance, which can be the following: VerificationReportResponseFlashCallImpl, - * VerificationReportResponsePhoneCallImpl, VerificationReportResponseSmsImpl + * VerificationReportResponsePhoneCallImpl, VerificationReportResponseSmsImpl, + * VerificationReportResponseWhatsAppImpl * * @return The actual instance (VerificationReportResponseFlashCallImpl, - * VerificationReportResponsePhoneCallImpl, VerificationReportResponseSmsImpl) + * VerificationReportResponsePhoneCallImpl, VerificationReportResponseSmsImpl, + * VerificationReportResponseWhatsAppImpl) */ @Override public Object getActualInstance() { @@ -423,4 +504,16 @@ public VerificationReportResponseSmsImpl getVerificationReportResponseSmsImpl() throws ClassCastException { return (VerificationReportResponseSmsImpl) super.getActualInstance(); } + + /** + * Get the actual instance of `VerificationReportResponseWhatsAppImpl`. If the actual instance is + * not `VerificationReportResponseWhatsAppImpl`, the ClassCastException will be thrown. + * + * @return The actual instance of `VerificationReportResponseWhatsAppImpl` + * @throws ClassCastException if the instance is not `VerificationReportResponseWhatsAppImpl` + */ + public VerificationReportResponseWhatsAppImpl getVerificationReportResponseWhatsAppImpl() + throws ClassCastException { + return (VerificationReportResponseWhatsAppImpl) super.getActualInstance(); + } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/internal/VerificationMethodStart.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/internal/VerificationMethodStart.java index ff96feb5a..0b1ccbb43 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/internal/VerificationMethodStart.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/internal/VerificationMethodStart.java @@ -29,11 +29,14 @@ public class VerificationMethodStart extends EnumDynamic ENUM_SUPPORT = new EnumSupportDynamic<>( VerificationMethodStart.class, VerificationMethodStart::new, - Arrays.asList(SMS, FLASH_CALL, PHONE_CALL, DATA)); + Arrays.asList(SMS, FLASH_CALL, PHONE_CALL, DATA, WHATSAPP)); private VerificationMethodStart(String value) { super(value); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestWhatsApp.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestWhatsApp.java new file mode 100644 index 000000000..28ee98032 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestWhatsApp.java @@ -0,0 +1,131 @@ +/* + * Verification | Sinch + * + * OpenAPI document version: 2.0.1 + * Contact: support@sinch.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit the class manually. + */ + +package com.sinch.sdk.domains.verification.models.v1.start.request; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.sinch.sdk.domains.verification.models.v1.Identity; +import com.sinch.sdk.domains.verification.models.v1.WhatsAppCodeType; + +/** VerificationStartRequestWhatsApp */ +@JsonDeserialize(builder = VerificationStartRequestWhatsAppImpl.Builder.class) +public interface VerificationStartRequestWhatsApp + extends com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequest { + + /** + * Get identity + * + *

Field is required + * + * @return identity + */ + Identity getIdentity(); + + /** + * Used to pass your own reference in the request for tracking purposes. Must be a unique value + * for each started verification request. The value must be encodable in the URL path segment. + * This value is passed to all events and returned from the status and report endpoints. The + * reference can be used to check the status + * of verifications, like with ID or identity. + * + * @return reference + */ + String getReference(); + + /** + * Can be used to pass custom data in the request. Will be passed to all events. Max length 4096 + * characters, can be arbitrary text data. + * + * @return custom + */ + String getCustom(); + + /** + * Get codeType + * + * @return codeType + */ + WhatsAppCodeType getCodeType(); + + /** + * Return the additional "whatsappOptions" with the specified name. + * + * @param key the name of the property + * @return the additional property with the specified name + */ + Object getExtraOption(String key); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new VerificationStartRequestWhatsAppImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder + extends com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequest + .Builder { + + /** + * see getter + * + * @param identity see getter + * @return Current builder + * @see #getIdentity + */ + Builder setIdentity(Identity identity); + + /** + * see getter + * + * @param reference see getter + * @return Current builder + * @see #getReference + */ + Builder setReference(String reference); + + /** + * see getter + * + * @param custom see getter + * @return Current builder + * @see #getCustom + */ + Builder setCustom(String custom); + + /** + * see getter + * + * @param codeType see getter + * @return Current builder + * @see #getCodeType + */ + Builder setCodeType(WhatsAppCodeType codeType); + + /** + * see getter + * + * @return Current builder + * @see #getExtraOption + */ + Builder putExtraOption(String key, Object value); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + VerificationStartRequestWhatsApp build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestWhatsAppImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestWhatsAppImpl.java new file mode 100644 index 000000000..5c6b9be53 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestWhatsAppImpl.java @@ -0,0 +1,303 @@ +package com.sinch.sdk.domains.verification.models.v1.start.request; + +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonSerializer; +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.Identity; +import com.sinch.sdk.domains.verification.models.v1.WhatsAppCodeType; +import com.sinch.sdk.domains.verification.models.v1.start.internal.VerificationMethodStart; +import com.sinch.sdk.domains.verification.models.v1.start.request.internal.VerificationStartWhatsAppOptions; +import com.sinch.sdk.domains.verification.models.v1.start.request.internal.VerificationStartWhatsAppOptionsImpl; +import java.io.IOException; +import java.util.Objects; +import java.util.Optional; + +@JsonPropertyOrder({ + VerificationStartRequestWhatsAppImpl.JSON_PROPERTY_IDENTITY, + VerificationStartRequestWhatsAppImpl.JSON_PROPERTY_METHOD, + VerificationStartRequestWhatsAppImpl.JSON_PROPERTY_REFERENCE, + VerificationStartRequestWhatsAppImpl.JSON_PROPERTY_CUSTOM, + VerificationStartRequestWhatsAppImpl.JSON_PROPERTY_WHATSAPP_OPTIONS +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class VerificationStartRequestWhatsAppImpl + implements VerificationStartRequestWhatsApp, + com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequest { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_IDENTITY = "identity"; + + private OptionalValue identity; + + public static final String JSON_PROPERTY_METHOD = "method"; + + private OptionalValue method; + + public static final String JSON_PROPERTY_REFERENCE = "reference"; + + private OptionalValue reference; + + public static final String JSON_PROPERTY_CUSTOM = "custom"; + + private OptionalValue custom; + + public static final String JSON_PROPERTY_WHATSAPP_OPTIONS = "whatsappOptions"; + + private OptionalValue whatsappOptions; + + public VerificationStartRequestWhatsAppImpl() {} + + protected VerificationStartRequestWhatsAppImpl( + OptionalValue identity, + OptionalValue method, + OptionalValue reference, + OptionalValue custom, + OptionalValue whatsappOptions) { + this.identity = identity; + this.method = method; + this.reference = reference; + this.custom = custom; + this.whatsappOptions = whatsappOptions; + } + + @JsonIgnore + public Identity getIdentity() { + return identity.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_IDENTITY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue identity() { + return identity; + } + + @JsonIgnore + public VerificationMethodStart getMethod() { + return method.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_METHOD) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue method() { + return method; + } + + @JsonIgnore + public String getReference() { + return reference.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_REFERENCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue reference() { + return reference; + } + + @JsonIgnore + public String getCustom() { + return custom.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CUSTOM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue custom() { + return custom; + } + + @JsonIgnore + public VerificationStartWhatsAppOptions getWhatsappOptions() { + return whatsappOptions.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_WHATSAPP_OPTIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue whatsappOptions() { + return whatsappOptions; + } + + @JsonIgnore + public WhatsAppCodeType getCodeType() { + if (null == whatsappOptions + || !whatsappOptions.isPresent() + || null == whatsappOptions.get().getCodeType()) { + return null; + } + return whatsappOptions.get().getCodeType(); + } + + public OptionalValue codeType() { + return null != whatsappOptions && whatsappOptions.isPresent() + ? whatsappOptions + .map(f -> ((VerificationStartWhatsAppOptionsImpl) f).codeType()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public Object getExtraOption(String key) { + return null != whatsappOptions && whatsappOptions.isPresent() + ? whatsappOptions.get().get(key) + : null; + } + + /** Return true if this VerificationStartRequestWhatsApp object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerificationStartRequestWhatsAppImpl verificationStartRequestWhatsApp = + (VerificationStartRequestWhatsAppImpl) o; + return Objects.equals(this.identity, verificationStartRequestWhatsApp.identity) + && Objects.equals(this.method, verificationStartRequestWhatsApp.method) + && Objects.equals(this.reference, verificationStartRequestWhatsApp.reference) + && Objects.equals(this.custom, verificationStartRequestWhatsApp.custom) + && Objects.equals(this.whatsappOptions, verificationStartRequestWhatsApp.whatsappOptions); + } + + @Override + public int hashCode() { + return Objects.hash(identity, method, reference, custom, whatsappOptions); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerificationStartRequestWhatsAppImpl {\n"); + sb.append(" identity: ").append(toIndentedString(identity)).append("\n"); + sb.append(" method: ").append(toIndentedString(method)).append("\n"); + sb.append(" reference: ").append(toIndentedString(reference)).append("\n"); + sb.append(" custom: ").append(toIndentedString(custom)).append("\n"); + sb.append(" whatsappOptions: ").append(toIndentedString(whatsappOptions)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + @JsonPOJOBuilder(withPrefix = "set") + static class Builder implements VerificationStartRequestWhatsApp.Builder { + OptionalValue identity = OptionalValue.empty(); + OptionalValue method = + OptionalValue.of(VerificationMethodStart.WHATSAPP); + OptionalValue reference = OptionalValue.empty(); + OptionalValue custom = OptionalValue.empty(); + OptionalValue whatsappOptions = OptionalValue.empty(); + + VerificationStartWhatsAppOptions.Builder _delegatedBuilder = null; + + @JsonProperty(value = JSON_PROPERTY_IDENTITY, required = true) + public Builder setIdentity(Identity identity) { + this.identity = OptionalValue.of(identity); + return this; + } + + @JsonProperty(JSON_PROPERTY_REFERENCE) + public Builder setReference(String reference) { + this.reference = OptionalValue.of(reference); + return this; + } + + @JsonProperty(JSON_PROPERTY_CUSTOM) + public Builder setCustom(String custom) { + this.custom = OptionalValue.of(custom); + return this; + } + + @JsonProperty(JSON_PROPERTY_WHATSAPP_OPTIONS) + public Builder setWhatsappOptions(VerificationStartWhatsAppOptions whatsappOptions) { + this.whatsappOptions = OptionalValue.of(whatsappOptions); + return this; + } + + @JsonIgnore + public Builder setCodeType(WhatsAppCodeType codeType) { + getDelegatedBuilder().setCodeType(codeType); + return this; + } + + public Builder putExtraOption(String key, Object value) { + getDelegatedBuilder().put(key, value); + return this; + } + + private VerificationStartWhatsAppOptions.Builder getDelegatedBuilder() { + if (null == _delegatedBuilder) { + this._delegatedBuilder = VerificationStartWhatsAppOptions.builder(); + } + return this._delegatedBuilder; + } + + public VerificationStartRequestWhatsApp build() { + // delegated builder was used: filling the related source of delegation field + if (null != this._delegatedBuilder) { + this.whatsappOptions = OptionalValue.of(this._delegatedBuilder.build()); + } + return new VerificationStartRequestWhatsAppImpl( + identity, method, reference, custom, whatsappOptions); + } + } + + public static class DelegatedSerializer + extends JsonSerializer> { + @Override + public void serialize( + OptionalValue value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException { + + if (!value.isPresent()) { + return; + } + VerificationStartRequestWhatsAppImpl impl = + (VerificationStartRequestWhatsAppImpl) value.get(); + jgen.writeObject(null != impl ? impl.getWhatsappOptions() : null); + } + } + + public static class DelegatedDeSerializer + extends JsonDeserializer { + @Override + public VerificationStartRequestWhatsApp deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException { + + VerificationStartRequestWhatsAppImpl.Builder builder = + new VerificationStartRequestWhatsAppImpl.Builder(); + VerificationStartWhatsAppOptionsImpl deserialized = + jp.readValueAs(VerificationStartWhatsAppOptionsImpl.class); + builder.setWhatsappOptions(deserialized); + return builder.build(); + } + } + + public static Optional delegatedConverter( + VerificationStartWhatsAppOptions internal) { + if (null == internal) { + return Optional.empty(); + } + return Optional.of(new Builder().setWhatsappOptions(internal).build()); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartRequestInternalImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartRequestInternalImpl.java index 2bb3c5e2a..c4d3405ff 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartRequestInternalImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartRequestInternalImpl.java @@ -20,6 +20,7 @@ import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestFlashCallImpl; import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestPhoneCallImpl; import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestSmsImpl; +import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestWhatsAppImpl; import java.io.IOException; import java.util.Collections; import java.util.HashMap; @@ -104,6 +105,11 @@ public VerificationStartRequestInternalImpl deserialize( tree.traverse(jp.getCodec()).readValueAs(VerificationStartRequestSmsImpl.class); newVerificationStartRequestInternalImpl.setActualInstance(deserialized); return newVerificationStartRequestInternalImpl; + case "whatsapp": + deserialized = + tree.traverse(jp.getCodec()).readValueAs(VerificationStartRequestWhatsAppImpl.class); + newVerificationStartRequestInternalImpl.setActualInstance(deserialized); + return newVerificationStartRequestInternalImpl; case "VerificationStartRequestData": deserialized = tree.traverse(jp.getCodec()).readValueAs(VerificationStartRequestDataImpl.class); @@ -124,15 +130,20 @@ public VerificationStartRequestInternalImpl deserialize( tree.traverse(jp.getCodec()).readValueAs(VerificationStartRequestSmsImpl.class); newVerificationStartRequestInternalImpl.setActualInstance(deserialized); return newVerificationStartRequestInternalImpl; + case "VerificationStartRequestWhatsApp": + deserialized = + tree.traverse(jp.getCodec()).readValueAs(VerificationStartRequestWhatsAppImpl.class); + newVerificationStartRequestInternalImpl.setActualInstance(deserialized); + return newVerificationStartRequestInternalImpl; default: log.log( Level.WARNING, String.format( "Failed to lookup discriminator value `%s` for" + " VerificationStartRequestInternalImpl. Possible values: callout flashcall" - + " seamless sms VerificationStartRequestData" + + " seamless sms whatsapp VerificationStartRequestData" + " VerificationStartRequestFlashCall VerificationStartRequestPhoneCall" - + " VerificationStartRequestSms", + + " VerificationStartRequestSms VerificationStartRequestWhatsApp", discriminatorValue)); } @@ -315,6 +326,51 @@ public VerificationStartRequestInternalImpl deserialize( Level.FINER, "Input data does not match schema 'VerificationStartRequestSmsImpl'", e); } + // deserialize VerificationStartRequestWhatsAppImpl + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (VerificationStartRequestWhatsAppImpl.class.equals(Integer.class) + || VerificationStartRequestWhatsAppImpl.class.equals(Long.class) + || VerificationStartRequestWhatsAppImpl.class.equals(Float.class) + || VerificationStartRequestWhatsAppImpl.class.equals(Double.class) + || VerificationStartRequestWhatsAppImpl.class.equals(Boolean.class) + || VerificationStartRequestWhatsAppImpl.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((VerificationStartRequestWhatsAppImpl.class.equals(Integer.class) + || VerificationStartRequestWhatsAppImpl.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((VerificationStartRequestWhatsAppImpl.class.equals(Float.class) + || VerificationStartRequestWhatsAppImpl.class.equals(Double.class)) + && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= + (VerificationStartRequestWhatsAppImpl.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (VerificationStartRequestWhatsAppImpl.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = + tree.traverse(jp.getCodec()).readValueAs(VerificationStartRequestWhatsAppImpl.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 'VerificationStartRequestWhatsAppImpl'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, + "Input data does not match schema 'VerificationStartRequestWhatsAppImpl'", + e); + } + if (match == 1) { VerificationStartRequestInternalImpl ret = new VerificationStartRequestInternalImpl(); ret.setActualInstance(deserialized); @@ -363,6 +419,11 @@ public VerificationStartRequestInternalImpl(VerificationStartRequestSmsImpl o) { setActualInstance(o); } + public VerificationStartRequestInternalImpl(VerificationStartRequestWhatsAppImpl o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + static { schemas.put("VerificationStartRequestDataImpl", VerificationStartRequestDataImpl.class); schemas.put( @@ -370,6 +431,7 @@ public VerificationStartRequestInternalImpl(VerificationStartRequestSmsImpl o) { schemas.put( "VerificationStartRequestPhoneCallImpl", VerificationStartRequestPhoneCallImpl.class); schemas.put("VerificationStartRequestSmsImpl", VerificationStartRequestSmsImpl.class); + schemas.put("VerificationStartRequestWhatsAppImpl", VerificationStartRequestWhatsAppImpl.class); JSONNavigator.registerDescendants( VerificationStartRequestInternalImpl.class, Collections.unmodifiableMap(schemas)); // Initialize and register the discriminator mappings. @@ -378,10 +440,12 @@ public VerificationStartRequestInternalImpl(VerificationStartRequestSmsImpl o) { mappings.put("flashcall", VerificationStartRequestFlashCallImpl.class); mappings.put("seamless", VerificationStartRequestDataImpl.class); mappings.put("sms", VerificationStartRequestSmsImpl.class); + mappings.put("whatsapp", VerificationStartRequestWhatsAppImpl.class); mappings.put("VerificationStartRequestData", VerificationStartRequestDataImpl.class); mappings.put("VerificationStartRequestFlashCall", VerificationStartRequestFlashCallImpl.class); mappings.put("VerificationStartRequestPhoneCall", VerificationStartRequestPhoneCallImpl.class); mappings.put("VerificationStartRequestSms", VerificationStartRequestSmsImpl.class); + mappings.put("VerificationStartRequestWhatsApp", VerificationStartRequestWhatsAppImpl.class); mappings.put("VerificationStartRequest", VerificationStartRequestInternalImpl.class); JSONNavigator.registerDiscriminator( VerificationStartRequestInternalImpl.class, "method", mappings); @@ -396,7 +460,7 @@ public Map> getSchemas() { * Set the instance that matches the oneOf child schema, check the instance parameter is valid * against the oneOf child schemas: VerificationStartRequestDataImpl, * VerificationStartRequestFlashCallImpl, VerificationStartRequestPhoneCallImpl, - * VerificationStartRequestSmsImpl + * VerificationStartRequestSmsImpl, VerificationStartRequestWhatsAppImpl * *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a * composed schema (allOf, anyOf, oneOf). @@ -427,20 +491,26 @@ public void setActualInstance(Object instance) { return; } + if (JSONNavigator.isInstanceOf( + VerificationStartRequestWhatsAppImpl.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException( "Invalid instance type. Must be VerificationStartRequestDataImpl," + " VerificationStartRequestFlashCallImpl, VerificationStartRequestPhoneCallImpl," - + " VerificationStartRequestSmsImpl"); + + " VerificationStartRequestSmsImpl, VerificationStartRequestWhatsAppImpl"); } /** * Get the actual instance, which can be the following: VerificationStartRequestDataImpl, * VerificationStartRequestFlashCallImpl, VerificationStartRequestPhoneCallImpl, - * VerificationStartRequestSmsImpl + * VerificationStartRequestSmsImpl, VerificationStartRequestWhatsAppImpl * * @return The actual instance (VerificationStartRequestDataImpl, * VerificationStartRequestFlashCallImpl, VerificationStartRequestPhoneCallImpl, - * VerificationStartRequestSmsImpl) + * VerificationStartRequestSmsImpl, VerificationStartRequestWhatsAppImpl) */ @Override public Object getActualInstance() { @@ -494,4 +564,16 @@ public VerificationStartRequestSmsImpl getVerificationStartRequestSmsImpl() throws ClassCastException { return (VerificationStartRequestSmsImpl) super.getActualInstance(); } + + /** + * Get the actual instance of `VerificationStartRequestWhatsAppImpl`. If the actual instance is + * not `VerificationStartRequestWhatsAppImpl`, the ClassCastException will be thrown. + * + * @return The actual instance of `VerificationStartRequestWhatsAppImpl` + * @throws ClassCastException if the instance is not `VerificationStartRequestWhatsAppImpl` + */ + public VerificationStartRequestWhatsAppImpl getVerificationStartRequestWhatsAppImpl() + throws ClassCastException { + return (VerificationStartRequestWhatsAppImpl) super.getActualInstance(); + } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartWhatsAppOptions.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartWhatsAppOptions.java new file mode 100644 index 000000000..2fb757ddd --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartWhatsAppOptions.java @@ -0,0 +1,68 @@ +/* + * Verification | Sinch + * + * OpenAPI document version: 2.0.1 + * Contact: support@sinch.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit the class manually. + */ + +package com.sinch.sdk.domains.verification.models.v1.start.request.internal; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.sinch.sdk.core.models.AdditionalProperties; +import com.sinch.sdk.domains.verification.models.v1.WhatsAppCodeType; + +/** + * An optional configuration for WhatsApp Verification, should be used only when the verification + * request originates from your backend (not an end user device) and request is signed via an Application signed request. + */ +@JsonDeserialize(builder = VerificationStartWhatsAppOptionsImpl.Builder.class) +public interface VerificationStartWhatsAppOptions extends AdditionalProperties { + + /** + * Get codeType + * + * @return codeType + */ + WhatsAppCodeType getCodeType(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new VerificationStartWhatsAppOptionsImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder extends AdditionalProperties.Builder { + + /** + * see getter + * + * @param codeType see getter + * @return Current builder + * @see #getCodeType + */ + Builder setCodeType(WhatsAppCodeType codeType); + + /** + * see getter + * + * @return Current builder + * @see #get + */ + Builder put(String key, Object value); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + VerificationStartWhatsAppOptions build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartWhatsAppOptionsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartWhatsAppOptionsImpl.java new file mode 100644 index 000000000..4bba56780 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartWhatsAppOptionsImpl.java @@ -0,0 +1,144 @@ +package com.sinch.sdk.domains.verification.models.v1.start.request.internal; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; +import com.sinch.sdk.core.models.OptionalValue; +import com.sinch.sdk.domains.verification.models.v1.WhatsAppCodeType; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +@JsonPropertyOrder({VerificationStartWhatsAppOptionsImpl.JSON_PROPERTY_CODE_TYPE}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class VerificationStartWhatsAppOptionsImpl implements VerificationStartWhatsAppOptions { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_CODE_TYPE = "codeType"; + + private OptionalValue codeType; + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private OptionalValue> additionalProperties; + + public VerificationStartWhatsAppOptionsImpl() {} + + protected VerificationStartWhatsAppOptionsImpl( + OptionalValue codeType, + OptionalValue> additionalProperties) { + this.codeType = codeType; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public WhatsAppCodeType getCodeType() { + return codeType.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CODE_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue codeType() { + return codeType; + } + + @JsonIgnore + public Object get(String key) { + + if (null == this.additionalProperties || !additionalProperties.isPresent()) { + return null; + } + return this.additionalProperties.get().get(key); + } + + @JsonAnyGetter + public Map additionalProperties() { + if (null == this.additionalProperties || !additionalProperties.isPresent()) { + return null; + } + return additionalProperties.get(); + } + + /** + * Return true if this VerificationStartRequestWhatsApp_allOf_whatsappOptions object is equal to + * o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerificationStartWhatsAppOptionsImpl verificationStartRequestWhatsAppAllOfWhatsappOptions = + (VerificationStartWhatsAppOptionsImpl) o; + return Objects.equals( + this.codeType, verificationStartRequestWhatsAppAllOfWhatsappOptions.codeType) + && Objects.equals( + this.additionalProperties, + verificationStartRequestWhatsAppAllOfWhatsappOptions.additionalProperties) + && super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(codeType, super.hashCode(), additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerificationStartWhatsAppOptionsImpl {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" codeType: ").append(toIndentedString(codeType)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + @JsonPOJOBuilder(withPrefix = "set") + static class Builder implements VerificationStartWhatsAppOptions.Builder { + OptionalValue codeType = OptionalValue.empty(); + OptionalValue> additionalProperties = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_CODE_TYPE) + public Builder setCodeType(WhatsAppCodeType codeType) { + this.codeType = OptionalValue.of(codeType); + return this; + } + + @JsonAnySetter + public Builder put(String key, Object value) { + if (!this.additionalProperties.isPresent()) { + this.additionalProperties = OptionalValue.of(new HashMap()); + } + this.additionalProperties.get().put(key, value); + return this; + } + + public VerificationStartWhatsAppOptions build() { + return new VerificationStartWhatsAppOptionsImpl(codeType, additionalProperties); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseWhatsApp.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseWhatsApp.java new file mode 100644 index 000000000..26d441568 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseWhatsApp.java @@ -0,0 +1,109 @@ +/* + * Verification | Sinch + * + * OpenAPI document version: 2.0.1 + * Contact: support@sinch.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit the class manually. + */ + +package com.sinch.sdk.domains.verification.models.v1.start.response; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.sinch.sdk.domains.verification.models.v1.WhatsAppCodeType; +import java.util.List; + +/** WhatsApp */ +@JsonDeserialize(builder = VerificationStartResponseWhatsAppImpl.Builder.class) +public interface VerificationStartResponseWhatsApp + extends com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponse { + + /** + * Verification identifier used to query for status. + * + *

Field is required + * + * @return id + */ + String getId(); + + /** + * Get links + * + * @return links + */ + List getLinks(); + + /** + * Get codeType + * + * @return codeType + */ + WhatsAppCodeType getCodeType(); + + /** + * Return the additional "whatsapp" with the specified name. + * + * @param key the name of the property + * @return the additional property with the specified name + */ + Object getExtraOption(String key); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new VerificationStartResponseWhatsAppImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder + extends com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponse + .Builder { + + /** + * see getter + * + * @param id see getter + * @return Current builder + * @see #getId + */ + Builder setId(String id); + + /** + * see getter + * + * @param links see getter + * @return Current builder + * @see #getLinks + */ + Builder setLinks(List links); + + /** + * see getter + * + * @param codeType see getter + * @return Current builder + * @see #getCodeType + */ + Builder setCodeType(WhatsAppCodeType codeType); + + /** + * see getter + * + * @return Current builder + * @see #getExtraOption + */ + Builder putExtraOption(String key, Object value); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + VerificationStartResponseWhatsApp build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseWhatsAppImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseWhatsAppImpl.java new file mode 100644 index 000000000..eaa96c1be --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseWhatsAppImpl.java @@ -0,0 +1,271 @@ +package com.sinch.sdk.domains.verification.models.v1.start.response; + +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonSerializer; +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.WhatsAppCodeType; +import com.sinch.sdk.domains.verification.models.v1.start.internal.VerificationMethodStart; +import com.sinch.sdk.domains.verification.models.v1.start.response.internal.VerificationStartResponseWhatsAppContent; +import com.sinch.sdk.domains.verification.models.v1.start.response.internal.VerificationStartResponseWhatsAppContentImpl; +import java.io.IOException; +import java.util.List; +import java.util.Objects; +import java.util.Optional; + +@JsonPropertyOrder({ + VerificationStartResponseWhatsAppImpl.JSON_PROPERTY_ID, + VerificationStartResponseWhatsAppImpl.JSON_PROPERTY_METHOD, + VerificationStartResponseWhatsAppImpl.JSON_PROPERTY_LINKS, + VerificationStartResponseWhatsAppImpl.JSON_PROPERTY_WHATSAPP +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class VerificationStartResponseWhatsAppImpl + implements VerificationStartResponseWhatsApp, + com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponse { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_ID = "id"; + + private OptionalValue id; + + public static final String JSON_PROPERTY_METHOD = "method"; + + private OptionalValue method; + + public static final String JSON_PROPERTY_LINKS = "_links"; + + private OptionalValue> links; + + public static final String JSON_PROPERTY_WHATSAPP = "whatsapp"; + + private OptionalValue whatsapp; + + public VerificationStartResponseWhatsAppImpl() {} + + protected VerificationStartResponseWhatsAppImpl( + OptionalValue id, + OptionalValue method, + OptionalValue> links, + OptionalValue whatsapp) { + this.id = id; + this.method = method; + this.links = links; + this.whatsapp = whatsapp; + } + + @JsonIgnore + public String getId() { + return id.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue id() { + return id; + } + + @JsonIgnore + public VerificationMethodStart getMethod() { + return method.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_METHOD) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue method() { + return method; + } + + @JsonIgnore + public List getLinks() { + return links.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_LINKS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue> links() { + return links; + } + + @JsonIgnore + public VerificationStartResponseWhatsAppContent getWhatsapp() { + return whatsapp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_WHATSAPP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue whatsapp() { + return whatsapp; + } + + @JsonIgnore + public WhatsAppCodeType getCodeType() { + if (null == whatsapp || !whatsapp.isPresent() || null == whatsapp.get().getCodeType()) { + return null; + } + return whatsapp.get().getCodeType(); + } + + public OptionalValue codeType() { + return null != whatsapp && whatsapp.isPresent() + ? whatsapp + .map(f -> ((VerificationStartResponseWhatsAppContentImpl) f).codeType()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public Object getExtraOption(String key) { + return null != whatsapp && whatsapp.isPresent() ? whatsapp.get().get(key) : null; + } + + /** Return true if this VerificationStartResponseWhatsApp object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerificationStartResponseWhatsAppImpl verificationStartResponseWhatsApp = + (VerificationStartResponseWhatsAppImpl) o; + return Objects.equals(this.id, verificationStartResponseWhatsApp.id) + && Objects.equals(this.method, verificationStartResponseWhatsApp.method) + && Objects.equals(this.links, verificationStartResponseWhatsApp.links) + && Objects.equals(this.whatsapp, verificationStartResponseWhatsApp.whatsapp); + } + + @Override + public int hashCode() { + return Objects.hash(id, method, links, whatsapp); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerificationStartResponseWhatsAppImpl {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" method: ").append(toIndentedString(method)).append("\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" whatsapp: ").append(toIndentedString(whatsapp)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + @JsonPOJOBuilder(withPrefix = "set") + static class Builder implements VerificationStartResponseWhatsApp.Builder { + OptionalValue id = OptionalValue.empty(); + OptionalValue method = + OptionalValue.of(VerificationMethodStart.WHATSAPP); + OptionalValue> links = OptionalValue.empty(); + OptionalValue whatsapp = OptionalValue.empty(); + + VerificationStartResponseWhatsAppContent.Builder _delegatedBuilder = null; + + @JsonProperty(value = JSON_PROPERTY_ID, required = true) + public Builder setId(String id) { + this.id = OptionalValue.of(id); + return this; + } + + @JsonProperty(JSON_PROPERTY_LINKS) + public Builder setLinks(List links) { + this.links = OptionalValue.of(links); + return this; + } + + @JsonProperty(JSON_PROPERTY_WHATSAPP) + public Builder setWhatsapp(VerificationStartResponseWhatsAppContent whatsapp) { + this.whatsapp = OptionalValue.of(whatsapp); + return this; + } + + @JsonIgnore + public Builder setCodeType(WhatsAppCodeType codeType) { + getDelegatedBuilder().setCodeType(codeType); + return this; + } + + public Builder putExtraOption(String key, Object value) { + getDelegatedBuilder().put(key, value); + return this; + } + + private VerificationStartResponseWhatsAppContent.Builder getDelegatedBuilder() { + if (null == _delegatedBuilder) { + this._delegatedBuilder = VerificationStartResponseWhatsAppContent.builder(); + } + return this._delegatedBuilder; + } + + public VerificationStartResponseWhatsApp 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 VerificationStartResponseWhatsAppImpl(id, method, links, whatsapp); + } + } + + public static class DelegatedSerializer + extends JsonSerializer> { + @Override + public void serialize( + OptionalValue value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException { + + if (!value.isPresent()) { + return; + } + VerificationStartResponseWhatsAppImpl impl = + (VerificationStartResponseWhatsAppImpl) value.get(); + jgen.writeObject(null != impl ? impl.getWhatsapp() : null); + } + } + + public static class DelegatedDeSerializer + extends JsonDeserializer { + @Override + public VerificationStartResponseWhatsApp deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException { + + VerificationStartResponseWhatsAppImpl.Builder builder = + new VerificationStartResponseWhatsAppImpl.Builder(); + VerificationStartResponseWhatsAppContentImpl deserialized = + jp.readValueAs(VerificationStartResponseWhatsAppContentImpl.class); + builder.setWhatsapp(deserialized); + return builder.build(); + } + } + + public static Optional delegatedConverter( + VerificationStartResponseWhatsAppContent internal) { + if (null == internal) { + return Optional.empty(); + } + return Optional.of(new Builder().setWhatsapp(internal).build()); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseInternalImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseInternalImpl.java index ca31fc689..a411b11b3 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseInternalImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseInternalImpl.java @@ -20,6 +20,7 @@ import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseFlashCallImpl; import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponsePhoneCallImpl; import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseSmsImpl; +import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseWhatsAppImpl; import java.io.IOException; import java.util.Collections; import java.util.HashMap; @@ -109,6 +110,11 @@ public VerificationStartResponseInternalImpl deserialize( tree.traverse(jp.getCodec()).readValueAs(VerificationStartResponseSmsImpl.class); newVerificationStartResponseInternalImpl.setActualInstance(deserialized); return newVerificationStartResponseInternalImpl; + case "whatsapp": + deserialized = + tree.traverse(jp.getCodec()).readValueAs(VerificationStartResponseWhatsAppImpl.class); + newVerificationStartResponseInternalImpl.setActualInstance(deserialized); + return newVerificationStartResponseInternalImpl; case "VerificationStartResponseData": deserialized = tree.traverse(jp.getCodec()).readValueAs(VerificationStartResponseDataImpl.class); @@ -131,15 +137,20 @@ public VerificationStartResponseInternalImpl deserialize( tree.traverse(jp.getCodec()).readValueAs(VerificationStartResponseSmsImpl.class); newVerificationStartResponseInternalImpl.setActualInstance(deserialized); return newVerificationStartResponseInternalImpl; + case "VerificationStartResponseWhatsApp": + deserialized = + tree.traverse(jp.getCodec()).readValueAs(VerificationStartResponseWhatsAppImpl.class); + newVerificationStartResponseInternalImpl.setActualInstance(deserialized); + return newVerificationStartResponseInternalImpl; default: log.log( Level.WARNING, String.format( "Failed to lookup discriminator value `%s` for" + " VerificationStartResponseInternalImpl. Possible values: callout flashcall" - + " seamless sms VerificationStartResponseData" + + " seamless sms whatsapp VerificationStartResponseData" + " VerificationStartResponseFlashCall VerificationStartResponsePhoneCall" - + " VerificationStartResponseSms", + + " VerificationStartResponseSms VerificationStartResponseWhatsApp", discriminatorValue)); } @@ -326,6 +337,51 @@ public VerificationStartResponseInternalImpl deserialize( Level.FINER, "Input data does not match schema 'VerificationStartResponseSmsImpl'", e); } + // deserialize VerificationStartResponseWhatsAppImpl + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (VerificationStartResponseWhatsAppImpl.class.equals(Integer.class) + || VerificationStartResponseWhatsAppImpl.class.equals(Long.class) + || VerificationStartResponseWhatsAppImpl.class.equals(Float.class) + || VerificationStartResponseWhatsAppImpl.class.equals(Double.class) + || VerificationStartResponseWhatsAppImpl.class.equals(Boolean.class) + || VerificationStartResponseWhatsAppImpl.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((VerificationStartResponseWhatsAppImpl.class.equals(Integer.class) + || VerificationStartResponseWhatsAppImpl.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((VerificationStartResponseWhatsAppImpl.class.equals(Float.class) + || VerificationStartResponseWhatsAppImpl.class.equals(Double.class)) + && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= + (VerificationStartResponseWhatsAppImpl.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (VerificationStartResponseWhatsAppImpl.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = + tree.traverse(jp.getCodec()).readValueAs(VerificationStartResponseWhatsAppImpl.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 'VerificationStartResponseWhatsAppImpl'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, + "Input data does not match schema 'VerificationStartResponseWhatsAppImpl'", + e); + } + if (match == 1) { VerificationStartResponseInternalImpl ret = new VerificationStartResponseInternalImpl(); ret.setActualInstance(deserialized); @@ -374,6 +430,11 @@ public VerificationStartResponseInternalImpl(VerificationStartResponseSmsImpl o) setActualInstance(o); } + public VerificationStartResponseInternalImpl(VerificationStartResponseWhatsAppImpl o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + static { schemas.put("VerificationStartResponseDataImpl", VerificationStartResponseDataImpl.class); schemas.put( @@ -381,6 +442,8 @@ public VerificationStartResponseInternalImpl(VerificationStartResponseSmsImpl o) schemas.put( "VerificationStartResponsePhoneCallImpl", VerificationStartResponsePhoneCallImpl.class); schemas.put("VerificationStartResponseSmsImpl", VerificationStartResponseSmsImpl.class); + schemas.put( + "VerificationStartResponseWhatsAppImpl", VerificationStartResponseWhatsAppImpl.class); JSONNavigator.registerDescendants( VerificationStartResponseInternalImpl.class, Collections.unmodifiableMap(schemas)); // Initialize and register the discriminator mappings. @@ -389,12 +452,14 @@ public VerificationStartResponseInternalImpl(VerificationStartResponseSmsImpl o) mappings.put("flashcall", VerificationStartResponseFlashCallImpl.class); mappings.put("seamless", VerificationStartResponseDataImpl.class); mappings.put("sms", VerificationStartResponseSmsImpl.class); + mappings.put("whatsapp", VerificationStartResponseWhatsAppImpl.class); mappings.put("VerificationStartResponseData", VerificationStartResponseDataImpl.class); mappings.put( "VerificationStartResponseFlashCall", VerificationStartResponseFlashCallImpl.class); mappings.put( "VerificationStartResponsePhoneCall", VerificationStartResponsePhoneCallImpl.class); mappings.put("VerificationStartResponseSms", VerificationStartResponseSmsImpl.class); + mappings.put("VerificationStartResponseWhatsApp", VerificationStartResponseWhatsAppImpl.class); mappings.put("VerificationStartResponse", VerificationStartResponseInternalImpl.class); JSONNavigator.registerDiscriminator( VerificationStartResponseInternalImpl.class, "method", mappings); @@ -409,7 +474,7 @@ public Map> getSchemas() { * Set the instance that matches the oneOf child schema, check the instance parameter is valid * against the oneOf child schemas: VerificationStartResponseDataImpl, * VerificationStartResponseFlashCallImpl, VerificationStartResponsePhoneCallImpl, - * VerificationStartResponseSmsImpl + * VerificationStartResponseSmsImpl, VerificationStartResponseWhatsAppImpl * *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a * composed schema (allOf, anyOf, oneOf). @@ -440,20 +505,26 @@ public void setActualInstance(Object instance) { return; } + if (JSONNavigator.isInstanceOf( + VerificationStartResponseWhatsAppImpl.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException( "Invalid instance type. Must be VerificationStartResponseDataImpl," + " VerificationStartResponseFlashCallImpl, VerificationStartResponsePhoneCallImpl," - + " VerificationStartResponseSmsImpl"); + + " VerificationStartResponseSmsImpl, VerificationStartResponseWhatsAppImpl"); } /** * Get the actual instance, which can be the following: VerificationStartResponseDataImpl, * VerificationStartResponseFlashCallImpl, VerificationStartResponsePhoneCallImpl, - * VerificationStartResponseSmsImpl + * VerificationStartResponseSmsImpl, VerificationStartResponseWhatsAppImpl * * @return The actual instance (VerificationStartResponseDataImpl, * VerificationStartResponseFlashCallImpl, VerificationStartResponsePhoneCallImpl, - * VerificationStartResponseSmsImpl) + * VerificationStartResponseSmsImpl, VerificationStartResponseWhatsAppImpl) */ @Override public Object getActualInstance() { @@ -507,4 +578,16 @@ public VerificationStartResponseSmsImpl getVerificationStartResponseSmsImpl() throws ClassCastException { return (VerificationStartResponseSmsImpl) super.getActualInstance(); } + + /** + * Get the actual instance of `VerificationStartResponseWhatsAppImpl`. If the actual instance is + * not `VerificationStartResponseWhatsAppImpl`, the ClassCastException will be thrown. + * + * @return The actual instance of `VerificationStartResponseWhatsAppImpl` + * @throws ClassCastException if the instance is not `VerificationStartResponseWhatsAppImpl` + */ + public VerificationStartResponseWhatsAppImpl getVerificationStartResponseWhatsAppImpl() + throws ClassCastException { + return (VerificationStartResponseWhatsAppImpl) super.getActualInstance(); + } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseWhatsAppContent.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseWhatsAppContent.java new file mode 100644 index 000000000..3b25a1806 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseWhatsAppContent.java @@ -0,0 +1,64 @@ +/* + * Verification | Sinch + * + * OpenAPI document version: 2.0.1 + * Contact: support@sinch.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit the class manually. + */ + +package com.sinch.sdk.domains.verification.models.v1.start.response.internal; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.sinch.sdk.core.models.AdditionalProperties; +import com.sinch.sdk.domains.verification.models.v1.WhatsAppCodeType; + +/** The response contains the codeType property. */ +@JsonDeserialize(builder = VerificationStartResponseWhatsAppContentImpl.Builder.class) +public interface VerificationStartResponseWhatsAppContent extends AdditionalProperties { + + /** + * Get codeType + * + * @return codeType + */ + WhatsAppCodeType getCodeType(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new VerificationStartResponseWhatsAppContentImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder extends AdditionalProperties.Builder { + + /** + * see getter + * + * @param codeType see getter + * @return Current builder + * @see #getCodeType + */ + Builder setCodeType(WhatsAppCodeType codeType); + + /** + * see getter + * + * @return Current builder + * @see #get + */ + Builder put(String key, Object value); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + VerificationStartResponseWhatsAppContent build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseWhatsAppContentImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseWhatsAppContentImpl.java new file mode 100644 index 000000000..afb3fbc97 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseWhatsAppContentImpl.java @@ -0,0 +1,141 @@ +package com.sinch.sdk.domains.verification.models.v1.start.response.internal; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; +import com.sinch.sdk.core.models.OptionalValue; +import com.sinch.sdk.domains.verification.models.v1.WhatsAppCodeType; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +@JsonPropertyOrder({VerificationStartResponseWhatsAppContentImpl.JSON_PROPERTY_CODE_TYPE}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class VerificationStartResponseWhatsAppContentImpl + implements VerificationStartResponseWhatsAppContent { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_CODE_TYPE = "codeType"; + + private OptionalValue codeType; + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private OptionalValue> additionalProperties; + + public VerificationStartResponseWhatsAppContentImpl() {} + + protected VerificationStartResponseWhatsAppContentImpl( + OptionalValue codeType, + OptionalValue> additionalProperties) { + this.codeType = codeType; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public WhatsAppCodeType getCodeType() { + return codeType.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CODE_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue codeType() { + return codeType; + } + + @JsonIgnore + public Object get(String key) { + + if (null == this.additionalProperties || !additionalProperties.isPresent()) { + return null; + } + return this.additionalProperties.get().get(key); + } + + @JsonAnyGetter + public Map additionalProperties() { + if (null == this.additionalProperties || !additionalProperties.isPresent()) { + return null; + } + return additionalProperties.get(); + } + + /** Return true if this VerificationStartResponseWhatsApp_allOf_whatsapp object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerificationStartResponseWhatsAppContentImpl verificationStartResponseWhatsAppAllOfWhatsapp = + (VerificationStartResponseWhatsAppContentImpl) o; + return Objects.equals(this.codeType, verificationStartResponseWhatsAppAllOfWhatsapp.codeType) + && Objects.equals( + this.additionalProperties, + verificationStartResponseWhatsAppAllOfWhatsapp.additionalProperties) + && super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(codeType, super.hashCode(), additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerificationStartResponseWhatsAppContentImpl {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" codeType: ").append(toIndentedString(codeType)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + @JsonPOJOBuilder(withPrefix = "set") + static class Builder implements VerificationStartResponseWhatsAppContent.Builder { + OptionalValue codeType = OptionalValue.empty(); + OptionalValue> additionalProperties = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_CODE_TYPE) + public Builder setCodeType(WhatsAppCodeType codeType) { + this.codeType = OptionalValue.of(codeType); + return this; + } + + @JsonAnySetter + public Builder put(String key, Object value) { + if (!this.additionalProperties.isPresent()) { + this.additionalProperties = OptionalValue.of(new HashMap()); + } + this.additionalProperties.get().put(key, value); + return this; + } + + public VerificationStartResponseWhatsAppContent build() { + return new VerificationStartResponseWhatsAppContentImpl(codeType, additionalProperties); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponseWhatsApp.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponseWhatsApp.java new file mode 100644 index 000000000..96f3dd85a --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponseWhatsApp.java @@ -0,0 +1,227 @@ +/* + * Verification | Sinch + * + * OpenAPI document version: 2.0.1 + * Contact: support@sinch.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit the class manually. + */ + +package com.sinch.sdk.domains.verification.models.v1.status.response; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.sinch.sdk.core.utils.EnumDynamic; +import com.sinch.sdk.core.utils.EnumSupportDynamic; +import com.sinch.sdk.domains.verification.models.v1.Identity; +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.status.StatusSource; +import java.time.Instant; +import java.util.Arrays; +import java.util.stream.Stream; + +/** WhatsApp Verification Status Response */ +@JsonDeserialize(builder = VerificationStatusResponseWhatsAppImpl.Builder.class) +public interface VerificationStatusResponseWhatsApp + extends com.sinch.sdk.domains.verification.models.v1.status.response + .VerificationStatusResponse { + + /** + * The unique ID of the verification request. + * + * @return id + */ + String getId(); + + /** + * Get status + * + * @return status + */ + VerificationStatus getStatus(); + + /** + * Get reason + * + * @return reason + */ + VerificationStatusReason getReason(); + + /** + * Used to pass your own reference in the request for tracking purposes. Must be a unique value + * for each started verification request. The value must be encodable in the URL path segment. + * This value is passed to all events and returned from the status and report endpoints. The + * reference can be used to check the status + * of verifications, like with ID or identity. + * + * @return reference + */ + String getReference(); + + /** + * Get identity + * + * @return identity + */ + Identity getIdentity(); + + /** + * The ID of the country to which the verification was sent. + * + * @return countryId + */ + String getCountryId(); + + /** + * The timestamp in UTC format.
+ * Note: The formatting does not respect ISO-8601 and the returned + * value has the format YYYY-MM-DDThh:mm:ss.SSS. If you need to parse this value into + * a specific date object in your programming language, please append Z (Zulu time = + * UTC) at the end of the date value to match the ISO-8601 format: + * YYYY-MM-DDThh:mm:ss.SSSZ. + * + * @return verificationTimestamp + */ + Instant getVerificationTimestamp(); + + /** The method of the verification request. This will always be whatsapp. */ + public class MethodEnum extends EnumDynamic { + public static final MethodEnum WHATSAPP = new MethodEnum("whatsapp"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>(MethodEnum.class, MethodEnum::new, Arrays.asList(WHATSAPP)); + + private MethodEnum(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static MethodEnum from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(MethodEnum e) { + return ENUM_SUPPORT.valueOf(e); + } + } + + /** + * Get price + * + * @return price + */ + VerificationStatusResponseSmsPrice getPrice(); + + /** + * Get source + * + * @return source + */ + StatusSource getSource(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new VerificationStatusResponseWhatsAppImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param id see getter + * @return Current builder + * @see #getId + */ + Builder setId(String id); + + /** + * see getter + * + * @param status see getter + * @return Current builder + * @see #getStatus + */ + Builder setStatus(VerificationStatus status); + + /** + * see getter + * + * @param reason see getter + * @return Current builder + * @see #getReason + */ + Builder setReason(VerificationStatusReason reason); + + /** + * see getter + * + * @param reference see getter + * @return Current builder + * @see #getReference + */ + Builder setReference(String reference); + + /** + * see getter + * + * @param identity see getter + * @return Current builder + * @see #getIdentity + */ + Builder setIdentity(Identity identity); + + /** + * see getter + * + * @param countryId see getter + * @return Current builder + * @see #getCountryId + */ + Builder setCountryId(String countryId); + + /** + * see getter + * + * @param verificationTimestamp see getter + * @return Current builder + * @see #getVerificationTimestamp + */ + Builder setVerificationTimestamp(Instant verificationTimestamp); + + /** + * see getter + * + * @param price see getter + * @return Current builder + * @see #getPrice + */ + Builder setPrice(VerificationStatusResponseSmsPrice price); + + /** + * see getter + * + * @param source see getter + * @return Current builder + * @see #getSource + */ + Builder setSource(StatusSource source); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + VerificationStatusResponseWhatsApp build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponseWhatsAppImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponseWhatsAppImpl.java new file mode 100644 index 000000000..b1a8f7caf --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponseWhatsAppImpl.java @@ -0,0 +1,361 @@ +package com.sinch.sdk.domains.verification.models.v1.status.response; + +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; +import com.sinch.sdk.core.models.OptionalValue; +import com.sinch.sdk.domains.verification.models.v1.Identity; +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.status.StatusSource; +import java.time.Instant; +import java.util.Objects; + +@JsonPropertyOrder({ + VerificationStatusResponseWhatsAppImpl.JSON_PROPERTY_ID, + VerificationStatusResponseWhatsAppImpl.JSON_PROPERTY_STATUS, + VerificationStatusResponseWhatsAppImpl.JSON_PROPERTY_REASON, + VerificationStatusResponseWhatsAppImpl.JSON_PROPERTY_REFERENCE, + VerificationStatusResponseWhatsAppImpl.JSON_PROPERTY_IDENTITY, + VerificationStatusResponseWhatsAppImpl.JSON_PROPERTY_COUNTRY_ID, + VerificationStatusResponseWhatsAppImpl.JSON_PROPERTY_VERIFICATION_TIMESTAMP, + VerificationStatusResponseWhatsAppImpl.JSON_PROPERTY_METHOD, + VerificationStatusResponseWhatsAppImpl.JSON_PROPERTY_PRICE, + VerificationStatusResponseWhatsAppImpl.JSON_PROPERTY_SOURCE +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class VerificationStatusResponseWhatsAppImpl + implements VerificationStatusResponseWhatsApp, + com.sinch.sdk.domains.verification.models.v1.status.response.VerificationStatusResponse { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_ID = "id"; + + private OptionalValue id; + + public static final String JSON_PROPERTY_STATUS = "status"; + + private OptionalValue status; + + public static final String JSON_PROPERTY_REASON = "reason"; + + private OptionalValue reason; + + public static final String JSON_PROPERTY_REFERENCE = "reference"; + + private OptionalValue reference; + + public static final String JSON_PROPERTY_IDENTITY = "identity"; + + private OptionalValue identity; + + public static final String JSON_PROPERTY_COUNTRY_ID = "countryId"; + + private OptionalValue countryId; + + public static final String JSON_PROPERTY_VERIFICATION_TIMESTAMP = "verificationTimestamp"; + + private OptionalValue verificationTimestamp; + + public static final String JSON_PROPERTY_METHOD = "method"; + + private OptionalValue method; + + public static final String JSON_PROPERTY_PRICE = "price"; + + private OptionalValue price; + + public static final String JSON_PROPERTY_SOURCE = "source"; + + private OptionalValue source; + + public VerificationStatusResponseWhatsAppImpl() {} + + protected VerificationStatusResponseWhatsAppImpl( + OptionalValue id, + OptionalValue status, + OptionalValue reason, + OptionalValue reference, + OptionalValue identity, + OptionalValue countryId, + OptionalValue verificationTimestamp, + OptionalValue method, + OptionalValue price, + OptionalValue source) { + this.id = id; + this.status = status; + this.reason = reason; + this.reference = reference; + this.identity = identity; + this.countryId = countryId; + this.verificationTimestamp = verificationTimestamp; + this.method = method; + this.price = price; + this.source = source; + } + + @JsonIgnore + public String getId() { + return id.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue id() { + return id; + } + + @JsonIgnore + public VerificationStatus getStatus() { + return status.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue status() { + return status; + } + + @JsonIgnore + public VerificationStatusReason getReason() { + return reason.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_REASON) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue reason() { + return reason; + } + + @JsonIgnore + public String getReference() { + return reference.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_REFERENCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue reference() { + return reference; + } + + @JsonIgnore + public Identity getIdentity() { + return identity.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_IDENTITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue identity() { + return identity; + } + + @JsonIgnore + public String getCountryId() { + return countryId.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_COUNTRY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue countryId() { + return countryId; + } + + @JsonIgnore + public Instant getVerificationTimestamp() { + return verificationTimestamp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_VERIFICATION_TIMESTAMP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue verificationTimestamp() { + return verificationTimestamp; + } + + @JsonIgnore + public MethodEnum getMethod() { + return method.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_METHOD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue method() { + return method; + } + + @JsonIgnore + public VerificationStatusResponseSmsPrice getPrice() { + return price.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_PRICE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue price() { + return price; + } + + @JsonIgnore + public StatusSource getSource() { + return source.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_SOURCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue source() { + return source; + } + + /** Return true if this VerificationStatusResponseWhatsApp object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerificationStatusResponseWhatsAppImpl verificationStatusResponseWhatsApp = + (VerificationStatusResponseWhatsAppImpl) o; + return Objects.equals(this.id, verificationStatusResponseWhatsApp.id) + && Objects.equals(this.status, verificationStatusResponseWhatsApp.status) + && Objects.equals(this.reason, verificationStatusResponseWhatsApp.reason) + && Objects.equals(this.reference, verificationStatusResponseWhatsApp.reference) + && Objects.equals(this.identity, verificationStatusResponseWhatsApp.identity) + && Objects.equals(this.countryId, verificationStatusResponseWhatsApp.countryId) + && Objects.equals( + this.verificationTimestamp, verificationStatusResponseWhatsApp.verificationTimestamp) + && Objects.equals(this.method, verificationStatusResponseWhatsApp.method) + && Objects.equals(this.price, verificationStatusResponseWhatsApp.price) + && Objects.equals(this.source, verificationStatusResponseWhatsApp.source); + } + + @Override + public int hashCode() { + return Objects.hash( + id, + status, + reason, + reference, + identity, + countryId, + verificationTimestamp, + method, + price, + source); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerificationStatusResponseWhatsAppImpl {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" reference: ").append(toIndentedString(reference)).append("\n"); + sb.append(" identity: ").append(toIndentedString(identity)).append("\n"); + sb.append(" countryId: ").append(toIndentedString(countryId)).append("\n"); + sb.append(" verificationTimestamp: ") + .append(toIndentedString(verificationTimestamp)) + .append("\n"); + sb.append(" method: ").append(toIndentedString(method)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + @JsonPOJOBuilder(withPrefix = "set") + static class Builder implements VerificationStatusResponseWhatsApp.Builder { + OptionalValue id = OptionalValue.empty(); + OptionalValue status = OptionalValue.empty(); + OptionalValue reason = OptionalValue.empty(); + OptionalValue reference = OptionalValue.empty(); + OptionalValue identity = OptionalValue.empty(); + OptionalValue countryId = OptionalValue.empty(); + OptionalValue verificationTimestamp = OptionalValue.empty(); + OptionalValue method = OptionalValue.of(MethodEnum.WHATSAPP); + OptionalValue price = OptionalValue.empty(); + OptionalValue source = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_ID) + public Builder setId(String id) { + this.id = OptionalValue.of(id); + return this; + } + + @JsonProperty(JSON_PROPERTY_STATUS) + public Builder setStatus(VerificationStatus status) { + this.status = OptionalValue.of(status); + return this; + } + + @JsonProperty(JSON_PROPERTY_REASON) + public Builder setReason(VerificationStatusReason reason) { + this.reason = OptionalValue.of(reason); + return this; + } + + @JsonProperty(JSON_PROPERTY_REFERENCE) + public Builder setReference(String reference) { + this.reference = OptionalValue.of(reference); + return this; + } + + @JsonProperty(JSON_PROPERTY_IDENTITY) + public Builder setIdentity(Identity identity) { + this.identity = OptionalValue.of(identity); + return this; + } + + @JsonProperty(JSON_PROPERTY_COUNTRY_ID) + public Builder setCountryId(String countryId) { + this.countryId = OptionalValue.of(countryId); + return this; + } + + @JsonProperty(JSON_PROPERTY_VERIFICATION_TIMESTAMP) + public Builder setVerificationTimestamp(Instant verificationTimestamp) { + this.verificationTimestamp = OptionalValue.of(verificationTimestamp); + return this; + } + + @JsonProperty(JSON_PROPERTY_PRICE) + public Builder setPrice(VerificationStatusResponseSmsPrice price) { + this.price = OptionalValue.of(price); + return this; + } + + @JsonProperty(JSON_PROPERTY_SOURCE) + public Builder setSource(StatusSource source) { + this.source = OptionalValue.of(source); + return this; + } + + public VerificationStatusResponseWhatsApp build() { + return new VerificationStatusResponseWhatsAppImpl( + id, + status, + reason, + reference, + identity, + countryId, + verificationTimestamp, + method, + price, + source); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/internal/VerificationStatusResponseInternalImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/internal/VerificationStatusResponseInternalImpl.java index 19d28593a..7ddecb828 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/internal/VerificationStatusResponseInternalImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/internal/VerificationStatusResponseInternalImpl.java @@ -19,6 +19,7 @@ import com.sinch.sdk.domains.verification.models.v1.status.response.VerificationStatusResponseFlashCallImpl; import com.sinch.sdk.domains.verification.models.v1.status.response.VerificationStatusResponsePhoneCallImpl; import com.sinch.sdk.domains.verification.models.v1.status.response.VerificationStatusResponseSmsImpl; +import com.sinch.sdk.domains.verification.models.v1.status.response.VerificationStatusResponseWhatsAppImpl; import java.io.IOException; import java.util.Collections; import java.util.HashMap; @@ -104,6 +105,12 @@ public VerificationStatusResponseInternalImpl deserialize( tree.traverse(jp.getCodec()).readValueAs(VerificationStatusResponseSmsImpl.class); newVerificationStatusResponseInternalImpl.setActualInstance(deserialized); return newVerificationStatusResponseInternalImpl; + case "whatsapp": + deserialized = + tree.traverse(jp.getCodec()) + .readValueAs(VerificationStatusResponseWhatsAppImpl.class); + newVerificationStatusResponseInternalImpl.setActualInstance(deserialized); + return newVerificationStatusResponseInternalImpl; case "VerificationStatusResponseFlashCall": deserialized = tree.traverse(jp.getCodec()) @@ -121,14 +128,21 @@ public VerificationStatusResponseInternalImpl deserialize( tree.traverse(jp.getCodec()).readValueAs(VerificationStatusResponseSmsImpl.class); newVerificationStatusResponseInternalImpl.setActualInstance(deserialized); return newVerificationStatusResponseInternalImpl; + case "VerificationStatusResponseWhatsApp": + deserialized = + tree.traverse(jp.getCodec()) + .readValueAs(VerificationStatusResponseWhatsAppImpl.class); + newVerificationStatusResponseInternalImpl.setActualInstance(deserialized); + return newVerificationStatusResponseInternalImpl; default: log.log( Level.WARNING, String.format( "Failed to lookup discriminator value `%s` for" + " VerificationStatusResponseInternalImpl. Possible values: callout" - + " flashcall sms VerificationStatusResponseFlashCall" - + " VerificationStatusResponsePhoneCall VerificationStatusResponseSms", + + " flashcall sms whatsapp VerificationStatusResponseFlashCall" + + " VerificationStatusResponsePhoneCall VerificationStatusResponseSms" + + " VerificationStatusResponseWhatsApp", discriminatorValue)); } @@ -272,6 +286,53 @@ public VerificationStatusResponseInternalImpl deserialize( Level.FINER, "Input data does not match schema 'VerificationStatusResponseSmsImpl'", e); } + // deserialize VerificationStatusResponseWhatsAppImpl + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (VerificationStatusResponseWhatsAppImpl.class.equals(Integer.class) + || VerificationStatusResponseWhatsAppImpl.class.equals(Long.class) + || VerificationStatusResponseWhatsAppImpl.class.equals(Float.class) + || VerificationStatusResponseWhatsAppImpl.class.equals(Double.class) + || VerificationStatusResponseWhatsAppImpl.class.equals(Boolean.class) + || VerificationStatusResponseWhatsAppImpl.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((VerificationStatusResponseWhatsAppImpl.class.equals(Integer.class) + || VerificationStatusResponseWhatsAppImpl.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((VerificationStatusResponseWhatsAppImpl.class.equals(Float.class) + || VerificationStatusResponseWhatsAppImpl.class.equals(Double.class)) + && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= + (VerificationStatusResponseWhatsAppImpl.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (VerificationStatusResponseWhatsAppImpl.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = + tree.traverse(jp.getCodec()) + .readValueAs(VerificationStatusResponseWhatsAppImpl.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 'VerificationStatusResponseWhatsAppImpl'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, + "Input data does not match schema 'VerificationStatusResponseWhatsAppImpl'", + e); + } + if (match == 1) { VerificationStatusResponseInternalImpl ret = new VerificationStatusResponseInternalImpl(); ret.setActualInstance(deserialized); @@ -315,12 +376,19 @@ public VerificationStatusResponseInternalImpl(VerificationStatusResponseSmsImpl setActualInstance(o); } + public VerificationStatusResponseInternalImpl(VerificationStatusResponseWhatsAppImpl o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + static { schemas.put( "VerificationStatusResponseFlashCallImpl", VerificationStatusResponseFlashCallImpl.class); schemas.put( "VerificationStatusResponsePhoneCallImpl", VerificationStatusResponsePhoneCallImpl.class); schemas.put("VerificationStatusResponseSmsImpl", VerificationStatusResponseSmsImpl.class); + schemas.put( + "VerificationStatusResponseWhatsAppImpl", VerificationStatusResponseWhatsAppImpl.class); JSONNavigator.registerDescendants( VerificationStatusResponseInternalImpl.class, Collections.unmodifiableMap(schemas)); // Initialize and register the discriminator mappings. @@ -328,11 +396,14 @@ public VerificationStatusResponseInternalImpl(VerificationStatusResponseSmsImpl mappings.put("callout", VerificationStatusResponsePhoneCallImpl.class); mappings.put("flashcall", VerificationStatusResponseFlashCallImpl.class); mappings.put("sms", VerificationStatusResponseSmsImpl.class); + mappings.put("whatsapp", VerificationStatusResponseWhatsAppImpl.class); mappings.put( "VerificationStatusResponseFlashCall", VerificationStatusResponseFlashCallImpl.class); mappings.put( "VerificationStatusResponsePhoneCall", VerificationStatusResponsePhoneCallImpl.class); mappings.put("VerificationStatusResponseSms", VerificationStatusResponseSmsImpl.class); + mappings.put( + "VerificationStatusResponseWhatsApp", VerificationStatusResponseWhatsAppImpl.class); mappings.put("VerificationStatusResponse", VerificationStatusResponseInternalImpl.class); JSONNavigator.registerDiscriminator( VerificationStatusResponseInternalImpl.class, "method", mappings); @@ -346,7 +417,8 @@ public Map> getSchemas() { /** * Set the instance that matches the oneOf child schema, check the instance parameter is valid * against the oneOf child schemas: VerificationStatusResponseFlashCallImpl, - * VerificationStatusResponsePhoneCallImpl, VerificationStatusResponseSmsImpl + * VerificationStatusResponsePhoneCallImpl, VerificationStatusResponseSmsImpl, + * VerificationStatusResponseWhatsAppImpl * *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a * composed schema (allOf, anyOf, oneOf). @@ -371,17 +443,26 @@ public void setActualInstance(Object instance) { return; } + if (JSONNavigator.isInstanceOf( + VerificationStatusResponseWhatsAppImpl.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException( "Invalid instance type. Must be VerificationStatusResponseFlashCallImpl," - + " VerificationStatusResponsePhoneCallImpl, VerificationStatusResponseSmsImpl"); + + " VerificationStatusResponsePhoneCallImpl, VerificationStatusResponseSmsImpl," + + " VerificationStatusResponseWhatsAppImpl"); } /** * Get the actual instance, which can be the following: VerificationStatusResponseFlashCallImpl, - * VerificationStatusResponsePhoneCallImpl, VerificationStatusResponseSmsImpl + * VerificationStatusResponsePhoneCallImpl, VerificationStatusResponseSmsImpl, + * VerificationStatusResponseWhatsAppImpl * * @return The actual instance (VerificationStatusResponseFlashCallImpl, - * VerificationStatusResponsePhoneCallImpl, VerificationStatusResponseSmsImpl) + * VerificationStatusResponsePhoneCallImpl, VerificationStatusResponseSmsImpl, + * VerificationStatusResponseWhatsAppImpl) */ @Override public Object getActualInstance() { @@ -423,4 +504,16 @@ public VerificationStatusResponseSmsImpl getVerificationStatusResponseSmsImpl() throws ClassCastException { return (VerificationStatusResponseSmsImpl) super.getActualInstance(); } + + /** + * Get the actual instance of `VerificationStatusResponseWhatsAppImpl`. If the actual instance is + * not `VerificationStatusResponseWhatsAppImpl`, the ClassCastException will be thrown. + * + * @return The actual instance of `VerificationStatusResponseWhatsAppImpl` + * @throws ClassCastException if the instance is not `VerificationStatusResponseWhatsAppImpl` + */ + public VerificationStatusResponseWhatsAppImpl getVerificationStatusResponseWhatsAppImpl() + throws ClassCastException { + return (VerificationStatusResponseWhatsAppImpl) super.getActualInstance(); + } } 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/webhooks/VerificationRequestEventResponseWhatsApp.java new file mode 100644 index 000000000..06dd6c0da --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventResponseWhatsApp.java @@ -0,0 +1,109 @@ +/* + * Verification | Sinch + * + * OpenAPI document version: 2.0.1 + * Contact: support@sinch.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit the class manually. + */ + +package com.sinch.sdk.domains.verification.models.v1.webhooks; + +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 { + + /** + * Get action + * + *

Field is required + * + * @return action + */ + VerificationEventResponseAction getAction(); + + /** + * Get codeType + * + * @return codeType + */ + WhatsAppCodeType getCodeType(); + + /** + * The WhatsApp verification content language. Set in the verification request. + * + * @return acceptLanguage + */ + List getAcceptLanguage(); + + /** + * Return the additional "whatsapp" with the specified name. + * + * @param key the name of the property + * @return the additional property with the specified name + */ + Object getExtraOption(String key); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new VerificationRequestEventResponseWhatsAppImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder + extends com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEventResponse + .Builder { + + /** + * see getter + * + * @param action see getter + * @return Current builder + * @see #getAction + */ + Builder setAction(VerificationEventResponseAction action); + + /** + * see getter + * + * @param codeType see getter + * @return Current builder + * @see #getCodeType + */ + Builder setCodeType(WhatsAppCodeType codeType); + + /** + * see getter + * + * @param acceptLanguage see getter + * @return Current builder + * @see #getAcceptLanguage + */ + Builder setAcceptLanguage(List acceptLanguage); + + /** + * see getter + * + * @return Current builder + * @see #getExtraOption + */ + Builder putExtraOption(String key, Object value); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + VerificationRequestEventResponseWhatsApp 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/webhooks/VerificationRequestEventResponseWhatsAppImpl.java new file mode 100644 index 000000000..5730ee7bc --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/VerificationRequestEventResponseWhatsAppImpl.java @@ -0,0 +1,243 @@ +package com.sinch.sdk.domains.verification.models.v1.webhooks; + +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonSerializer; +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.WhatsAppCodeType; +import com.sinch.sdk.domains.verification.models.v1.webhooks.internal.VerificationRequestEventResponseWhatsAppContent; +import com.sinch.sdk.domains.verification.models.v1.webhooks.internal.VerificationRequestEventResponseWhatsAppContentImpl; +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 +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class VerificationRequestEventResponseWhatsAppImpl + implements VerificationRequestEventResponseWhatsApp, + com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEventResponse { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_ACTION = "action"; + + private OptionalValue action; + + public static final String JSON_PROPERTY_WHATSAPP = "whatsapp"; + + private OptionalValue whatsapp; + + public VerificationRequestEventResponseWhatsAppImpl() {} + + protected VerificationRequestEventResponseWhatsAppImpl( + OptionalValue action, + OptionalValue whatsapp) { + this.action = action; + this.whatsapp = whatsapp; + } + + @JsonIgnore + public VerificationEventResponseAction getAction() { + return action.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ACTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue action() { + return action; + } + + @JsonIgnore + public VerificationRequestEventResponseWhatsAppContent getWhatsapp() { + return whatsapp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_WHATSAPP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue whatsapp() { + return whatsapp; + } + + @JsonIgnore + public WhatsAppCodeType getCodeType() { + if (null == whatsapp || !whatsapp.isPresent() || null == whatsapp.get().getCodeType()) { + return null; + } + return whatsapp.get().getCodeType(); + } + + public OptionalValue codeType() { + return null != whatsapp && whatsapp.isPresent() + ? whatsapp + .map(f -> ((VerificationRequestEventResponseWhatsAppContentImpl) f).codeType()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public List getAcceptLanguage() { + if (null == whatsapp || !whatsapp.isPresent() || null == whatsapp.get().getAcceptLanguage()) { + return null; + } + return whatsapp.get().getAcceptLanguage(); + } + + public OptionalValue> acceptLanguage() { + return null != whatsapp && whatsapp.isPresent() + ? whatsapp + .map(f -> ((VerificationRequestEventResponseWhatsAppContentImpl) f).acceptLanguage()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public Object getExtraOption(String key) { + return null != whatsapp && whatsapp.isPresent() ? whatsapp.get().get(key) : null; + } + + /** Return true if this VerificationRequestEventResponseWhatsApp object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerificationRequestEventResponseWhatsAppImpl verificationRequestEventResponseWhatsApp = + (VerificationRequestEventResponseWhatsAppImpl) o; + return Objects.equals(this.action, verificationRequestEventResponseWhatsApp.action) + && Objects.equals(this.whatsapp, verificationRequestEventResponseWhatsApp.whatsapp); + } + + @Override + public int hashCode() { + return Objects.hash(action, whatsapp); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerificationRequestEventResponseWhatsAppImpl {\n"); + sb.append(" action: ").append(toIndentedString(action)).append("\n"); + sb.append(" whatsapp: ").append(toIndentedString(whatsapp)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + @JsonPOJOBuilder(withPrefix = "set") + static class Builder implements VerificationRequestEventResponseWhatsApp.Builder { + OptionalValue action = OptionalValue.empty(); + OptionalValue whatsapp = OptionalValue.empty(); + + VerificationRequestEventResponseWhatsAppContent.Builder _delegatedBuilder = null; + + @JsonProperty(value = JSON_PROPERTY_ACTION, required = true) + public Builder setAction(VerificationEventResponseAction action) { + this.action = OptionalValue.of(action); + return this; + } + + @JsonProperty(JSON_PROPERTY_WHATSAPP) + public Builder setWhatsapp(VerificationRequestEventResponseWhatsAppContent whatsapp) { + this.whatsapp = OptionalValue.of(whatsapp); + return this; + } + + @JsonIgnore + public Builder setCodeType(WhatsAppCodeType codeType) { + getDelegatedBuilder().setCodeType(codeType); + return this; + } + + @JsonIgnore + public Builder setAcceptLanguage(List acceptLanguage) { + getDelegatedBuilder().setAcceptLanguage(acceptLanguage); + return this; + } + + public Builder putExtraOption(String key, Object value) { + getDelegatedBuilder().put(key, value); + return this; + } + + private VerificationRequestEventResponseWhatsAppContent.Builder getDelegatedBuilder() { + if (null == _delegatedBuilder) { + this._delegatedBuilder = VerificationRequestEventResponseWhatsAppContent.builder(); + } + return this._delegatedBuilder; + } + + public VerificationRequestEventResponseWhatsApp 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); + } + } + + public static class DelegatedSerializer + extends JsonSerializer> { + @Override + public void serialize( + OptionalValue value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException { + + if (!value.isPresent()) { + return; + } + VerificationRequestEventResponseWhatsAppImpl impl = + (VerificationRequestEventResponseWhatsAppImpl) value.get(); + jgen.writeObject(null != impl ? impl.getWhatsapp() : null); + } + } + + public static class DelegatedDeSerializer + extends JsonDeserializer { + @Override + public VerificationRequestEventResponseWhatsApp deserialize( + JsonParser jp, DeserializationContext ctxt) throws IOException { + + VerificationRequestEventResponseWhatsAppImpl.Builder builder = + new VerificationRequestEventResponseWhatsAppImpl.Builder(); + VerificationRequestEventResponseWhatsAppContentImpl deserialized = + jp.readValueAs(VerificationRequestEventResponseWhatsAppContentImpl.class); + builder.setWhatsapp(deserialized); + return builder.build(); + } + } + + public static Optional delegatedConverter( + VerificationRequestEventResponseWhatsAppContent internal) { + if (null == internal) { + return Optional.empty(); + } + return Optional.of(new Builder().setWhatsapp(internal).build()); + } +} 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/webhooks/internal/VerificationRequestEventResponseWhatsAppContent.java new file mode 100644 index 000000000..a0b7687be --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/internal/VerificationRequestEventResponseWhatsAppContent.java @@ -0,0 +1,81 @@ +/* + * Verification | Sinch + * + * OpenAPI document version: 2.0.1 + * Contact: support@sinch.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit the class manually. + */ + +package com.sinch.sdk.domains.verification.models.v1.webhooks.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 { + + /** + * Get codeType + * + * @return codeType + */ + WhatsAppCodeType getCodeType(); + + /** + * The WhatsApp verification content language. Set in the verification request. + * + * @return acceptLanguage + */ + List getAcceptLanguage(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new VerificationRequestEventResponseWhatsAppContentImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder extends AdditionalProperties.Builder { + + /** + * see getter + * + * @param codeType see getter + * @return Current builder + * @see #getCodeType + */ + Builder setCodeType(WhatsAppCodeType codeType); + + /** + * see getter + * + * @param acceptLanguage see getter + * @return Current builder + * @see #getAcceptLanguage + */ + Builder setAcceptLanguage(List acceptLanguage); + + /** + * see getter + * + * @return Current builder + * @see #get + */ + Builder put(String key, Object value); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + VerificationRequestEventResponseWhatsAppContent 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/webhooks/internal/VerificationRequestEventResponseWhatsAppContentImpl.java new file mode 100644 index 000000000..abeb5e319 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/webhooks/internal/VerificationRequestEventResponseWhatsAppContentImpl.java @@ -0,0 +1,179 @@ +package com.sinch.sdk.domains.verification.models.v1.webhooks.internal; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; +import com.sinch.sdk.core.models.OptionalValue; +import com.sinch.sdk.domains.verification.models.v1.WhatsAppCodeType; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonPropertyOrder({ + VerificationRequestEventResponseWhatsAppContentImpl.JSON_PROPERTY_CODE_TYPE, + VerificationRequestEventResponseWhatsAppContentImpl.JSON_PROPERTY_ACCEPT_LANGUAGE +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class VerificationRequestEventResponseWhatsAppContentImpl + implements VerificationRequestEventResponseWhatsAppContent { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_CODE_TYPE = "codeType"; + + private OptionalValue codeType; + + public static final String JSON_PROPERTY_ACCEPT_LANGUAGE = "acceptLanguage"; + + private OptionalValue> acceptLanguage; + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private OptionalValue> additionalProperties; + + public VerificationRequestEventResponseWhatsAppContentImpl() {} + + protected VerificationRequestEventResponseWhatsAppContentImpl( + OptionalValue codeType, + OptionalValue> acceptLanguage, + OptionalValue> additionalProperties) { + this.codeType = codeType; + this.acceptLanguage = acceptLanguage; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public WhatsAppCodeType getCodeType() { + return codeType.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CODE_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue codeType() { + return codeType; + } + + @JsonIgnore + public List getAcceptLanguage() { + return acceptLanguage.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ACCEPT_LANGUAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue> acceptLanguage() { + return acceptLanguage; + } + + @JsonIgnore + public Object get(String key) { + + if (null == this.additionalProperties || !additionalProperties.isPresent()) { + return null; + } + return this.additionalProperties.get().get(key); + } + + @JsonAnyGetter + public Map additionalProperties() { + if (null == this.additionalProperties || !additionalProperties.isPresent()) { + return null; + } + return additionalProperties.get(); + } + + /** + * Return true if this VerificationRequestEventResponseWhatsApp_allOf_whatsapp object is equal to + * o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerificationRequestEventResponseWhatsAppContentImpl + verificationRequestEventResponseWhatsAppAllOfWhatsapp = + (VerificationRequestEventResponseWhatsAppContentImpl) o; + return Objects.equals( + this.codeType, verificationRequestEventResponseWhatsAppAllOfWhatsapp.codeType) + && Objects.equals( + this.acceptLanguage, + verificationRequestEventResponseWhatsAppAllOfWhatsapp.acceptLanguage) + && Objects.equals( + this.additionalProperties, + verificationRequestEventResponseWhatsAppAllOfWhatsapp.additionalProperties) + && super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(codeType, acceptLanguage, super.hashCode(), additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerificationRequestEventResponseWhatsAppContentImpl {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" codeType: ").append(toIndentedString(codeType)).append("\n"); + sb.append(" acceptLanguage: ").append(toIndentedString(acceptLanguage)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + @JsonPOJOBuilder(withPrefix = "set") + static class Builder implements VerificationRequestEventResponseWhatsAppContent.Builder { + OptionalValue codeType = OptionalValue.empty(); + OptionalValue> acceptLanguage = OptionalValue.empty(); + OptionalValue> additionalProperties = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_CODE_TYPE) + public Builder setCodeType(WhatsAppCodeType codeType) { + this.codeType = OptionalValue.of(codeType); + return this; + } + + @JsonProperty(JSON_PROPERTY_ACCEPT_LANGUAGE) + public Builder setAcceptLanguage(List acceptLanguage) { + this.acceptLanguage = OptionalValue.of(acceptLanguage); + return this; + } + + @JsonAnySetter + public Builder put(String key, Object value) { + if (!this.additionalProperties.isPresent()) { + this.additionalProperties = OptionalValue.of(new HashMap()); + } + this.additionalProperties.get().put(key, value); + return this; + } + + public VerificationRequestEventResponseWhatsAppContent build() { + return new VerificationRequestEventResponseWhatsAppContentImpl( + codeType, acceptLanguage, additionalProperties); + } + } +} From 73989cd06a9fcfea5157a9c5621a854d959c6074 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier Date: Thu, 28 Aug 2025 16:12:52 +0200 Subject: [PATCH 017/122] test (Verification): Define Status 'countryId' as an ID --- .../dto/v1/status/VerificationStatusResponseTest.java | 8 ++++---- .../v1/status/VerificationStatusResponseFlashCallDto.json | 2 +- .../v1/status/VerificationStatusResponsePhoneCallDto.json | 2 +- .../v1/status/VerificationStatusResponseSmsDto.json | 2 +- .../v1/status/VerificationStatusResponseWhatsAppDto.json | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/status/VerificationStatusResponseTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/status/VerificationStatusResponseTest.java index 6f81a8d14..3fc78a91a 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/status/VerificationStatusResponseTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/status/VerificationStatusResponseTest.java @@ -52,7 +52,7 @@ public class VerificationStatusResponseTest extends VerificationBaseTest { .setBillableDuration(34) .build()) .setIdentity(NumberIdentity.valueOf("endpoint value")) - .setCountryId("es-ES") + .setCountryId("ES") .setVerificationTimestamp( DateUtil.failSafeTimeStampToInstant("2024-05-22T09:38:59.5590437")) .setCallResult(StatusCallResult.ANSWERED) @@ -81,7 +81,7 @@ public class VerificationStatusResponseTest extends VerificationBaseTest { .build()) .setSource(StatusSource.MANUAL) .setIdentity(NumberIdentity.valueOf("endpoint value")) - .setCountryId("es-ES") + .setCountryId("ES") .setVerificationTimestamp( DateUtil.failSafeTimeStampToInstant("2024-05-22T09:38:59.5590437")) .setCallComplete(false) @@ -105,7 +105,7 @@ public class VerificationStatusResponseTest extends VerificationBaseTest { .build()) .build()) .setIdentity(NumberIdentity.valueOf("endpoint value")) - .setCountryId("es-ES") + .setCountryId("ES") .setVerificationTimestamp( DateUtil.failSafeTimeStampToInstant("2024-05-22T09:38:59.5590437")) .build()); @@ -128,7 +128,7 @@ public class VerificationStatusResponseTest extends VerificationBaseTest { .build()) .build()) .setIdentity(NumberIdentity.valueOf("+33123456789")) - .setCountryId("es-ES") + .setCountryId("ES") .setVerificationTimestamp( DateUtil.failSafeTimeStampToInstant("2024-05-22T09:38:59.5590437")) .build()); diff --git a/openapi-contracts/src/test/resources/domains/verification/v1/status/VerificationStatusResponseFlashCallDto.json b/openapi-contracts/src/test/resources/domains/verification/v1/status/VerificationStatusResponseFlashCallDto.json index 67526add7..852f769bf 100644 --- a/openapi-contracts/src/test/resources/domains/verification/v1/status/VerificationStatusResponseFlashCallDto.json +++ b/openapi-contracts/src/test/resources/domains/verification/v1/status/VerificationStatusResponseFlashCallDto.json @@ -8,7 +8,7 @@ "type": "number", "endpoint": "endpoint value" }, - "countryId": "es-ES", + "countryId": "ES", "verificationTimestamp": "2024-05-22T09:38:59.5590437", "source": "manual", "price": { diff --git a/openapi-contracts/src/test/resources/domains/verification/v1/status/VerificationStatusResponsePhoneCallDto.json b/openapi-contracts/src/test/resources/domains/verification/v1/status/VerificationStatusResponsePhoneCallDto.json index fa1929953..cb07d5bd4 100644 --- a/openapi-contracts/src/test/resources/domains/verification/v1/status/VerificationStatusResponsePhoneCallDto.json +++ b/openapi-contracts/src/test/resources/domains/verification/v1/status/VerificationStatusResponsePhoneCallDto.json @@ -20,7 +20,7 @@ "type": "number", "endpoint": "endpoint value" }, - "countryId": "es-ES", + "countryId": "ES", "verificationTimestamp": "2024-05-22T09:38:59.5590437", "callResult": "ANSWERED" } diff --git a/openapi-contracts/src/test/resources/domains/verification/v1/status/VerificationStatusResponseSmsDto.json b/openapi-contracts/src/test/resources/domains/verification/v1/status/VerificationStatusResponseSmsDto.json index b54ebb96a..ef2c13b2e 100644 --- a/openapi-contracts/src/test/resources/domains/verification/v1/status/VerificationStatusResponseSmsDto.json +++ b/openapi-contracts/src/test/resources/domains/verification/v1/status/VerificationStatusResponseSmsDto.json @@ -8,7 +8,7 @@ "type": "number", "endpoint": "endpoint value" }, - "countryId": "es-ES", + "countryId": "ES", "verificationTimestamp": "2024-05-22T09:38:59.5590437", "source": "intercepted", "price": { diff --git a/openapi-contracts/src/test/resources/domains/verification/v1/status/VerificationStatusResponseWhatsAppDto.json b/openapi-contracts/src/test/resources/domains/verification/v1/status/VerificationStatusResponseWhatsAppDto.json index 797809422..40b105170 100644 --- a/openapi-contracts/src/test/resources/domains/verification/v1/status/VerificationStatusResponseWhatsAppDto.json +++ b/openapi-contracts/src/test/resources/domains/verification/v1/status/VerificationStatusResponseWhatsAppDto.json @@ -8,7 +8,7 @@ "type": "number", "endpoint": "+33123456789" }, - "countryId": "es-ES", + "countryId": "ES", "verificationTimestamp": "2024-05-22T09:38:59.5590437", "source": "intercepted", "price": { From 6076f6f918c9460a90101b02bede21835865be92 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier Date: Sun, 24 Aug 2025 14:39:02 +0200 Subject: [PATCH 018/122] feat (Conversation): Remove "VIBER' channel and define 'SINCH_CHAT' --- .../conversation/api/v1/ContactService.java | 6 ++-- .../api/v1/adapters/ContactService.java | 5 +--- ...ationChannelCredentialsBuilderFactory.java | 14 --------- ...nChannelCredentialsBuilderFactoryTest.java | 10 ------- .../conversation/TranscodingSteps.java | 4 +-- .../models/v1/ConversationChannel.java | 8 ++--- .../messages/request/SendMessageRequest.java | 12 ++++++-- ...ConversationChannelCredentialsDtoTest.java | 30 +++++++++---------- ...onversationChannelSinchChatRequestDto.json | 5 ++++ ...versationChannelSinchChatResponseDto.json} | 5 +--- .../ConversationChannelViberRequestDto.json | 8 ----- .../conversation/application/Create.java | 6 ---- 12 files changed, 40 insertions(+), 73 deletions(-) create mode 100644 openapi-contracts/src/test/resources/domains/conversation/v1/credentials/ConversationChannelSinchChatRequestDto.json rename openapi-contracts/src/test/resources/domains/conversation/v1/credentials/{ConversationChannelViberResponseDto.json => ConversationChannelSinchChatResponseDto.json} (70%) delete mode 100644 openapi-contracts/src/test/resources/domains/conversation/v1/credentials/ConversationChannelViberRequestDto.json diff --git a/client/src/main/com/sinch/sdk/domains/conversation/api/v1/ContactService.java b/client/src/main/com/sinch/sdk/domains/conversation/api/v1/ContactService.java index 27cc78709..05b1cc724 100644 --- a/client/src/main/com/sinch/sdk/domains/conversation/api/v1/ContactService.java +++ b/client/src/main/com/sinch/sdk/domains/conversation/api/v1/ContactService.java @@ -118,8 +118,7 @@ public interface ContactService { * Get user profile from a specific channel by contact ID. * *

Only supported on {@link ConversationChannel#MESSENGER MESSENGER}, {@link - * ConversationChannel#INSTAGRAM INSTAGRAM}, {@link ConversationChannel#VIBER VIBER} and {@link - * ConversationChannel#LINE LINE} channels. + * ConversationChannel#INSTAGRAM INSTAGRAM} and {@link ConversationChannel#LINE LINE} channels. * *

Note that, in order to retrieve a WhatsApp display name, you can use the Get a Contact or * List Contacts operations, which will populate the display_name field of each returned contact @@ -136,8 +135,7 @@ public interface ContactService { * Get user profile from a specific channel by channel identity. * *

Only supported on {@link ConversationChannel#MESSENGER MESSENGER}, {@link - * ConversationChannel#INSTAGRAM INSTAGRAM}, {@link ConversationChannel#VIBER VIBER} and {@link - * ConversationChannel#LINE LINE} channels. + * ConversationChannel#INSTAGRAM INSTAGRAM} and {@link ConversationChannel#LINE LINE} channels. * *

Note that, in order to retrieve a WhatsApp display name, you can use the Get a Contact or * List Contacts operations, which will populate the display_name field of each returned contact diff --git a/client/src/main/com/sinch/sdk/domains/conversation/api/v1/adapters/ContactService.java b/client/src/main/com/sinch/sdk/domains/conversation/api/v1/adapters/ContactService.java index 731875d61..60288a5d9 100644 --- a/client/src/main/com/sinch/sdk/domains/conversation/api/v1/adapters/ContactService.java +++ b/client/src/main/com/sinch/sdk/domains/conversation/api/v1/adapters/ContactService.java @@ -31,10 +31,7 @@ public class ContactService implements com.sinch.sdk.domains.conversation.api.v1 private final ContactApi api; private final Collection supportedChannelForGetProfile = Arrays.asList( - ConversationChannel.INSTAGRAM, - ConversationChannel.MESSENGER, - ConversationChannel.VIBER, - ConversationChannel.LINE); + ConversationChannel.INSTAGRAM, ConversationChannel.MESSENGER, ConversationChannel.LINE); public ContactService( String uriUUID, diff --git a/client/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/ConversationChannelCredentialsBuilderFactory.java b/client/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/ConversationChannelCredentialsBuilderFactory.java index 062bf8423..625f0fca5 100644 --- a/client/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/ConversationChannelCredentialsBuilderFactory.java +++ b/client/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/ConversationChannelCredentialsBuilderFactory.java @@ -150,20 +150,6 @@ public static ConversationChannelCredentials.Builder telegram(TelegramCredential .setCredentials(credentials); } - /** - * Create dedicated conversation credential builder for{@link ConversationChannel#VIBER} - * channel - * - * @param credentials Credentials parameters to be used to init builder - * @return Conversation channel credentials builder filled with input parameters - * @since 1.3 - */ - public static ConversationChannelCredentials.Builder viber(StaticTokenCredentials credentials) { - return ConversationChannelCredentials.builder() - .setChannel(ConversationChannel.VIBER) - .setCredentials(credentials); - } - /** * Create dedicated conversation credential builder for{@link ConversationChannel#VIBERBM} * channel diff --git a/client/src/test/java/com/sinch/sdk/domains/conversation/models/v1/credentials/ConversationChannelCredentialsBuilderFactoryTest.java b/client/src/test/java/com/sinch/sdk/domains/conversation/models/v1/credentials/ConversationChannelCredentialsBuilderFactoryTest.java index 451a3ba51..073add9c7 100644 --- a/client/src/test/java/com/sinch/sdk/domains/conversation/models/v1/credentials/ConversationChannelCredentialsBuilderFactoryTest.java +++ b/client/src/test/java/com/sinch/sdk/domains/conversation/models/v1/credentials/ConversationChannelCredentialsBuilderFactoryTest.java @@ -108,16 +108,6 @@ void telegram() { TestHelpers.recursiveEquals(conversationChannelCredentials.getCredentials(), credentials); } - @Test - void viber() { - StaticTokenCredentials credentials = StaticTokenCredentials.builder().build(); - ConversationChannelCredentials conversationChannelCredentials = - ConversationChannelCredentialsBuilderFactory.viber(credentials).build(); - - assertEquals(conversationChannelCredentials.getChannel(), ConversationChannel.VIBER); - TestHelpers.recursiveEquals(conversationChannelCredentials.getCredentials(), credentials); - } - @Test void viberBm() { StaticBearerCredentials credentials = StaticBearerCredentials.builder().build(); diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/conversation/TranscodingSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/conversation/TranscodingSteps.java index b286eba11..aa78de11d 100644 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/conversation/TranscodingSteps.java +++ b/client/src/test/java/com/sinch/sdk/e2e/domains/conversation/TranscodingSteps.java @@ -49,7 +49,7 @@ public void transcodeMessage() { ConversationChannel.RCS, ConversationChannel.SMS, ConversationChannel.TELEGRAM, - ConversationChannel.VIBER, + ConversationChannel.from("VIBER"), ConversationChannel.WECHAT, ConversationChannel.WHATSAPP); @@ -79,7 +79,7 @@ public void transcodeMessageResult() { Assertions.assertTrue(transcodedMap.containsKey(ConversationChannel.RCS)); Assertions.assertTrue(transcodedMap.containsKey(ConversationChannel.SMS)); Assertions.assertTrue(transcodedMap.containsKey(ConversationChannel.TELEGRAM)); - Assertions.assertTrue(transcodedMap.containsKey(ConversationChannel.VIBER)); + Assertions.assertTrue(transcodedMap.containsKey(ConversationChannel.from("VIBER"))); Assertions.assertTrue(transcodedMap.containsKey(ConversationChannel.WECHAT)); Assertions.assertTrue(transcodedMap.containsKey(ConversationChannel.WHATSAPP)); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/ConversationChannel.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/ConversationChannel.java index 7f78bc874..917b331b2 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/ConversationChannel.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/ConversationChannel.java @@ -20,9 +20,6 @@ public class ConversationChannel extends EnumDynamic { * send another message with a different value for conversation_metadata in the same * conversation, the latest metadata value overwrites the existing one. So, future MO callbacks * will include the new metadata. - The conversation_metadata only accepts json - * objects. Currently only returned in the message_metadata field of an DISPATCH mode while the retention + * period of the app is set to 0 (note that this value is set to 0 by default), the + * conversation_metadata field will not be retained. Currently only returned in the + * message_metadata field of an Inbound * Message callback. * @@ -151,7 +155,11 @@ public interface SendMessageRequest { * conversation in CONVERSATION mode and with the specified recipient identities in * DISPATCH mode. The MO callbacks will always include the last correlation_id * available, (which is similar to how the conversation_metadata property - * functions). Up to 128 characters long. + * functions). Up to 128 characters long. Important note: If you send a message in DISPATCH + * mode while the retention + * period of the app is set to 0 (note that this value is set to 0 by default), the + * correlation_id field will not be retained. * * @return correlationId */ diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/conversation/models/v1/credentials/ConversationChannelCredentialsDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/conversation/models/v1/credentials/ConversationChannelCredentialsDtoTest.java index 1b7fe404d..7c8decdba 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/conversation/models/v1/credentials/ConversationChannelCredentialsDtoTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/conversation/models/v1/credentials/ConversationChannelCredentialsDtoTest.java @@ -460,16 +460,17 @@ public class ConversationChannelCredentialsDtoTest extends ConversationBaseTest .setCredentialOrdinalNumber(0) .build(); - @GivenTextResource("/domains/conversation/v1/credentials/ConversationChannelViberRequestDto.json") - String jsonConversationChannelViberRequestDto; + @GivenTextResource( + "/domains/conversation/v1/credentials/ConversationChannelSinchChatRequestDto.json") + String jsonConversationChannelSinchChatRequestDto; @GivenJsonResource( - "/domains/conversation/v1/credentials/ConversationChannelViberResponseDto.json") - ConversationChannelCredentials loadedConversationChannelViberDto; + "/domains/conversation/v1/credentials/ConversationChannelSinchChatResponseDto.json") + ConversationChannelCredentials loadedConversationChannelSinchChatDto; - public static ConversationChannelCredentials conversationChannelViberResponseDto = + public static ConversationChannelCredentials conversationChannelSinchChatResponseDto = ConversationChannelCredentials.builder() - .setChannel(ConversationChannel.VIBER) + .setChannel(ConversationChannel.SINCH_CHAT) .setCallbackSecret("callback secret") .setChannelKnownId("channel id") .setState( @@ -477,14 +478,12 @@ public class ConversationChannelCredentialsDtoTest extends ConversationBaseTest .setStatus(ChannelIntegrationStatus.PENDING) .setDescription("description value") .build()) - .setCredentials(StaticTokenCredentials.builder().setToken("viberChannel token").build()) .setCredentialOrdinalNumber(0) .build(); - public static ConversationChannelCredentials conversationChannelViberRequestDto = + public static ConversationChannelCredentials conversationChannelSinchChatRequestDto = ConversationChannelCredentials.builder() - .setChannel(ConversationChannel.VIBER) + .setChannel(ConversationChannel.SINCH_CHAT) .setCallbackSecret("callback secret") - .setCredentials(StaticTokenCredentials.builder().setToken("viberChannel token").build()) .setCredentialOrdinalNumber(0) .build(); @@ -774,16 +773,17 @@ void deserializeConversationChannelTelegramDto() { } @Test - void serializeConversationChannelViberDto() throws JsonProcessingException, JSONException { - String serializedString = objectMapper.writeValueAsString(conversationChannelViberRequestDto); + void serializeConversationChannelSinchChatDto() throws JsonProcessingException, JSONException { + String serializedString = + objectMapper.writeValueAsString(conversationChannelSinchChatRequestDto); - JSONAssert.assertEquals(jsonConversationChannelViberRequestDto, serializedString, true); + JSONAssert.assertEquals(jsonConversationChannelSinchChatRequestDto, serializedString, true); } @Test - void deserializeConversationChannelViberDto() { + void deserializeConversationChannelSinchChatDto() { TestHelpers.recursiveEquals( - loadedConversationChannelViberDto, conversationChannelViberResponseDto); + loadedConversationChannelSinchChatDto, conversationChannelSinchChatResponseDto); } @Test diff --git a/openapi-contracts/src/test/resources/domains/conversation/v1/credentials/ConversationChannelSinchChatRequestDto.json b/openapi-contracts/src/test/resources/domains/conversation/v1/credentials/ConversationChannelSinchChatRequestDto.json new file mode 100644 index 000000000..657332bb5 --- /dev/null +++ b/openapi-contracts/src/test/resources/domains/conversation/v1/credentials/ConversationChannelSinchChatRequestDto.json @@ -0,0 +1,5 @@ +{ + "channel": "SINCH_CHAT", + "callback_secret": "callback secret", + "credential_ordinal_number": 0 +} diff --git a/openapi-contracts/src/test/resources/domains/conversation/v1/credentials/ConversationChannelViberResponseDto.json b/openapi-contracts/src/test/resources/domains/conversation/v1/credentials/ConversationChannelSinchChatResponseDto.json similarity index 70% rename from openapi-contracts/src/test/resources/domains/conversation/v1/credentials/ConversationChannelViberResponseDto.json rename to openapi-contracts/src/test/resources/domains/conversation/v1/credentials/ConversationChannelSinchChatResponseDto.json index a9a4cb5ac..dddf819c4 100644 --- a/openapi-contracts/src/test/resources/domains/conversation/v1/credentials/ConversationChannelViberResponseDto.json +++ b/openapi-contracts/src/test/resources/domains/conversation/v1/credentials/ConversationChannelSinchChatResponseDto.json @@ -1,8 +1,5 @@ { - "channel": "VIBER", - "static_token": { - "token": "viberChannel token" - }, + "channel": "SINCH_CHAT", "callback_secret": "callback secret", "state": { "status": "PENDING", diff --git a/openapi-contracts/src/test/resources/domains/conversation/v1/credentials/ConversationChannelViberRequestDto.json b/openapi-contracts/src/test/resources/domains/conversation/v1/credentials/ConversationChannelViberRequestDto.json deleted file mode 100644 index 28e7e5682..000000000 --- a/openapi-contracts/src/test/resources/domains/conversation/v1/credentials/ConversationChannelViberRequestDto.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "channel": "VIBER", - "static_token": { - "token": "viberChannel token" - }, - "callback_secret": "callback secret", - "credential_ordinal_number": 0 -} diff --git a/sample-app/src/main/java/com/sinch/sample/conversation/application/Create.java b/sample-app/src/main/java/com/sinch/sample/conversation/application/Create.java index 6c5351acd..232e7539c 100644 --- a/sample-app/src/main/java/com/sinch/sample/conversation/application/Create.java +++ b/sample-app/src/main/java/com/sinch/sample/conversation/application/Create.java @@ -122,11 +122,6 @@ public void run() { TelegramCredentials.builder().setToken("telegramChannel token").build()) .build(); - var viberChannel = - ConversationChannelCredentialsBuilderFactory.viber( - StaticTokenCredentials.builder().setToken("viberChannel token").build()) - .build(); - var viberBMChannel = ConversationChannelCredentialsBuilderFactory.viberBm( StaticBearerCredentials.builder() @@ -164,7 +159,6 @@ public void run() { rcsChannel, smsChannel, telegramChannel, - viberChannel, viberBMChannel, wechatChannel, whatsAppChannel); From 9a824211f483b3e81a9856a15bc79337abd17a7f Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier Date: Fri, 29 Aug 2025 08:36:24 +0200 Subject: [PATCH 019/122] test (Verification/WhatsApp): Update e2e tests for WhatsApp --- .../domains/verification/v1/ReportSteps.java | 43 +++++++++++++++++++ .../domains/verification/v1/StartSteps.java | 43 +++++++++++++++++++ 2 files changed, 86 insertions(+) diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/verification/v1/ReportSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/verification/v1/ReportSteps.java index ab7aec71b..dfde1a726 100644 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/verification/v1/ReportSteps.java +++ b/client/src/test/java/com/sinch/sdk/e2e/domains/verification/v1/ReportSteps.java @@ -8,10 +8,12 @@ import com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestFlashCall; import com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestPhoneCall; import com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestSms; +import com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestWhatsApp; import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponse; import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponseFlashCall; import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponsePhoneCall; import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponseSms; +import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponseWhatsApp; import com.sinch.sdk.e2e.Config; import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; @@ -26,6 +28,8 @@ public class ReportSteps { VerificationReportResponse reportCalloutByIdentityResponse; VerificationReportResponse reportFlashCallByIdResponse; VerificationReportResponse reportFlashCallByIdentityResponse; + VerificationReportResponse reportWhatsAppByIdResponse; + VerificationReportResponse reportWhatsAppByIdentityResponse; @Given("^the Verification service \"Report\" is available$") public void serviceAvailable() { @@ -100,6 +104,29 @@ public void reportFlashCallByIdentity(String phoneNumber) { service.reportFlashCallByIdentity(NumberIdentity.valueOf(phoneNumber), request); } + @When( + "I send a request to report a WhatsApp verification by \"ID\" with the verification ID" + + " {string}") + public void reportWhatsAppById(String id) { + + VerificationReportRequestWhatsApp request = + VerificationReportRequestWhatsApp.builder().setCode("1234").build(); + + reportWhatsAppByIdResponse = service.reportWhatsAppById(id, request); + } + + @When( + "I send a request to report a WhatsApp verification by \"identity\" with the phone number" + + " {string}") + public void reportWhatsAppByIdentity(String phoneNumber) { + + VerificationReportRequestWhatsApp request = + VerificationReportRequestWhatsApp.builder().setCode("5678").build(); + + reportWhatsAppByIdentityResponse = + service.reportWhatsAppByIdentity(NumberIdentity.valueOf(phoneNumber), request); + } + @Then("the response by {string} contains the details of an SMS verification report") public void reportSmsResult(String by) { VerificationReportResponse expected = null; @@ -158,4 +185,20 @@ public void reportFlashCallFailedResult() { .setReason(VerificationStatusReason.EXPIRED) .build()); } + + @Then("the response by {string} contains the details of a WhatsApp verification report") + public void reportWhatsAppResult(String by) { + VerificationReportResponse expected = null; + if (by.equals("ID")) { + expected = reportWhatsAppByIdResponse; + } else if (by.equals("identity")) { + expected = reportWhatsAppByIdentityResponse; + } + TestHelpers.recursiveEquals( + expected, + VerificationReportResponseWhatsApp.builder() + .setId("1ce0ffee-c0de-5eed-d33d-f00dfeed1337") + .setStatus(VerificationStatus.SUCCESSFUL) + .build()); + } } diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/verification/v1/StartSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/verification/v1/StartSteps.java index 16136574a..bc6c3414c 100644 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/verification/v1/StartSteps.java +++ b/client/src/test/java/com/sinch/sdk/e2e/domains/verification/v1/StartSteps.java @@ -5,17 +5,20 @@ import com.sinch.sdk.domains.verification.api.v1.VerificationStartService; import com.sinch.sdk.domains.verification.models.v1.NumberIdentity; 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.start.request.VerificationStartRequestData; import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestFlashCall; import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestPhoneCall; import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestSms; +import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestWhatsApp; import com.sinch.sdk.domains.verification.models.v1.start.response.Link; import com.sinch.sdk.domains.verification.models.v1.start.response.Link.RelEnum; import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponse; import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseFlashCall; import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponsePhoneCall; import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseSms; +import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponseWhatsApp; import com.sinch.sdk.e2e.Config; import com.sinch.sdk.models.E164PhoneNumber; import io.cucumber.java.en.Given; @@ -30,6 +33,8 @@ public class StartSteps { VerificationStartResponse startVerificationBySmsResponse; VerificationStartResponse startVerificationByPhoneCallResponse; VerificationStartResponse startVerificationByFlashCallResponse; + VerificationStartResponse startVerificationByWhatsAppResponse; + ApiException startSeamlessException; @Given("^the Verification service \"Start\" is available$") @@ -89,6 +94,19 @@ public void startData() { } } + @When("I send a request to start a verification with WhatsApp") + public void startWhatsApp() { + + VerificationStartRequestWhatsApp request = + VerificationStartRequestWhatsApp.builder() + .setIdentity(NumberIdentity.valueOf("+33123456789")) + .setCodeType(WhatsAppCodeType.NUMERIC) + .putExtraOption("fooKey", "foo value") + .build(); + + startVerificationByWhatsAppResponse = service.startWhatsApp(request); + } + @Then("the response contains the details of a verification started with a SMS") public void startSmsResult() { @@ -179,4 +197,29 @@ public void startDataResult() { "Seamless verification not available for given destination." + " (reference=c01dc0de-c4db-44f1-5ca1-da9159d21c191)")); } + + @Then("the response contains the details of a verification started with WhatsApp") + public void startWhatsAppResult() { + + TestHelpers.recursiveEquals( + startVerificationByWhatsAppResponse, + VerificationStartResponseWhatsApp.builder() + .setId("1ce0ffee-c0de-5eed-d33d-f00dfeed1337") + .setCodeType(null) + .setLinks( + Arrays.asList( + Link.builder() + .setRel(RelEnum.STATUS) + .setHref( + "http://localhost:3018/verification/v1/verifications/id/1ce0ffee-c0de-5eed-d33d-f00dfeed1337") + .setMethod("GET") + .build(), + Link.builder() + .setRel(RelEnum.REPORT) + .setHref( + "http://localhost:3018/verification/v1/verifications/id/1ce0ffee-c0de-5eed-d33d-f00dfeed1337") + .setMethod("PUT") + .build())) + .build()); + } } From 825551ae24271dca5a81951d32a91091b1aaf186 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier <141755467+JPPortier@users.noreply.github.com> Date: Wed, 3 Sep 2025 16:02:08 +0200 Subject: [PATCH 020/122] DEVEXP-1096: W36 OAS synch (#272) * doc: W36 OAS Synch * feat (Conversation): W36 OAS Synch. Support 'message_properties' onto 'CardMessage' --- .../api/v1/internal/MessagesApi.java | 6 +- .../models/v1/ChannelIdentity.java | 8 +- .../models/v1/app/SmartConversation.java | 5 +- .../request/InjectMessageRequestBase.java | 6 +- .../internal/ConversationMessageInternal.java | 6 +- ...nnelSpecificMessageHeaderInternalImpl.java | 28 +----- .../v1/messages/types/card/CardMessage.java | 16 ++++ .../messages/types/card/CardMessageImpl.java | 24 +++++ .../types/card/MessageProperties.java | 56 ++++++++++++ .../types/card/MessagePropertiesImpl.java | 90 +++++++++++++++++++ .../types/internal/CardMessageInternal.java | 17 ++++ .../internal/CardMessageInternalImpl.java | 39 ++++++-- .../domains/mailgun/api/v1/EmailsService.java | 13 +-- .../v1/emails/request/OverrideProperties.java | 14 +-- .../SendEmailHtmlInTemplateRequest.java | 2 +- .../emails/request/SendMimeEmailRequest.java | 2 +- .../v1/emails/request/TemplateProperties.java | 2 +- .../emails/request/TrueFalseHtmlonlyEnum.java | 2 +- ...cheduledVoiceProvisioningInternalImpl.java | 22 +---- .../VoiceConfigurationInternalImpl.java | 18 +--- .../internal/BatchResponseInternalImpl.java | 18 +--- .../BatchDeliveryReportOneOfImpl.java | 13 +-- .../RecipientDeliveryReportOneOfImpl.java | 15 +--- .../internal/InboundInternalImpl.java | 18 +--- .../internal/WebhookEventOneOfImpl.java | 41 +-------- ...VerificationReportRequestInternalImpl.java | 32 +------ ...erificationReportResponseInternalImpl.java | 34 +------ ...VerificationStartFlashCallOptionsImpl.java | 6 +- ...VerificationStartPhoneCallOptionsImpl.java | 6 +- .../VerificationStartRequestInternalImpl.java | 34 +------ .../VerificationStartSmsOptionsImpl.java | 7 +- .../VerificationStartWhatsAppOptionsImpl.java | 6 +- ...tionStartResponseFlashCallContentImpl.java | 11 +-- ...VerificationStartResponseInternalImpl.java | 38 +------- ...rificationStartResponseSmsContentImpl.java | 7 +- ...ationStartResponseWhatsAppContentImpl.java | 6 +- ...erificationStatusResponseInternalImpl.java | 34 +------ ...uestEventResponseFlashCallContentImpl.java | 7 +- ...uestEventResponsePhoneCallContentImpl.java | 6 +- ...ionRequestEventResponseSmsContentImpl.java | 7 +- ...questEventResponseWhatsAppContentImpl.java | 6 +- .../internal/CalloutRequestInternalImpl.java | 19 +--- .../internal/DestinationInternalImpl.java | 23 +---- .../internal/SvamlActionInternalImpl.java | 9 -- .../SvamlInstructionInternalImpl.java | 7 -- .../internal/WebhooksEventInternalImpl.java | 28 +----- .../types/card/CardMessageDtoTest.java | 55 +++++++++++- .../types/card/MessagePropertiesDtoTest.java | 34 +++++++ ...ithMessagePropertiesWhatsAppHeaderDto.json | 48 ++++++++++ .../types/card/MessagePropertiesDto.json | 3 + 50 files changed, 448 insertions(+), 506 deletions(-) create mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/card/MessageProperties.java create mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/card/MessagePropertiesImpl.java create mode 100644 openapi-contracts/src/test/java/com/sinch/sdk/domains/conversation/models/v1/messages/types/card/MessagePropertiesDtoTest.java create mode 100644 openapi-contracts/src/test/resources/domains/conversation/v1/messages/types/card/CardMessageWithMessagePropertiesWhatsAppHeaderDto.json create mode 100644 openapi-contracts/src/test/resources/domains/conversation/v1/messages/types/card/MessagePropertiesDto.json diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/api/v1/internal/MessagesApi.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/api/v1/internal/MessagesApi.java index ed79a3bda..ea94690f7 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/api/v1/internal/MessagesApi.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/api/v1/internal/MessagesApi.java @@ -59,8 +59,10 @@ public MessagesApi( } /** - * Delete a message Delete a specific message by its ID. Note: Removing all messages of a - * conversation will not automatically delete the conversation. + * Delete a message Delete a specific message by its ID. Note that this operation deletes the + * message from Conversation API storage; this operation does not affect messages already + * delivered to recipients' handsets. Also note that removing all messages of a conversation + * will not automatically delete the conversation. * * @param projectId The unique ID of the project. You can find this on the [Sinch * Dashboard](https://dashboard.sinch.com/convapi/apps). (required) diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/ChannelIdentity.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/ChannelIdentity.java index 7fedf8cb6..9f786d3a3 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/ChannelIdentity.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/ChannelIdentity.java @@ -21,10 +21,10 @@ public interface ChannelIdentity { /** * Required if using a channel that uses app-scoped channel identities. Currently, FB Messenger, - * Viber Bot, Instagram, Apple Messages for Business, LINE, and WeChat use app-scoped channel - * identities, which means contacts will have different channel identities on different - * Conversation API apps. These can be thought of as virtual identities that are app-specific and, - * therefore, the app_id must be included in the API call. + * Instagram, LINE, and WeChat use app-scoped channel identities, which means contacts will have + * different channel identities on different Conversation API apps. These can be thought of as + * virtual identities that are app-specific and, therefore, the app_id must be included in the API + * call. * * @return appId */ diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/app/SmartConversation.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/app/SmartConversation.java index 3e5234f51..d7a742f18 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/app/SmartConversation.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/app/SmartConversation.java @@ -12,10 +12,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -/** - * This object is required for apps that subscribe to Smart Conversations features. Note that this - * functionality is available for open beta testing. - */ +/** This object is required for apps that subscribe to Smart Conversations features. */ @JsonDeserialize(builder = SmartConversationImpl.Builder.class) public interface SmartConversation { diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/conversation/request/InjectMessageRequestBase.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/conversation/request/InjectMessageRequestBase.java index db1643efa..7caba7fd2 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/conversation/request/InjectMessageRequestBase.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/conversation/request/InjectMessageRequestBase.java @@ -65,8 +65,10 @@ public interface InjectMessageRequestBase { String getConversationId(); /** - * For Contact Messages the sender ID is the contact sent the message to. For App Messages the - * sender that was used to send the message, if applicable. + * For Contact Messages (MO messages), the sender ID represents the recipient to which the message + * was sent. This may be a phone number (in the case of SMS and MMS) or a unique ID (in the case + * of WhatsApp). This is field is not supported on all channels, nor is it supported for MT + * messages. * * @return senderId */ diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/internal/ConversationMessageInternal.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/internal/ConversationMessageInternal.java index df7286da9..34be0ba90 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/internal/ConversationMessageInternal.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/internal/ConversationMessageInternal.java @@ -95,8 +95,10 @@ public interface ConversationMessageInternal { Boolean getInjected(); /** - * For Contact Messages the sender ID is the contact sent the message to. For App Messages the - * sender that was used to send the message, if applicable. + * For Contact Messages (MO messages), the sender ID represents the recipient to which the message + * was sent. This may be a phone number (in the case of SMS and MMS) or a unique ID (in the case + * of WhatsApp). This is field is not supported on all channels, nor is it supported for MT + * messages. * * @return senderId */ diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/internal/FlowChannelSpecificMessageHeaderInternalImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/internal/FlowChannelSpecificMessageHeaderInternalImpl.java index e65b6b2c1..281d317ad 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/internal/FlowChannelSpecificMessageHeaderInternalImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/internal/FlowChannelSpecificMessageHeaderInternalImpl.java @@ -108,35 +108,13 @@ public FlowChannelSpecificMessageHeaderInternalImpl deserialize( tree.traverse(jp.getCodec()).readValueAs(WhatsAppInteractiveHeaderVideoImpl.class); newFlowChannelSpecificMessageHeaderInternalImpl.setActualInstance(deserialized); return newFlowChannelSpecificMessageHeaderInternalImpl; - case "WhatsAppInteractiveDocumentHeader": - deserialized = - tree.traverse(jp.getCodec()).readValueAs(WhatsAppInteractiveHeaderDocumentImpl.class); - newFlowChannelSpecificMessageHeaderInternalImpl.setActualInstance(deserialized); - return newFlowChannelSpecificMessageHeaderInternalImpl; - case "WhatsAppInteractiveImageHeader": - deserialized = - tree.traverse(jp.getCodec()).readValueAs(WhatsAppInteractiveHeaderImageImpl.class); - newFlowChannelSpecificMessageHeaderInternalImpl.setActualInstance(deserialized); - return newFlowChannelSpecificMessageHeaderInternalImpl; - case "WhatsAppInteractiveTextHeader": - deserialized = - tree.traverse(jp.getCodec()).readValueAs(WhatsAppInteractiveHeaderTextImpl.class); - newFlowChannelSpecificMessageHeaderInternalImpl.setActualInstance(deserialized); - return newFlowChannelSpecificMessageHeaderInternalImpl; - case "WhatsAppInteractiveVideoHeader": - deserialized = - tree.traverse(jp.getCodec()).readValueAs(WhatsAppInteractiveHeaderVideoImpl.class); - newFlowChannelSpecificMessageHeaderInternalImpl.setActualInstance(deserialized); - return newFlowChannelSpecificMessageHeaderInternalImpl; default: log.log( Level.WARNING, String.format( "Failed to lookup discriminator value `%s` for" + " FlowChannelSpecificMessageHeaderInternalImpl. Possible values: document" - + " image text video WhatsAppInteractiveDocumentHeader" - + " WhatsAppInteractiveImageHeader WhatsAppInteractiveTextHeader" - + " WhatsAppInteractiveVideoHeader", + + " image text video", discriminatorValue)); } @@ -384,10 +362,6 @@ public FlowChannelSpecificMessageHeaderInternalImpl(WhatsAppInteractiveHeaderVid mappings.put("image", WhatsAppInteractiveHeaderImageImpl.class); mappings.put("text", WhatsAppInteractiveHeaderTextImpl.class); mappings.put("video", WhatsAppInteractiveHeaderVideoImpl.class); - mappings.put("WhatsAppInteractiveDocumentHeader", WhatsAppInteractiveHeaderDocumentImpl.class); - mappings.put("WhatsAppInteractiveImageHeader", WhatsAppInteractiveHeaderImageImpl.class); - mappings.put("WhatsAppInteractiveTextHeader", WhatsAppInteractiveHeaderTextImpl.class); - mappings.put("WhatsAppInteractiveVideoHeader", WhatsAppInteractiveHeaderVideoImpl.class); mappings.put( "ChannelSpecificCommonProps_header", FlowChannelSpecificMessageHeaderInternalImpl.class); JSONNavigator.registerDiscriminator( diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/card/CardMessage.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/card/CardMessage.java index f59f2f178..d4571f14f 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/card/CardMessage.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/card/CardMessage.java @@ -56,6 +56,13 @@ public interface CardMessage */ MediaMessage getMedia(); + /** + * Get messageProperties + * + * @return messageProperties + */ + MessageProperties getMessageProperties(); + /** * Getting builder * @@ -113,6 +120,15 @@ interface Builder { */ Builder setMedia(MediaMessage media); + /** + * see getter + * + * @param messageProperties see getter + * @return Current builder + * @see #getMessageProperties + */ + Builder setMessageProperties(MessageProperties messageProperties); + /** * Create instance * diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/card/CardMessageImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/card/CardMessageImpl.java index a0e2a59f9..9b4d356be 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/card/CardMessageImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/card/CardMessageImpl.java @@ -128,6 +128,24 @@ public OptionalValue media() { : OptionalValue.empty(); } + @JsonIgnore + public MessageProperties getMessageProperties() { + if (null == cardMessage + || !cardMessage.isPresent() + || null == cardMessage.get().getMessageProperties()) { + return null; + } + return cardMessage.get().getMessageProperties(); + } + + public OptionalValue messageProperties() { + return null != cardMessage && cardMessage.isPresent() + ? cardMessage + .map(f -> ((CardMessageInternalImpl) f).messageProperties()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + /** Return true if this CardMessageField object is equal to o. */ @Override public boolean equals(Object o) { @@ -207,6 +225,12 @@ public Builder setMedia(MediaMessage media) { return this; } + @JsonIgnore + public Builder setMessageProperties(MessageProperties messageProperties) { + getDelegatedBuilder().setMessageProperties(messageProperties); + return this; + } + private CardMessageInternal.Builder getDelegatedBuilder() { if (null == _delegatedBuilder) { this._delegatedBuilder = CardMessageInternal.builder(); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/card/MessageProperties.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/card/MessageProperties.java new file mode 100644 index 000000000..a20373d2a --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/card/MessageProperties.java @@ -0,0 +1,56 @@ +/* + * Conversation API | Sinch + * + * OpenAPI document version: 1.0 + * Contact: support@sinch.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit the class manually. + */ + +package com.sinch.sdk.domains.conversation.models.v1.messages.types.card; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** Optional additional properties. */ +@JsonDeserialize(builder = MessagePropertiesImpl.Builder.class) +public interface MessageProperties { + + /** + * Optional. Sets the header for the footer of a WhatsApp reply button message, if there is no + * media in the message. Ignored for other channels. Ignored if not transcoded to a native + * WhatsApp message with reply buttons. + * + * @return whatsappHeader + */ + String getWhatsappHeader(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new MessagePropertiesImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param whatsappHeader see getter + * @return Current builder + * @see #getWhatsappHeader + */ + Builder setWhatsappHeader(String whatsappHeader); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + MessageProperties build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/card/MessagePropertiesImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/card/MessagePropertiesImpl.java new file mode 100644 index 000000000..52188d1c4 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/card/MessagePropertiesImpl.java @@ -0,0 +1,90 @@ +package com.sinch.sdk.domains.conversation.models.v1.messages.types.card; + +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; +import com.sinch.sdk.core.models.OptionalValue; +import java.util.Objects; + +@JsonPropertyOrder({MessagePropertiesImpl.JSON_PROPERTY_WHATSAPP_HEADER}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class MessagePropertiesImpl implements MessageProperties { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_WHATSAPP_HEADER = "whatsapp_header"; + + private OptionalValue whatsappHeader; + + public MessagePropertiesImpl() {} + + protected MessagePropertiesImpl(OptionalValue whatsappHeader) { + this.whatsappHeader = whatsappHeader; + } + + @JsonIgnore + public String getWhatsappHeader() { + return whatsappHeader.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_WHATSAPP_HEADER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue whatsappHeader() { + return whatsappHeader; + } + + /** Return true if this CardMessage_message_properties object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessagePropertiesImpl cardMessageMessageProperties = (MessagePropertiesImpl) o; + return Objects.equals(this.whatsappHeader, cardMessageMessageProperties.whatsappHeader); + } + + @Override + public int hashCode() { + return Objects.hash(whatsappHeader); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessagePropertiesImpl {\n"); + sb.append(" whatsappHeader: ").append(toIndentedString(whatsappHeader)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + @JsonPOJOBuilder(withPrefix = "set") + static class Builder implements MessageProperties.Builder { + OptionalValue whatsappHeader = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_WHATSAPP_HEADER) + public Builder setWhatsappHeader(String whatsappHeader) { + this.whatsappHeader = OptionalValue.of(whatsappHeader); + return this; + } + + public MessageProperties build() { + return new MessagePropertiesImpl(whatsappHeader); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/internal/CardMessageInternal.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/internal/CardMessageInternal.java index d5d475809..b61c5b0f2 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/internal/CardMessageInternal.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/internal/CardMessageInternal.java @@ -12,6 +12,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.sinch.sdk.domains.conversation.models.v1.messages.types.card.CardHeight; +import com.sinch.sdk.domains.conversation.models.v1.messages.types.card.MessageProperties; import com.sinch.sdk.domains.conversation.models.v1.messages.types.choice.Choice; import com.sinch.sdk.domains.conversation.models.v1.messages.types.media.MediaMessage; import java.util.List; @@ -55,6 +56,13 @@ public interface CardMessageInternal { */ MediaMessage getMedia(); + /** + * Get messageProperties + * + * @return messageProperties + */ + MessageProperties getMessageProperties(); + /** * Getting builder * @@ -112,6 +120,15 @@ interface Builder { */ Builder setMedia(MediaMessage media); + /** + * see getter + * + * @param messageProperties see getter + * @return Current builder + * @see #getMessageProperties + */ + Builder setMessageProperties(MessageProperties messageProperties); + /** * Create instance * diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/internal/CardMessageInternalImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/internal/CardMessageInternalImpl.java index 13efe3ac6..4ca615614 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/internal/CardMessageInternalImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/internal/CardMessageInternalImpl.java @@ -8,6 +8,7 @@ import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; import com.sinch.sdk.core.models.OptionalValue; import com.sinch.sdk.domains.conversation.models.v1.messages.types.card.CardHeight; +import com.sinch.sdk.domains.conversation.models.v1.messages.types.card.MessageProperties; import com.sinch.sdk.domains.conversation.models.v1.messages.types.choice.Choice; import com.sinch.sdk.domains.conversation.models.v1.messages.types.media.MediaMessage; import java.util.List; @@ -18,7 +19,8 @@ CardMessageInternalImpl.JSON_PROPERTY_DESCRIPTION, CardMessageInternalImpl.JSON_PROPERTY_HEIGHT, CardMessageInternalImpl.JSON_PROPERTY_TITLE, - CardMessageInternalImpl.JSON_PROPERTY_MEDIA_MESSAGE + CardMessageInternalImpl.JSON_PROPERTY_MEDIA_MESSAGE, + CardMessageInternalImpl.JSON_PROPERTY_MESSAGE_PROPERTIES }) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) @@ -45,6 +47,10 @@ public class CardMessageInternalImpl implements CardMessageInternal { private OptionalValue media; + public static final String JSON_PROPERTY_MESSAGE_PROPERTIES = "message_properties"; + + private OptionalValue messageProperties; + public CardMessageInternalImpl() {} protected CardMessageInternalImpl( @@ -52,12 +58,14 @@ protected CardMessageInternalImpl( OptionalValue description, OptionalValue height, OptionalValue title, - OptionalValue media) { + OptionalValue media, + OptionalValue messageProperties) { this.choices = choices; this.description = description; this.height = height; this.title = title; this.media = media; + this.messageProperties = messageProperties; } @JsonIgnore @@ -115,6 +123,17 @@ public OptionalValue media() { return media; } + @JsonIgnore + public MessageProperties getMessageProperties() { + return messageProperties.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_MESSAGE_PROPERTIES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue messageProperties() { + return messageProperties; + } + /** Return true if this CardMessage object is equal to o. */ @Override public boolean equals(Object o) { @@ -129,12 +148,13 @@ public boolean equals(Object o) { && Objects.equals(this.description, cardMessage.description) && Objects.equals(this.height, cardMessage.height) && Objects.equals(this.title, cardMessage.title) - && Objects.equals(this.media, cardMessage.media); + && Objects.equals(this.media, cardMessage.media) + && Objects.equals(this.messageProperties, cardMessage.messageProperties); } @Override public int hashCode() { - return Objects.hash(choices, description, height, title, media); + return Objects.hash(choices, description, height, title, media, messageProperties); } @Override @@ -146,6 +166,7 @@ public String toString() { sb.append(" height: ").append(toIndentedString(height)).append("\n"); sb.append(" title: ").append(toIndentedString(title)).append("\n"); sb.append(" media: ").append(toIndentedString(media)).append("\n"); + sb.append(" messageProperties: ").append(toIndentedString(messageProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -167,6 +188,7 @@ static class Builder implements CardMessageInternal.Builder { OptionalValue height = OptionalValue.empty(); OptionalValue title = OptionalValue.empty(); OptionalValue media = OptionalValue.empty(); + OptionalValue messageProperties = OptionalValue.empty(); @JsonProperty(JSON_PROPERTY_CHOICES) public Builder setChoices(List> choices) { @@ -198,8 +220,15 @@ public Builder setMedia(MediaMessage media) { return this; } + @JsonProperty(JSON_PROPERTY_MESSAGE_PROPERTIES) + public Builder setMessageProperties(MessageProperties messageProperties) { + this.messageProperties = OptionalValue.of(messageProperties); + return this; + } + public CardMessageInternal build() { - return new CardMessageInternalImpl(choices, description, height, title, media); + return new CardMessageInternalImpl( + choices, description, height, title, media, messageProperties); } } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/api/v1/EmailsService.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/api/v1/EmailsService.java index 358be75a5..84a524b11 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/api/v1/EmailsService.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/api/v1/EmailsService.java @@ -47,10 +47,11 @@ public interface EmailsService { /** * Send an email * - *

Pass the components of the messages such as To, From, Subject, HTML and text parts, - * attachments, etc. Mailgun will build a MIME representation of the message and send it. Note: In - * order to send you must provide one of the following parameters: 'text', 'html', - * 'amp-html' or 'template' + *

Pass the components of the messages such as To, From, Subject, HTML, text parts, + * attachments, etc. Mailgun will build a MIME representation of the message and send it. In order + * to send you must provide one of the following parameters: 'text', 'html', + * 'amp-html' or 'template'. Important: Send options (parameters starting with o:, + * h:, v:, or t:) are limited to 16KB total * * @param domainName Domain name used to send the message (required) * @param requestParameters Request parameters @@ -63,8 +64,8 @@ SendEmailResponse sendEmail(String domainName, SendEmailRequest requestParameter /** * Send an email in MIME format * - *

Build a MIME string yourself using a MIME library for your programming language and submit - * it to Mailgun. + *

Build a MIME string yourself using a MIME library and submit it to Mailgun. Important: Send + * options (parameters starting with o:, h:, v:, or t:) are limited to 16KB total * * @param domainName Domain name used to send the message (required) * @param requestParameters Request parameters diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/OverrideProperties.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/OverrideProperties.java index ac69192d6..29c00664c 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/OverrideProperties.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/OverrideProperties.java @@ -22,7 +22,7 @@ public interface OverrideProperties { /** * Tag string. See Tagging + * href="https://documentation.mailgun.com/docs/mailgun/user-manual/tracking-messages/track-tagging">Tagging * for more information * * @return tag @@ -34,7 +34,7 @@ public interface OverrideProperties { * of hours in [0-9]+h format, with the minimum being 24h and the * maximum being 72h. This value defines the time window in which Mailgun will run * the optimization algorithm based on prior engagement data of a given recipient. See Sending + * href="https://documentation.mailgun.com/docs/mailgun/user-manual/sending-messages/send-sto">Sending * a Message with STO for details. Please note that STO is only available on certain * plans. See www.mailgun.com/pricing for more info * @@ -73,7 +73,7 @@ public interface OverrideProperties { /** * Specifies the scheduled delivery time in RFC-2822 + * href="https://documentation.mailgun.com/docs/mailgun/api-reference/api-overview#date-format">RFC-2822 * format. Depending on your plan, you can schedule messages up to 3 or 7 days in advance. If * your domain has a custom message_ttl (time-to-live) setting, this value determines the maximum * scheduling duration. Example: 'Fri, 14 Oct 2011 12:00:00 +0000' @@ -86,7 +86,7 @@ public interface OverrideProperties { * Toggles Timezone Optimization (TZO) on a per message basis. String should be set to preferred * delivery time in HH:mm or hh:mmaa format, where HH:mm is * used for 24 hour format without AM/PM and hh:mmaa is used for 12 hour format with AM/PM. See Sending + * href="https://documentation.mailgun.com/docs/mailgun/user-manual/sending-messages/send-tzo">Sending * a Message with TZO for details. Please note that TZO is only available on certain * plans. See www.mailgun.com/pricing for more info * @@ -96,7 +96,7 @@ public interface OverrideProperties { /** * Toggles click tracking on a per-message basis, see Tracking + * href="https://documentation.mailgun.com/docs/mailgun/user-manual/tracking-messages/tracking-clicks">Tracking * Clicks. This overrides the domain-level click tracking setting. * * @return trackingClicks @@ -112,7 +112,7 @@ public interface OverrideProperties { /** * Toggles opens tracking on a per-message basis, see Tracking + * href="https://documentation.mailgun.com/docs/mailgun/user-manual/tracking-messages/tracking-opens">Tracking * Opens. Has higher priority than domain-level setting. * * @return trackingOpens @@ -163,7 +163,7 @@ public interface OverrideProperties { /** * Enables sending in test mode. Messages are processed normally but not actually delivered to * recipients. Useful for testing without sending real emails. See Sending + * href="https://documentation.mailgun.com/docs/mailgun/user-manual/sending-messages/test-mode">Sending * in Test Mode * * @return testMode diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailHtmlInTemplateRequest.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailHtmlInTemplateRequest.java index 5ef03884c..db64fae5e 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailHtmlInTemplateRequest.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailHtmlInTemplateRequest.java @@ -137,7 +137,7 @@ public interface SendEmailHtmlInTemplateRequest extends SendEmailRequest { /** * Name of a template stored via the Templates API to use to render the email body. See Templates + * href="https://documentation.mailgun.com/docs/mailgun/user-manual/sending-messages/send-templates">Templates * for more information * * @return template diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendMimeEmailRequest.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendMimeEmailRequest.java index 182070238..6a78576f1 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendMimeEmailRequest.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendMimeEmailRequest.java @@ -45,7 +45,7 @@ public interface SendMimeEmailRequest { /** * Name of a template stored via template API to use to render the email body. See Templates + * href="https://documentation.mailgun.com/docs/mailgun/user-manual/sending-messages/send-templates">Templates * for more information * * @return template diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/TemplateProperties.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/TemplateProperties.java index d2dd08c14..e1705242e 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/TemplateProperties.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/TemplateProperties.java @@ -39,7 +39,7 @@ public interface TemplateProperties { /** * A valid JSON-encoded dictionary used as the input for template variable expansion. See Templates + * href="https://documentation.mailgun.com/docs/mailgun/user-manual/sending-messages/send-templates">Templates * for more information * * @return variables diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/TrueFalseHtmlonlyEnum.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/TrueFalseHtmlonlyEnum.java index 6a655fd7d..391f03e14 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/TrueFalseHtmlonlyEnum.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/TrueFalseHtmlonlyEnum.java @@ -7,7 +7,7 @@ /** * Toggles click tracking on a per-message basis, see Tracking + * href="https://documentation.mailgun.com/docs/mailgun/user-manual/tracking-messages/tracking-clicks">Tracking * Clicks. This overrides the domain-level click tracking setting. */ public class TrueFalseHtmlonlyEnum extends EnumDynamic { diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/internal/ScheduledVoiceProvisioningInternalImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/internal/ScheduledVoiceProvisioningInternalImpl.java index e782d1e98..e0264d639 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/internal/ScheduledVoiceProvisioningInternalImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/internal/ScheduledVoiceProvisioningInternalImpl.java @@ -102,29 +102,12 @@ public ScheduledVoiceProvisioningInternalImpl deserialize( tree.traverse(jp.getCodec()).readValueAs(ScheduledVoiceProvisioningRTCImpl.class); newScheduledVoiceProvisioningInternalImpl.setActualInstance(deserialized); return newScheduledVoiceProvisioningInternalImpl; - case "ScheduledVoiceProvisioningEST": - deserialized = - tree.traverse(jp.getCodec()).readValueAs(ScheduledVoiceProvisioningESTImpl.class); - newScheduledVoiceProvisioningInternalImpl.setActualInstance(deserialized); - return newScheduledVoiceProvisioningInternalImpl; - case "ScheduledVoiceProvisioningFAX": - deserialized = - tree.traverse(jp.getCodec()).readValueAs(ScheduledVoiceProvisioningFAXImpl.class); - newScheduledVoiceProvisioningInternalImpl.setActualInstance(deserialized); - return newScheduledVoiceProvisioningInternalImpl; - case "ScheduledVoiceProvisioningRTC": - deserialized = - tree.traverse(jp.getCodec()).readValueAs(ScheduledVoiceProvisioningRTCImpl.class); - newScheduledVoiceProvisioningInternalImpl.setActualInstance(deserialized); - return newScheduledVoiceProvisioningInternalImpl; default: log.log( Level.WARNING, String.format( "Failed to lookup discriminator value `%s` for" - + " ScheduledVoiceProvisioningInternalImpl. Possible values: EST FAX RTC" - + " ScheduledVoiceProvisioningEST ScheduledVoiceProvisioningFAX" - + " ScheduledVoiceProvisioningRTC", + + " ScheduledVoiceProvisioningInternalImpl. Possible values: EST FAX RTC", discriminatorValue)); } @@ -314,9 +297,6 @@ public ScheduledVoiceProvisioningInternalImpl(ScheduledVoiceProvisioningRTCImpl mappings.put("EST", ScheduledVoiceProvisioningESTImpl.class); mappings.put("FAX", ScheduledVoiceProvisioningFAXImpl.class); mappings.put("RTC", ScheduledVoiceProvisioningRTCImpl.class); - mappings.put("ScheduledVoiceProvisioningEST", ScheduledVoiceProvisioningESTImpl.class); - mappings.put("ScheduledVoiceProvisioningFAX", ScheduledVoiceProvisioningFAXImpl.class); - mappings.put("ScheduledVoiceProvisioningRTC", ScheduledVoiceProvisioningRTCImpl.class); mappings.put("ScheduledVoiceProvisioning", ScheduledVoiceProvisioningInternalImpl.class); JSONNavigator.registerDiscriminator( ScheduledVoiceProvisioningInternalImpl.class, "type", mappings); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/internal/VoiceConfigurationInternalImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/internal/VoiceConfigurationInternalImpl.java index ad1f6d8a5..1cab03238 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/internal/VoiceConfigurationInternalImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/internal/VoiceConfigurationInternalImpl.java @@ -92,25 +92,12 @@ public VoiceConfigurationInternalImpl deserialize(JsonParser jp, Deserialization deserialized = tree.traverse(jp.getCodec()).readValueAs(VoiceConfigurationRTCImpl.class); newVoiceConfigurationInternalImpl.setActualInstance(deserialized); return newVoiceConfigurationInternalImpl; - case "VoiceConfigurationEST": - deserialized = tree.traverse(jp.getCodec()).readValueAs(VoiceConfigurationESTImpl.class); - newVoiceConfigurationInternalImpl.setActualInstance(deserialized); - return newVoiceConfigurationInternalImpl; - case "VoiceConfigurationFAX": - deserialized = tree.traverse(jp.getCodec()).readValueAs(VoiceConfigurationFAXImpl.class); - newVoiceConfigurationInternalImpl.setActualInstance(deserialized); - return newVoiceConfigurationInternalImpl; - case "VoiceConfigurationRTC": - deserialized = tree.traverse(jp.getCodec()).readValueAs(VoiceConfigurationRTCImpl.class); - newVoiceConfigurationInternalImpl.setActualInstance(deserialized); - return newVoiceConfigurationInternalImpl; default: log.log( Level.WARNING, String.format( "Failed to lookup discriminator value `%s` for VoiceConfigurationInternalImpl." - + " Possible values: EST FAX RTC VoiceConfigurationEST VoiceConfigurationFAX" - + " VoiceConfigurationRTC", + + " Possible values: EST FAX RTC", discriminatorValue)); } @@ -294,9 +281,6 @@ public VoiceConfigurationInternalImpl(VoiceConfigurationRTCImpl o) { mappings.put("EST", VoiceConfigurationESTImpl.class); mappings.put("FAX", VoiceConfigurationFAXImpl.class); mappings.put("RTC", VoiceConfigurationRTCImpl.class); - mappings.put("VoiceConfigurationEST", VoiceConfigurationESTImpl.class); - mappings.put("VoiceConfigurationFAX", VoiceConfigurationFAXImpl.class); - mappings.put("VoiceConfigurationRTC", VoiceConfigurationRTCImpl.class); mappings.put("VoiceConfiguration", VoiceConfigurationInternalImpl.class); JSONNavigator.registerDiscriminator(VoiceConfigurationInternalImpl.class, "type", mappings); } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/response/internal/BatchResponseInternalImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/response/internal/BatchResponseInternalImpl.java index 57d7e0cea..9c6d1d322 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/response/internal/BatchResponseInternalImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/response/internal/BatchResponseInternalImpl.java @@ -88,25 +88,12 @@ public BatchResponseInternalImpl deserialize(JsonParser jp, DeserializationConte deserialized = tree.traverse(jp.getCodec()).readValueAs(TextResponseImpl.class); newBatchResponseInternalImpl.setActualInstance(deserialized); return newBatchResponseInternalImpl; - case "BinaryResponse": - deserialized = tree.traverse(jp.getCodec()).readValueAs(BinaryResponseImpl.class); - newBatchResponseInternalImpl.setActualInstance(deserialized); - return newBatchResponseInternalImpl; - case "MediaResponse": - deserialized = tree.traverse(jp.getCodec()).readValueAs(MediaResponseImpl.class); - newBatchResponseInternalImpl.setActualInstance(deserialized); - return newBatchResponseInternalImpl; - case "TextResponse": - deserialized = tree.traverse(jp.getCodec()).readValueAs(TextResponseImpl.class); - newBatchResponseInternalImpl.setActualInstance(deserialized); - return newBatchResponseInternalImpl; default: log.log( Level.WARNING, String.format( "Failed to lookup discriminator value `%s` for BatchResponseInternalImpl." - + " Possible values: mt_binary mt_media mt_text BinaryResponse MediaResponse" - + " TextResponse", + + " Possible values: mt_binary mt_media mt_text", discriminatorValue)); } @@ -286,9 +273,6 @@ public BatchResponseInternalImpl(TextResponseImpl o) { mappings.put("mt_binary", BinaryResponseImpl.class); mappings.put("mt_media", MediaResponseImpl.class); mappings.put("mt_text", TextResponseImpl.class); - mappings.put("BinaryResponse", BinaryResponseImpl.class); - mappings.put("MediaResponse", MediaResponseImpl.class); - mappings.put("TextResponse", TextResponseImpl.class); mappings.put("Batch", BatchResponseInternalImpl.class); JSONNavigator.registerDiscriminator(BatchResponseInternalImpl.class, "type", mappings); } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/internal/BatchDeliveryReportOneOfImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/internal/BatchDeliveryReportOneOfImpl.java index 2783481a5..b7c19f6b3 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/internal/BatchDeliveryReportOneOfImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/internal/BatchDeliveryReportOneOfImpl.java @@ -85,21 +85,12 @@ public BatchDeliveryReportOneOfImpl deserialize(JsonParser jp, DeserializationCo deserialized = tree.traverse(jp.getCodec()).readValueAs(BatchDeliveryReportSMSImpl.class); newBatchDeliveryReportOneOfImpl.setActualInstance(deserialized); return newBatchDeliveryReportOneOfImpl; - case "BatchDeliveryReportMMS": - deserialized = tree.traverse(jp.getCodec()).readValueAs(BatchDeliveryReportMMSImpl.class); - newBatchDeliveryReportOneOfImpl.setActualInstance(deserialized); - return newBatchDeliveryReportOneOfImpl; - case "BatchDeliveryReportSMS": - deserialized = tree.traverse(jp.getCodec()).readValueAs(BatchDeliveryReportSMSImpl.class); - newBatchDeliveryReportOneOfImpl.setActualInstance(deserialized); - return newBatchDeliveryReportOneOfImpl; default: log.log( Level.WARNING, String.format( "Failed to lookup discriminator value `%s` for BatchDeliveryReportOneOfImpl." - + " Possible values: delivery_report_mms delivery_report_sms" - + " BatchDeliveryReportMMS BatchDeliveryReportSMS", + + " Possible values: delivery_report_mms delivery_report_sms", discriminatorValue)); } @@ -235,8 +226,6 @@ public BatchDeliveryReportOneOfImpl(BatchDeliveryReportSMSImpl o) { Map> mappings = new HashMap>(); mappings.put("delivery_report_mms", BatchDeliveryReportMMSImpl.class); mappings.put("delivery_report_sms", BatchDeliveryReportSMSImpl.class); - mappings.put("BatchDeliveryReportMMS", BatchDeliveryReportMMSImpl.class); - mappings.put("BatchDeliveryReportSMS", BatchDeliveryReportSMSImpl.class); mappings.put("BatchDeliveryReportOneOf", BatchDeliveryReportOneOfImpl.class); JSONNavigator.registerDiscriminator(BatchDeliveryReportOneOfImpl.class, "type", mappings); } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/internal/RecipientDeliveryReportOneOfImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/internal/RecipientDeliveryReportOneOfImpl.java index 0f0d10b3b..49c630ecb 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/internal/RecipientDeliveryReportOneOfImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/internal/RecipientDeliveryReportOneOfImpl.java @@ -89,24 +89,13 @@ public RecipientDeliveryReportOneOfImpl deserialize(JsonParser jp, Deserializati tree.traverse(jp.getCodec()).readValueAs(RecipientDeliveryReportSMSImpl.class); newRecipientDeliveryReportOneOfImpl.setActualInstance(deserialized); return newRecipientDeliveryReportOneOfImpl; - case "RecipientDeliveryReportMMS": - deserialized = - tree.traverse(jp.getCodec()).readValueAs(RecipientDeliveryReportMMSImpl.class); - newRecipientDeliveryReportOneOfImpl.setActualInstance(deserialized); - return newRecipientDeliveryReportOneOfImpl; - case "RecipientDeliveryReportSMS": - deserialized = - tree.traverse(jp.getCodec()).readValueAs(RecipientDeliveryReportSMSImpl.class); - newRecipientDeliveryReportOneOfImpl.setActualInstance(deserialized); - return newRecipientDeliveryReportOneOfImpl; default: log.log( Level.WARNING, String.format( "Failed to lookup discriminator value `%s` for RecipientDeliveryReportOneOfImpl." + " Possible values: recipient_delivery_report_mms" - + " recipient_delivery_report_sms RecipientDeliveryReportMMS" - + " RecipientDeliveryReportSMS", + + " recipient_delivery_report_sms", discriminatorValue)); } @@ -246,8 +235,6 @@ public RecipientDeliveryReportOneOfImpl(RecipientDeliveryReportSMSImpl o) { Map> mappings = new HashMap>(); mappings.put("recipient_delivery_report_mms", RecipientDeliveryReportMMSImpl.class); mappings.put("recipient_delivery_report_sms", RecipientDeliveryReportSMSImpl.class); - mappings.put("RecipientDeliveryReportMMS", RecipientDeliveryReportMMSImpl.class); - mappings.put("RecipientDeliveryReportSMS", RecipientDeliveryReportSMSImpl.class); mappings.put("RecipientDeliveryReportOneOf", RecipientDeliveryReportOneOfImpl.class); JSONNavigator.registerDiscriminator(RecipientDeliveryReportOneOfImpl.class, "type", mappings); } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/inbounds/response/internal/InboundInternalImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/inbounds/response/internal/InboundInternalImpl.java index 566856b6d..7a6a0cbee 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/inbounds/response/internal/InboundInternalImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/inbounds/response/internal/InboundInternalImpl.java @@ -87,25 +87,12 @@ public InboundInternalImpl deserialize(JsonParser jp, DeserializationContext ctx deserialized = tree.traverse(jp.getCodec()).readValueAs(TextMessageImpl.class); newInboundInternalImpl.setActualInstance(deserialized); return newInboundInternalImpl; - case "binary_message": - deserialized = tree.traverse(jp.getCodec()).readValueAs(BinaryMessageImpl.class); - newInboundInternalImpl.setActualInstance(deserialized); - return newInboundInternalImpl; - case "media_message": - deserialized = tree.traverse(jp.getCodec()).readValueAs(MediaMessageImpl.class); - newInboundInternalImpl.setActualInstance(deserialized); - return newInboundInternalImpl; - case "text_message": - deserialized = tree.traverse(jp.getCodec()).readValueAs(TextMessageImpl.class); - newInboundInternalImpl.setActualInstance(deserialized); - return newInboundInternalImpl; default: log.log( Level.WARNING, String.format( "Failed to lookup discriminator value `%s` for InboundInternalImpl. Possible" - + " values: mo_binary mo_media mo_text binary_message media_message" - + " text_message", + + " values: mo_binary mo_media mo_text", discriminatorValue)); } @@ -284,9 +271,6 @@ public InboundInternalImpl(TextMessageImpl o) { mappings.put("mo_binary", BinaryMessageImpl.class); mappings.put("mo_media", MediaMessageImpl.class); mappings.put("mo_text", TextMessageImpl.class); - mappings.put("binary_message", BinaryMessageImpl.class); - mappings.put("media_message", MediaMessageImpl.class); - mappings.put("text_message", TextMessageImpl.class); mappings.put("inbound", InboundInternalImpl.class); JSONNavigator.registerDiscriminator(InboundInternalImpl.class, "type", mappings); } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/webhooks/internal/WebhookEventOneOfImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/webhooks/internal/WebhookEventOneOfImpl.java index e43302547..24cb61bec 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/webhooks/internal/WebhookEventOneOfImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/webhooks/internal/WebhookEventOneOfImpl.java @@ -109,45 +109,13 @@ public WebhookEventOneOfImpl deserialize(JsonParser jp, DeserializationContext c tree.traverse(jp.getCodec()).readValueAs(RecipientDeliveryReportSMSImpl.class); newWebhookEventOneOfImpl.setActualInstance(deserialized); return newWebhookEventOneOfImpl; - case "BatchDeliveryReportMMS": - deserialized = tree.traverse(jp.getCodec()).readValueAs(BatchDeliveryReportMMSImpl.class); - newWebhookEventOneOfImpl.setActualInstance(deserialized); - return newWebhookEventOneOfImpl; - case "BatchDeliveryReportSMS": - deserialized = tree.traverse(jp.getCodec()).readValueAs(BatchDeliveryReportSMSImpl.class); - newWebhookEventOneOfImpl.setActualInstance(deserialized); - return newWebhookEventOneOfImpl; - case "RecipientDeliveryReportMMS": - deserialized = - tree.traverse(jp.getCodec()).readValueAs(RecipientDeliveryReportMMSImpl.class); - newWebhookEventOneOfImpl.setActualInstance(deserialized); - return newWebhookEventOneOfImpl; - case "RecipientDeliveryReportSMS": - deserialized = - tree.traverse(jp.getCodec()).readValueAs(RecipientDeliveryReportSMSImpl.class); - newWebhookEventOneOfImpl.setActualInstance(deserialized); - return newWebhookEventOneOfImpl; - case "binary_message": - deserialized = tree.traverse(jp.getCodec()).readValueAs(BinaryMessageImpl.class); - newWebhookEventOneOfImpl.setActualInstance(deserialized); - return newWebhookEventOneOfImpl; - case "media_message": - deserialized = tree.traverse(jp.getCodec()).readValueAs(MediaMessageImpl.class); - newWebhookEventOneOfImpl.setActualInstance(deserialized); - return newWebhookEventOneOfImpl; - case "text_message": - deserialized = tree.traverse(jp.getCodec()).readValueAs(TextMessageImpl.class); - newWebhookEventOneOfImpl.setActualInstance(deserialized); - return newWebhookEventOneOfImpl; default: log.log( Level.WARNING, String.format( "Failed to lookup discriminator value `%s` for WebhookEventOneOfImpl. Possible" + " values: delivery_report_mms delivery_report_sms mo_binary mo_media" - + " mo_text recipient_delivery_report_mms recipient_delivery_report_sms" - + " BatchDeliveryReportMMS BatchDeliveryReportSMS RecipientDeliveryReportMMS" - + " RecipientDeliveryReportSMS binary_message media_message text_message", + + " mo_text recipient_delivery_report_mms recipient_delivery_report_sms", discriminatorValue)); } @@ -523,13 +491,6 @@ public WebhookEventOneOfImpl(TextMessageImpl o) { mappings.put("mo_text", TextMessageImpl.class); mappings.put("recipient_delivery_report_mms", RecipientDeliveryReportMMSImpl.class); mappings.put("recipient_delivery_report_sms", RecipientDeliveryReportSMSImpl.class); - mappings.put("BatchDeliveryReportMMS", BatchDeliveryReportMMSImpl.class); - mappings.put("BatchDeliveryReportSMS", BatchDeliveryReportSMSImpl.class); - mappings.put("RecipientDeliveryReportMMS", RecipientDeliveryReportMMSImpl.class); - mappings.put("RecipientDeliveryReportSMS", RecipientDeliveryReportSMSImpl.class); - mappings.put("binary_message", BinaryMessageImpl.class); - mappings.put("media_message", MediaMessageImpl.class); - mappings.put("text_message", TextMessageImpl.class); mappings.put("WebhookEventOneOf", WebhookEventOneOfImpl.class); JSONNavigator.registerDiscriminator(WebhookEventOneOfImpl.class, "type", mappings); } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/internal/VerificationReportRequestInternalImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/internal/VerificationReportRequestInternalImpl.java index c72d1aa65..597529584 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/internal/VerificationReportRequestInternalImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/internal/VerificationReportRequestInternalImpl.java @@ -109,37 +109,13 @@ public VerificationReportRequestInternalImpl deserialize( tree.traverse(jp.getCodec()).readValueAs(VerificationReportRequestWhatsAppImpl.class); newVerificationReportRequestInternalImpl.setActualInstance(deserialized); return newVerificationReportRequestInternalImpl; - case "VerificationReportRequestFlashCall": - deserialized = - tree.traverse(jp.getCodec()) - .readValueAs(VerificationReportRequestFlashCallImpl.class); - newVerificationReportRequestInternalImpl.setActualInstance(deserialized); - return newVerificationReportRequestInternalImpl; - case "VerificationReportRequestPhoneCall": - deserialized = - tree.traverse(jp.getCodec()) - .readValueAs(VerificationReportRequestPhoneCallImpl.class); - newVerificationReportRequestInternalImpl.setActualInstance(deserialized); - return newVerificationReportRequestInternalImpl; - case "VerificationReportRequestSms": - deserialized = - tree.traverse(jp.getCodec()).readValueAs(VerificationReportRequestSmsImpl.class); - newVerificationReportRequestInternalImpl.setActualInstance(deserialized); - return newVerificationReportRequestInternalImpl; - case "VerificationReportRequestWhatsApp": - deserialized = - tree.traverse(jp.getCodec()).readValueAs(VerificationReportRequestWhatsAppImpl.class); - newVerificationReportRequestInternalImpl.setActualInstance(deserialized); - return newVerificationReportRequestInternalImpl; default: log.log( Level.WARNING, String.format( "Failed to lookup discriminator value `%s` for" + " VerificationReportRequestInternalImpl. Possible values: callout flashcall" - + " sms whatsapp VerificationReportRequestFlashCall" - + " VerificationReportRequestPhoneCall VerificationReportRequestSms" - + " VerificationReportRequestWhatsApp", + + " sms whatsapp", discriminatorValue)); } @@ -392,12 +368,6 @@ public VerificationReportRequestInternalImpl(VerificationReportRequestWhatsAppIm mappings.put("flashcall", VerificationReportRequestFlashCallImpl.class); mappings.put("sms", VerificationReportRequestSmsImpl.class); mappings.put("whatsapp", VerificationReportRequestWhatsAppImpl.class); - mappings.put( - "VerificationReportRequestFlashCall", VerificationReportRequestFlashCallImpl.class); - mappings.put( - "VerificationReportRequestPhoneCall", VerificationReportRequestPhoneCallImpl.class); - mappings.put("VerificationReportRequestSms", VerificationReportRequestSmsImpl.class); - mappings.put("VerificationReportRequestWhatsApp", VerificationReportRequestWhatsAppImpl.class); mappings.put("VerificationReportRequest", VerificationReportRequestInternalImpl.class); JSONNavigator.registerDiscriminator( VerificationReportRequestInternalImpl.class, "method", mappings); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/response/internal/VerificationReportResponseInternalImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/response/internal/VerificationReportResponseInternalImpl.java index b48c655e4..7ce6223e6 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/response/internal/VerificationReportResponseInternalImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/response/internal/VerificationReportResponseInternalImpl.java @@ -111,38 +111,13 @@ public VerificationReportResponseInternalImpl deserialize( .readValueAs(VerificationReportResponseWhatsAppImpl.class); newVerificationReportResponseInternalImpl.setActualInstance(deserialized); return newVerificationReportResponseInternalImpl; - case "VerificationReportResponseFlashCall": - deserialized = - tree.traverse(jp.getCodec()) - .readValueAs(VerificationReportResponseFlashCallImpl.class); - newVerificationReportResponseInternalImpl.setActualInstance(deserialized); - return newVerificationReportResponseInternalImpl; - case "VerificationReportResponsePhoneCall": - deserialized = - tree.traverse(jp.getCodec()) - .readValueAs(VerificationReportResponsePhoneCallImpl.class); - newVerificationReportResponseInternalImpl.setActualInstance(deserialized); - return newVerificationReportResponseInternalImpl; - case "VerificationReportResponseSms": - deserialized = - tree.traverse(jp.getCodec()).readValueAs(VerificationReportResponseSmsImpl.class); - newVerificationReportResponseInternalImpl.setActualInstance(deserialized); - return newVerificationReportResponseInternalImpl; - case "VerificationReportResponseWhatsApp": - deserialized = - tree.traverse(jp.getCodec()) - .readValueAs(VerificationReportResponseWhatsAppImpl.class); - newVerificationReportResponseInternalImpl.setActualInstance(deserialized); - return newVerificationReportResponseInternalImpl; default: log.log( Level.WARNING, String.format( "Failed to lookup discriminator value `%s` for" + " VerificationReportResponseInternalImpl. Possible values: callout" - + " flashcall sms whatsapp VerificationReportResponseFlashCall" - + " VerificationReportResponsePhoneCall VerificationReportResponseSms" - + " VerificationReportResponseWhatsApp", + + " flashcall sms whatsapp", discriminatorValue)); } @@ -397,13 +372,6 @@ public VerificationReportResponseInternalImpl(VerificationReportResponseWhatsApp mappings.put("flashcall", VerificationReportResponseFlashCallImpl.class); mappings.put("sms", VerificationReportResponseSmsImpl.class); mappings.put("whatsapp", VerificationReportResponseWhatsAppImpl.class); - mappings.put( - "VerificationReportResponseFlashCall", VerificationReportResponseFlashCallImpl.class); - mappings.put( - "VerificationReportResponsePhoneCall", VerificationReportResponsePhoneCallImpl.class); - mappings.put("VerificationReportResponseSms", VerificationReportResponseSmsImpl.class); - mappings.put( - "VerificationReportResponseWhatsApp", VerificationReportResponseWhatsAppImpl.class); mappings.put("VerificationReportResponse", VerificationReportResponseInternalImpl.class); JSONNavigator.registerDiscriminator( VerificationReportResponseInternalImpl.class, "method", mappings); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartFlashCallOptionsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartFlashCallOptionsImpl.java index f2c56899f..039429687 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartFlashCallOptionsImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartFlashCallOptionsImpl.java @@ -107,20 +107,18 @@ public boolean equals(Object o) { verificationStartRequestFlashCallAllOfFlashCallOptions.interceptionTimeout) && Objects.equals( this.additionalProperties, - verificationStartRequestFlashCallAllOfFlashCallOptions.additionalProperties) - && super.equals(o); + verificationStartRequestFlashCallAllOfFlashCallOptions.additionalProperties); } @Override public int hashCode() { - return Objects.hash(dialTimeout, interceptionTimeout, super.hashCode(), additionalProperties); + return Objects.hash(dialTimeout, interceptionTimeout, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class VerificationStartFlashCallOptionsImpl {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" dialTimeout: ").append(toIndentedString(dialTimeout)).append("\n"); sb.append(" interceptionTimeout: ") .append(toIndentedString(interceptionTimeout)) diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartPhoneCallOptionsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartPhoneCallOptionsImpl.java index 6dccf2018..847ffcfab 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartPhoneCallOptionsImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartPhoneCallOptionsImpl.java @@ -84,20 +84,18 @@ public boolean equals(Object o) { return Objects.equals(this.speech, verificationStartRequestPhoneCallAllOfCalloutOptions.speech) && Objects.equals( this.additionalProperties, - verificationStartRequestPhoneCallAllOfCalloutOptions.additionalProperties) - && super.equals(o); + verificationStartRequestPhoneCallAllOfCalloutOptions.additionalProperties); } @Override public int hashCode() { - return Objects.hash(speech, super.hashCode(), additionalProperties); + return Objects.hash(speech, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class VerificationStartPhoneCallOptionsImpl {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" speech: ").append(toIndentedString(speech)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartRequestInternalImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartRequestInternalImpl.java index c4d3405ff..19136b88d 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartRequestInternalImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartRequestInternalImpl.java @@ -110,40 +110,13 @@ public VerificationStartRequestInternalImpl deserialize( tree.traverse(jp.getCodec()).readValueAs(VerificationStartRequestWhatsAppImpl.class); newVerificationStartRequestInternalImpl.setActualInstance(deserialized); return newVerificationStartRequestInternalImpl; - case "VerificationStartRequestData": - deserialized = - tree.traverse(jp.getCodec()).readValueAs(VerificationStartRequestDataImpl.class); - newVerificationStartRequestInternalImpl.setActualInstance(deserialized); - return newVerificationStartRequestInternalImpl; - case "VerificationStartRequestFlashCall": - deserialized = - tree.traverse(jp.getCodec()).readValueAs(VerificationStartRequestFlashCallImpl.class); - newVerificationStartRequestInternalImpl.setActualInstance(deserialized); - return newVerificationStartRequestInternalImpl; - case "VerificationStartRequestPhoneCall": - deserialized = - tree.traverse(jp.getCodec()).readValueAs(VerificationStartRequestPhoneCallImpl.class); - newVerificationStartRequestInternalImpl.setActualInstance(deserialized); - return newVerificationStartRequestInternalImpl; - case "VerificationStartRequestSms": - deserialized = - tree.traverse(jp.getCodec()).readValueAs(VerificationStartRequestSmsImpl.class); - newVerificationStartRequestInternalImpl.setActualInstance(deserialized); - return newVerificationStartRequestInternalImpl; - case "VerificationStartRequestWhatsApp": - deserialized = - tree.traverse(jp.getCodec()).readValueAs(VerificationStartRequestWhatsAppImpl.class); - newVerificationStartRequestInternalImpl.setActualInstance(deserialized); - return newVerificationStartRequestInternalImpl; default: log.log( Level.WARNING, String.format( "Failed to lookup discriminator value `%s` for" + " VerificationStartRequestInternalImpl. Possible values: callout flashcall" - + " seamless sms whatsapp VerificationStartRequestData" - + " VerificationStartRequestFlashCall VerificationStartRequestPhoneCall" - + " VerificationStartRequestSms VerificationStartRequestWhatsApp", + + " seamless sms whatsapp", discriminatorValue)); } @@ -441,11 +414,6 @@ public VerificationStartRequestInternalImpl(VerificationStartRequestWhatsAppImpl mappings.put("seamless", VerificationStartRequestDataImpl.class); mappings.put("sms", VerificationStartRequestSmsImpl.class); mappings.put("whatsapp", VerificationStartRequestWhatsAppImpl.class); - mappings.put("VerificationStartRequestData", VerificationStartRequestDataImpl.class); - mappings.put("VerificationStartRequestFlashCall", VerificationStartRequestFlashCallImpl.class); - mappings.put("VerificationStartRequestPhoneCall", VerificationStartRequestPhoneCallImpl.class); - mappings.put("VerificationStartRequestSms", VerificationStartRequestSmsImpl.class); - mappings.put("VerificationStartRequestWhatsApp", VerificationStartRequestWhatsAppImpl.class); mappings.put("VerificationStartRequest", VerificationStartRequestInternalImpl.class); JSONNavigator.registerDiscriminator( VerificationStartRequestInternalImpl.class, "method", mappings); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartSmsOptionsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartSmsOptionsImpl.java index f027e34e3..3a5134313 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartSmsOptionsImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartSmsOptionsImpl.java @@ -136,21 +136,18 @@ public boolean equals(Object o) { this.acceptLanguage, verificationStartRequestSmsAllOfSmsOptions.acceptLanguage) && Objects.equals( this.additionalProperties, - verificationStartRequestSmsAllOfSmsOptions.additionalProperties) - && super.equals(o); + verificationStartRequestSmsAllOfSmsOptions.additionalProperties); } @Override public int hashCode() { - return Objects.hash( - codeType, expiry, template, acceptLanguage, super.hashCode(), additionalProperties); + return Objects.hash(codeType, expiry, template, acceptLanguage, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class VerificationStartSmsOptionsImpl {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" codeType: ").append(toIndentedString(codeType)).append("\n"); sb.append(" expiry: ").append(toIndentedString(expiry)).append("\n"); sb.append(" template: ").append(toIndentedString(template)).append("\n"); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartWhatsAppOptionsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartWhatsAppOptionsImpl.java index 4bba56780..d36a68988 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartWhatsAppOptionsImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartWhatsAppOptionsImpl.java @@ -85,20 +85,18 @@ public boolean equals(Object o) { this.codeType, verificationStartRequestWhatsAppAllOfWhatsappOptions.codeType) && Objects.equals( this.additionalProperties, - verificationStartRequestWhatsAppAllOfWhatsappOptions.additionalProperties) - && super.equals(o); + verificationStartRequestWhatsAppAllOfWhatsappOptions.additionalProperties); } @Override public int hashCode() { - return Objects.hash(codeType, super.hashCode(), additionalProperties); + return Objects.hash(codeType, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class VerificationStartWhatsAppOptionsImpl {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" codeType: ").append(toIndentedString(codeType)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseFlashCallContentImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseFlashCallContentImpl.java index d0790054e..8a5a2eee5 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseFlashCallContentImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseFlashCallContentImpl.java @@ -147,26 +147,19 @@ public boolean equals(Object o) { this.denyCallAfter, verificationStartResponseFlashCallAllOfFlashCall.denyCallAfter) && Objects.equals( this.additionalProperties, - verificationStartResponseFlashCallAllOfFlashCall.additionalProperties) - && super.equals(o); + verificationStartResponseFlashCallAllOfFlashCall.additionalProperties); } @Override public int hashCode() { return Objects.hash( - cliFilter, - interceptionTimeout, - reportTimeout, - denyCallAfter, - super.hashCode(), - additionalProperties); + cliFilter, interceptionTimeout, reportTimeout, denyCallAfter, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class VerificationStartResponseFlashCallContentImpl {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" cliFilter: ").append(toIndentedString(cliFilter)).append("\n"); sb.append(" interceptionTimeout: ") .append(toIndentedString(interceptionTimeout)) diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseInternalImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseInternalImpl.java index a411b11b3..1753bc48a 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseInternalImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseInternalImpl.java @@ -115,42 +115,13 @@ public VerificationStartResponseInternalImpl deserialize( tree.traverse(jp.getCodec()).readValueAs(VerificationStartResponseWhatsAppImpl.class); newVerificationStartResponseInternalImpl.setActualInstance(deserialized); return newVerificationStartResponseInternalImpl; - case "VerificationStartResponseData": - deserialized = - tree.traverse(jp.getCodec()).readValueAs(VerificationStartResponseDataImpl.class); - newVerificationStartResponseInternalImpl.setActualInstance(deserialized); - return newVerificationStartResponseInternalImpl; - case "VerificationStartResponseFlashCall": - deserialized = - tree.traverse(jp.getCodec()) - .readValueAs(VerificationStartResponseFlashCallImpl.class); - newVerificationStartResponseInternalImpl.setActualInstance(deserialized); - return newVerificationStartResponseInternalImpl; - case "VerificationStartResponsePhoneCall": - deserialized = - tree.traverse(jp.getCodec()) - .readValueAs(VerificationStartResponsePhoneCallImpl.class); - newVerificationStartResponseInternalImpl.setActualInstance(deserialized); - return newVerificationStartResponseInternalImpl; - case "VerificationStartResponseSms": - deserialized = - tree.traverse(jp.getCodec()).readValueAs(VerificationStartResponseSmsImpl.class); - newVerificationStartResponseInternalImpl.setActualInstance(deserialized); - return newVerificationStartResponseInternalImpl; - case "VerificationStartResponseWhatsApp": - deserialized = - tree.traverse(jp.getCodec()).readValueAs(VerificationStartResponseWhatsAppImpl.class); - newVerificationStartResponseInternalImpl.setActualInstance(deserialized); - return newVerificationStartResponseInternalImpl; default: log.log( Level.WARNING, String.format( "Failed to lookup discriminator value `%s` for" + " VerificationStartResponseInternalImpl. Possible values: callout flashcall" - + " seamless sms whatsapp VerificationStartResponseData" - + " VerificationStartResponseFlashCall VerificationStartResponsePhoneCall" - + " VerificationStartResponseSms VerificationStartResponseWhatsApp", + + " seamless sms whatsapp", discriminatorValue)); } @@ -453,13 +424,6 @@ public VerificationStartResponseInternalImpl(VerificationStartResponseWhatsAppIm mappings.put("seamless", VerificationStartResponseDataImpl.class); mappings.put("sms", VerificationStartResponseSmsImpl.class); mappings.put("whatsapp", VerificationStartResponseWhatsAppImpl.class); - mappings.put("VerificationStartResponseData", VerificationStartResponseDataImpl.class); - mappings.put( - "VerificationStartResponseFlashCall", VerificationStartResponseFlashCallImpl.class); - mappings.put( - "VerificationStartResponsePhoneCall", VerificationStartResponsePhoneCallImpl.class); - mappings.put("VerificationStartResponseSms", VerificationStartResponseSmsImpl.class); - mappings.put("VerificationStartResponseWhatsApp", VerificationStartResponseWhatsAppImpl.class); mappings.put("VerificationStartResponse", VerificationStartResponseInternalImpl.class); JSONNavigator.registerDiscriminator( VerificationStartResponseInternalImpl.class, "method", mappings); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseSmsContentImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseSmsContentImpl.java index 8cad02c9e..25658fd8d 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseSmsContentImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseSmsContentImpl.java @@ -122,21 +122,18 @@ public boolean equals(Object o) { this.interceptionTimeout, verificationStartResponseSmsAllOfSms.interceptionTimeout) && Objects.equals(this.codeType, verificationStartResponseSmsAllOfSms.codeType) && Objects.equals( - this.additionalProperties, verificationStartResponseSmsAllOfSms.additionalProperties) - && super.equals(o); + this.additionalProperties, verificationStartResponseSmsAllOfSms.additionalProperties); } @Override public int hashCode() { - return Objects.hash( - template, interceptionTimeout, codeType, super.hashCode(), additionalProperties); + return Objects.hash(template, interceptionTimeout, codeType, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class VerificationStartResponseSmsContentImpl {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" template: ").append(toIndentedString(template)).append("\n"); sb.append(" interceptionTimeout: ") .append(toIndentedString(interceptionTimeout)) diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseWhatsAppContentImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseWhatsAppContentImpl.java index afb3fbc97..1597ab546 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseWhatsAppContentImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/internal/VerificationStartResponseWhatsAppContentImpl.java @@ -82,20 +82,18 @@ public boolean equals(Object o) { return Objects.equals(this.codeType, verificationStartResponseWhatsAppAllOfWhatsapp.codeType) && Objects.equals( this.additionalProperties, - verificationStartResponseWhatsAppAllOfWhatsapp.additionalProperties) - && super.equals(o); + verificationStartResponseWhatsAppAllOfWhatsapp.additionalProperties); } @Override public int hashCode() { - return Objects.hash(codeType, super.hashCode(), additionalProperties); + return Objects.hash(codeType, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class VerificationStartResponseWhatsAppContentImpl {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" codeType: ").append(toIndentedString(codeType)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/internal/VerificationStatusResponseInternalImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/internal/VerificationStatusResponseInternalImpl.java index 7ddecb828..f39be2475 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/internal/VerificationStatusResponseInternalImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/internal/VerificationStatusResponseInternalImpl.java @@ -111,38 +111,13 @@ public VerificationStatusResponseInternalImpl deserialize( .readValueAs(VerificationStatusResponseWhatsAppImpl.class); newVerificationStatusResponseInternalImpl.setActualInstance(deserialized); return newVerificationStatusResponseInternalImpl; - case "VerificationStatusResponseFlashCall": - deserialized = - tree.traverse(jp.getCodec()) - .readValueAs(VerificationStatusResponseFlashCallImpl.class); - newVerificationStatusResponseInternalImpl.setActualInstance(deserialized); - return newVerificationStatusResponseInternalImpl; - case "VerificationStatusResponsePhoneCall": - deserialized = - tree.traverse(jp.getCodec()) - .readValueAs(VerificationStatusResponsePhoneCallImpl.class); - newVerificationStatusResponseInternalImpl.setActualInstance(deserialized); - return newVerificationStatusResponseInternalImpl; - case "VerificationStatusResponseSms": - deserialized = - tree.traverse(jp.getCodec()).readValueAs(VerificationStatusResponseSmsImpl.class); - newVerificationStatusResponseInternalImpl.setActualInstance(deserialized); - return newVerificationStatusResponseInternalImpl; - case "VerificationStatusResponseWhatsApp": - deserialized = - tree.traverse(jp.getCodec()) - .readValueAs(VerificationStatusResponseWhatsAppImpl.class); - newVerificationStatusResponseInternalImpl.setActualInstance(deserialized); - return newVerificationStatusResponseInternalImpl; default: log.log( Level.WARNING, String.format( "Failed to lookup discriminator value `%s` for" + " VerificationStatusResponseInternalImpl. Possible values: callout" - + " flashcall sms whatsapp VerificationStatusResponseFlashCall" - + " VerificationStatusResponsePhoneCall VerificationStatusResponseSms" - + " VerificationStatusResponseWhatsApp", + + " flashcall sms whatsapp", discriminatorValue)); } @@ -397,13 +372,6 @@ public VerificationStatusResponseInternalImpl(VerificationStatusResponseWhatsApp mappings.put("flashcall", VerificationStatusResponseFlashCallImpl.class); mappings.put("sms", VerificationStatusResponseSmsImpl.class); mappings.put("whatsapp", VerificationStatusResponseWhatsAppImpl.class); - mappings.put( - "VerificationStatusResponseFlashCall", VerificationStatusResponseFlashCallImpl.class); - mappings.put( - "VerificationStatusResponsePhoneCall", VerificationStatusResponsePhoneCallImpl.class); - mappings.put("VerificationStatusResponseSms", VerificationStatusResponseSmsImpl.class); - mappings.put( - "VerificationStatusResponseWhatsApp", VerificationStatusResponseWhatsAppImpl.class); mappings.put("VerificationStatusResponse", VerificationStatusResponseInternalImpl.class); JSONNavigator.registerDiscriminator( VerificationStatusResponseInternalImpl.class, "method", mappings); 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/webhooks/internal/VerificationRequestEventResponseFlashCallContentImpl.java index 8736c592f..51a11cb3b 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/webhooks/internal/VerificationRequestEventResponseFlashCallContentImpl.java @@ -128,21 +128,18 @@ public boolean equals(Object o) { verificationRequestEventResponseFlashCallAllOfFlashCall.interceptionTimeout) && Objects.equals( this.additionalProperties, - verificationRequestEventResponseFlashCallAllOfFlashCall.additionalProperties) - && super.equals(o); + verificationRequestEventResponseFlashCallAllOfFlashCall.additionalProperties); } @Override public int hashCode() { - return Objects.hash( - cli, dialTimeout, interceptionTimeout, super.hashCode(), additionalProperties); + return Objects.hash(cli, dialTimeout, interceptionTimeout, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class VerificationRequestEventResponseFlashCallContentImpl {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" cli: ").append(toIndentedString(cli)).append("\n"); sb.append(" dialTimeout: ").append(toIndentedString(dialTimeout)).append("\n"); sb.append(" interceptionTimeout: ") 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/webhooks/internal/VerificationRequestEventResponsePhoneCallContentImpl.java index 03f54b24d..c91b0cb45 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/webhooks/internal/VerificationRequestEventResponsePhoneCallContentImpl.java @@ -107,20 +107,18 @@ public boolean equals(Object o) { && Objects.equals(this.speech, verificationRequestEventResponsePhoneCallAllOfCallout.speech) && Objects.equals( this.additionalProperties, - verificationRequestEventResponsePhoneCallAllOfCallout.additionalProperties) - && super.equals(o); + verificationRequestEventResponsePhoneCallAllOfCallout.additionalProperties); } @Override public int hashCode() { - return Objects.hash(code, speech, super.hashCode(), additionalProperties); + return Objects.hash(code, speech, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class VerificationRequestEventResponsePhoneCallContentImpl {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" code: ").append(toIndentedString(code)).append("\n"); sb.append(" speech: ").append(toIndentedString(speech)).append("\n"); sb.append(" additionalProperties: ") 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/webhooks/internal/VerificationRequestEventResponseSmsContentImpl.java index 2de8637cb..1f03822f7 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/webhooks/internal/VerificationRequestEventResponseSmsContentImpl.java @@ -143,21 +143,18 @@ public boolean equals(Object o) { this.acceptLanguage, verificationRequestEventResponseSmsAllOfSms.acceptLanguage) && Objects.equals( this.additionalProperties, - verificationRequestEventResponseSmsAllOfSms.additionalProperties) - && super.equals(o); + verificationRequestEventResponseSmsAllOfSms.additionalProperties); } @Override public int hashCode() { - return Objects.hash( - code, codeType, expiry, acceptLanguage, super.hashCode(), additionalProperties); + return Objects.hash(code, codeType, expiry, acceptLanguage, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class VerificationRequestEventResponseSmsContentImpl {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\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"); 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/webhooks/internal/VerificationRequestEventResponseWhatsAppContentImpl.java index abeb5e319..142101863 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/webhooks/internal/VerificationRequestEventResponseWhatsAppContentImpl.java @@ -111,20 +111,18 @@ public boolean equals(Object o) { verificationRequestEventResponseWhatsAppAllOfWhatsapp.acceptLanguage) && Objects.equals( this.additionalProperties, - verificationRequestEventResponseWhatsAppAllOfWhatsapp.additionalProperties) - && super.equals(o); + verificationRequestEventResponseWhatsAppAllOfWhatsapp.additionalProperties); } @Override public int hashCode() { - return Objects.hash(codeType, acceptLanguage, super.hashCode(), additionalProperties); + return Objects.hash(codeType, acceptLanguage, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class VerificationRequestEventResponseWhatsAppContentImpl {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" codeType: ").append(toIndentedString(codeType)).append("\n"); sb.append(" acceptLanguage: ").append(toIndentedString(acceptLanguage)).append("\n"); sb.append(" additionalProperties: ") diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/internal/CalloutRequestInternalImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/internal/CalloutRequestInternalImpl.java index 71cbd0abe..776828e92 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/internal/CalloutRequestInternalImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/internal/CalloutRequestInternalImpl.java @@ -89,26 +89,12 @@ public CalloutRequestInternalImpl deserialize(JsonParser jp, DeserializationCont deserialized = tree.traverse(jp.getCodec()).readValueAs(CalloutRequestTTSImpl.class); newCalloutRequestInternalImpl.setActualInstance(deserialized); return newCalloutRequestInternalImpl; - case "conferenceCalloutRequest": - deserialized = - tree.traverse(jp.getCodec()).readValueAs(CalloutRequestConferenceImpl.class); - newCalloutRequestInternalImpl.setActualInstance(deserialized); - return newCalloutRequestInternalImpl; - case "customCalloutRequest": - deserialized = tree.traverse(jp.getCodec()).readValueAs(CalloutRequestCustomImpl.class); - newCalloutRequestInternalImpl.setActualInstance(deserialized); - return newCalloutRequestInternalImpl; - case "ttsCalloutRequest": - deserialized = tree.traverse(jp.getCodec()).readValueAs(CalloutRequestTTSImpl.class); - newCalloutRequestInternalImpl.setActualInstance(deserialized); - return newCalloutRequestInternalImpl; default: log.log( Level.WARNING, String.format( "Failed to lookup discriminator value `%s` for CalloutRequestInternalImpl." - + " Possible values: conferenceCallout customCallout ttsCallout" - + " conferenceCalloutRequest customCalloutRequest ttsCalloutRequest", + + " Possible values: conferenceCallout customCallout ttsCallout", discriminatorValue)); } @@ -292,9 +278,6 @@ public CalloutRequestInternalImpl(CalloutRequestTTSImpl o) { mappings.put("conferenceCallout", CalloutRequestConferenceImpl.class); mappings.put("customCallout", CalloutRequestCustomImpl.class); mappings.put("ttsCallout", CalloutRequestTTSImpl.class); - mappings.put("conferenceCalloutRequest", CalloutRequestConferenceImpl.class); - mappings.put("customCalloutRequest", CalloutRequestCustomImpl.class); - mappings.put("ttsCalloutRequest", CalloutRequestTTSImpl.class); mappings.put("CalloutRequest", CalloutRequestInternalImpl.class); JSONNavigator.registerDiscriminator(CalloutRequestInternalImpl.class, "method", mappings); } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/internal/DestinationInternalImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/internal/DestinationInternalImpl.java index 358df8367..4036c04b6 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/internal/DestinationInternalImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/internal/DestinationInternalImpl.java @@ -100,29 +100,12 @@ public DestinationInternalImpl deserialize(JsonParser jp, DeserializationContext deserialized = tree.traverse(jp.getCodec()).readValueAs(DestinationMxpImpl.class); newDestinationInternalImpl.setActualInstance(deserialized); return newDestinationInternalImpl; - case "destinationDid": - deserialized = tree.traverse(jp.getCodec()).readValueAs(DestinationDidImpl.class); - newDestinationInternalImpl.setActualInstance(deserialized); - return newDestinationInternalImpl; - case "destinationMxp": - deserialized = tree.traverse(jp.getCodec()).readValueAs(DestinationMxpImpl.class); - newDestinationInternalImpl.setActualInstance(deserialized); - return newDestinationInternalImpl; - case "destinationPstn": - deserialized = tree.traverse(jp.getCodec()).readValueAs(DestinationPstnImpl.class); - newDestinationInternalImpl.setActualInstance(deserialized); - return newDestinationInternalImpl; - case "destinationSip": - deserialized = tree.traverse(jp.getCodec()).readValueAs(DestinationSipImpl.class); - newDestinationInternalImpl.setActualInstance(deserialized); - return newDestinationInternalImpl; default: log.log( Level.WARNING, String.format( "Failed to lookup discriminator value `%s` for DestinationInternalImpl. Possible" - + " values: Number Username did number sip username destinationDid" - + " destinationMxp destinationPstn destinationSip", + + " values: Number Username did number sip username", discriminatorValue)); } @@ -351,10 +334,6 @@ public DestinationInternalImpl(DestinationSipImpl o) { mappings.put("number", DestinationPstnImpl.class); mappings.put("sip", DestinationSipImpl.class); mappings.put("username", DestinationMxpImpl.class); - mappings.put("destinationDid", DestinationDidImpl.class); - mappings.put("destinationMxp", DestinationMxpImpl.class); - mappings.put("destinationPstn", DestinationPstnImpl.class); - mappings.put("destinationSip", DestinationSipImpl.class); mappings.put("destination", DestinationInternalImpl.class); JSONNavigator.registerDiscriminator(DestinationInternalImpl.class, "type", mappings); } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/internal/SvamlActionInternalImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/internal/SvamlActionInternalImpl.java index dc6368151..7f8da59ca 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/internal/SvamlActionInternalImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/internal/SvamlActionInternalImpl.java @@ -270,15 +270,6 @@ public SvamlActionInternalImpl(SvamlActionRunMenuImpl o) { mappings.put("hangup", SvamlActionHangupImpl.class); mappings.put("park", SvamlActionParkImpl.class); mappings.put("runMenu", SvamlActionRunMenuImpl.class); - mappings.put("svaml.action.connectConf", SvamlActionConnectConferenceImpl.class); - mappings.put("svaml.action.connectMxp", SvamlActionConnectMxpImpl.class); - mappings.put("svaml.action.connectPstn", SvamlActionConnectPstnImpl.class); - mappings.put("svaml.action.connectSip", SvamlActionConnectSipImpl.class); - mappings.put("svaml.action.connectStream", SvamlActionConnectStreamImpl.class); - mappings.put("svaml.action.continue", SvamlActionContinueImpl.class); - mappings.put("svaml.action.hangup", SvamlActionHangupImpl.class); - mappings.put("svaml.action.park", SvamlActionParkImpl.class); - mappings.put("svaml.action.runMenu", SvamlActionRunMenuImpl.class); mappings.put("svaml.action", SvamlActionInternalImpl.class); JSONNavigator.registerDiscriminator(SvamlActionInternalImpl.class, "name", mappings); } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/internal/SvamlInstructionInternalImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/internal/SvamlInstructionInternalImpl.java index 941ff3e1b..c8e9f71cd 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/internal/SvamlInstructionInternalImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/internal/SvamlInstructionInternalImpl.java @@ -237,13 +237,6 @@ public SvamlInstructionInternalImpl(SvamlInstructionStopRecordingImpl o) { mappings.put("setCookie", SvamlInstructionSetCookieImpl.class); mappings.put("startRecording", SvamlInstructionStartRecordingImpl.class); mappings.put("stopRecording", SvamlInstructionStopRecordingImpl.class); - mappings.put("svaml.instruction.answer", SvamlInstructionAnswerImpl.class); - mappings.put("svaml.instruction.playFiles", SvamlInstructionPlayFilesImpl.class); - mappings.put("svaml.instruction.say", SvamlInstructionSayImpl.class); - mappings.put("svaml.instruction.sendDtmf", SvamlInstructionSendDtmfImpl.class); - mappings.put("svaml.instruction.setCookie", SvamlInstructionSetCookieImpl.class); - mappings.put("svaml.instruction.startRecording", SvamlInstructionStartRecordingImpl.class); - mappings.put("svaml.instruction.stopRecording", SvamlInstructionStopRecordingImpl.class); mappings.put("svaml.instruction", SvamlInstructionInternalImpl.class); JSONNavigator.registerDiscriminator(SvamlInstructionInternalImpl.class, "name", mappings); } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/internal/WebhooksEventInternalImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/internal/WebhooksEventInternalImpl.java index 3198f345f..777ebd611 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/internal/WebhooksEventInternalImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/internal/WebhooksEventInternalImpl.java @@ -98,33 +98,12 @@ public WebhooksEventInternalImpl deserialize(JsonParser jp, DeserializationConte deserialized = tree.traverse(jp.getCodec()).readValueAs(PromptInputEventImpl.class); newWebhooksEventInternalImpl.setActualInstance(deserialized); return newWebhooksEventInternalImpl; - case "aceRequest": - deserialized = tree.traverse(jp.getCodec()).readValueAs(AnsweredCallEventImpl.class); - newWebhooksEventInternalImpl.setActualInstance(deserialized); - return newWebhooksEventInternalImpl; - case "diceRequest": - deserialized = tree.traverse(jp.getCodec()).readValueAs(DisconnectedCallEventImpl.class); - newWebhooksEventInternalImpl.setActualInstance(deserialized); - return newWebhooksEventInternalImpl; - case "iceRequest": - deserialized = tree.traverse(jp.getCodec()).readValueAs(IncomingCallEventImpl.class); - newWebhooksEventInternalImpl.setActualInstance(deserialized); - return newWebhooksEventInternalImpl; - case "notifyRequest": - deserialized = tree.traverse(jp.getCodec()).readValueAs(NotificationEventImpl.class); - newWebhooksEventInternalImpl.setActualInstance(deserialized); - return newWebhooksEventInternalImpl; - case "pieRequest": - deserialized = tree.traverse(jp.getCodec()).readValueAs(PromptInputEventImpl.class); - newWebhooksEventInternalImpl.setActualInstance(deserialized); - return newWebhooksEventInternalImpl; default: log.log( Level.WARNING, String.format( "Failed to lookup discriminator value `%s` for WebhooksEventInternalImpl." - + " Possible values: ace dice ice notify pie aceRequest diceRequest" - + " iceRequest notifyRequest pieRequest", + + " Possible values: ace dice ice notify pie", discriminatorValue)); } @@ -403,11 +382,6 @@ public WebhooksEventInternalImpl(PromptInputEventImpl o) { mappings.put("ice", IncomingCallEventImpl.class); mappings.put("notify", NotificationEventImpl.class); mappings.put("pie", PromptInputEventImpl.class); - mappings.put("aceRequest", AnsweredCallEventImpl.class); - mappings.put("diceRequest", DisconnectedCallEventImpl.class); - mappings.put("iceRequest", IncomingCallEventImpl.class); - mappings.put("notifyRequest", NotificationEventImpl.class); - mappings.put("pieRequest", PromptInputEventImpl.class); mappings.put("webhooksEvent", WebhooksEventInternalImpl.class); JSONNavigator.registerDiscriminator(WebhooksEventInternalImpl.class, "event", mappings); } diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/conversation/models/v1/messages/types/card/CardMessageDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/conversation/models/v1/messages/types/card/CardMessageDtoTest.java index 61793d5c1..0beb16b6a 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/conversation/models/v1/messages/types/card/CardMessageDtoTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/conversation/models/v1/messages/types/card/CardMessageDtoTest.java @@ -3,6 +3,7 @@ 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.core.TestHelpers; import com.sinch.sdk.domains.conversation.api.v1.adapters.ConversationBaseTest; import com.sinch.sdk.domains.conversation.models.v1.messages.types.call.CallMessageDtoTest; import com.sinch.sdk.domains.conversation.models.v1.messages.types.choice.ChoiceCallMessage; @@ -14,7 +15,6 @@ import com.sinch.sdk.domains.conversation.models.v1.messages.types.text.TextMessageDtoTest; import com.sinch.sdk.domains.conversation.models.v1.messages.types.url.UrlMessageDtoTest; import java.util.Arrays; -import org.assertj.core.api.Assertions; import org.json.JSONException; import org.junit.jupiter.api.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -48,9 +48,40 @@ public class CardMessageDtoTest extends ConversationBaseTest { .build())) .build(); + public static CardMessage cardMessageWithMessagePropertiesWhatsAppHeaderDto = + CardMessage.builder() + .setTitle("title value") + .setDescription("description value") + .setMedia(MediaMessageDtoTest.mediaMessageDto) + .setHeight(CardHeight.MEDIUM) + .setChoices( + Arrays.asList( + ChoiceTextMessage.builder() + .setMessage(TextMessageDtoTest.textMessageDto) + .setPostbackData("postback_data text") + .build(), + ChoiceCallMessage.builder() + .setMessage(CallMessageDtoTest.callMessageDto) + .setPostbackData("postback_data call") + .build(), + ChoiceLocationMessage.builder() + .setMessage(LocationMessageDtoTest.locationMessageDto) + .setPostbackData("postback_data location") + .build(), + ChoiceURLMessage.builder() + .setMessage(UrlMessageDtoTest.urlMessageDto) + .setPostbackData("postback_data url") + .build())) + .setMessageProperties(MessagePropertiesDtoTest.messagePropertiesDto) + .build(); + @GivenTextResource("/domains/conversation/v1/messages/types/card/CardMessageDto.json") String jsonCardMessageDto; + @GivenTextResource( + "/domains/conversation/v1/messages/types/card/CardMessageWithMessagePropertiesWhatsAppHeaderDto.json") + String jsonCardMessageWithMessagePropertiesWhatsAppHeaderDto; + @Test void serializeMessageDto() throws JsonProcessingException, JSONException { String serializedString = objectMapper.writeValueAsString(cardMessageDto); @@ -62,6 +93,26 @@ void serializeMessageDto() throws JsonProcessingException, JSONException { void deserializeMessageDto() throws JsonProcessingException { Object deserialized = objectMapper.readValue(jsonCardMessageDto, CardMessage.class); - Assertions.assertThat(deserialized).usingRecursiveComparison().isEqualTo(cardMessageDto); + TestHelpers.recursiveEquals(deserialized, cardMessageDto); + } + + @Test + void serializeCardMessageWithMessagePropertiesWhatsAppHeaderDto() + throws JsonProcessingException, JSONException { + String serializedString = + objectMapper.writeValueAsString(cardMessageWithMessagePropertiesWhatsAppHeaderDto); + + JSONAssert.assertEquals( + jsonCardMessageWithMessagePropertiesWhatsAppHeaderDto, serializedString, true); + } + + @Test + void deserializeCardMessageWithMessagePropertiesWhatsAppHeaderDto() + throws JsonProcessingException { + Object deserialized = + objectMapper.readValue( + jsonCardMessageWithMessagePropertiesWhatsAppHeaderDto, CardMessage.class); + + TestHelpers.recursiveEquals(deserialized, cardMessageWithMessagePropertiesWhatsAppHeaderDto); } } diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/conversation/models/v1/messages/types/card/MessagePropertiesDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/conversation/models/v1/messages/types/card/MessagePropertiesDtoTest.java new file mode 100644 index 000000000..e39e10910 --- /dev/null +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/conversation/models/v1/messages/types/card/MessagePropertiesDtoTest.java @@ -0,0 +1,34 @@ +package com.sinch.sdk.domains.conversation.models.v1.messages.types.card; + +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.core.TestHelpers; +import com.sinch.sdk.domains.conversation.api.v1.adapters.ConversationBaseTest; +import org.json.JSONException; +import org.junit.jupiter.api.Test; +import org.skyscreamer.jsonassert.JSONAssert; + +@TestWithResources +public class MessagePropertiesDtoTest extends ConversationBaseTest { + + public static MessageProperties messagePropertiesDto = + MessageProperties.builder().setWhatsappHeader("WhatsApp Header value").build(); + + @GivenTextResource("/domains/conversation/v1/messages/types/card/MessagePropertiesDto.json") + String jsonMessagePropertiesDto; + + @Test + void serializeDto() throws JsonProcessingException, JSONException { + String serializedString = objectMapper.writeValueAsString(messagePropertiesDto); + + JSONAssert.assertEquals(jsonMessagePropertiesDto, serializedString, true); + } + + @Test + void deserializeDto() throws JsonProcessingException { + Object deserialized = objectMapper.readValue(jsonMessagePropertiesDto, MessageProperties.class); + + TestHelpers.recursiveEquals(deserialized, messagePropertiesDto); + } +} diff --git a/openapi-contracts/src/test/resources/domains/conversation/v1/messages/types/card/CardMessageWithMessagePropertiesWhatsAppHeaderDto.json b/openapi-contracts/src/test/resources/domains/conversation/v1/messages/types/card/CardMessageWithMessagePropertiesWhatsAppHeaderDto.json new file mode 100644 index 000000000..754dcf86b --- /dev/null +++ b/openapi-contracts/src/test/resources/domains/conversation/v1/messages/types/card/CardMessageWithMessagePropertiesWhatsAppHeaderDto.json @@ -0,0 +1,48 @@ +{ + "card_message": { + "title": "title value", + "description": "description value", + "media_message": { + "url": "an url value", + "thumbnail_url": "another url", + "filename_override": "filename override value" + }, + "message_properties": { + "whatsapp_header": "WhatsApp Header value" + }, + "height": "MEDIUM", + "choices": [ + { + "text_message": { + "text": "This is a text message." + }, + "postback_data": "postback_data text" + }, + { + "call_message": { + "title": "title value", + "phone_number": "phone number value" + }, + "postback_data": "postback_data call" + }, + { + "location_message": { + "coordinates": { + "latitude": 47.6279809, + "longitude": -2.8229159 + }, + "title": "title value", + "label": "label value" + }, + "postback_data": "postback_data location" + }, + { + "url_message": { + "title": "title value", + "url": "an url value" + }, + "postback_data": "postback_data url" + } + ] + } +} diff --git a/openapi-contracts/src/test/resources/domains/conversation/v1/messages/types/card/MessagePropertiesDto.json b/openapi-contracts/src/test/resources/domains/conversation/v1/messages/types/card/MessagePropertiesDto.json new file mode 100644 index 000000000..95b116931 --- /dev/null +++ b/openapi-contracts/src/test/resources/domains/conversation/v1/messages/types/card/MessagePropertiesDto.json @@ -0,0 +1,3 @@ +{ + "whatsapp_header": "WhatsApp Header value" +} From 40b223bec45efb97df722e57e3cb31474b9d9ca4 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier Date: Fri, 24 Oct 2025 11:23:54 +0200 Subject: [PATCH 021/122] test (e2e): Synch e2e (dummy) validation against latest mockserver version --- .../test/java/com/sinch/sdk/e2e/Config.java | 19 ++++++- .../domains/conversation/ConsentsSteps.java | 57 +++++++++++++++++++ .../domains/conversation/ContactsSteps.java | 36 ++++++++++++ .../conversation/ProjectSettingsSteps.java | 57 +++++++++++++++++++ .../sdk/e2e/domains/sms/v1/BatchesSteps.java | 7 +++ .../domains/sms/v1/DeliveryReportsSteps.java | 8 +++ .../sdk/e2e/domains/sms/v1/GroupsSteps.java | 7 +++ .../sdk/e2e/domains/sms/v1/InboundsSteps.java | 8 +++ 8 files changed, 198 insertions(+), 1 deletion(-) create mode 100644 client/src/test/java/com/sinch/sdk/e2e/domains/conversation/ConsentsSteps.java create mode 100644 client/src/test/java/com/sinch/sdk/e2e/domains/conversation/ProjectSettingsSteps.java diff --git a/client/src/test/java/com/sinch/sdk/e2e/Config.java b/client/src/test/java/com/sinch/sdk/e2e/Config.java index 8a4b5133e..023108747 100644 --- a/client/src/test/java/com/sinch/sdk/e2e/Config.java +++ b/client/src/test/java/com/sinch/sdk/e2e/Config.java @@ -6,6 +6,7 @@ import com.sinch.sdk.models.ConversationRegion; import com.sinch.sdk.models.MailgunContext; import com.sinch.sdk.models.NumbersContext; +import com.sinch.sdk.models.SMSRegion; import com.sinch.sdk.models.SmsContext; import com.sinch.sdk.models.VerificationContext; import com.sinch.sdk.models.VoiceContext; @@ -36,6 +37,7 @@ public class Config { public static final String VERIFICATION_HOST_NAME = "http://localhost:3018"; private final SinchClient client; + private final SinchClient clientServicePlanId; private Config() { @@ -63,12 +65,23 @@ private Config() { MailgunContext.builder().setStorageUrls(Arrays.asList(MAILGUN_STORAGE)).build()) .setMailgunApiKey(MAILGUN_API_KEY) .setMailgunUrl(MAILGUN_HOST_NAME) - .setSmsContext(SmsContext.builder().setSmsUrl(SMS_HOST_NAME).build()) + .setSmsContext( + SmsContext.builder().setSmsUrl(SMS_HOST_NAME).setSmsRegion(SMSRegion.EU).build()) .setVerificationContext( VerificationContext.builder().setVerificationUrl(VERIFICATION_HOST_NAME).build()) .build(); client = new SinchClient(configuration); + + Configuration configurationServicePlanId = + Configuration.builder() + .setSmsServicePlanId("CappyPremiumPlan") + .setSmsApiToken("HappyCappyToken") + .setSmsContext( + SmsContext.builder().setSmsUrl(SMS_HOST_NAME).setSmsRegion(SMSRegion.EU).build()) + .build(); + + clientServicePlanId = new SinchClient(configurationServicePlanId); } private static class LazyHolder { @@ -78,4 +91,8 @@ private static class LazyHolder { public static SinchClient getSinchClient() { return LazyHolder.INSTANCE.client; } + + public static SinchClient getSinchClientServicePlanId() { + return LazyHolder.INSTANCE.clientServicePlanId; + } } diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/conversation/ConsentsSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/conversation/ConsentsSteps.java new file mode 100644 index 000000000..8c04b3c41 --- /dev/null +++ b/client/src/test/java/com/sinch/sdk/e2e/domains/conversation/ConsentsSteps.java @@ -0,0 +1,57 @@ +package com.sinch.sdk.e2e.domains.conversation; + +import io.cucumber.java.en.Given; +import io.cucumber.java.en.Then; +import io.cucumber.java.en.When; + +public class ConsentsSteps { + + @Given("^the Conversation service \"Consents\" is available$") + public void serviceAvailable() { + // TODO implement conversation consents steps + } + + @When("^I send a request to list the existing Consent Identities$") + public void listPage() { + + // TODO implement conversation consents steps + } + + @When("^I send a request to list all the Consent Identities$") + public void listAll() { + + // TODO implement conversation consents steps + } + + @When("^I iterate manually over the Consent Identities pages$") + public void listIterateManually() { + + // TODO implement conversation consents steps + } + + @When("^I send a request to list the Audit Records associated with an identity$") + public void listAuditRecords() { + + // TODO implement conversation consents steps + } + + @Then("the response contains \"{int}\" Consent Identities") + public void listPageResult(int count) { + // TODO implement conversation consents steps + } + + @Then("the Consent Identities list contains \"{int}\" Consent Identities") + public void listAllResult(int count) { + // TODO implement conversation consents steps + } + + @Then("the Consent Identities iteration result contains the data from \"{int}\" pages") + public void listPageIterateResult(int count) { + // TODO implement conversation consents steps + } + + @Then("the response contains list of the Audit Records associated with an identity") + public void listAuditRecordsResult() { + // TODO implement conversation consents steps + } +} diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/conversation/ContactsSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/conversation/ContactsSteps.java index 0a2253da6..c0719444e 100644 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/conversation/ContactsSteps.java +++ b/client/src/test/java/com/sinch/sdk/e2e/domains/conversation/ContactsSteps.java @@ -129,6 +129,24 @@ public void channelProfileByContactId() { .build()); } + @When("^I send a request to list the existing identity conflicts$") + public void listIdentityConflicts() { + + // TODO: implement when the API is available + } + + @When("^I send a request to list all the identity conflicts$") + public void listAllIdentityConflicts() { + + // TODO: implement when the API is available + } + + @When("^I iterate manually over the identity conflicts pages$") + public void listAllIdentityConflictsPageIterate() { + + // TODO: implement when the API is available + } + @Then("the contact is created") public void createResult() { Assertions.assertEquals(createResponse.getId(), CONTACT_ID); @@ -226,6 +244,24 @@ public void channelProfileByContactIdResult() { Assertions.assertEquals(channelProfileByContactIdResponse, "Marty McFly FB"); } + @Then("the response contains \"{int}\" identity conflicts") + public void listIdentityConflictsResults(int count) { + + // TODO: implement when the API is available + } + + @Then("the identity conflicts list contains \"{int}\" identity conflicts") + public void listAllIdentityConflictsResults(int count) { + + // TODO: implement when the API is available + } + + @Then("the identity conflicts iteration result contains the data from \"{int}\" pages") + public void listAllIdentityConflictsPageIterateResults(int count) { + + // TODO: implement when the API is available + } + void checkExpectedContactResponseCommonFields(Contact contactResponse) { Assertions.assertEquals(contactResponse.getLanguage(), ContactLanguage.EN_US); } diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/conversation/ProjectSettingsSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/conversation/ProjectSettingsSteps.java new file mode 100644 index 000000000..dc888f68f --- /dev/null +++ b/client/src/test/java/com/sinch/sdk/e2e/domains/conversation/ProjectSettingsSteps.java @@ -0,0 +1,57 @@ +package com.sinch.sdk.e2e.domains.conversation; + +import io.cucumber.java.en.Given; +import io.cucumber.java.en.Then; +import io.cucumber.java.en.When; + +public class ProjectSettingsSteps { + + @Given("^the Conversation service \"ProjectSettings\" is available$") + public void serviceAvailable() { + // TODO implement conversation consents steps + } + + @When("^I send a request to create project settings$") + public void create() { + + // TODO implement conversation consents steps + } + + @When("^I send a request to retrieve project settings$") + public void get() { + + // TODO implement conversation consents steps + } + + @When("^I send a request to update project settings$") + public void update() { + + // TODO implement conversation consents steps + } + + @When("^I send a request to delete project settings$") + public void delete() { + + // TODO implement conversation consents steps + } + + @Then("the project settings are created") + public void createResult() { + // TODO implement conversation consents steps + } + + @Then("the response contains the project settings details") + public void getResult() { + // TODO implement conversation consents steps + } + + @Then("the response contains the project settings details with updated properties") + public void updateResult() { + // TODO implement conversation consents steps + } + + @Then("the delete project settings response contains no data") + public void deleteResult() { + // TODO implement conversation consents steps + } +} diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v1/BatchesSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v1/BatchesSteps.java index a614257fa..c7324263e 100644 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v1/BatchesSteps.java +++ b/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v1/BatchesSteps.java @@ -50,6 +50,13 @@ public void serviceAvailable() { service = Config.getSinchClient().sms().v1().batches(); } + @Given( + "the SMS service \"Batches\" is available and is configured for servicePlanId authentication") + public void servicePlanIdSAvailable() { + + service = Config.getSinchClientServicePlanId().sms().v1().batches(); + } + @When("^I send a request to send a text message$") public void send() { TextRequest request = diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v1/DeliveryReportsSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v1/DeliveryReportsSteps.java index c9744996c..9c53251cf 100644 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v1/DeliveryReportsSteps.java +++ b/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v1/DeliveryReportsSteps.java @@ -41,6 +41,14 @@ public void serviceAvailable() { service = Config.getSinchClient().sms().v1().deliveryReports(); } + @Given( + "the SMS service \"Delivery Reports\" is available and is configured for servicePlanId" + + " authentication") + public void servicePlanIdSAvailable() { + + service = Config.getSinchClientServicePlanId().sms().v1().deliveryReports(); + } + @When("^I send a request to retrieve a summary SMS delivery report$") public void getSummary() { BatchDeliveryReportQueryParameters request = diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v1/GroupsSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v1/GroupsSteps.java index 2c303a00b..14bba1bf1 100644 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v1/GroupsSteps.java +++ b/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v1/GroupsSteps.java @@ -40,6 +40,13 @@ public void serviceAvailable() { service = Config.getSinchClient().sms().v1().groups(); } + @Given( + "the SMS service \"Groups\" is available and is configured for servicePlanId authentication") + public void servicePlanIdSAvailable() { + + service = Config.getSinchClientServicePlanId().sms().v1().groups(); + } + @When("^I send a request to create an SMS group$") public void create() { GroupRequest request = diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v1/InboundsSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v1/InboundsSteps.java index 0a0311438..16f310e86 100644 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v1/InboundsSteps.java +++ b/client/src/test/java/com/sinch/sdk/e2e/domains/sms/v1/InboundsSteps.java @@ -29,6 +29,14 @@ public void serviceAvailable() { service = Config.getSinchClient().sms().v1().inbounds(); } + @Given( + "the SMS service \"Inbounds\" is available and is configured for servicePlanId" + + " authentication") + public void servicePlanIdSAvailable() { + + service = Config.getSinchClientServicePlanId().sms().v1().inbounds(); + } + @When("^I send a request to retrieve an inbound message") public void get() { From 0d56535d5b7ca78f6b8e12f3cb31f9db72fc67f2 Mon Sep 17 00:00:00 2001 From: Antoine SEIN <142824551+asein-sinch@users.noreply.github.com> Date: Tue, 14 Oct 2025 10:24:20 +0200 Subject: [PATCH 022/122] Fix NPE when handling 401 response without headers (#274) --- .github/workflows/build.yml | 3 +- .../com/sinch/sdk/http/HttpClientApache.java | 5 +- .../sinch/sdk/http/HttpClientApacheTest.java | 78 +++++++++++++++++++ 3 files changed, 83 insertions(+), 3 deletions(-) create mode 100644 client/src/test/java/com/sinch/sdk/http/HttpClientApacheTest.java diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1f708f778..e3d7238d1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,6 +39,7 @@ jobs: repository: sinch/sinch-sdk-mockserver token: ${{ secrets.MOCKSERVER_REPO_PAT_CI }} fetch-depth: 0 + ref: 57b6c306152628b2d834241ec495e868ac696148 path: sinch-sdk-mockserver - name: Install Docker Compose @@ -54,6 +55,6 @@ jobs: - name: Link to feature files run: | ln -s ${{ github.workspace }}/sinch-sdk-mockserver/features client/src/test/resources - + - name: Run e2e tests run: mvn -B -DskipUTs -Dspotless.check.skip=true verify --file pom.xml diff --git a/client/src/main/com/sinch/sdk/http/HttpClientApache.java b/client/src/main/com/sinch/sdk/http/HttpClientApache.java index b08eb037b..2e96027f9 100644 --- a/client/src/main/com/sinch/sdk/http/HttpClientApache.java +++ b/client/src/main/com/sinch/sdk/http/HttpClientApache.java @@ -200,7 +200,8 @@ private boolean processUnauthorizedResponse( Map> responseHeaders = response.getHeaders(); Collection header = responseHeaders.get(BEARER_AUTHENTICATE_RESPONSE_HEADER_KEYWORD); - boolean headerPresent = header.stream().anyMatch(e -> e.contains(BEARER_EXPIRED_KEYWORD)); + boolean headerPresent = + header != null && header.stream().anyMatch(e -> e.contains(BEARER_EXPIRED_KEYWORD)); if (headerPresent) { bearerAuthManager.resetToken(); } @@ -332,7 +333,7 @@ private void addAuth( } } - private HttpResponse processRequest(CloseableHttpClient client, ClassicHttpRequest request) + HttpResponse processRequest(CloseableHttpClient client, ClassicHttpRequest request) throws IOException { return client.execute(request, HttpClientApache::processResponse); } diff --git a/client/src/test/java/com/sinch/sdk/http/HttpClientApacheTest.java b/client/src/test/java/com/sinch/sdk/http/HttpClientApacheTest.java new file mode 100644 index 000000000..075fc7f3e --- /dev/null +++ b/client/src/test/java/com/sinch/sdk/http/HttpClientApacheTest.java @@ -0,0 +1,78 @@ +package com.sinch.sdk.http; + +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.Mockito.*; + +import com.sinch.sdk.auth.adapters.OAuthManager; +import com.sinch.sdk.core.http.AuthManager; +import com.sinch.sdk.core.http.HttpMethod; +import com.sinch.sdk.core.http.HttpRequest; +import com.sinch.sdk.core.http.HttpResponse; +import com.sinch.sdk.core.models.ServerConfiguration; +import java.lang.reflect.Field; +import java.util.*; +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +class HttpClientApacheTest { + + private HttpClientApache client; + private AuthManager mockAuthManager; + + @BeforeEach + void setup() throws Exception { + CloseableHttpClient mockApacheClient = mock(CloseableHttpClient.class); + mockAuthManager = mock(AuthManager.class); + + // Create an instance of HttpClientApache and inject the mock HTTP client + client = spy(new HttpClientApache()); + Field clientField = HttpClientApache.class.getDeclaredField("client"); + clientField.setAccessible(true); + clientField.set(client, mockApacheClient); + } + + @Test + void testInvokeApiHandles401WithEmptyHeaders() throws Exception { + // GIVEN: a simulated 401 response with empty headers + HttpResponse unauthorizedResponse = + new HttpResponse( + 401, + "Unauthorized", + Collections.emptyMap(), // Empty headers + null); + + // Spy on processRequest() to return the mocked 401 response + doReturn(unauthorizedResponse).when(client).processRequest(any(), any()); + + // Mock ServerConfiguration and HttpRequest + ServerConfiguration serverConfig = mock(ServerConfiguration.class); + when(serverConfig.getUrl()).thenReturn("https://api.example.com"); + + HttpRequest request = mock(HttpRequest.class); + when(request.getFullUrl()).thenReturn(Optional.of("https://api.example.com/v1/test")); + when(request.getMethod()).thenReturn(HttpMethod.GET); + when(request.getQueryParameters()).thenReturn(Collections.emptyList()); + when(request.getBody()).thenReturn(null); + when(request.getFormParams()).thenReturn(Collections.emptyMap()); + when(request.getHeaderParams()).thenReturn(Collections.emptyMap()); + when(request.getAccept()).thenReturn(Collections.emptyList()); + when(request.getContentType()).thenReturn(Collections.emptyList()); + when(request.getAuthNames()).thenReturn(Collections.singletonList("Bearer")); + + // Mock AuthManagers map (bearer) + Map authManagers = new HashMap<>(); + authManagers.put(OAuthManager.SCHEMA_KEYWORD_BEARER, mockAuthManager); + when(mockAuthManager.getSchema()).thenReturn(OAuthManager.SCHEMA_KEYWORD_BEARER); + + // WHEN: invokeAPI is called + HttpResponse response = client.invokeAPI(serverConfig, authManagers, request); + + // THEN: response is returned (no crash) + assertEquals(401, response.getCode()); + assertEquals("Unauthorized", response.getMessage()); + + // AND: resetToken() is not called (no headers to check) + verify(mockAuthManager, never()).resetToken(); + } +} From 01dd22754ff4a68ec1e19af16c23d0524216997b Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier Date: Fri, 24 Oct 2025 11:26:50 +0200 Subject: [PATCH 023/122] test (e2e): Restore latest mockserver version usage --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e3d7238d1..457c4eb04 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,7 +39,6 @@ jobs: repository: sinch/sinch-sdk-mockserver token: ${{ secrets.MOCKSERVER_REPO_PAT_CI }} fetch-depth: 0 - ref: 57b6c306152628b2d834241ec495e868ac696148 path: sinch-sdk-mockserver - name: Install Docker Compose From 575d9f1e935cac812274dc3241da817e3bf08f07 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier Date: Fri, 24 Oct 2025 09:43:15 +0200 Subject: [PATCH 024/122] feat (Voice): Support 'SVAML ConnectStreamingOptions' --- .../action/ConnectStreamStreamingOptions.java | 70 ++++++++++ .../ConnectStreamStreamingOptionsImpl.java | 120 ++++++++++++++++++ .../action/SvamlActionConnectStream.java | 16 +++ .../action/SvamlActionConnectStreamImpl.java | 32 ++++- .../ConnectStreamStreamingOptionsTest.java | 26 ++++ .../action/SvamlActionConnectStreamTest.java | 1 + .../ConnectStreamStreamingOptionsDto.json | 4 + .../action/SvamlActionConnectStreamDto.json | 6 +- 8 files changed, 272 insertions(+), 3 deletions(-) create mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/ConnectStreamStreamingOptions.java create mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/ConnectStreamStreamingOptionsImpl.java create mode 100644 openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/ConnectStreamStreamingOptionsTest.java create mode 100644 openapi-contracts/src/test/resources/domains/voice/v1/svaml/action/ConnectStreamStreamingOptionsDto.json diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/ConnectStreamStreamingOptions.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/ConnectStreamStreamingOptions.java new file mode 100644 index 000000000..8b0fe1593 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/ConnectStreamStreamingOptions.java @@ -0,0 +1,70 @@ +/* + * Voice API | Sinch + * + * OpenAPI document version: 1.0.1 + * Contact: support@sinch.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit the class manually. + */ + +package com.sinch.sdk.domains.voice.models.v1.svaml.action; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** Optional parameters for the WebSocket stream. */ +@JsonDeserialize(builder = ConnectStreamStreamingOptionsImpl.Builder.class) +public interface ConnectStreamStreamingOptions { + + /** + * The version of the streaming feature. + * + * @return version + */ + Integer getVersion(); + + /** + * The sample rate for the audio stream in Hz. + * + * @return sampleRate + */ + Integer getSampleRate(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new ConnectStreamStreamingOptionsImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param version see getter + * @return Current builder + * @see #getVersion + */ + Builder setVersion(Integer version); + + /** + * see getter + * + * @param sampleRate see getter + * @return Current builder + * @see #getSampleRate + */ + Builder setSampleRate(Integer sampleRate); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + ConnectStreamStreamingOptions build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/ConnectStreamStreamingOptionsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/ConnectStreamStreamingOptionsImpl.java new file mode 100644 index 000000000..654deba6d --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/ConnectStreamStreamingOptionsImpl.java @@ -0,0 +1,120 @@ +package com.sinch.sdk.domains.voice.models.v1.svaml.action; + +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; +import com.sinch.sdk.core.models.OptionalValue; +import java.util.Objects; + +@JsonPropertyOrder({ + ConnectStreamStreamingOptionsImpl.JSON_PROPERTY_VERSION, + ConnectStreamStreamingOptionsImpl.JSON_PROPERTY_SAMPLE_RATE +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class ConnectStreamStreamingOptionsImpl implements ConnectStreamStreamingOptions { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_VERSION = "version"; + + private OptionalValue version; + + public static final String JSON_PROPERTY_SAMPLE_RATE = "sampleRate"; + + private OptionalValue sampleRate; + + public ConnectStreamStreamingOptionsImpl() {} + + protected ConnectStreamStreamingOptionsImpl( + OptionalValue version, OptionalValue sampleRate) { + this.version = version; + this.sampleRate = sampleRate; + } + + @JsonIgnore + public Integer getVersion() { + return version.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_VERSION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue version() { + return version; + } + + @JsonIgnore + public Integer getSampleRate() { + return sampleRate.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_SAMPLE_RATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue sampleRate() { + return sampleRate; + } + + /** Return true if this svaml_action_connectStream_streamingOptions object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConnectStreamStreamingOptionsImpl svamlActionConnectStreamStreamingOptions = + (ConnectStreamStreamingOptionsImpl) o; + return Objects.equals(this.version, svamlActionConnectStreamStreamingOptions.version) + && Objects.equals(this.sampleRate, svamlActionConnectStreamStreamingOptions.sampleRate); + } + + @Override + public int hashCode() { + return Objects.hash(version, sampleRate); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConnectStreamStreamingOptionsImpl {\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" sampleRate: ").append(toIndentedString(sampleRate)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + @JsonPOJOBuilder(withPrefix = "set") + static class Builder implements ConnectStreamStreamingOptions.Builder { + OptionalValue version = OptionalValue.empty(); + OptionalValue sampleRate = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_VERSION) + public Builder setVersion(Integer version) { + this.version = OptionalValue.of(version); + return this; + } + + @JsonProperty(JSON_PROPERTY_SAMPLE_RATE) + public Builder setSampleRate(Integer sampleRate) { + this.sampleRate = OptionalValue.of(sampleRate); + return this; + } + + public ConnectStreamStreamingOptions build() { + return new ConnectStreamStreamingOptionsImpl(version, sampleRate); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectStream.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectStream.java index b64f99866..7afb637dc 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectStream.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectStream.java @@ -60,6 +60,13 @@ public static String valueOf(NameEnum e) { */ DestinationWebSocket getDestination(); + /** + * Get streamingOptions + * + * @return streamingOptions + */ + ConnectStreamStreamingOptions getStreamingOptions(); + /** * The max duration of the call in seconds (max 14400 seconds). If the call is still connected at * that time, it will be automatically disconnected. @@ -97,6 +104,15 @@ interface Builder { */ Builder setDestination(DestinationWebSocket destination); + /** + * see getter + * + * @param streamingOptions see getter + * @return Current builder + * @see #getStreamingOptions + */ + Builder setStreamingOptions(ConnectStreamStreamingOptions streamingOptions); + /** * see getter * diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectStreamImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectStreamImpl.java index 314b11997..95396b0fa 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectStreamImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectStreamImpl.java @@ -14,6 +14,7 @@ @JsonPropertyOrder({ SvamlActionConnectStreamImpl.JSON_PROPERTY_NAME, SvamlActionConnectStreamImpl.JSON_PROPERTY_DESTINATION, + SvamlActionConnectStreamImpl.JSON_PROPERTY_STREAMING_OPTIONS, SvamlActionConnectStreamImpl.JSON_PROPERTY_MAX_DURATION, SvamlActionConnectStreamImpl.JSON_PROPERTY_CALL_HEADERS }) @@ -32,6 +33,10 @@ public class SvamlActionConnectStreamImpl private OptionalValue destination; + public static final String JSON_PROPERTY_STREAMING_OPTIONS = "streamingOptions"; + + private OptionalValue streamingOptions; + public static final String JSON_PROPERTY_MAX_DURATION = "maxDuration"; private OptionalValue maxDuration; @@ -45,10 +50,12 @@ public SvamlActionConnectStreamImpl() {} protected SvamlActionConnectStreamImpl( OptionalValue name, OptionalValue destination, + OptionalValue streamingOptions, OptionalValue maxDuration, OptionalValue> callHeaders) { this.name = name; this.destination = destination; + this.streamingOptions = streamingOptions; this.maxDuration = maxDuration; this.callHeaders = callHeaders; } @@ -75,6 +82,17 @@ public OptionalValue destination() { return destination; } + @JsonIgnore + public ConnectStreamStreamingOptions getStreamingOptions() { + return streamingOptions.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_STREAMING_OPTIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue streamingOptions() { + return streamingOptions; + } + @JsonIgnore public Integer getMaxDuration() { return maxDuration.orElse(null); @@ -109,13 +127,14 @@ public boolean equals(Object o) { SvamlActionConnectStreamImpl svamlActionConnectStream = (SvamlActionConnectStreamImpl) o; return Objects.equals(this.name, svamlActionConnectStream.name) && Objects.equals(this.destination, svamlActionConnectStream.destination) + && Objects.equals(this.streamingOptions, svamlActionConnectStream.streamingOptions) && Objects.equals(this.maxDuration, svamlActionConnectStream.maxDuration) && Objects.equals(this.callHeaders, svamlActionConnectStream.callHeaders); } @Override public int hashCode() { - return Objects.hash(name, destination, maxDuration, callHeaders); + return Objects.hash(name, destination, streamingOptions, maxDuration, callHeaders); } @Override @@ -124,6 +143,7 @@ public String toString() { sb.append("class SvamlActionConnectStreamImpl {\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" destination: ").append(toIndentedString(destination)).append("\n"); + sb.append(" streamingOptions: ").append(toIndentedString(streamingOptions)).append("\n"); sb.append(" maxDuration: ").append(toIndentedString(maxDuration)).append("\n"); sb.append(" callHeaders: ").append(toIndentedString(callHeaders)).append("\n"); sb.append("}"); @@ -144,6 +164,7 @@ private String toIndentedString(Object o) { static class Builder implements SvamlActionConnectStream.Builder { OptionalValue name = OptionalValue.of(NameEnum.CONNECT_STREAM); OptionalValue destination = OptionalValue.empty(); + OptionalValue streamingOptions = OptionalValue.empty(); OptionalValue maxDuration = OptionalValue.empty(); OptionalValue> callHeaders = OptionalValue.empty(); @@ -153,6 +174,12 @@ public Builder setDestination(DestinationWebSocket destination) { return this; } + @JsonProperty(JSON_PROPERTY_STREAMING_OPTIONS) + public Builder setStreamingOptions(ConnectStreamStreamingOptions streamingOptions) { + this.streamingOptions = OptionalValue.of(streamingOptions); + return this; + } + @JsonProperty(JSON_PROPERTY_MAX_DURATION) public Builder setMaxDuration(Integer maxDuration) { this.maxDuration = OptionalValue.of(maxDuration); @@ -166,7 +193,8 @@ public Builder setCallHeaders(List callHeaders) { } public SvamlActionConnectStream build() { - return new SvamlActionConnectStreamImpl(name, destination, maxDuration, callHeaders); + return new SvamlActionConnectStreamImpl( + name, destination, streamingOptions, maxDuration, callHeaders); } } } diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/ConnectStreamStreamingOptionsTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/ConnectStreamStreamingOptionsTest.java new file mode 100644 index 000000000..21290a09b --- /dev/null +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/ConnectStreamStreamingOptionsTest.java @@ -0,0 +1,26 @@ +package com.sinch.sdk.domains.voice.models.v1.svaml.action; + +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.BaseTest; +import org.json.JSONException; +import org.junit.jupiter.api.Test; +import org.skyscreamer.jsonassert.JSONAssert; + +@TestWithResources +public class ConnectStreamStreamingOptionsTest extends BaseTest { + + public static ConnectStreamStreamingOptions streamingOptions = + ConnectStreamStreamingOptions.builder().setVersion(2).setSampleRate(16000).build(); + + @GivenTextResource("/domains/voice/v1/svaml/action/ConnectStreamStreamingOptionsDto.json") + String json; + + @Test + void serialize() throws JsonProcessingException, JSONException { + String serializedString = objectMapper.writeValueAsString(streamingOptions); + + JSONAssert.assertEquals(json, serializedString, true); + } +} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectStreamTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectStreamTest.java index 1e4087b48..9c2ade8b9 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectStreamTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectStreamTest.java @@ -20,6 +20,7 @@ public class SvamlActionConnectStreamTest extends BaseTest { .setCallHeaders( Collections.singletonList( CallHeader.builder().setKey("left string").setValue("right string").build())) + .setStreamingOptions(ConnectStreamStreamingOptionsTest.streamingOptions) .build(); @GivenTextResource("/domains/voice/v1/svaml/action/SvamlActionConnectStreamDto.json") diff --git a/openapi-contracts/src/test/resources/domains/voice/v1/svaml/action/ConnectStreamStreamingOptionsDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/svaml/action/ConnectStreamStreamingOptionsDto.json new file mode 100644 index 000000000..52a91f799 --- /dev/null +++ b/openapi-contracts/src/test/resources/domains/voice/v1/svaml/action/ConnectStreamStreamingOptionsDto.json @@ -0,0 +1,4 @@ +{ + "version": 2, + "sampleRate": 16000 +} diff --git a/openapi-contracts/src/test/resources/domains/voice/v1/svaml/action/SvamlActionConnectStreamDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/svaml/action/SvamlActionConnectStreamDto.json index bbb811568..30404ae4d 100644 --- a/openapi-contracts/src/test/resources/domains/voice/v1/svaml/action/SvamlActionConnectStreamDto.json +++ b/openapi-contracts/src/test/resources/domains/voice/v1/svaml/action/SvamlActionConnectStreamDto.json @@ -10,5 +10,9 @@ "key": "left string", "value": "right string" } - ] + ], + "streamingOptions": { + "version": 2, + "sampleRate": 16000 + } } From c77e3b04196b6bd2e9cf2e65797d38d84483647c Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier Date: Tue, 28 Oct 2025 17:43:36 +0100 Subject: [PATCH 025/122] feat: Ensure POJO const are compliant onto deserialization --- ...WhatsAppInteractiveHeaderDocumentImpl.java | 11 ++++++++++ .../WhatsAppInteractiveHeaderImageImpl.java | 11 ++++++++++ .../WhatsAppInteractiveHeaderTextImpl.java | 11 ++++++++++ .../WhatsAppInteractiveHeaderVideoImpl.java | 11 ++++++++++ ...eplyChannelSpecificContactMessageImpl.java | 12 +++++++++++ .../v1/ScheduledVoiceProvisioningESTImpl.java | 9 +++++++++ .../v1/ScheduledVoiceProvisioningFAXImpl.java | 9 +++++++++ .../v1/ScheduledVoiceProvisioningRTCImpl.java | 9 +++++++++ .../models/v1/VoiceConfigurationESTImpl.java | 9 +++++++++ .../models/v1/VoiceConfigurationFAXImpl.java | 9 +++++++++ .../models/v1/VoiceConfigurationRTCImpl.java | 9 +++++++++ .../models/v1/errors/BadRequestImpl.java | 9 +++++++++ .../v1/batches/request/BinaryRequestImpl.java | 9 +++++++++ .../v1/batches/request/MediaRequestImpl.java | 9 +++++++++ .../v1/batches/request/TextRequestImpl.java | 9 +++++++++ .../request/UpdateBinaryRequestImpl.java | 9 +++++++++ .../request/UpdateMediaRequestImpl.java | 9 +++++++++ .../request/UpdateTextRequestImpl.java | 9 +++++++++ .../batches/response/BinaryResponseImpl.java | 9 +++++++++ .../batches/response/MediaResponseImpl.java | 9 +++++++++ .../v1/batches/response/TextResponseImpl.java | 9 +++++++++ .../BatchDeliveryReportMMSImpl.java | 9 +++++++++ .../BatchDeliveryReportSMSImpl.java | 9 +++++++++ .../RecipientDeliveryReportMMSImpl.java | 10 ++++++++++ .../RecipientDeliveryReportSMSImpl.java | 10 ++++++++++ .../models/v1/inbounds/BinaryMessageImpl.java | 9 +++++++++ .../models/v1/inbounds/MediaMessageImpl.java | 9 +++++++++ .../models/v1/inbounds/TextMessageImpl.java | 9 +++++++++ ...erificationReportRequestFlashCallImpl.java | 9 +++++++++ ...erificationReportRequestPhoneCallImpl.java | 9 +++++++++ .../VerificationReportRequestSmsImpl.java | 9 +++++++++ ...VerificationReportRequestWhatsAppImpl.java | 9 +++++++++ ...rificationReportResponseFlashCallImpl.java | 10 ++++++++++ ...rificationReportResponsePhoneCallImpl.java | 10 ++++++++++ .../VerificationReportResponseSmsImpl.java | 9 +++++++++ ...erificationReportResponseWhatsAppImpl.java | 9 +++++++++ .../VerificationStartRequestDataImpl.java | 9 +++++++++ ...VerificationStartRequestFlashCallImpl.java | 10 ++++++++++ ...VerificationStartRequestPhoneCallImpl.java | 10 ++++++++++ .../VerificationStartRequestSmsImpl.java | 9 +++++++++ .../VerificationStartRequestWhatsAppImpl.java | 10 ++++++++++ .../VerificationStartResponseDataImpl.java | 9 +++++++++ ...erificationStartResponseFlashCallImpl.java | 10 ++++++++++ ...erificationStartResponsePhoneCallImpl.java | 10 ++++++++++ .../VerificationStartResponseSmsImpl.java | 9 +++++++++ ...VerificationStartResponseWhatsAppImpl.java | 10 ++++++++++ ...rificationStatusResponseFlashCallImpl.java | 9 +++++++++ ...rificationStatusResponsePhoneCallImpl.java | 9 +++++++++ .../VerificationStatusResponseSmsImpl.java | 9 +++++++++ ...erificationStatusResponseWhatsAppImpl.java | 9 +++++++++ .../VerificationRequestEventImpl.java | 10 ++++++++++ .../webhooks/VerificationResultEventImpl.java | 10 ++++++++++ .../VerificationSmsDeliveredEventImpl.java | 11 ++++++++++ .../request/CalloutRequestConferenceImpl.java | 11 ++++++++++ .../request/CalloutRequestCustomImpl.java | 9 +++++++++ .../request/CalloutRequestTTSImpl.java | 9 +++++++++ .../v1/destination/DestinationDidImpl.java | 9 +++++++++ .../v1/destination/DestinationMxpImpl.java | 11 ++++++++++ .../v1/destination/DestinationPstnImpl.java | 11 ++++++++++ .../v1/destination/DestinationSipImpl.java | 9 +++++++++ .../destination/DestinationWebSocketImpl.java | 10 ++++++++++ .../SvamlActionConnectConferenceImpl.java | 9 +++++++++ .../action/SvamlActionConnectMxpImpl.java | 9 +++++++++ .../action/SvamlActionConnectPstnImpl.java | 9 +++++++++ .../action/SvamlActionConnectSipImpl.java | 9 +++++++++ .../action/SvamlActionConnectStreamImpl.java | 9 +++++++++ .../svaml/action/SvamlActionContinueImpl.java | 9 +++++++++ .../svaml/action/SvamlActionHangupImpl.java | 9 +++++++++ .../v1/svaml/action/SvamlActionParkImpl.java | 9 +++++++++ .../svaml/action/SvamlActionRunMenuImpl.java | 9 +++++++++ .../SvamlInstructionAnswerImpl.java | 9 +++++++++ .../SvamlInstructionPlayFilesImpl.java | 9 +++++++++ .../instruction/SvamlInstructionSayImpl.java | 9 +++++++++ .../SvamlInstructionSendDtmfImpl.java | 9 +++++++++ .../SvamlInstructionSetCookieImpl.java | 9 +++++++++ .../SvamlInstructionStartRecordingImpl.java | 9 +++++++++ .../SvamlInstructionStopRecordingImpl.java | 9 +++++++++ .../v1/webhooks/AnsweredCallEventImpl.java | 9 +++++++++ .../webhooks/DisconnectedCallEventImpl.java | 9 +++++++++ .../v1/webhooks/IncomingCallEventImpl.java | 9 +++++++++ .../v1/webhooks/NotificationEventImpl.java | 10 ++++++++++ .../v1/webhooks/PromptInputEventImpl.java | 9 +++++++++ .../v1/destination/DestinationTest.java | 20 +++++++++++++++++++ .../destination/DestinationMxpAliasDto.json | 4 ++++ .../destination/DestinationPstnAliasDto.json | 4 ++++ 85 files changed, 799 insertions(+) create mode 100644 openapi-contracts/src/test/resources/domains/voice/v1/destination/DestinationMxpAliasDto.json create mode 100644 openapi-contracts/src/test/resources/domains/voice/v1/destination/DestinationPstnAliasDto.json diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/channelspecific/whatsapp/flows/WhatsAppInteractiveHeaderDocumentImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/channelspecific/whatsapp/flows/WhatsAppInteractiveHeaderDocumentImpl.java index 588dfc9e8..64ed9d5ac 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/channelspecific/whatsapp/flows/WhatsAppInteractiveHeaderDocumentImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/channelspecific/whatsapp/flows/WhatsAppInteractiveHeaderDocumentImpl.java @@ -105,6 +105,17 @@ static class Builder implements WhatsAppInteractiveHeaderDocument.Builder { OptionalValue.of(WhatsAppInteractiveHeaderDocument.TypeEnum.DOCUMENT); OptionalValue document = OptionalValue.empty(); + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + Builder setType(TypeEnum type) { + if (!Objects.equals(type, WhatsAppInteractiveHeaderDocument.TypeEnum.DOCUMENT)) { + throw new IllegalArgumentException( + String.format( + "'type' must be '%s' (is '%s')", + WhatsAppInteractiveHeaderDocument.TypeEnum.DOCUMENT, type)); + } + return this; + } + @JsonProperty(value = JSON_PROPERTY_DOCUMENT, required = true) public Builder setDocument(WhatsAppInteractiveHeaderMedia document) { this.document = OptionalValue.of(document); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/channelspecific/whatsapp/flows/WhatsAppInteractiveHeaderImageImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/channelspecific/whatsapp/flows/WhatsAppInteractiveHeaderImageImpl.java index 8c0ad3151..4b33af5f0 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/channelspecific/whatsapp/flows/WhatsAppInteractiveHeaderImageImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/channelspecific/whatsapp/flows/WhatsAppInteractiveHeaderImageImpl.java @@ -104,6 +104,17 @@ static class Builder implements WhatsAppInteractiveHeaderImage.Builder { OptionalValue type = OptionalValue.of(WhatsAppInteractiveHeaderImage.TypeEnum.IMAGE); OptionalValue image = OptionalValue.empty(); + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + Builder setType(TypeEnum type) { + if (!Objects.equals(type, WhatsAppInteractiveHeaderImage.TypeEnum.IMAGE)) { + throw new IllegalArgumentException( + String.format( + "'type' must be '%s' (is '%s')", + WhatsAppInteractiveHeaderImage.TypeEnum.IMAGE, type)); + } + return this; + } + @JsonProperty(value = JSON_PROPERTY_IMAGE, required = true) public Builder setImage(WhatsAppInteractiveHeaderMedia image) { this.image = OptionalValue.of(image); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/channelspecific/whatsapp/flows/WhatsAppInteractiveHeaderTextImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/channelspecific/whatsapp/flows/WhatsAppInteractiveHeaderTextImpl.java index 20cae6fa5..9eb218429 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/channelspecific/whatsapp/flows/WhatsAppInteractiveHeaderTextImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/channelspecific/whatsapp/flows/WhatsAppInteractiveHeaderTextImpl.java @@ -104,6 +104,17 @@ static class Builder implements WhatsAppInteractiveHeaderText.Builder { OptionalValue type = OptionalValue.of(WhatsAppInteractiveHeaderText.TypeEnum.TEXT); OptionalValue text = OptionalValue.empty(); + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + Builder setType(TypeEnum type) { + if (!Objects.equals(type, WhatsAppInteractiveHeaderText.TypeEnum.TEXT)) { + throw new IllegalArgumentException( + String.format( + "'type' must be '%s' (is '%s')", + WhatsAppInteractiveHeaderText.TypeEnum.TEXT, type)); + } + return this; + } + @JsonProperty(value = JSON_PROPERTY_TEXT, required = true) public Builder setText(String text) { this.text = OptionalValue.of(text); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/channelspecific/whatsapp/flows/WhatsAppInteractiveHeaderVideoImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/channelspecific/whatsapp/flows/WhatsAppInteractiveHeaderVideoImpl.java index bda1ed137..84f7c8b84 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/channelspecific/whatsapp/flows/WhatsAppInteractiveHeaderVideoImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/channelspecific/whatsapp/flows/WhatsAppInteractiveHeaderVideoImpl.java @@ -104,6 +104,17 @@ static class Builder implements WhatsAppInteractiveHeaderVideo.Builder { OptionalValue type = OptionalValue.of(WhatsAppInteractiveHeaderVideo.TypeEnum.VIDEO); OptionalValue video = OptionalValue.empty(); + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + Builder setType(TypeEnum type) { + if (!Objects.equals(type, WhatsAppInteractiveHeaderVideo.TypeEnum.VIDEO)) { + throw new IllegalArgumentException( + String.format( + "'type' must be '%s' (is '%s')", + WhatsAppInteractiveHeaderVideo.TypeEnum.VIDEO, type)); + } + return this; + } + @JsonProperty(value = JSON_PROPERTY_VIDEO, required = true) public Builder setVideo(WhatsAppInteractiveHeaderMedia video) { this.video = OptionalValue.of(video); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/channelspecific/whatsapp/nfmreply/WhatsAppInteractiveNfmReplyChannelSpecificContactMessageImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/channelspecific/whatsapp/nfmreply/WhatsAppInteractiveNfmReplyChannelSpecificContactMessageImpl.java index 87aea57e2..fbaad6cf8 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/channelspecific/whatsapp/nfmreply/WhatsAppInteractiveNfmReplyChannelSpecificContactMessageImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/messages/types/channelspecific/whatsapp/nfmreply/WhatsAppInteractiveNfmReplyChannelSpecificContactMessageImpl.java @@ -111,6 +111,18 @@ static class Builder implements WhatsAppInteractiveNfmReplyChannelSpecificContac WhatsAppInteractiveNfmReplyChannelSpecificContactMessage.TypeEnum.NFM_REPLY); OptionalValue nfmReply = OptionalValue.empty(); + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + Builder setType(TypeEnum type) { + if (!Objects.equals( + type, WhatsAppInteractiveNfmReplyChannelSpecificContactMessage.TypeEnum.NFM_REPLY)) { + throw new IllegalArgumentException( + String.format( + "'type' must be '%s' (is '%s')", + WhatsAppInteractiveNfmReplyChannelSpecificContactMessage.TypeEnum.NFM_REPLY, type)); + } + return this; + } + @JsonProperty(value = JSON_PROPERTY_NFM_REPLY, required = true) public Builder setNfmReply(WhatsAppInteractiveNfmReply nfmReply) { this.nfmReply = OptionalValue.of(nfmReply); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/ScheduledVoiceProvisioningESTImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/ScheduledVoiceProvisioningESTImpl.java index f50a7cc2e..a756e2336 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/ScheduledVoiceProvisioningESTImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/ScheduledVoiceProvisioningESTImpl.java @@ -147,6 +147,15 @@ static class Builder implements ScheduledVoiceProvisioningEST.Builder { OptionalValue status = OptionalValue.empty(); OptionalValue trunkId = OptionalValue.empty(); + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + Builder setType(VoiceApplicationType type) { + if (!Objects.equals(type, VoiceApplicationType.EST)) { + throw new IllegalArgumentException( + String.format("'type' must be '%s' (is '%s')", VoiceApplicationType.EST, type)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_LAST_UPDATED_TIME) public Builder setLastUpdatedTime(Instant lastUpdatedTime) { this.lastUpdatedTime = OptionalValue.of(lastUpdatedTime); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/ScheduledVoiceProvisioningFAXImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/ScheduledVoiceProvisioningFAXImpl.java index 4f4be5182..76c5bcc14 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/ScheduledVoiceProvisioningFAXImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/ScheduledVoiceProvisioningFAXImpl.java @@ -147,6 +147,15 @@ static class Builder implements ScheduledVoiceProvisioningFAX.Builder { OptionalValue status = OptionalValue.empty(); OptionalValue serviceId = OptionalValue.empty(); + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + Builder setType(VoiceApplicationType type) { + if (!Objects.equals(type, VoiceApplicationType.FAX)) { + throw new IllegalArgumentException( + String.format("'type' must be '%s' (is '%s')", VoiceApplicationType.FAX, type)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_LAST_UPDATED_TIME) public Builder setLastUpdatedTime(Instant lastUpdatedTime) { this.lastUpdatedTime = OptionalValue.of(lastUpdatedTime); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/ScheduledVoiceProvisioningRTCImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/ScheduledVoiceProvisioningRTCImpl.java index 9599fdbbb..cc8d8f403 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/ScheduledVoiceProvisioningRTCImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/ScheduledVoiceProvisioningRTCImpl.java @@ -147,6 +147,15 @@ static class Builder implements ScheduledVoiceProvisioningRTC.Builder { OptionalValue status = OptionalValue.empty(); OptionalValue appId = OptionalValue.empty(); + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + Builder setType(VoiceApplicationType type) { + if (!Objects.equals(type, VoiceApplicationType.RTC)) { + throw new IllegalArgumentException( + String.format("'type' must be '%s' (is '%s')", VoiceApplicationType.RTC, type)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_LAST_UPDATED_TIME) public Builder setLastUpdatedTime(Instant lastUpdatedTime) { this.lastUpdatedTime = OptionalValue.of(lastUpdatedTime); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/VoiceConfigurationESTImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/VoiceConfigurationESTImpl.java index 5f244b0ff..0cdbce611 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/VoiceConfigurationESTImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/VoiceConfigurationESTImpl.java @@ -147,6 +147,15 @@ static class Builder implements VoiceConfigurationEST.Builder { OptionalValue scheduledProvisioning = OptionalValue.empty(); OptionalValue trunkId = OptionalValue.empty(); + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + Builder setType(VoiceApplicationType type) { + if (!Objects.equals(type, VoiceApplicationType.EST)) { + throw new IllegalArgumentException( + String.format("'type' must be '%s' (is '%s')", VoiceApplicationType.EST, type)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_LAST_UPDATED_TIME) public Builder setLastUpdatedTime(Instant lastUpdatedTime) { this.lastUpdatedTime = OptionalValue.of(lastUpdatedTime); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/VoiceConfigurationFAXImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/VoiceConfigurationFAXImpl.java index 3489261dc..b55064d39 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/VoiceConfigurationFAXImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/VoiceConfigurationFAXImpl.java @@ -147,6 +147,15 @@ static class Builder implements VoiceConfigurationFAX.Builder { OptionalValue scheduledProvisioning = OptionalValue.empty(); OptionalValue serviceId = OptionalValue.empty(); + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + Builder setType(VoiceApplicationType type) { + if (!Objects.equals(type, VoiceApplicationType.FAX)) { + throw new IllegalArgumentException( + String.format("'type' must be '%s' (is '%s')", VoiceApplicationType.FAX, type)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_LAST_UPDATED_TIME) public Builder setLastUpdatedTime(Instant lastUpdatedTime) { this.lastUpdatedTime = OptionalValue.of(lastUpdatedTime); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/VoiceConfigurationRTCImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/VoiceConfigurationRTCImpl.java index 0a1b5bc09..1ac9865c4 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/VoiceConfigurationRTCImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/VoiceConfigurationRTCImpl.java @@ -147,6 +147,15 @@ static class Builder implements VoiceConfigurationRTC.Builder { OptionalValue scheduledProvisioning = OptionalValue.empty(); OptionalValue appId = OptionalValue.empty(); + @JsonProperty(JSON_PROPERTY_TYPE) + Builder setType(VoiceApplicationType type) { + if (!Objects.equals(type, VoiceApplicationType.RTC)) { + throw new IllegalArgumentException( + String.format("'type' must be '%s' (is '%s')", VoiceApplicationType.RTC, type)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_LAST_UPDATED_TIME) public Builder setLastUpdatedTime(Instant lastUpdatedTime) { this.lastUpdatedTime = OptionalValue.of(lastUpdatedTime); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/errors/BadRequestImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/errors/BadRequestImpl.java index 653644bc5..af14254c6 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/errors/BadRequestImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/errors/BadRequestImpl.java @@ -101,6 +101,15 @@ static class Builder implements BadRequest.Builder { OptionalValue type = OptionalValue.of(TypeEnum.BAD_REQUEST); OptionalValue> fieldViolations = OptionalValue.empty(); + @JsonProperty(JSON_PROPERTY_TYPE) + Builder setType(TypeEnum type) { + if (!Objects.equals(type, TypeEnum.BAD_REQUEST)) { + throw new IllegalArgumentException( + String.format("'type' must be '%s' (is '%s')", TypeEnum.BAD_REQUEST, type)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_FIELD_VIOLATIONS) public Builder setFieldViolations(List fieldViolations) { this.fieldViolations = OptionalValue.of(fieldViolations); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/request/BinaryRequestImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/request/BinaryRequestImpl.java index 85d0664eb..a88cfa917 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/request/BinaryRequestImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/request/BinaryRequestImpl.java @@ -372,6 +372,15 @@ public Builder setUdh(String udh) { return this; } + @JsonProperty(JSON_PROPERTY_TYPE) + Builder setType(TypeEnum type) { + if (!Objects.equals(type, TypeEnum.MT_BINARY)) { + throw new IllegalArgumentException( + String.format("'type' must be '%s' (is '%s')", TypeEnum.MT_BINARY, type)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_DELIVERY_REPORT) public Builder setDeliveryReport(DeliveryReportType deliveryReport) { this.deliveryReport = OptionalValue.of(deliveryReport); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/request/MediaRequestImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/request/MediaRequestImpl.java index f036b95f1..ce08f29b2 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/request/MediaRequestImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/request/MediaRequestImpl.java @@ -352,6 +352,15 @@ public Builder setParameters(Map> parameters) { return this; } + @JsonProperty(JSON_PROPERTY_TYPE) + Builder setType(TypeEnum type) { + if (!Objects.equals(type, TypeEnum.MT_MEDIA)) { + throw new IllegalArgumentException( + String.format("'type' must be '%s' (is '%s')", TypeEnum.MT_MEDIA, type)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_DELIVERY_REPORT) public Builder setDeliveryReport(DeliveryReportType deliveryReport) { this.deliveryReport = OptionalValue.of(deliveryReport); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/request/TextRequestImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/request/TextRequestImpl.java index a365022b3..7e23e742a 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/request/TextRequestImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/request/TextRequestImpl.java @@ -442,6 +442,15 @@ public Builder setBody(String body) { return this; } + @JsonProperty(JSON_PROPERTY_TYPE) + Builder setType(TypeEnum type) { + if (!Objects.equals(type, TypeEnum.MT_TEXT)) { + throw new IllegalArgumentException( + String.format("'type' must be '%s' (is '%s')", TypeEnum.MT_TEXT, type)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_DELIVERY_REPORT) public Builder setDeliveryReport(DeliveryReportType deliveryReport) { this.deliveryReport = OptionalValue.of(deliveryReport); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/request/UpdateBinaryRequestImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/request/UpdateBinaryRequestImpl.java index fd6e49156..a9413ef4e 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/request/UpdateBinaryRequestImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/request/UpdateBinaryRequestImpl.java @@ -376,6 +376,15 @@ public Builder setFrom(String from) { return this; } + @JsonProperty(JSON_PROPERTY_TYPE) + Builder setType(TypeEnum type) { + if (!Objects.equals(type, TypeEnum.MT_BINARY)) { + throw new IllegalArgumentException( + String.format("'type' must be '%s' (is '%s')", TypeEnum.MT_BINARY, type)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_TO_ADD) public Builder setToAdd(List toAdd) { this.toAdd = OptionalValue.of(toAdd); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/request/UpdateMediaRequestImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/request/UpdateMediaRequestImpl.java index f7d0a38e9..8b61d26ef 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/request/UpdateMediaRequestImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/request/UpdateMediaRequestImpl.java @@ -356,6 +356,15 @@ public Builder setFrom(String from) { return this; } + @JsonProperty(JSON_PROPERTY_TYPE) + Builder setType(TypeEnum type) { + if (!Objects.equals(type, TypeEnum.MT_MEDIA)) { + throw new IllegalArgumentException( + String.format("'type' must be '%s' (is '%s')", TypeEnum.MT_MEDIA, type)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_TO_ADD) public Builder setToAdd(List toAdd) { this.toAdd = OptionalValue.of(toAdd); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/request/UpdateTextRequestImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/request/UpdateTextRequestImpl.java index 0a1e8b192..45660cbe6 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/request/UpdateTextRequestImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/request/UpdateTextRequestImpl.java @@ -446,6 +446,15 @@ public Builder setFrom(String from) { return this; } + @JsonProperty(JSON_PROPERTY_TYPE) + Builder setType(TypeEnum type) { + if (!Objects.equals(type, TypeEnum.MT_TEXT)) { + throw new IllegalArgumentException( + String.format("'type' must be '%s' (is '%s')", TypeEnum.MT_TEXT, type)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_TO_ADD) public Builder setToAdd(List toAdd) { this.toAdd = OptionalValue.of(toAdd); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/response/BinaryResponseImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/response/BinaryResponseImpl.java index fafac3b55..37baeadfb 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/response/BinaryResponseImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/response/BinaryResponseImpl.java @@ -468,6 +468,15 @@ public Builder setUdh(String udh) { return this; } + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + Builder setType(TypeEnum type) { + if (!Objects.equals(type, TypeEnum.MT_BINARY)) { + throw new IllegalArgumentException( + String.format("'type' must be '%s' (is '%s')", TypeEnum.MT_BINARY, type)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_CREATED_AT) public Builder setCreatedAt(Instant createdAt) { this.createdAt = OptionalValue.of(createdAt); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/response/MediaResponseImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/response/MediaResponseImpl.java index cc0d03c06..eb22db7f7 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/response/MediaResponseImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/response/MediaResponseImpl.java @@ -447,6 +447,15 @@ public Builder setParameters(Map> parameters) { return this; } + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + Builder setType(TypeEnum type) { + if (!Objects.equals(type, TypeEnum.MT_MEDIA)) { + throw new IllegalArgumentException( + String.format("'type' must be '%s' (is '%s')", TypeEnum.MT_MEDIA, type)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_CREATED_AT) public Builder setCreatedAt(Instant createdAt) { this.createdAt = OptionalValue.of(createdAt); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/response/TextResponseImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/response/TextResponseImpl.java index eb8a3cc9b..f17528209 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/response/TextResponseImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/batches/response/TextResponseImpl.java @@ -537,6 +537,15 @@ public Builder setBody(String body) { return this; } + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + Builder setType(TypeEnum type) { + if (!Objects.equals(type, TypeEnum.MT_TEXT)) { + throw new IllegalArgumentException( + String.format("'type' must be '%s' (is '%s')", TypeEnum.MT_TEXT, type)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_CREATED_AT) public Builder setCreatedAt(Instant createdAt) { this.createdAt = OptionalValue.of(createdAt); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/BatchDeliveryReportMMSImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/BatchDeliveryReportMMSImpl.java index 1959b56c8..401ef177a 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/BatchDeliveryReportMMSImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/BatchDeliveryReportMMSImpl.java @@ -215,6 +215,15 @@ public Builder setTotalMessageCount(Integer totalMessageCount) { return this; } + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + Builder setType(TypeEnum type) { + if (!Objects.equals(type, TypeEnum.DELIVERY_REPORT_MMS)) { + throw new IllegalArgumentException( + String.format("'type' must be '%s' (is '%s')", TypeEnum.DELIVERY_REPORT_MMS, type)); + } + return this; + } + public BatchDeliveryReportMMS build() { return new BatchDeliveryReportMMSImpl( batchId, clientReference, statuses, totalMessageCount, type); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/BatchDeliveryReportSMSImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/BatchDeliveryReportSMSImpl.java index f57462ed8..121f144d1 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/BatchDeliveryReportSMSImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/BatchDeliveryReportSMSImpl.java @@ -215,6 +215,15 @@ public Builder setTotalMessageCount(Integer totalMessageCount) { return this; } + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + Builder setType(TypeEnum type) { + if (!Objects.equals(type, TypeEnum.DELIVERY_REPORT_SMS)) { + throw new IllegalArgumentException( + String.format("'type' must be '%s' (is '%s')", TypeEnum.DELIVERY_REPORT_SMS, type)); + } + return this; + } + public BatchDeliveryReportSMS build() { return new BatchDeliveryReportSMSImpl( batchId, clientReference, statuses, totalMessageCount, type); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/RecipientDeliveryReportMMSImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/RecipientDeliveryReportMMSImpl.java index bbbc6f1b8..51b6f99ca 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/RecipientDeliveryReportMMSImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/RecipientDeliveryReportMMSImpl.java @@ -422,6 +422,16 @@ public Builder setStatus(DeliveryStatus status) { return this; } + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + Builder setType(TypeEnum type) { + if (!Objects.equals(type, TypeEnum.RECIPIENT_DELIVERY_REPORT_MMS)) { + throw new IllegalArgumentException( + String.format( + "'type' must be '%s' (is '%s')", TypeEnum.RECIPIENT_DELIVERY_REPORT_MMS, type)); + } + return this; + } + public RecipientDeliveryReportMMS build() { return new RecipientDeliveryReportMMSImpl( appliedOriginator, diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/RecipientDeliveryReportSMSImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/RecipientDeliveryReportSMSImpl.java index 97fe7e8e9..a3f06c67a 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/RecipientDeliveryReportSMSImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/deliveryreports/RecipientDeliveryReportSMSImpl.java @@ -422,6 +422,16 @@ public Builder setStatus(DeliveryStatus status) { return this; } + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + Builder setType(TypeEnum type) { + if (!Objects.equals(type, TypeEnum.RECIPIENT_DELIVERY_REPORT_SMS)) { + throw new IllegalArgumentException( + String.format( + "'type' must be '%s' (is '%s')", TypeEnum.RECIPIENT_DELIVERY_REPORT_SMS, type)); + } + return this; + } + public RecipientDeliveryReportSMS build() { return new RecipientDeliveryReportSMSImpl( appliedOriginator, diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/inbounds/BinaryMessageImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/inbounds/BinaryMessageImpl.java index 4b4329790..8559c972c 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/inbounds/BinaryMessageImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/inbounds/BinaryMessageImpl.java @@ -312,6 +312,15 @@ public Builder setTo(String to) { return this; } + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + Builder setType(TypeEnum type) { + if (!Objects.equals(type, TypeEnum.MO_BINARY)) { + throw new IllegalArgumentException( + String.format("'type' must be '%s' (is '%s')", TypeEnum.MO_BINARY, type)); + } + return this; + } + @JsonProperty(value = JSON_PROPERTY_BODY, required = true) public Builder setBody(String body) { this.body = OptionalValue.of(body); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/inbounds/MediaMessageImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/inbounds/MediaMessageImpl.java index 33a0e398f..199181fe2 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/inbounds/MediaMessageImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/inbounds/MediaMessageImpl.java @@ -290,6 +290,15 @@ public Builder setTo(String to) { return this; } + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + Builder setType(TypeEnum type) { + if (!Objects.equals(type, TypeEnum.MO_MEDIA)) { + throw new IllegalArgumentException( + String.format("'type' must be '%s' (is '%s')", TypeEnum.MO_MEDIA, type)); + } + return this; + } + @JsonProperty(value = JSON_PROPERTY_BODY, required = true) public Builder setBody(MediaMessageBody body) { this.body = OptionalValue.of(body); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/inbounds/TextMessageImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/inbounds/TextMessageImpl.java index 5858aaae1..b00331419 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/inbounds/TextMessageImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/models/v1/inbounds/TextMessageImpl.java @@ -290,6 +290,15 @@ public Builder setTo(String to) { return this; } + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + Builder setType(TypeEnum type) { + if (!Objects.equals(type, TypeEnum.MO_TEXT)) { + throw new IllegalArgumentException( + String.format("'type' must be '%s' (is '%s')", TypeEnum.MO_TEXT, type)); + } + return this; + } + @JsonProperty(value = JSON_PROPERTY_BODY, required = true) public Builder setBody(String body) { this.body = OptionalValue.of(body); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/VerificationReportRequestFlashCallImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/VerificationReportRequestFlashCallImpl.java index 4c8b88768..42d32286d 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/VerificationReportRequestFlashCallImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/VerificationReportRequestFlashCallImpl.java @@ -132,6 +132,15 @@ static class Builder implements VerificationReportRequestFlashCall.Builder { VerificationReportRequestFlashCallOptions.Builder _delegatedBuilder = null; + @JsonProperty(value = JSON_PROPERTY_METHOD, required = true) + Builder setMethod(MethodEnum method) { + if (!Objects.equals(method, MethodEnum.FLASH_CALL)) { + throw new IllegalArgumentException( + String.format("'method' must be '%s' (is '%s')", MethodEnum.FLASH_CALL, method)); + } + return this; + } + @JsonProperty(value = JSON_PROPERTY_FLASH_CALL, required = true) public Builder setFlashCall(VerificationReportRequestFlashCallOptions flashCall) { this.flashCall = OptionalValue.of(flashCall); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/VerificationReportRequestPhoneCallImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/VerificationReportRequestPhoneCallImpl.java index 8aecad875..0d2291626 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/VerificationReportRequestPhoneCallImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/VerificationReportRequestPhoneCallImpl.java @@ -132,6 +132,15 @@ static class Builder implements VerificationReportRequestPhoneCall.Builder { VerificationReportRequestPhoneCallOptions.Builder _delegatedBuilder = null; + @JsonProperty(value = JSON_PROPERTY_METHOD, required = true) + Builder setMethod(MethodEnum method) { + if (!Objects.equals(method, MethodEnum.PHONE_CALL)) { + throw new IllegalArgumentException( + String.format("'method' must be '%s' (is '%s')", MethodEnum.PHONE_CALL, method)); + } + return this; + } + @JsonProperty(value = JSON_PROPERTY_CALLOUT, required = true) public Builder setCallout(VerificationReportRequestPhoneCallOptions callout) { this.callout = OptionalValue.of(callout); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/VerificationReportRequestSmsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/VerificationReportRequestSmsImpl.java index 3e5077e8a..a434e66ac 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/VerificationReportRequestSmsImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/VerificationReportRequestSmsImpl.java @@ -130,6 +130,15 @@ static class Builder implements VerificationReportRequestSms.Builder { VerificationReportRequestSmsOptions.Builder _delegatedBuilder = null; + @JsonProperty(value = JSON_PROPERTY_METHOD, required = true) + Builder setMethod(MethodEnum method) { + if (!Objects.equals(method, MethodEnum.SMS)) { + throw new IllegalArgumentException( + String.format("'method' must be '%s' (is '%s')", MethodEnum.SMS, method)); + } + return this; + } + @JsonProperty(value = JSON_PROPERTY_SMS, required = true) public Builder setSms(VerificationReportRequestSmsOptions sms) { this.sms = OptionalValue.of(sms); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/VerificationReportRequestWhatsAppImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/VerificationReportRequestWhatsAppImpl.java index f049d8926..16bccf752 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/VerificationReportRequestWhatsAppImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/request/VerificationReportRequestWhatsAppImpl.java @@ -132,6 +132,15 @@ static class Builder implements VerificationReportRequestWhatsApp.Builder { VerificationReportRequestWhatsAppOptions.Builder _delegatedBuilder = null; + @JsonProperty(value = JSON_PROPERTY_METHOD, required = true) + Builder setMethod(MethodEnum method) { + if (!Objects.equals(method, MethodEnum.WHATSAPP)) { + throw new IllegalArgumentException( + String.format("'method' must be '%s' (is '%s')", MethodEnum.WHATSAPP, method)); + } + return this; + } + @JsonProperty(value = JSON_PROPERTY_WHATSAPP, required = true) public Builder setWhatsapp(VerificationReportRequestWhatsAppOptions whatsapp) { this.whatsapp = OptionalValue.of(whatsapp); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/response/VerificationReportResponseFlashCallImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/response/VerificationReportResponseFlashCallImpl.java index 059e56d35..70566649a 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/response/VerificationReportResponseFlashCallImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/response/VerificationReportResponseFlashCallImpl.java @@ -176,6 +176,16 @@ public Builder setId(String id) { return this; } + @JsonProperty(value = JSON_PROPERTY_METHOD, required = true) + Builder setMethod(VerificationMethod method) { + if (!Objects.equals(method, VerificationMethod.FLASH_CALL)) { + throw new IllegalArgumentException( + String.format( + "'method' must be '%s' (is '%s')", VerificationMethod.FLASH_CALL, method)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_STATUS) public Builder setStatus(VerificationStatus status) { this.status = OptionalValue.of(status); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/response/VerificationReportResponsePhoneCallImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/response/VerificationReportResponsePhoneCallImpl.java index 7e91bfab3..03d83da81 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/response/VerificationReportResponsePhoneCallImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/response/VerificationReportResponsePhoneCallImpl.java @@ -176,6 +176,16 @@ public Builder setId(String id) { return this; } + @JsonProperty(value = JSON_PROPERTY_METHOD, required = true) + Builder setMethod(VerificationMethod method) { + if (!Objects.equals(method, VerificationMethod.PHONE_CALL)) { + throw new IllegalArgumentException( + String.format( + "'method' must be '%s' (is '%s')", VerificationMethod.PHONE_CALL, method)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_STATUS) public Builder setStatus(VerificationStatus status) { this.status = OptionalValue.of(status); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/response/VerificationReportResponseSmsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/response/VerificationReportResponseSmsImpl.java index 25f1920be..0752b7040 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/response/VerificationReportResponseSmsImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/response/VerificationReportResponseSmsImpl.java @@ -155,6 +155,15 @@ public Builder setId(String id) { return this; } + @JsonProperty(value = JSON_PROPERTY_METHOD, required = true) + Builder setMethod(VerificationMethod method) { + if (!Objects.equals(method, VerificationMethod.SMS)) { + throw new IllegalArgumentException( + String.format("'method' must be '%s' (is '%s')", VerificationMethod.SMS, method)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_STATUS) public Builder setStatus(VerificationStatus status) { this.status = OptionalValue.of(status); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/response/VerificationReportResponseWhatsAppImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/response/VerificationReportResponseWhatsAppImpl.java index b51eca4b0..0bb6f2ee9 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/response/VerificationReportResponseWhatsAppImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/report/response/VerificationReportResponseWhatsAppImpl.java @@ -155,6 +155,15 @@ public Builder setId(String id) { return this; } + @JsonProperty(value = JSON_PROPERTY_METHOD, required = true) + Builder setMethod(VerificationMethod method) { + if (!Objects.equals(method, VerificationMethod.WHATSAPP)) { + throw new IllegalArgumentException( + String.format("'method' must be '%s' (is '%s')", VerificationMethod.WHATSAPP, method)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_STATUS) public Builder setStatus(VerificationStatus status) { this.status = OptionalValue.of(status); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestDataImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestDataImpl.java index 356216d44..76767944d 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestDataImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestDataImpl.java @@ -154,6 +154,15 @@ public Builder setIdentity(Identity identity) { return this; } + @JsonProperty(value = JSON_PROPERTY_METHOD, required = true) + Builder setMethod(VerificationMethodStart method) { + if (!Objects.equals(method, VerificationMethodStart.DATA)) { + throw new IllegalArgumentException( + String.format("'method' must be '%s' (is '%s')", VerificationMethodStart.DATA, method)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_REFERENCE) public Builder setReference(String reference) { this.reference = OptionalValue.of(reference); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestFlashCallImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestFlashCallImpl.java index 16ebfe298..4eade71fe 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestFlashCallImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestFlashCallImpl.java @@ -232,6 +232,16 @@ public Builder setIdentity(Identity identity) { return this; } + @JsonProperty(value = JSON_PROPERTY_METHOD, required = true) + Builder setMethod(VerificationMethodStart method) { + if (!Objects.equals(method, VerificationMethodStart.FLASH_CALL)) { + throw new IllegalArgumentException( + String.format( + "'method' must be '%s' (is '%s')", VerificationMethodStart.FLASH_CALL, method)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_REFERENCE) public Builder setReference(String reference) { this.reference = OptionalValue.of(reference); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestPhoneCallImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestPhoneCallImpl.java index baf341afd..3dd7fbc39 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestPhoneCallImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestPhoneCallImpl.java @@ -213,6 +213,16 @@ public Builder setIdentity(Identity identity) { return this; } + @JsonProperty(value = JSON_PROPERTY_METHOD, required = true) + Builder setMethod(VerificationMethodStart method) { + if (!Objects.equals(method, VerificationMethodStart.PHONE_CALL)) { + throw new IllegalArgumentException( + String.format( + "'method' must be '%s' (is '%s')", VerificationMethodStart.PHONE_CALL, method)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_REFERENCE) public Builder setReference(String reference) { this.reference = OptionalValue.of(reference); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestSmsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestSmsImpl.java index f65ca1f9b..94fb34eb0 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestSmsImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestSmsImpl.java @@ -259,6 +259,15 @@ public Builder setIdentity(Identity identity) { return this; } + @JsonProperty(value = JSON_PROPERTY_METHOD, required = true) + Builder setMethod(VerificationMethodStart method) { + if (!Objects.equals(method, VerificationMethodStart.SMS)) { + throw new IllegalArgumentException( + String.format("'method' must be '%s' (is '%s')", VerificationMethodStart.SMS, method)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_REFERENCE) public Builder setReference(String reference) { this.reference = OptionalValue.of(reference); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestWhatsAppImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestWhatsAppImpl.java index 5c6b9be53..9f4e8701a 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestWhatsAppImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestWhatsAppImpl.java @@ -214,6 +214,16 @@ public Builder setIdentity(Identity identity) { return this; } + @JsonProperty(value = JSON_PROPERTY_METHOD, required = true) + Builder setMethod(VerificationMethodStart method) { + if (!Objects.equals(method, VerificationMethodStart.WHATSAPP)) { + throw new IllegalArgumentException( + String.format( + "'method' must be '%s' (is '%s')", VerificationMethodStart.WHATSAPP, method)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_REFERENCE) public Builder setReference(String reference) { this.reference = OptionalValue.of(reference); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseDataImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseDataImpl.java index 0d2cef702..5216bec3d 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseDataImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseDataImpl.java @@ -182,6 +182,15 @@ public Builder setId(String id) { return this; } + @JsonProperty(value = JSON_PROPERTY_METHOD, required = true) + Builder setMethod(VerificationMethodStart method) { + if (!Objects.equals(method, VerificationMethodStart.DATA)) { + throw new IllegalArgumentException( + String.format("'method' must be '%s' (is '%s')", VerificationMethodStart.DATA, method)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_LINKS) public Builder setLinks(List links) { this.links = OptionalValue.of(links); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseFlashCallImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseFlashCallImpl.java index 44820952b..6cce87f36 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseFlashCallImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseFlashCallImpl.java @@ -238,6 +238,16 @@ public Builder setId(String id) { return this; } + @JsonProperty(value = JSON_PROPERTY_METHOD, required = true) + Builder setMethod(VerificationMethodStart method) { + if (!Objects.equals(method, VerificationMethodStart.FLASH_CALL)) { + throw new IllegalArgumentException( + String.format( + "'method' must be '%s' (is '%s')", VerificationMethodStart.FLASH_CALL, method)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_LINKS) public Builder setLinks(List links) { this.links = OptionalValue.of(links); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponsePhoneCallImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponsePhoneCallImpl.java index 5fa39f28d..aea159532 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponsePhoneCallImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponsePhoneCallImpl.java @@ -134,6 +134,16 @@ public Builder setId(String id) { return this; } + @JsonProperty(value = JSON_PROPERTY_METHOD, required = true) + Builder setMethod(VerificationMethodStart method) { + if (!Objects.equals(method, VerificationMethodStart.PHONE_CALL)) { + throw new IllegalArgumentException( + String.format( + "'method' must be '%s' (is '%s')", VerificationMethodStart.PHONE_CALL, method)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_LINKS) public Builder setLinks(List links) { this.links = OptionalValue.of(links); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseSmsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseSmsImpl.java index e6abbad90..7fe43ddf5 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseSmsImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseSmsImpl.java @@ -217,6 +217,15 @@ public Builder setId(String id) { return this; } + @JsonProperty(value = JSON_PROPERTY_METHOD, required = true) + Builder setMethod(VerificationMethodStart method) { + if (!Objects.equals(method, VerificationMethodStart.SMS)) { + throw new IllegalArgumentException( + String.format("'method' must be '%s' (is '%s')", VerificationMethodStart.SMS, method)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_LINKS) public Builder setLinks(List links) { this.links = OptionalValue.of(links); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseWhatsAppImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseWhatsAppImpl.java index eaa96c1be..dd9d02122 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseWhatsAppImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/response/VerificationStartResponseWhatsAppImpl.java @@ -189,6 +189,16 @@ public Builder setId(String id) { return this; } + @JsonProperty(value = JSON_PROPERTY_METHOD, required = true) + Builder setMethod(VerificationMethodStart method) { + if (!Objects.equals(method, VerificationMethodStart.WHATSAPP)) { + throw new IllegalArgumentException( + String.format( + "'method' must be '%s' (is '%s')", VerificationMethodStart.WHATSAPP, method)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_LINKS) public Builder setLinks(List links) { this.links = OptionalValue.of(links); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponseFlashCallImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponseFlashCallImpl.java index 05d786f14..5aebb5ec8 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponseFlashCallImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponseFlashCallImpl.java @@ -378,6 +378,15 @@ public Builder setVerificationTimestamp(Instant verificationTimestamp) { return this; } + @JsonProperty(JSON_PROPERTY_METHOD) + Builder setMethod(MethodEnum method) { + if (!Objects.equals(method, MethodEnum.FLASH_CALL)) { + throw new IllegalArgumentException( + String.format("'method' must be '%s' (is '%s')", MethodEnum.FLASH_CALL, method)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_CALL_COMPLETE) public Builder setCallComplete(Boolean callComplete) { this.callComplete = OptionalValue.of(callComplete); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponsePhoneCallImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponsePhoneCallImpl.java index 7299a2f1a..ad49a93ea 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponsePhoneCallImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponsePhoneCallImpl.java @@ -355,6 +355,15 @@ public Builder setVerificationTimestamp(Instant verificationTimestamp) { return this; } + @JsonProperty(JSON_PROPERTY_METHOD) + Builder setMethod(MethodEnum method) { + if (!Objects.equals(method, MethodEnum.PHONE_CALL)) { + throw new IllegalArgumentException( + String.format("'method' must be '%s' (is '%s')", MethodEnum.PHONE_CALL, method)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_CALL_COMPLETE) public Builder setCallComplete(Boolean callComplete) { this.callComplete = OptionalValue.of(callComplete); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponseSmsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponseSmsImpl.java index 20342c2e6..7756fc4ab 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponseSmsImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponseSmsImpl.java @@ -332,6 +332,15 @@ public Builder setVerificationTimestamp(Instant verificationTimestamp) { return this; } + @JsonProperty(JSON_PROPERTY_METHOD) + Builder setMethod(MethodEnum method) { + if (!Objects.equals(method, MethodEnum.SMS)) { + throw new IllegalArgumentException( + String.format("'method' must be '%s' (is '%s')", MethodEnum.SMS, method)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_PRICE) public Builder setPrice(VerificationStatusResponseSmsPrice price) { this.price = OptionalValue.of(price); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponseWhatsAppImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponseWhatsAppImpl.java index b1a8f7caf..efe18d553 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponseWhatsAppImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponseWhatsAppImpl.java @@ -332,6 +332,15 @@ public Builder setVerificationTimestamp(Instant verificationTimestamp) { return this; } + @JsonProperty(JSON_PROPERTY_METHOD) + Builder setMethod(MethodEnum method) { + if (!Objects.equals(method, MethodEnum.WHATSAPP)) { + throw new IllegalArgumentException( + String.format("'method' must be '%s' (is '%s')", MethodEnum.WHATSAPP, method)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_PRICE) public Builder setPrice(VerificationStatusResponseSmsPrice price) { this.price = OptionalValue.of(price); 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/webhooks/VerificationRequestEventImpl.java index 21d8e1cda..8b97b30db 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/webhooks/VerificationRequestEventImpl.java @@ -239,6 +239,16 @@ public Builder setId(String id) { return this; } + @JsonProperty(value = JSON_PROPERTY_EVENT, required = true) + Builder setEvent(EventEnum event) { + if (!Objects.equals(event, EventEnum.VERIFICATION_REQUEST_EVENT)) { + throw new IllegalArgumentException( + String.format( + "'event' must be '%s' (is '%s')", EventEnum.VERIFICATION_REQUEST_EVENT, event)); + } + return this; + } + @JsonProperty(value = JSON_PROPERTY_METHOD, required = true) public Builder setMethod(VerificationMethod method) { this.method = OptionalValue.of(method); 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/webhooks/VerificationResultEventImpl.java index d89066546..bc36c5552 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/webhooks/VerificationResultEventImpl.java @@ -261,6 +261,16 @@ public Builder setId(String id) { return this; } + @JsonProperty(value = JSON_PROPERTY_EVENT, required = true) + Builder setEvent(EventEnum event) { + if (!Objects.equals(event, EventEnum.VERIFICATION_RESULT_EVENT)) { + throw new IllegalArgumentException( + String.format( + "'event' must be '%s' (is '%s')", EventEnum.VERIFICATION_RESULT_EVENT, event)); + } + return this; + } + @JsonProperty(value = JSON_PROPERTY_METHOD, required = true) public Builder setMethod(VerificationMethod method) { this.method = OptionalValue.of(method); 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/webhooks/VerificationSmsDeliveredEventImpl.java index 9c41a27f6..0ca9948b3 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/webhooks/VerificationSmsDeliveredEventImpl.java @@ -217,6 +217,17 @@ public Builder setId(String id) { return this; } + @JsonProperty(value = JSON_PROPERTY_EVENT, required = true) + Builder setEvent(EventEnum event) { + if (!Objects.equals(event, EventEnum.VERIFICATION_SMS_DELIVERED_EVENT)) { + throw new IllegalArgumentException( + String.format( + "'event' must be '%s' (is '%s')", + EventEnum.VERIFICATION_SMS_DELIVERED_EVENT, event)); + } + return this; + } + @JsonProperty(value = JSON_PROPERTY_METHOD, required = true) public Builder setMethod(VerificationMethod method) { this.method = OptionalValue.of(method); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/CalloutRequestConferenceImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/CalloutRequestConferenceImpl.java index 002796fa0..f66dfd078 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/CalloutRequestConferenceImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/CalloutRequestConferenceImpl.java @@ -373,6 +373,17 @@ static class Builder implements CalloutRequestConference.Builder { ConferenceCalloutInternal.Builder _delegatedBuilder = null; + @JsonProperty(JSON_PROPERTY_METHOD) + Builder setMethod(MethodEnum method) { + if (!Objects.equals(method, CalloutRequestConference.MethodEnum.CONFERENCE_CALLOUT)) { + throw new IllegalArgumentException( + String.format( + "'method' must be '%s' (is '%s')", + CalloutRequestConference.MethodEnum.CONFERENCE_CALLOUT, method)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_CONFERENCE_CALLOUT) public Builder setConferenceCallout(ConferenceCalloutInternal conferenceCallout) { this.conferenceCallout = OptionalValue.of(conferenceCallout); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/CalloutRequestCustomImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/CalloutRequestCustomImpl.java index 24ed08504..be75f250b 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/CalloutRequestCustomImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/CalloutRequestCustomImpl.java @@ -261,6 +261,15 @@ static class Builder implements CalloutRequestCustom.Builder { CustomCalloutInternal.Builder _delegatedBuilder = null; + @JsonProperty(JSON_PROPERTY_METHOD) + Builder setMethod(MethodEnum method) { + if (!Objects.equals(method, MethodEnum.CUSTOM_CALLOUT)) { + throw new IllegalArgumentException( + String.format("'method' must be '%s' (is '%s')", MethodEnum.CUSTOM_CALLOUT, method)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_CUSTOM_CALLOUT) public Builder setCustomCallout(CustomCalloutInternal customCallout) { this.customCallout = OptionalValue.of(customCallout); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/CalloutRequestTTSImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/CalloutRequestTTSImpl.java index c2a9ce1ec..5e9723796 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/CalloutRequestTTSImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/CalloutRequestTTSImpl.java @@ -281,6 +281,15 @@ static class Builder implements CalloutRequestTTS.Builder { TtsCalloutInternal.Builder _delegatedBuilder = null; + @JsonProperty(JSON_PROPERTY_METHOD) + Builder setMethod(MethodEnum method) { + if (!Objects.equals(method, MethodEnum.TTS_CALLOUT)) { + throw new IllegalArgumentException( + String.format("'method' must be '%s' (is '%s')", MethodEnum.TTS_CALLOUT, method)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_TTS_CALLOUT) public Builder setTtsCallout(TtsCalloutInternal ttsCallout) { this.ttsCallout = OptionalValue.of(ttsCallout); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationDidImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationDidImpl.java index 63c53f22a..c36fdf037 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationDidImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationDidImpl.java @@ -100,6 +100,15 @@ static class Builder implements DestinationDid.Builder { OptionalValue type = OptionalValue.of(DidDestination.DID); OptionalValue endpoint = OptionalValue.empty(); + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + Builder setType(DidDestination type) { + if (!Objects.equals(type, DidDestination.DID)) { + throw new IllegalArgumentException( + String.format("'type' must be '%s' (is '%s')", DidDestination.DID, type)); + } + return this; + } + @JsonProperty(value = JSON_PROPERTY_ENDPOINT, required = true) public Builder setEndpoint(String endpoint) { this.endpoint = OptionalValue.of(endpoint); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationMxpImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationMxpImpl.java index 6b2649d7e..f31490392 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationMxpImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationMxpImpl.java @@ -11,6 +11,7 @@ import com.sinch.sdk.domains.voice.models.v1.calls.response.CallInformationTo; import com.sinch.sdk.domains.voice.models.v1.destination.internal.MxpDestination; import java.util.Objects; +import java.util.stream.Stream; @JsonPropertyOrder({ DestinationMxpImpl.JSON_PROPERTY_TYPE, @@ -109,6 +110,16 @@ static class Builder implements DestinationMxp.Builder { OptionalValue type = OptionalValue.of(MxpDestination.USERNAME); OptionalValue endpoint = OptionalValue.empty(); + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + Builder setType(MxpDestination type) { + if (Stream.of(MxpDestination.USERNAME, MxpDestination.USERNAME2) + .noneMatch(d -> Objects.equals(d, type))) { + throw new IllegalArgumentException( + String.format("'type' must be '%s' (is '%s')", type, MxpDestination.USERNAME)); + } + return this; + } + @JsonProperty(value = JSON_PROPERTY_ENDPOINT, required = true) public Builder setEndpoint(String endpoint) { this.endpoint = OptionalValue.of(endpoint); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationPstnImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationPstnImpl.java index 56c525609..646ab997a 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationPstnImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationPstnImpl.java @@ -11,6 +11,7 @@ import com.sinch.sdk.domains.voice.models.v1.calls.response.CallInformationTo; import com.sinch.sdk.domains.voice.models.v1.destination.internal.PstnDestination; import java.util.Objects; +import java.util.stream.Stream; @JsonPropertyOrder({ DestinationPstnImpl.JSON_PROPERTY_TYPE, @@ -110,6 +111,16 @@ static class Builder implements DestinationPstn.Builder { OptionalValue type = OptionalValue.of(PstnDestination.NUMBER); OptionalValue endpoint = OptionalValue.empty(); + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + Builder setType(PstnDestination type) { + if (Stream.of(PstnDestination.NUMBER, PstnDestination.NUMBER2) + .noneMatch(d -> Objects.equals(d, type))) { + throw new IllegalArgumentException( + String.format("'type' must be '%s' (is '%s')", type, PstnDestination.NUMBER)); + } + return this; + } + @JsonProperty(value = JSON_PROPERTY_ENDPOINT, required = true) public Builder setEndpoint(String endpoint) { this.endpoint = OptionalValue.of(endpoint); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationSipImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationSipImpl.java index e16785c27..8e8d9c75b 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationSipImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationSipImpl.java @@ -109,6 +109,15 @@ static class Builder implements DestinationSip.Builder { OptionalValue type = OptionalValue.of(SipDestination.SIP); OptionalValue endpoint = OptionalValue.empty(); + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + Builder setType(SipDestination type) { + if (!Objects.equals(type, SipDestination.SIP)) { + throw new IllegalArgumentException( + String.format("'type' must be '%s' (is '%s')", SipDestination.SIP, type)); + } + return this; + } + @JsonProperty(value = JSON_PROPERTY_ENDPOINT, required = true) public Builder setEndpoint(String endpoint) { this.endpoint = OptionalValue.of(endpoint); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationWebSocketImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationWebSocketImpl.java index 99ebd5f28..95cbb887f 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationWebSocketImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationWebSocketImpl.java @@ -99,6 +99,16 @@ static class Builder implements DestinationWebSocket.Builder { OptionalValue type = OptionalValue.of(DestinationWebSocket.TypeEnum.WEBSOCKET); OptionalValue endpoint = OptionalValue.empty(); + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + Builder setType(TypeEnum type) { + if (!Objects.equals(type, DestinationWebSocket.TypeEnum.WEBSOCKET)) { + throw new IllegalArgumentException( + String.format( + "'type' must be '%s' (is '%s')", DestinationWebSocket.TypeEnum.WEBSOCKET, type)); + } + return this; + } + @JsonProperty(value = JSON_PROPERTY_ENDPOINT, required = true) public Builder setEndpoint(String endpoint) { this.endpoint = OptionalValue.of(endpoint); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectConferenceImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectConferenceImpl.java index 2f311c60d..df049c518 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectConferenceImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectConferenceImpl.java @@ -149,6 +149,15 @@ static class Builder implements SvamlActionConnectConference.Builder { OptionalValue conferenceDtmfOptions = OptionalValue.empty(); OptionalValue MusicOnHold = OptionalValue.empty(); + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + Builder setName(NameEnum name) { + if (!Objects.equals(name, NameEnum.CONNECT_CONF)) { + throw new IllegalArgumentException( + String.format("'name' must be '%s' (is '%s')", NameEnum.CONNECT_CONF, name)); + } + return this; + } + @JsonProperty(value = JSON_PROPERTY_CONFERENCE_ID, required = true) public Builder setConferenceId(String conferenceId) { this.conferenceId = OptionalValue.of(conferenceId); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectMxpImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectMxpImpl.java index 8d7119f86..dfeb8135f 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectMxpImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectMxpImpl.java @@ -126,6 +126,15 @@ static class Builder implements SvamlActionConnectMxp.Builder { OptionalValue destination = OptionalValue.empty(); OptionalValue> callheaders = OptionalValue.empty(); + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + Builder setName(NameEnum name) { + if (!Objects.equals(name, NameEnum.CONNECT_MXP)) { + throw new IllegalArgumentException( + String.format("'name' must be '%s' (is '%s')", NameEnum.CONNECT_MXP, name)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_DESTINATION) public Builder setDestination(DestinationMxp destination) { this.destination = OptionalValue.of(destination); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectPstnImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectPstnImpl.java index a64cb7f49..070368e86 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectPstnImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectPstnImpl.java @@ -282,6 +282,15 @@ static class Builder implements SvamlActionConnectPstn.Builder { OptionalValue indications = OptionalValue.empty(); OptionalValue amd = OptionalValue.empty(); + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + Builder setName(NameEnum name) { + if (!Objects.equals(name, NameEnum.CONNECT_PSTN)) { + throw new IllegalArgumentException( + String.format("'name' must be '%s' (is '%s')", NameEnum.CONNECT_PSTN, name)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_NUMBER) public Builder setNumber(String number) { this.number = OptionalValue.of(number); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectSipImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectSipImpl.java index 9b346ec03..87b7c50c3 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectSipImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectSipImpl.java @@ -240,6 +240,15 @@ static class Builder implements SvamlActionConnectSip.Builder { OptionalValue> callHeaders = OptionalValue.empty(); OptionalValue MusicOnHold = OptionalValue.empty(); + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + Builder setName(NameEnum name) { + if (!Objects.equals(name, NameEnum.CONNECT_SIP)) { + throw new IllegalArgumentException( + String.format("'name' must be '%s' (is '%s')", NameEnum.CONNECT_SIP, name)); + } + return this; + } + @JsonProperty(value = JSON_PROPERTY_DESTINATION, required = true) public Builder setDestination(DestinationSip destination) { this.destination = OptionalValue.of(destination); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectStreamImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectStreamImpl.java index 95396b0fa..4e80aa8eb 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectStreamImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectStreamImpl.java @@ -168,6 +168,15 @@ static class Builder implements SvamlActionConnectStream.Builder { OptionalValue maxDuration = OptionalValue.empty(); OptionalValue> callHeaders = OptionalValue.empty(); + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + Builder setName(NameEnum name) { + if (!Objects.equals(name, NameEnum.CONNECT_STREAM)) { + throw new IllegalArgumentException( + String.format("'name' must be '%s' (is '%s')", NameEnum.CONNECT_STREAM, name)); + } + return this; + } + @JsonProperty(value = JSON_PROPERTY_DESTINATION, required = true) public Builder setDestination(DestinationWebSocket destination) { this.destination = OptionalValue.of(destination); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionContinueImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionContinueImpl.java index 71afb7f97..09c3450e7 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionContinueImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionContinueImpl.java @@ -78,6 +78,15 @@ private String toIndentedString(Object o) { static class Builder implements SvamlActionContinue.Builder { OptionalValue name = OptionalValue.of(NameEnum.CONTINUE); + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + Builder setName(NameEnum name) { + if (!Objects.equals(name, NameEnum.CONTINUE)) { + throw new IllegalArgumentException( + String.format("'name' must be '%s' (is '%s')", NameEnum.CONTINUE, name)); + } + return this; + } + public SvamlActionContinue build() { return new SvamlActionContinueImpl(name); } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionHangupImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionHangupImpl.java index ca37fd5d2..9cdac58e9 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionHangupImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionHangupImpl.java @@ -78,6 +78,15 @@ private String toIndentedString(Object o) { static class Builder implements SvamlActionHangup.Builder { OptionalValue name = OptionalValue.of(NameEnum.HANGUP); + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + Builder setName(NameEnum name) { + if (!Objects.equals(name, NameEnum.HANGUP)) { + throw new IllegalArgumentException( + String.format("'name' must be '%s' (is '%s')", NameEnum.HANGUP, name)); + } + return this; + } + public SvamlActionHangup build() { return new SvamlActionHangupImpl(name); } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionParkImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionParkImpl.java index 79a904a57..d66651404 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionParkImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionParkImpl.java @@ -165,6 +165,15 @@ static class Builder implements SvamlActionPark.Builder { OptionalValue holdPrompt = OptionalValue.empty(); OptionalValue maxDuration = OptionalValue.empty(); + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + Builder setName(NameEnum name) { + if (!Objects.equals(name, NameEnum.PARK)) { + throw new IllegalArgumentException( + String.format("'name' must be '%s' (is '%s')", NameEnum.PARK, name)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_LOCALE) public Builder setLocale(String locale) { this.locale = OptionalValue.of(locale); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionRunMenuImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionRunMenuImpl.java index b47ed13e2..d827a95df 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionRunMenuImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionRunMenuImpl.java @@ -187,6 +187,15 @@ static class Builder implements SvamlActionRunMenu.Builder { OptionalValue enableVoice = OptionalValue.empty(); OptionalValue> menus = OptionalValue.empty(); + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + Builder setName(NameEnum name) { + if (!Objects.equals(name, NameEnum.RUN_MENU)) { + throw new IllegalArgumentException( + String.format("'name' must be '%s' (is '%s')", NameEnum.RUN_MENU, name)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_BARGE) public Builder setBarge(Boolean barge) { this.barge = OptionalValue.of(barge); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionAnswerImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionAnswerImpl.java index fbdbc55e2..533419717 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionAnswerImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionAnswerImpl.java @@ -79,6 +79,15 @@ private String toIndentedString(Object o) { static class Builder implements SvamlInstructionAnswer.Builder { OptionalValue name = OptionalValue.of(NameEnum.ANSWER); + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + Builder setName(NameEnum name) { + if (!Objects.equals(name, NameEnum.ANSWER)) { + throw new IllegalArgumentException( + String.format("'name' must be '%s' (is '%s')", NameEnum.ANSWER, name)); + } + return this; + } + public SvamlInstructionAnswer build() { return new SvamlInstructionAnswerImpl(name); } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionPlayFilesImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionPlayFilesImpl.java index fc48b5281..934fe0c05 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionPlayFilesImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionPlayFilesImpl.java @@ -123,6 +123,15 @@ static class Builder implements SvamlInstructionPlayFiles.Builder { OptionalValue> ids = OptionalValue.empty(); OptionalValue locale = OptionalValue.empty(); + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + Builder setName(NameEnum name) { + if (!Objects.equals(name, NameEnum.PLAY_FILES)) { + throw new IllegalArgumentException( + String.format("'name' must be '%s' (is '%s')", NameEnum.PLAY_FILES, name)); + } + return this; + } + @JsonProperty(value = JSON_PROPERTY_IDS, required = true) public Builder setIds(List ids) { this.ids = OptionalValue.of(ids); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionSayImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionSayImpl.java index 723ab34a1..39f2676ed 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionSayImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionSayImpl.java @@ -122,6 +122,15 @@ static class Builder implements SvamlInstructionSay.Builder { OptionalValue text = OptionalValue.empty(); OptionalValue locale = OptionalValue.empty(); + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + Builder setName(NameEnum name) { + if (!Objects.equals(name, NameEnum.SAY)) { + throw new IllegalArgumentException( + String.format("'name' must be '%s' (is '%s')", NameEnum.SAY, name)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_TEXT) public Builder setText(String text) { this.text = OptionalValue.of(text); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionSendDtmfImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionSendDtmfImpl.java index 3e0d91a05..d3104ab37 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionSendDtmfImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionSendDtmfImpl.java @@ -102,6 +102,15 @@ static class Builder implements SvamlInstructionSendDtmf.Builder { OptionalValue name = OptionalValue.of(NameEnum.SEND_DTMF); OptionalValue value = OptionalValue.empty(); + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + Builder setName(NameEnum name) { + if (!Objects.equals(name, NameEnum.SEND_DTMF)) { + throw new IllegalArgumentException( + String.format("'name' must be '%s' (is '%s')", NameEnum.SEND_DTMF, name)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_VALUE) public Builder setValue(String value) { this.value = OptionalValue.of(value); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionSetCookieImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionSetCookieImpl.java index 648da0506..47aee0d57 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionSetCookieImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionSetCookieImpl.java @@ -122,6 +122,15 @@ static class Builder implements SvamlInstructionSetCookie.Builder { OptionalValue key = OptionalValue.empty(); OptionalValue value = OptionalValue.empty(); + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + Builder setName(NameEnum name) { + if (!Objects.equals(name, NameEnum.SET_COOKIE)) { + throw new IllegalArgumentException( + String.format("'name' must be '%s' (is '%s')", NameEnum.SET_COOKIE, name)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_KEY) public Builder setKey(String key) { this.key = OptionalValue.of(key); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionStartRecordingImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionStartRecordingImpl.java index acbb08fd5..cb5d81403 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionStartRecordingImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionStartRecordingImpl.java @@ -103,6 +103,15 @@ static class Builder implements SvamlInstructionStartRecording.Builder { OptionalValue name = OptionalValue.of(NameEnum.START_RECORDING); OptionalValue options = OptionalValue.empty(); + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + Builder setName(NameEnum name) { + if (!Objects.equals(name, NameEnum.START_RECORDING)) { + throw new IllegalArgumentException( + String.format("'name' must be '%s' (is '%s')", NameEnum.START_RECORDING, name)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_OPTIONS) public Builder setOptions(StartRecordingOptions options) { this.options = OptionalValue.of(options); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionStopRecordingImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionStopRecordingImpl.java index 177dbb240..48acce001 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionStopRecordingImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionStopRecordingImpl.java @@ -80,6 +80,15 @@ private String toIndentedString(Object o) { static class Builder implements SvamlInstructionStopRecording.Builder { OptionalValue name = OptionalValue.of(NameEnum.STOP_RECORDING); + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + Builder setName(NameEnum name) { + if (!Objects.equals(name, NameEnum.STOP_RECORDING)) { + throw new IllegalArgumentException( + String.format("'name' must be '%s' (is '%s')", NameEnum.STOP_RECORDING, name)); + } + return this; + } + public SvamlInstructionStopRecording build() { return new SvamlInstructionStopRecordingImpl(name); } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/AnsweredCallEventImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/AnsweredCallEventImpl.java index f541f8659..3d34f4a66 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/AnsweredCallEventImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/AnsweredCallEventImpl.java @@ -266,6 +266,15 @@ public Builder setApplicationKey(String applicationKey) { return this; } + @JsonProperty(value = JSON_PROPERTY_EVENT, required = true) + Builder setEvent(WebhooksEventRequestType event) { + if (!Objects.equals(event, WebhooksEventRequestType.ACE)) { + throw new IllegalArgumentException( + String.format("'event' must be '%s' (is '%s')", WebhooksEventRequestType.ACE, event)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_AMD) public Builder setAmd(AnsweringMachineDetection amd) { this.amd = OptionalValue.of(amd); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/DisconnectedCallEventImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/DisconnectedCallEventImpl.java index a2b4da30b..60f7d7c15 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/DisconnectedCallEventImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/DisconnectedCallEventImpl.java @@ -425,6 +425,15 @@ public Builder setApplicationKey(String applicationKey) { return this; } + @JsonProperty(value = JSON_PROPERTY_EVENT, required = true) + Builder setEvent(WebhooksEventRequestType event) { + if (!Objects.equals(event, WebhooksEventRequestType.DICE)) { + throw new IllegalArgumentException( + String.format("'event' must be '%s' (is '%s')", WebhooksEventRequestType.DICE, event)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_REASON) public Builder setReason(ReasonEnum reason) { this.reason = OptionalValue.of(reason); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/IncomingCallEventImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/IncomingCallEventImpl.java index 423ca32a1..5d7f9471e 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/IncomingCallEventImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/IncomingCallEventImpl.java @@ -447,6 +447,15 @@ public Builder setApplicationKey(String applicationKey) { return this; } + @JsonProperty(value = JSON_PROPERTY_EVENT, required = true) + Builder setEvent(WebhooksEventRequestType event) { + if (!Objects.equals(event, WebhooksEventRequestType.ICE)) { + throw new IllegalArgumentException( + String.format("'event' must be '%s' (is '%s')", WebhooksEventRequestType.ICE, event)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_CALL_RESOURCE_URL) public Builder setCallResourceUrl(String callResourceUrl) { this.callResourceUrl = OptionalValue.of(callResourceUrl); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/NotificationEventImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/NotificationEventImpl.java index 370c462b0..bbe3448d5 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/NotificationEventImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/NotificationEventImpl.java @@ -239,6 +239,16 @@ static class Builder implements NotificationEvent.Builder { OptionalValue conferenceId = OptionalValue.empty(); OptionalValue version = OptionalValue.empty(); + @JsonProperty(JSON_PROPERTY_EVENT) + Builder setEvent(WebhooksEventRequestType event) { + if (!Objects.equals(event, WebhooksEventRequestType.NOTIFY)) { + throw new IllegalArgumentException( + String.format( + "'event' must be '%s' (is '%s')", WebhooksEventRequestType.NOTIFY, event)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_TYPE) public Builder setType(String type) { this.type = OptionalValue.of(type); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/PromptInputEventImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/PromptInputEventImpl.java index 125fb6690..ab734b767 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/PromptInputEventImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/PromptInputEventImpl.java @@ -247,6 +247,15 @@ static class Builder implements PromptInputEvent.Builder { OptionalValue conferenceId = OptionalValue.empty(); OptionalValue version = OptionalValue.empty(); + @JsonProperty(value = JSON_PROPERTY_EVENT, required = true) + Builder setEvent(WebhooksEventRequestType event) { + if (!Objects.equals(event, WebhooksEventRequestType.PIE)) { + throw new IllegalArgumentException( + String.format("'event' must be '%s' (is '%s')", WebhooksEventRequestType.PIE, event)); + } + return this; + } + @JsonProperty(JSON_PROPERTY_TIMESTAMP) public Builder setTimestamp(Instant timestamp) { this.timestamp = OptionalValue.of(timestamp); diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/destination/DestinationTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/destination/DestinationTest.java index 22adcdc36..83cfc91f0 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/destination/DestinationTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/destination/DestinationTest.java @@ -28,9 +28,15 @@ class DestinationTest extends VoiceBaseTest { @GivenTextResource("/domains/voice/v1/destination/DestinationMxpDto.json") String jsonUserName; + @GivenTextResource("/domains/voice/v1/destination/DestinationMxpAliasDto.json") + String jsonUserNameAlias; + @GivenTextResource("/domains/voice/v1/destination/DestinationPstnDto.json") String jsonNumber; + @GivenTextResource("/domains/voice/v1/destination/DestinationPstnAliasDto.json") + String jsonNumberAlias; + @GivenTextResource("/domains/voice/v1/destination/DestinationSipDto.json") String jsonSip; @@ -54,6 +60,13 @@ void deserializeMxp() throws JsonProcessingException { TestHelpers.recursiveEquals(userName, expected); } + @Test + void deserializeMxpAlias() throws JsonProcessingException { + Destination expected = objectMapper.readValue(jsonUserNameAlias, Destination.class); + + TestHelpers.recursiveEquals(userName, expected); + } + @Test void serializePstn() throws JsonProcessingException, JSONException { String serializedString = objectMapper.writeValueAsString(number); @@ -68,6 +81,13 @@ void deserializePstn() throws JsonProcessingException { TestHelpers.recursiveEquals(number, expected); } + @Test + void deserializePstnAlias() throws JsonProcessingException { + Destination expected = objectMapper.readValue(jsonNumberAlias, Destination.class); + + TestHelpers.recursiveEquals(number, expected); + } + @Test void serializeSIP() throws JsonProcessingException, JSONException { String serializedString = objectMapper.writeValueAsString(sip); diff --git a/openapi-contracts/src/test/resources/domains/voice/v1/destination/DestinationMxpAliasDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/destination/DestinationMxpAliasDto.json new file mode 100644 index 000000000..f4a399601 --- /dev/null +++ b/openapi-contracts/src/test/resources/domains/voice/v1/destination/DestinationMxpAliasDto.json @@ -0,0 +1,4 @@ +{ + "type": "Username", + "endpoint": "user name value" +} diff --git a/openapi-contracts/src/test/resources/domains/voice/v1/destination/DestinationPstnAliasDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/destination/DestinationPstnAliasDto.json new file mode 100644 index 000000000..de0a879e3 --- /dev/null +++ b/openapi-contracts/src/test/resources/domains/voice/v1/destination/DestinationPstnAliasDto.json @@ -0,0 +1,4 @@ +{ + "type": "Number", + "endpoint": "+123456789" +} From 8a8884d674ee148f38b1dc4f1950984a740f320a Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier Date: Wed, 25 Jun 2025 15:00:58 +0200 Subject: [PATCH 026/122] refactor (Numbers): Use auto-pagination response based onto generator --- MIGRATION-GUIDE.md | 30 +- .../adapters/ActiveNumberServiceFacade.java | 43 +-- .../AvailableNumberServiceFacade.java | 42 +-- .../api/v1/adapters/NumbersService.java | 23 +- .../request/AvailableRegionListRequest.java | 66 ---- .../response/AvailableRegionListResponse.java | 36 --- .../v1/request/ActiveNumberListRequest.java | 107 ------- .../request/ActiveNumberListRequestImpl.java | 249 --------------- .../request/AvailableNumberListRequest.java | 82 ----- .../AvailableNumberListRequestImpl.java | 148 --------- .../v1/response/ActiveNumberListResponse.java | 74 ----- .../response/AvailableNumberListResponse.java | 36 --- .../v1/adapters/ActiveNumberServiceTest.java | 76 +++-- .../adapters/AvailableNumberServiceTest.java | 34 ++- .../adapters/AvailableRegionsServiceTest.java | 6 +- .../numbers/v1/AvailableRegionsSteps.java | 10 +- .../e2e/domains/numbers/v1/NumbersSteps.java | 10 +- .../pagination/HttpRequestPageNavigator.java | 31 ++ .../numbers/api/v1/ActiveNumberService.java | 26 +- .../api/v1/AvailableNumberService.java | 6 +- .../api/v1/AvailableRegionsService.java | 10 +- .../v1/adapters/ActiveNumberServiceImpl.java | 286 +++++++++--------- .../adapters/AvailableNumberServiceImpl.java | 26 +- .../adapters/AvailableRegionsServiceImpl.java | 23 +- .../response/AvailableRegion.java | 2 +- .../response/AvailableRegionImpl.java | 2 +- .../AvailableRegionsListResponse.java | 63 ++++ ...AvailableRegionsListResponseInternal.java} | 12 +- ...lableRegionsListResponseInternalImpl.java} | 26 +- .../ActiveNumbersListQueryParameters.java | 36 +-- .../ActiveNumbersListQueryParametersImpl.java | 10 +- .../numbers/models/v1/request/OrderBy.java | 13 +- .../response/ActiveNumbersListResponse.java | 64 ++++ .../AvailableNumbersListResponse.java | 63 ++++ ...=> ActiveNumbersListResponseInternal.java} | 8 +- ...ctiveNumbersListResponseInternalImpl.java} | 24 +- ...AvailableNumbersListResponseInternal.java} | 8 +- ...lableNumbersListResponseInternalImpl.java} | 22 +- .../models/v1/ActiveNumberDtoTest.java | 19 +- .../models/v1/AvailableNumberDtoTest.java | 10 +- .../models/v1/AvailableRegionsDtoTest.java | 12 +- .../java/com/sinch/sample/numbers/List.java | 4 +- .../numbers/SearchForAvailableNumbers.java | 4 +- .../sinch/sample/numbers/regions/List.java | 4 +- 44 files changed, 646 insertions(+), 1240 deletions(-) delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/available/request/AvailableRegionListRequest.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/available/response/AvailableRegionListResponse.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/v1/request/ActiveNumberListRequest.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/v1/request/ActiveNumberListRequestImpl.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/v1/request/AvailableNumberListRequest.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/v1/request/AvailableNumberListRequestImpl.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/v1/response/ActiveNumberListResponse.java delete mode 100644 client/src/main/com/sinch/sdk/domains/numbers/models/v1/response/AvailableNumberListResponse.java create mode 100644 core/src/main/com/sinch/sdk/core/models/pagination/HttpRequestPageNavigator.java rename openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/{available => }/response/AvailableRegion.java (96%) rename openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/{available => }/response/AvailableRegionImpl.java (98%) create mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/response/AvailableRegionsListResponse.java rename openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/{available/response/internal/AvailableRegionListResponseInternal.java => response/internal/AvailableRegionsListResponseInternal.java} (70%) rename openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/{available/response/internal/AvailableRegionListResponseInternalImpl.java => response/internal/AvailableRegionsListResponseInternalImpl.java} (73%) rename {client => openapi-contracts}/src/main/com/sinch/sdk/domains/numbers/models/v1/request/OrderBy.java (81%) create mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/response/ActiveNumbersListResponse.java create mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/response/AvailableNumbersListResponse.java rename openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/response/internal/{ActiveNumberListResponseInternal.java => ActiveNumbersListResponseInternal.java} (87%) rename openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/response/internal/{ActiveNumberListResponseInternalImpl.java => ActiveNumbersListResponseInternalImpl.java} (83%) rename openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/response/internal/{AvailableNumberListResponseInternal.java => AvailableNumbersListResponseInternal.java} (81%) rename openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/response/internal/{AvailableNumberListResponseInternalImpl.java => AvailableNumbersListResponseInternalImpl.java} (78%) diff --git a/MIGRATION-GUIDE.md b/MIGRATION-GUIDE.md index 3d151801c..0a0f10308 100644 --- a/MIGRATION-GUIDE.md +++ b/MIGRATION-GUIDE.md @@ -49,7 +49,7 @@ This guide lists all removed classes and interfaces from V1 and how to migrate t | models.requests.ActiveNumberUpdateRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumberUpdateRequest](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/ActiveNumberUpdateRequest.html) | | models.requests.ActiveNumberUpdateSMSConfigurationRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.SmsConfiguration](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/SmsConfiguration.html) | | models.requests.ActiveNumberUpdateVoiceConfigurationRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.VoiceConfiguration](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/VoiceConfiguration.html) | -| models.responses.ActiveNumberListResponse.java | [com.sinch.sdk.domains.numbers.models.v1.response.ActiveNumberListResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/response/ActiveNumberListResponse.html) | +| models.responses.ActiveNumberListResponse.java | [com.sinch.sdk.domains.numbers.models.v1.response.ActiveNumbersListResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/response/ActiveNumbersListResponse.html) | ##### Available Numbers | Old class | New class | @@ -57,15 +57,15 @@ This guide lists all removed classes and interfaces from V1 and how to migrate t | models.requests.AvailableNumberListAllRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumbersListQueryParameters](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/AvailableNumbersListQueryParameters.html) | | models.requests.AvailableNumberRentAnyRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentAnyRequest](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/AvailableNumberRentAnyRequest.html) | | models.requests.AvailableNumberRentRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentRequest](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/request/AvailableNumberRentRequest.html) | -| models.responses.AvailableNumberListResponse | [com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumberListResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/response/AvailableNumberListResponse.html) | +| models.responses.AvailableNumberListResponse | [com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumbersListResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/response/AvailableNumbersListResponse.html) | | models.requests.RentSMSConfigurationRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.SmsConfiguration](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/SmsConfiguration.html) | | models.requests.RentVoiceConfigurationRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.VoiceConfiguration](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/VoiceConfiguration.html) | ##### Regions -| Old class | New class | -|---------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| models.requests.AvailableRegionListAllRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.regions.request.AvailableRegionsListQueryParameters](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/regions/request/AvailableRegionsListQueryParameters.html) | -| models.responses.AvailableRegionListResponse | [com.sinch.sdk.domains.numbers.models.v1.regions.available.response.AvailableRegionListResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/regions/available/response/AvailableRegionListResponse.html) | +| Old class | New class | +|---------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| models.requests.AvailableRegionListAllRequestParameters | [com.sinch.sdk.domains.numbers.models.v1.regions.request.AvailableRegionsListQueryParameters](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/regions/request/AvailableRegionsListQueryParameters.html) | +| models.responses.AvailableRegionListResponse | [com.sinch.sdk.domains.numbers.models.v1.regions.response.AvailableRegionsListResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/models/v1/regions/response/AvailableRegionsListResponse.html) | ##### Callbacks configuration | Old class | New class | @@ -139,7 +139,7 @@ Use the new versioned API under `numbers().v1()` to get access to [NumbersServic | models/requests/DeliveryReportBatchGetRequestParameters | [com.sinch.sdk.domains.sms.models.v1.deliveryreports.request.BatchDeliveryReportQueryParameters](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/deliveryreports/request/BatchDeliveryReportQueryParameters.html) | | models/requests/DeliveryReportListRequestParameters | [com.sinch.sdk.domains.sms.models.v1.deliveryreports.request.ListDeliveryReportsQueryParameters](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/deliveryreports/request/ListDeliveryReportsQueryParameters.html) | | models/responses/DeliveryReportsListResponse | [com.sinch.sdk.domains.sms.models.v1.deliveryreports.response.ListDeliveryReportsResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/deliveryreports/response/ListDeliveryReportsResponse.html) | -| models/v1/deliveryreports/DeliveryReceiptErrorCode | Renamed to [com.sinch.sdk.domains.sms.models.v1.deliveryreports.DeliveryReceiptStatusCode](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/deliveryreports/deliveryreports/DeliveryReceiptStatusCode.html) | +| models/v1/deliveryreports/DeliveryReceiptErrorCode | Renamed to [com.sinch.sdk.domains.sms.models.v1.deliveryreports.DeliveryReceiptStatusCode](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/sms/models/v1/deliveryreports/deliveryreports/DeliveryReceiptStatusCode.html) | ##### Groups | Old class | New class | @@ -349,14 +349,14 @@ Use the new versioned API under `voice().v1()` to get access to [VoiceService](h | models/LinkRelType | [com.sinch.sdk.domains.verification.models.v1.start.response.Link.RelEnum](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/start/response/Link.RelEnum.html) | ##### Verification Status -| Old class | New class | -|-------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| models/VerificationStatus | [com.sinch.sdk.domains.verification.models.v1.status.response.VerificationStatusResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponse.html) | -| models/VerificationStatusCallout | [com.sinch.sdk.domains.verification.models.v1.status.response.VerificationStatusResponsePhoneCall](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponsePhoneCall.html) | -| models/VerificationStatusFlashCall | [com.sinch.sdk.domains.verification.models.v1.status.response.VerificationStatusResponseFlashCall](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponseFlashCall.html) | -| models/VerificationStatusReasonType | [com.sinch.sdk.domains.verification.models.v1.VerificationStatusReason](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/VerificationStatusReason.html) | -| models/VerificationStatusSMS | [com.sinch.sdk.domains.verification.models.v1.status.response.VerificationStatusResponseSms](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponseSms.html) | -| 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) | +| Old class | New class | +|-------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| models/VerificationStatus | [com.sinch.sdk.domains.verification.models.v1.status.response.VerificationStatusResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponse.html) | +| models/VerificationStatusCallout | [com.sinch.sdk.domains.verification.models.v1.status.response.VerificationStatusResponsePhoneCall](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponsePhoneCall.html) | +| models/VerificationStatusFlashCall | [com.sinch.sdk.domains.verification.models.v1.status.response.VerificationStatusResponseFlashCall](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponseFlashCall.html) | +| models/VerificationStatusReasonType | [com.sinch.sdk.domains.verification.models.v1.VerificationStatusReason](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/VerificationStatusReason.html) | +| models/VerificationStatusSMS | [com.sinch.sdk.domains.verification.models.v1.status.response.VerificationStatusResponseSms](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/verification/models/v1/status/response/VerificationStatusResponseSms.html) | +| 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 | diff --git a/client/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/ActiveNumberServiceFacade.java b/client/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/ActiveNumberServiceFacade.java index f165785bf..e1dbe6505 100644 --- a/client/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/ActiveNumberServiceFacade.java +++ b/client/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/ActiveNumberServiceFacade.java @@ -8,17 +8,12 @@ import com.sinch.sdk.domains.numbers.api.v1.NumbersService; import com.sinch.sdk.domains.numbers.models.v1.ActiveNumber; import com.sinch.sdk.domains.numbers.models.v1.EmergencyAddress; -import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumberListRequest; -import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumberListRequestImpl; import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumberUpdateRequest; import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumbersListQueryParameters; -import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumbersListQueryParameters.OrderByEnum; import com.sinch.sdk.domains.numbers.models.v1.request.EmergencyAddressRequest; -import com.sinch.sdk.domains.numbers.models.v1.request.SearchPattern; -import com.sinch.sdk.domains.numbers.models.v1.response.ActiveNumberListResponse; +import com.sinch.sdk.domains.numbers.models.v1.response.ActiveNumbersListResponse; import com.sinch.sdk.domains.numbers.models.v1.response.ValidateAddressResponse; import com.sinch.sdk.models.NumbersContext; -import java.util.ArrayList; import java.util.Map; import java.util.function.Supplier; @@ -42,9 +37,8 @@ public ActiveNumberServiceFacade( numbersService); } - @Deprecated - public ActiveNumberListResponse list(ActiveNumberListRequest _parameters) throws ApiException { - return list(convert(_parameters)); + protected ActiveNumberService getService() { + return this.activeNumberService; } @Override @@ -86,37 +80,8 @@ public EmergencyAddress getEmergencyAddress(String phoneNumber) throws ApiExcept } @Override - public ActiveNumberListResponse list(ActiveNumbersListQueryParameters queryParameter) + public ActiveNumbersListResponse list(ActiveNumbersListQueryParameters queryParameter) throws ApiException { return activeNumberService.list(queryParameter); } - - @Deprecated - public static ActiveNumbersListQueryParameters convert(ActiveNumberListRequest _parameters) - throws ApiException { - - if (null == _parameters) { - return null; - } - - ActiveNumberListRequestImpl parameters = (ActiveNumberListRequestImpl) _parameters; - - ActiveNumbersListQueryParameters.Builder builder = ActiveNumbersListQueryParameters.builder(); - - parameters.regionCode().ifPresent(builder::setRegionCode); - parameters.type().ifPresent(builder::setType); - parameters.capabilities().ifPresent(p -> builder.setCapabilities(new ArrayList<>(p))); - parameters.pageSize().ifPresent(builder::setPageSize); - - parameters.orderBy().ifPresent(p -> builder.setOrderBy(OrderByEnum.from(p.value()))); - - parameters.pageToken().ifPresent(builder::setPageToken); - - if (parameters.searchPattern().isPresent()) { - SearchPattern search = parameters.getSearchPattern(); - builder.setSearchPattern(search.getPattern()); - builder.setSearchPosition(search.getPosition()); - } - return builder.build(); - } } diff --git a/client/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/AvailableNumberServiceFacade.java b/client/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/AvailableNumberServiceFacade.java index 91267d3ee..991dce225 100644 --- a/client/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/AvailableNumberServiceFacade.java +++ b/client/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/AvailableNumberServiceFacade.java @@ -6,16 +6,12 @@ import com.sinch.sdk.core.http.HttpMapper; import com.sinch.sdk.domains.numbers.api.v1.AvailableNumberService; import com.sinch.sdk.domains.numbers.models.v1.ActiveNumber; -import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberListRequest; -import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberListRequestImpl; import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentAnyRequest; import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentRequest; import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumbersListQueryParameters; -import com.sinch.sdk.domains.numbers.models.v1.request.SearchPattern; import com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumber; -import com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumberListResponse; +import com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumbersListResponse; import com.sinch.sdk.models.NumbersContext; -import java.util.ArrayList; import java.util.Map; import java.util.function.Supplier; @@ -37,18 +33,16 @@ public AvailableNumberServiceFacade( uriUUID); } + protected AvailableNumberService getService() { + return this.availableNumberService; + } + @Override - public AvailableNumberListResponse searchForAvailableNumbers( + public AvailableNumbersListResponse searchForAvailableNumbers( AvailableNumbersListQueryParameters queryParameter) throws ApiException { return availableNumberService.searchForAvailableNumbers(queryParameter); } - @Deprecated - public AvailableNumberListResponse searchForAvailableNumbers( - AvailableNumberListRequest _parameters) throws ApiException { - return searchForAvailableNumbers(convert(_parameters)); - } - @Override public AvailableNumber checkAvailability(String phoneNumber) throws ApiException { return availableNumberService.checkAvailability(phoneNumber); @@ -68,28 +62,4 @@ public ActiveNumber rent(String phoneNumber, AvailableNumberRentRequest paramete public ActiveNumber rentAny(AvailableNumberRentAnyRequest parameters) throws ApiException { return availableNumberService.rentAny(parameters); } - - @Deprecated - public static AvailableNumbersListQueryParameters convert(AvailableNumberListRequest _parameters) - throws ApiException { - - if (null == _parameters) { - return null; - } - AvailableNumberListRequestImpl parameters = (AvailableNumberListRequestImpl) _parameters; - AvailableNumbersListQueryParameters.Builder builder = - AvailableNumbersListQueryParameters.builder(); - - parameters.regionCode().ifPresent(builder::setRegionCode); - parameters.type().ifPresent(builder::setType); - parameters.capabilities().ifPresent(f -> builder.setCapabilities(new ArrayList<>(f))); - parameters.size().ifPresent(builder::setSize); - - if (parameters.searchPattern().isPresent()) { - SearchPattern search = parameters.getSearchPattern(); - builder.setSearchPattern(search.getPattern()); - builder.setSearchPosition(search.getPosition()); - } - return builder.build(); - } } diff --git a/client/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/NumbersService.java b/client/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/NumbersService.java index e1261a0b2..d81c5b663 100644 --- a/client/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/NumbersService.java +++ b/client/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/NumbersService.java @@ -17,9 +17,9 @@ import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentRequest; import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumbersListQueryParameters; import com.sinch.sdk.domains.numbers.models.v1.request.EmergencyAddressRequest; -import com.sinch.sdk.domains.numbers.models.v1.response.ActiveNumberListResponse; +import com.sinch.sdk.domains.numbers.models.v1.response.ActiveNumbersListResponse; import com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumber; -import com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumberListResponse; +import com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumbersListResponse; import com.sinch.sdk.domains.numbers.models.v1.response.ValidateAddressResponse; import com.sinch.sdk.models.NumbersContext; import com.sinch.sdk.models.UnifiedCredentials; @@ -87,7 +87,8 @@ public AvailableRegionsService regions() { return this.regions; } - ActiveNumberServiceFacade active() { + // should be protected when V0 design will be removed onto 2.0 version + public ActiveNumberServiceFacade active() { if (null == this.active) { instanceLazyInit(); this.active = @@ -118,61 +119,73 @@ public WebHooksService webhooks() { return this.webhooks; } - public AvailableNumberListResponse searchForAvailableNumbers( + @Override + public AvailableNumbersListResponse searchForAvailableNumbers( AvailableNumbersListQueryParameters parameters) throws ApiException { return available().searchForAvailableNumbers(parameters); } + @Override public AvailableNumber checkAvailability(String phoneNumber) throws ApiException { return available().checkAvailability(phoneNumber); } + @Override public ActiveNumber rent(String phoneNumber) throws ApiException { return available().rent(phoneNumber); } + @Override public ActiveNumber rent(String phoneNumber, AvailableNumberRentRequest parameters) throws ApiException { return available().rent(phoneNumber, parameters); } + @Override public ActiveNumber rentAny(AvailableNumberRentAnyRequest parameters) throws ApiException { return available().rentAny(parameters); } @Override - public ActiveNumberListResponse list(ActiveNumbersListQueryParameters queryParameter) + public ActiveNumbersListResponse list(ActiveNumbersListQueryParameters queryParameter) throws ApiException { return active().list(queryParameter); } + @Override public ActiveNumber get(String phoneNumber) throws ApiException { return active().get(phoneNumber); } + @Override public ActiveNumber update(String phoneNumber, ActiveNumberUpdateRequest parameters) throws ApiException { return active().update(phoneNumber, parameters); } + @Override public ActiveNumber release(String phoneNumber) throws ApiException { return active().release(phoneNumber); } + @Override public ValidateAddressResponse validateEmergencyAddress( String phoneNumber, EmergencyAddressRequest emergencyAddressRequest) throws ApiException { return active().validateEmergencyAddress(phoneNumber, emergencyAddressRequest); } + @Override public EmergencyAddress provisionEmergencyAddress( String phoneNumber, EmergencyAddressRequest emergencyAddressRequest) throws ApiException { return active().provisionEmergencyAddress(phoneNumber, emergencyAddressRequest); } + @Override public void deprovisionEmergencyAddress(String phoneNumber) throws ApiException { active().deprovisionEmergencyAddress(phoneNumber); } + @Override public EmergencyAddress getEmergencyAddress(String phoneNumber) throws ApiException { return active().getEmergencyAddress(phoneNumber); } diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/available/request/AvailableRegionListRequest.java b/client/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/available/request/AvailableRegionListRequest.java deleted file mode 100644 index 3311f674d..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/available/request/AvailableRegionListRequest.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.v1.regions.available.request; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.numbers.models.v1.NumberType; -import java.util.Collection; -import java.util.Objects; - -/** - * Parameters request to list all regions by criteria - * - * @see https://developers.sinch.com/docs/numbers/api-reference/numbers/tag/Available-Regions/ - * @since 1.2 - */ -public class AvailableRegionListRequest { - - private final OptionalValue> types; - - private AvailableRegionListRequest(OptionalValue> types) { - this.types = types; - } - - public OptionalValue> getTypes() { - return types; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - OptionalValue> types = OptionalValue.empty(); - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (!(o instanceof Builder)) { - return false; - } - Builder builder = (Builder) o; - return Objects.equals(types, builder.types); - } - - @Override - public int hashCode() { - return Objects.hash(types); - } - - private Builder() {} - - /** - * @param types Only return regions for which numbers are provided with the given types - * @return current builder - */ - public Builder setTypes(Collection types) { - this.types = OptionalValue.of(types); - return this; - } - - public AvailableRegionListRequest build() { - return new AvailableRegionListRequest(types); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/available/response/AvailableRegionListResponse.java b/client/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/available/response/AvailableRegionListResponse.java deleted file mode 100644 index 6298220b6..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/available/response/AvailableRegionListResponse.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.v1.regions.available.response; - -import com.sinch.sdk.core.models.pagination.ListResponse; -import java.util.Collection; -import java.util.NoSuchElementException; - -/** - * Lists all available numbers for a project - * - * @since 1.2 - */ -public class AvailableRegionListResponse extends ListResponse { - - Collection content; - - public AvailableRegionListResponse(Collection content) { - this.content = content; - } - - public boolean hasNextPage() { - return false; - } - - public AvailableRegionListResponse nextPage() { - throw new NoSuchElementException("Reached the last page of the API response"); - } - - public Collection getContent() { - return content; - } - - @Override - public String toString() { - return "AvailableRegionListResponse{" + "content=" + content + '}'; - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/v1/request/ActiveNumberListRequest.java b/client/src/main/com/sinch/sdk/domains/numbers/models/v1/request/ActiveNumberListRequest.java deleted file mode 100644 index c8b2409e8..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/v1/request/ActiveNumberListRequest.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.v1.request; - -import com.sinch.sdk.domains.numbers.models.v1.Capability; -import com.sinch.sdk.domains.numbers.models.v1.NumberType; -import java.util.Collection; - -/** - * Parameters request to list active numbers for a project - * - * @see https://developers.sinch.com/docs/numbers/api-reference/numbers/tag/Active-Number/ - * @since 1.2 - */ -public interface ActiveNumberListRequest { - - /** - * @return Region code to filter by. ISO 3166-1 alpha-2 country code of the phone number. - *

Example: "US", "GB" or "SE". - */ - String getRegionCode(); - - /** - * @return Number type to filter by. - */ - NumberType getType(); - - /** - * @return Search criteria - */ - SearchPattern getSearchPattern(); - - /** - * @return Number capabilities to filter by. - */ - Collection getCapabilities(); - - /** - * @return The maximum number of items to return - */ - Integer getPageSize(); - - /** - * @return The next page token value returned from a previous List request, if any. - */ - String getPageToken(); - - /** - * @return Supported fields for ordering by. - */ - OrderBy getOrderBy(); - - static Builder builder() { - return new ActiveNumberListRequestImpl.Builder(); - } - - static Builder builder(ActiveNumberListRequest parameters) { - return new ActiveNumberListRequestImpl.Builder(parameters); - } - - public interface Builder { - - /** - * @param regionCode Region code to filter by. ISO 3166-1 alpha-2 country code of the phone - * number. Example: US, GB or SE. - * @return Current builder - */ - Builder setRegionCode(String regionCode); - - /** - * @param type Number type to filter by - * @return Current builder - */ - Builder setType(NumberType type); - - /** - * @param searchPattern Pattern to search for - * @return Current builder - */ - Builder setSearchPattern(SearchPattern searchPattern); - - /** - * @param capabilities Number capabilities to filter by - * @return Current builder - */ - Builder setCapabilities(Collection capabilities); - - /** - * @param pageSize The maximum number of items to return. - * @return Current builder - */ - Builder setPageSize(Integer pageSize); - - /** - * @param pageToken The next page token value returned from a previous List request, if any - * @return Current builder - */ - Builder setPageToken(String pageToken); - - /** - * @param orderBy Ordering results - * @return Current builder - */ - Builder setOrderBy(OrderBy orderBy); - - ActiveNumberListRequest build(); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/v1/request/ActiveNumberListRequestImpl.java b/client/src/main/com/sinch/sdk/domains/numbers/models/v1/request/ActiveNumberListRequestImpl.java deleted file mode 100644 index b9f4df84c..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/v1/request/ActiveNumberListRequestImpl.java +++ /dev/null @@ -1,249 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.v1.request; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.numbers.models.v1.Capability; -import com.sinch.sdk.domains.numbers.models.v1.NumberType; -import java.util.Collection; -import java.util.Objects; - -/** - * Parameters request to list active numbers for a project - * - * @see https://developers.sinch.com/docs/numbers/api-reference/numbers/tag/Active-Number/ - * @since 1.2 - */ -public class ActiveNumberListRequestImpl implements ActiveNumberListRequest { - - private final OptionalValue regionCode; - private final OptionalValue type; - private final OptionalValue searchPattern; - private final OptionalValue> capabilities; - private final OptionalValue pageSize; - private final OptionalValue pageToken; - private final OptionalValue orderBy; - - private ActiveNumberListRequestImpl( - OptionalValue regionCode, - OptionalValue type, - OptionalValue searchPattern, - OptionalValue> capabilities, - OptionalValue pageSize, - OptionalValue pageToken, - OptionalValue orderBy) { - this.regionCode = regionCode; - this.type = type; - this.searchPattern = searchPattern; - this.capabilities = capabilities; - this.pageSize = pageSize; - this.pageToken = pageToken; - this.orderBy = orderBy; - } - - public String getRegionCode() { - return regionCode.orElse(null); - } - - public OptionalValue regionCode() { - return regionCode; - } - - public NumberType getType() { - return type.orElse(null); - } - - public OptionalValue type() { - return type; - } - - public SearchPattern getSearchPattern() { - return searchPattern.orElse(null); - } - - public OptionalValue searchPattern() { - return searchPattern; - } - - public Collection getCapabilities() { - return capabilities.orElse(null); - } - - public OptionalValue> capabilities() { - return capabilities; - } - - public Integer getPageSize() { - return pageSize.orElse(null); - } - - public OptionalValue pageSize() { - return pageSize; - } - - public String getPageToken() { - return pageToken.orElse(null); - } - - public OptionalValue pageToken() { - return pageToken; - } - - public OrderBy getOrderBy() { - return orderBy.orElse(null); - } - - public OptionalValue orderBy() { - return orderBy; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (!(o instanceof ActiveNumberListRequestImpl)) { - return false; - } - ActiveNumberListRequestImpl that = (ActiveNumberListRequestImpl) o; - return Objects.equals(getRegionCode(), that.getRegionCode()) - && Objects.equals(getType(), that.getType()) - && Objects.equals(getSearchPattern(), that.getSearchPattern()) - && Objects.equals(getCapabilities(), that.getCapabilities()) - && Objects.equals(getPageSize(), that.getPageSize()) - && Objects.equals(getPageToken(), that.getPageToken()) - && Objects.equals(getOrderBy(), that.getOrderBy()); - } - - @Override - public int hashCode() { - return Objects.hash( - getRegionCode(), - getType(), - getSearchPattern(), - getCapabilities(), - getPageSize(), - getPageToken(), - getOrderBy()); - } - - public static Builder builder() { - return new Builder(); - } - - public static Builder builder(ActiveNumberListRequest parameters) { - return new Builder(parameters); - } - - public static class Builder implements ActiveNumberListRequest.Builder { - - OptionalValue regionCode = OptionalValue.empty(); - OptionalValue type = OptionalValue.empty(); - OptionalValue searchPattern = OptionalValue.empty(); - OptionalValue> capabilities = OptionalValue.empty(); - OptionalValue pageSize = OptionalValue.empty(); - OptionalValue pageToken = OptionalValue.empty(); - OptionalValue orderBy = OptionalValue.empty(); - - protected Builder() {} - - protected Builder(ActiveNumberListRequest _parameters) { - ActiveNumberListRequestImpl parameters = (ActiveNumberListRequestImpl) _parameters; - parameters.regionCode.ifPresent(this::setRegionCode); - parameters.type.ifPresent(this::setType); - parameters.searchPattern.ifPresent(this::setSearchPattern); - parameters.capabilities.ifPresent(this::setCapabilities); - parameters.pageSize.ifPresent(this::setPageSize); - parameters.pageToken.ifPresent(this::setPageToken); - parameters.orderBy.ifPresent(this::setOrderBy); - } - - /** - * see getter - * - * @param regionCode see getter - * @return Current builder - * @see #getRegionCode() - */ - public Builder setRegionCode(String regionCode) { - this.regionCode = OptionalValue.of(regionCode); - return this; - } - - /** - * see getter - * - * @param type see getter - * @return Current builder - * @see #getType - */ - public Builder setType(NumberType type) { - this.type = OptionalValue.of(type); - return this; - } - - /** - * see getter - * - * @param searchPattern see getter - * @return Current builder - * @see #getSearchPattern() - */ - public Builder setSearchPattern(SearchPattern searchPattern) { - this.searchPattern = OptionalValue.of(searchPattern); - return this; - } - - /** - * see getter - * - * @param capabilities see getter - * @return Current builder - * @see #getCapabilities() - */ - public Builder setCapabilities(Collection capabilities) { - this.capabilities = OptionalValue.of(capabilities); - return this; - } - - /** - * see getter - * - * @param pageSize see getter - * @return Current builder - * @see #getPageSize() - */ - public Builder setPageSize(Integer pageSize) { - this.pageSize = OptionalValue.of(pageSize); - return this; - } - - /** - * see getter - * - * @param pageToken see getter - * @return Current builder - * @see #getPageToken() - */ - public Builder setPageToken(String pageToken) { - this.pageToken = OptionalValue.of(pageToken); - return this; - } - - /** - * see getter - * - * @param orderBy see getter - * @return Current builder - * @see #getOrderBy() - */ - public Builder setOrderBy(OrderBy orderBy) { - this.orderBy = OptionalValue.of(orderBy); - return this; - } - - public ActiveNumberListRequest build() { - return new ActiveNumberListRequestImpl( - regionCode, type, searchPattern, capabilities, pageSize, pageToken, orderBy); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/v1/request/AvailableNumberListRequest.java b/client/src/main/com/sinch/sdk/domains/numbers/models/v1/request/AvailableNumberListRequest.java deleted file mode 100644 index 712d3febc..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/v1/request/AvailableNumberListRequest.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.v1.request; - -import com.sinch.sdk.domains.numbers.models.v1.Capability; -import com.sinch.sdk.domains.numbers.models.v1.NumberType; -import java.util.Collection; - -/** - * Parameters request to list available numbers for a project - * - * @see https://developers.sinch.com/docs/numbers/api-reference/numbers/tag/Available-Number/#tag/Available-Number/operation/NumberService_ListAvailableNumbers/ - * @since 1.2 - */ -public interface AvailableNumberListRequest { - - /** - * @return Region code to filter by. ISO 3166-1 alpha-2 country code of the phone number. Example: - * `US`, `GB` or `SE`. (required) - */ - String getRegionCode(); - - /** - * @return Number type to filter by. Options include, `MOBILE`, `LOCAL` or - * `TOLL_FREE`. (required) - */ - NumberType getType(); - - /** - * @return Search criteria - */ - SearchPattern getSearchPattern(); - - /** - * @return Number capabilities to filter by, `SMS` and/or `VOICE`. - */ - Collection getCapabilities(); - - /** - * @return The maximum number of items to return - */ - Integer getSize(); - - static Builder builder() { - return AvailableNumberListRequestImpl.builder(); - } - - interface Builder { - - /** - * @param regionCode Region code to filter by. ISO 3166-1 alpha-2 country code of the phone - * number. Example: US, GB or SE. - * @return current builder - */ - Builder setRegionCode(String regionCode); - - /** - * @param type Number type to filter by - * @return current builder - */ - Builder setType(NumberType type); - - /** - * @param searchPattern Search criteria - * @return current builder - */ - Builder setSearchPattern(SearchPattern searchPattern); - - /** - * @param capabilities capability criteria - * @return current builder - */ - Builder setCapabilities(Collection capabilities); - - /** - * @param size Optional. The maximum number of items to return. - * @return current builder - */ - Builder setSize(Integer size); - - AvailableNumberListRequest build(); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/v1/request/AvailableNumberListRequestImpl.java b/client/src/main/com/sinch/sdk/domains/numbers/models/v1/request/AvailableNumberListRequestImpl.java deleted file mode 100644 index 996025f4d..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/v1/request/AvailableNumberListRequestImpl.java +++ /dev/null @@ -1,148 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.v1.request; - -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.numbers.models.v1.Capability; -import com.sinch.sdk.domains.numbers.models.v1.NumberType; -import java.util.Collection; -import java.util.Objects; - -/** - * Parameters request to list available numbers for a project - * - * @see https://developers.sinch.com/docs/numbers/api-reference/numbers/tag/Available-Number/#tag/Available-Number/operation/NumberService_ListAvailableNumbers/ - * @since 1.2 - */ -public class AvailableNumberListRequestImpl implements AvailableNumberListRequest { - private final OptionalValue regionCode; - private final OptionalValue type; - private final OptionalValue searchPattern; - private final OptionalValue> capabilities; - private final OptionalValue size; - - private AvailableNumberListRequestImpl( - OptionalValue regionCode, - OptionalValue type, - OptionalValue searchPattern, - OptionalValue> capabilities, - OptionalValue size) { - this.regionCode = regionCode; - this.type = type; - this.searchPattern = searchPattern; - this.capabilities = capabilities; - this.size = size; - } - - public String getRegionCode() { - return regionCode.orElse(null); - } - - public OptionalValue regionCode() { - return regionCode; - } - - public NumberType getType() { - return type.orElse(null); - } - - public OptionalValue type() { - return type; - } - - public SearchPattern getSearchPattern() { - return searchPattern.orElse(null); - } - - public OptionalValue searchPattern() { - return searchPattern; - } - - public Collection getCapabilities() { - return capabilities.orElse(null); - } - - public OptionalValue> capabilities() { - return capabilities; - } - - public Integer getSize() { - return size.orElse(null); - } - - public OptionalValue size() { - return size; - } - - public static Builder builder() { - return new Builder(); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (!(o instanceof AvailableNumberListRequestImpl)) { - return false; - } - AvailableNumberListRequestImpl that = (AvailableNumberListRequestImpl) o; - return Objects.equals(getRegionCode(), that.getRegionCode()) - && Objects.equals(getType(), that.getType()) - && Objects.equals(getSearchPattern(), that.getSearchPattern()) - && Objects.equals(getCapabilities(), that.getCapabilities()) - && Objects.equals(getSize(), that.getSize()); - } - - @Override - public int hashCode() { - return Objects.hash( - getRegionCode(), getType(), getSearchPattern(), getCapabilities(), getSize()); - } - - public static class Builder implements AvailableNumberListRequest.Builder { - OptionalValue regionCode = OptionalValue.empty(); - OptionalValue type = OptionalValue.empty(); - OptionalValue searchPattern = OptionalValue.empty(); - OptionalValue> capabilities = OptionalValue.empty(); - OptionalValue size = OptionalValue.empty(); - - private Builder() {} - - public Builder setRegionCode(String regionCode) { - this.regionCode = OptionalValue.of(regionCode); - return this; - } - - public Builder setType(NumberType type) { - this.type = OptionalValue.of(type); - return this; - } - - public Builder setSearchPattern(SearchPattern searchPattern) { - this.searchPattern = OptionalValue.of(searchPattern); - return this; - } - - /** - * @return current builder - */ - public Builder setCapabilities(Collection capabilities) { - this.capabilities = OptionalValue.of(capabilities); - return this; - } - - /** - * @param size Optional. The maximum number of items to return. - * @return current builder - */ - public Builder setSize(Integer size) { - this.size = OptionalValue.of(size); - return this; - } - - public AvailableNumberListRequestImpl build() { - return new AvailableNumberListRequestImpl( - regionCode, type, searchPattern, capabilities, size); - } - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/v1/response/ActiveNumberListResponse.java b/client/src/main/com/sinch/sdk/domains/numbers/models/v1/response/ActiveNumberListResponse.java deleted file mode 100644 index 77271fc5c..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/v1/response/ActiveNumberListResponse.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.v1.response; - -import com.sinch.sdk.core.models.pagination.ListResponse; -import com.sinch.sdk.core.models.pagination.Page; -import com.sinch.sdk.core.models.pagination.TokenPageNavigator; -import com.sinch.sdk.core.utils.StringUtil; -import com.sinch.sdk.domains.numbers.api.v1.NumbersService; -import com.sinch.sdk.domains.numbers.api.v1.adapters.ActiveNumberServiceFacade; -import com.sinch.sdk.domains.numbers.models.v1.ActiveNumber; -import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumberListRequest; -import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumbersListQueryParameters; -import java.util.Collection; -import java.util.NoSuchElementException; - -/** - * Lists all active numbers for a project - * - * @since 1.2 - */ -public class ActiveNumberListResponse extends ListResponse { - - private final Page page; - private final NumbersService service; - - @Deprecated - public ActiveNumberListResponse( - NumbersService service, Page page) { - this.service = service; - this.page = - new Page<>( - ActiveNumberServiceFacade.convert(page.getParameters()), - page.getEntities(), - new TokenPageNavigator(page.getNextPageToken())); - } - - public ActiveNumberListResponse( - Page page, NumbersService service) { - this.service = service; - this.page = page; - } - - public boolean hasNextPage() { - return (null != page.getNextPageToken() && !StringUtil.isEmpty(page.getNextPageToken())); - } - - public ActiveNumberListResponse nextPage() { - if (!hasNextPage()) { - throw new NoSuchElementException("Reached the last page of the API response"); - } - ActiveNumbersListQueryParameters.Builder newParameters = - ActiveNumbersListQueryParameters.builder(page.getParameters()); - newParameters.setPageToken(page.getNextPageToken()); - return service.list(newParameters.build()); - } - - /** - * Do not use / Internal usage only - * - * @return Internal usage only - * @deprecated - */ - public String getNextPageToken() { - return page.getNextPageToken(); - } - - public Collection getContent() { - return page.getEntities(); - } - - @Override - public String toString() { - return "ActiveNumberListResponse{" + "page=" + page + '}'; - } -} diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/v1/response/AvailableNumberListResponse.java b/client/src/main/com/sinch/sdk/domains/numbers/models/v1/response/AvailableNumberListResponse.java deleted file mode 100644 index f65141b5b..000000000 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/v1/response/AvailableNumberListResponse.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.sinch.sdk.domains.numbers.models.v1.response; - -import com.sinch.sdk.core.models.pagination.ListResponse; -import java.util.Collection; -import java.util.NoSuchElementException; - -/** - * Lists all available numbers for a project - * - * @since 1.2 - */ -public class AvailableNumberListResponse extends ListResponse { - - Collection content; - - public AvailableNumberListResponse(Collection content) { - this.content = content; - } - - public boolean hasNextPage() { - return false; - } - - public AvailableNumberListResponse nextPage() { - throw new NoSuchElementException("Reached the last page of the API response"); - } - - public Collection getContent() { - return content; - } - - @Override - public String toString() { - return "AvailableNumberListResponse{" + "content=" + content + '}'; - } -} diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/api/v1/adapters/ActiveNumberServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/api/v1/adapters/ActiveNumberServiceTest.java index 780a8b583..ed4e2e2c8 100644 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/api/v1/adapters/ActiveNumberServiceTest.java +++ b/client/src/test/java/com/sinch/sdk/domains/numbers/api/v1/adapters/ActiveNumberServiceTest.java @@ -22,8 +22,8 @@ import com.sinch.sdk.core.http.URLPathUtils; import com.sinch.sdk.core.models.ServerConfiguration; import com.sinch.sdk.core.models.ServerConfigurationTest.ServerConfigurationMatcher; +import com.sinch.sdk.core.models.pagination.HttpRequestPageNavigator; import com.sinch.sdk.core.models.pagination.Page; -import com.sinch.sdk.core.models.pagination.TokenPageNavigator; import com.sinch.sdk.domains.numbers.api.v1.NumbersService; import com.sinch.sdk.domains.numbers.models.v1.ActiveNumber; import com.sinch.sdk.domains.numbers.models.v1.ActiveNumberDtoTest; @@ -36,10 +36,10 @@ import com.sinch.sdk.domains.numbers.models.v1.VoiceConfigurationRTC; import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumberUpdateRequest; import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumbersListQueryParameters; -import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumbersListQueryParameters.OrderByEnum; import com.sinch.sdk.domains.numbers.models.v1.request.EmergencyAddressRequestDtoTest; +import com.sinch.sdk.domains.numbers.models.v1.request.OrderBy; import com.sinch.sdk.domains.numbers.models.v1.request.SearchPosition; -import com.sinch.sdk.domains.numbers.models.v1.response.ActiveNumberListResponse; +import com.sinch.sdk.domains.numbers.models.v1.response.ActiveNumbersListResponse; import com.sinch.sdk.domains.numbers.models.v1.response.ValidateAddressResponse; import com.sinch.sdk.domains.numbers.models.v1.response.ValidateAddressResponseDtoTest; import com.sinch.sdk.models.NumbersContext; @@ -137,18 +137,25 @@ void listWithRequiredParameters() throws ApiException { argThat(new HttpRequestMatcher(httpRequest)))) .thenReturn(httpResponse); - ActiveNumberListResponse expected = - new ActiveNumberListResponse( + ActiveNumberServiceImpl lowService = + (ActiveNumberServiceImpl) + (((com.sinch.sdk.domains.numbers.api.v1.adapters.NumbersService) service) + .active() + .getService()); + + ActiveNumbersListResponse expected = + new ActiveNumbersListResponse( + lowService, new Page<>( ActiveNumbersListQueryParameters.builder() .setRegionCode("region") .setType(NumberType.MOBILE) + .setPageToken("") .build(), ActiveNumberDtoTest.activeNumberListLight.getActiveNumbers(), - new TokenPageNavigator("")), - service); + new HttpRequestPageNavigator(null))); - ActiveNumberListResponse response = + ActiveNumbersListResponse response = service.list( ActiveNumbersListQueryParameters.builder() .setRegionCode("region") @@ -173,8 +180,8 @@ void listWithOptionalParameters() throws ApiException { new URLParameter("type", NumberType.TOLL_FREE, STYLE.FORM, true), new URLParameter("capability", Arrays.asList(Capability.VOICE), STYLE.FORM, true), new URLParameter("pageSize", 5, STYLE.FORM, true), - new URLParameter("pageToken", "foo", STYLE.FORM, true), - new URLParameter("orderBy", OrderByEnum.PHONE_NUMBER, STYLE.FORM, true)), + new URLParameter("pageToken", "foo-req", STYLE.FORM, true), + new URLParameter("orderBy", OrderBy.PHONE_NUMBER, STYLE.FORM, true)), (String) null, Collections.emptyMap(), Collections.singletonList(HttpContentType.APPLICATION_JSON), @@ -190,8 +197,15 @@ void listWithOptionalParameters() throws ApiException { argThat(new HttpRequestMatcher(httpRequest)))) .thenReturn(httpResponse); - ActiveNumberListResponse expected = - new ActiveNumberListResponse( + ActiveNumberServiceImpl lowService = + (ActiveNumberServiceImpl) + (((com.sinch.sdk.domains.numbers.api.v1.adapters.NumbersService) service) + .active() + .getService()); + + ActiveNumbersListResponse expected = + new ActiveNumbersListResponse( + lowService, new Page<>( ActiveNumbersListQueryParameters.builder() .setRegionCode("another region") @@ -201,13 +215,37 @@ void listWithOptionalParameters() throws ApiException { .setCapabilities(Arrays.asList(Capability.VOICE)) .setPageSize(5) .setPageToken("foo") - .setOrderBy(OrderByEnum.PHONE_NUMBER) + .setOrderBy(OrderBy.PHONE_NUMBER) .build(), ActiveNumberDtoTest.activeNumberList.getActiveNumbers(), - new TokenPageNavigator("foo")), - service); - - ActiveNumberListResponse response = + new HttpRequestPageNavigator( + new HttpRequest( + "/v1/projects/" + + URLPathUtils.encodePathSegment(URI_UUID) + + "/activeNumbers", + HttpMethod.GET, + Arrays.asList( + new URLParameter("regionCode", "another region", STYLE.FORM, true), + new URLParameter( + "numberPattern.pattern", "pattern value", STYLE.FORM, true), + new URLParameter( + "numberPattern.searchPattern", + SearchPosition.END, + STYLE.FORM, + true), + new URLParameter("type", NumberType.TOLL_FREE, STYLE.FORM, true), + new URLParameter( + "capability", Arrays.asList(Capability.VOICE), STYLE.FORM, true), + new URLParameter("pageSize", 5, STYLE.FORM, true), + new URLParameter("pageToken", "foo", STYLE.FORM, true), + new URLParameter("orderBy", OrderBy.PHONE_NUMBER, STYLE.FORM, true)), + (String) null, + Collections.emptyMap(), + Collections.singletonList(HttpContentType.APPLICATION_JSON), + Collections.emptyList(), + NUMBERS_AUTH_NAMES)))); + + ActiveNumbersListResponse response = service.list( ActiveNumbersListQueryParameters.builder() .setRegionCode("another region") @@ -216,8 +254,8 @@ void listWithOptionalParameters() throws ApiException { .setSearchPosition(SearchPosition.END) .setCapabilities(Arrays.asList(Capability.VOICE)) .setPageSize(5) - .setPageToken("foo") - .setOrderBy(OrderByEnum.PHONE_NUMBER) + .setPageToken("foo-req") + .setOrderBy(OrderBy.PHONE_NUMBER) .build()); TestHelpers.recursiveEquals(response, expected); diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/api/v1/adapters/AvailableNumberServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/api/v1/adapters/AvailableNumberServiceTest.java index b0e9d7b36..5745f9e37 100644 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/api/v1/adapters/AvailableNumberServiceTest.java +++ b/client/src/test/java/com/sinch/sdk/domains/numbers/api/v1/adapters/AvailableNumberServiceTest.java @@ -23,6 +23,7 @@ import com.sinch.sdk.core.http.URLPathUtils; import com.sinch.sdk.core.models.ServerConfiguration; import com.sinch.sdk.core.models.ServerConfigurationTest.ServerConfigurationMatcher; +import com.sinch.sdk.core.models.pagination.Page; import com.sinch.sdk.domains.numbers.api.v1.NumbersService; import com.sinch.sdk.domains.numbers.models.v1.ActiveNumber; import com.sinch.sdk.domains.numbers.models.v1.ActiveNumberDtoTest; @@ -35,7 +36,7 @@ import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentRequest; import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumbersListQueryParameters; import com.sinch.sdk.domains.numbers.models.v1.request.SearchPosition; -import com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumberListResponse; +import com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumbersListResponse; import com.sinch.sdk.models.NumbersContext; import com.sinch.sdk.models.UnifiedCredentials; import java.util.Arrays; @@ -127,11 +128,18 @@ void searchForAvailableNumbersWithRequiredParameters() throws ApiException { argThat(new HttpRequestMatcher(httpRequest)))) .thenReturn(httpResponse); - AvailableNumberListResponse response = service.searchForAvailableNumbers(parameters); + AvailableNumbersListResponse response = service.searchForAvailableNumbers(parameters); - AvailableNumberListResponse expected = - new AvailableNumberListResponse( - AvailableNumberDtoTest.availableNumberList.getAvailableNumbers()); + AvailableNumberServiceImpl lowService = + (AvailableNumberServiceImpl) + (((com.sinch.sdk.domains.numbers.api.v1.adapters.NumbersService) service) + .available() + .getService()); + AvailableNumbersListResponse expected = + new AvailableNumbersListResponse( + lowService, + new Page<>( + null, AvailableNumberDtoTest.availableNumberList.getAvailableNumbers(), null)); TestHelpers.recursiveEquals(response, expected); } @@ -175,11 +183,19 @@ void searchForAvailableNumbersWithOptionalParameters() throws ApiException { argThat(new HttpRequestMatcher(httpRequest)))) .thenReturn(httpResponse); - AvailableNumberListResponse response = service.searchForAvailableNumbers(parameters); + AvailableNumbersListResponse response = service.searchForAvailableNumbers(parameters); - AvailableNumberListResponse expected = - new AvailableNumberListResponse( - AvailableNumberDtoTest.availableNumberList.getAvailableNumbers()); + AvailableNumberServiceImpl lowService = + (AvailableNumberServiceImpl) + (((com.sinch.sdk.domains.numbers.api.v1.adapters.NumbersService) service) + .available() + .getService()); + + AvailableNumbersListResponse expected = + new AvailableNumbersListResponse( + lowService, + new Page<>( + null, AvailableNumberDtoTest.availableNumberList.getAvailableNumbers(), null)); TestHelpers.recursiveEquals(response, expected); } diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/api/v1/adapters/AvailableRegionsServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/api/v1/adapters/AvailableRegionsServiceTest.java index dd7898c52..b207c2b9b 100644 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/api/v1/adapters/AvailableRegionsServiceTest.java +++ b/client/src/test/java/com/sinch/sdk/domains/numbers/api/v1/adapters/AvailableRegionsServiceTest.java @@ -24,8 +24,8 @@ import com.sinch.sdk.domains.numbers.api.v1.AvailableRegionsService; import com.sinch.sdk.domains.numbers.models.v1.AvailableRegionsDtoTest; import com.sinch.sdk.domains.numbers.models.v1.NumberType; -import com.sinch.sdk.domains.numbers.models.v1.regions.available.response.AvailableRegionListResponse; import com.sinch.sdk.domains.numbers.models.v1.regions.request.AvailableRegionsListQueryParameters; +import com.sinch.sdk.domains.numbers.models.v1.regions.response.AvailableRegionsListResponse; import java.util.Arrays; import java.util.Collection; import java.util.Collections; @@ -77,7 +77,7 @@ void listWithoutFilters() throws ApiException { argThat(new HttpRequestMatcher(httpRequest)))) .thenReturn(httpResponse); - AvailableRegionListResponse response = service.list(); + AvailableRegionsListResponse response = service.list(); TestHelpers.recursiveEquals( response.getContent(), AvailableRegionsDtoTest.availableRegionList.getAvailableRegions()); @@ -106,7 +106,7 @@ void list() throws ApiException { argThat(new HttpRequestMatcher(httpRequest)))) .thenReturn(httpResponse); - AvailableRegionListResponse response = + AvailableRegionsListResponse response = service.list( AvailableRegionsListQueryParameters.builder() .setTypes(Arrays.asList(NumberType.MOBILE)) diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/numbers/v1/AvailableRegionsSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/numbers/v1/AvailableRegionsSteps.java index 9b31dcf5c..9a96ada2b 100644 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/numbers/v1/AvailableRegionsSteps.java +++ b/client/src/test/java/com/sinch/sdk/e2e/domains/numbers/v1/AvailableRegionsSteps.java @@ -2,9 +2,8 @@ import com.sinch.sdk.domains.numbers.api.v1.AvailableRegionsService; import com.sinch.sdk.domains.numbers.models.v1.NumberType; -import com.sinch.sdk.domains.numbers.models.v1.regions.available.request.AvailableRegionListRequest; -import com.sinch.sdk.domains.numbers.models.v1.regions.available.response.AvailableRegionListResponse; import com.sinch.sdk.domains.numbers.models.v1.regions.request.AvailableRegionsListQueryParameters; +import com.sinch.sdk.domains.numbers.models.v1.regions.response.AvailableRegionsListResponse; import com.sinch.sdk.e2e.Config; import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; @@ -16,7 +15,7 @@ public class AvailableRegionsSteps { AvailableRegionsService service; - AvailableRegionListResponse listResponse; + AvailableRegionsListResponse listResponse; @Given("^the Numbers service \"Regions\" is available$") public void serviceAvailable() { @@ -27,8 +26,6 @@ public void serviceAvailable() { @When("^I send a request to list all the regions$") public void list() { - AvailableRegionListRequest parametersDeprecated = AvailableRegionListRequest.builder().build(); - AvailableRegionsListQueryParameters parameters = AvailableRegionsListQueryParameters.builder().build(); listResponse = service.list(parameters); @@ -37,9 +34,6 @@ public void list() { @When("^I send a request to list the TOLL_FREE regions$") public void listTollFree() { - AvailableRegionListRequest parametersDeprecated = - AvailableRegionListRequest.builder().setTypes(Arrays.asList(NumberType.TOLL_FREE)).build(); - AvailableRegionsListQueryParameters parameters = AvailableRegionsListQueryParameters.builder() .setTypes(Arrays.asList(NumberType.TOLL_FREE)) diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/numbers/v1/NumbersSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/numbers/v1/NumbersSteps.java index 64faec050..4fa07abfb 100644 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/numbers/v1/NumbersSteps.java +++ b/client/src/test/java/com/sinch/sdk/e2e/domains/numbers/v1/NumbersSteps.java @@ -22,9 +22,9 @@ import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumbersListQueryParameters; import com.sinch.sdk.domains.numbers.models.v1.request.SearchPattern; import com.sinch.sdk.domains.numbers.models.v1.request.SearchPosition; -import com.sinch.sdk.domains.numbers.models.v1.response.ActiveNumberListResponse; +import com.sinch.sdk.domains.numbers.models.v1.response.ActiveNumbersListResponse; import com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumber; -import com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumberListResponse; +import com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumbersListResponse; import com.sinch.sdk.e2e.Config; import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; @@ -38,15 +38,15 @@ public class NumbersSteps { NumbersService service; - AvailableNumberListResponse searchForAvailableNumbersResponse; + AvailableNumbersListResponse searchForAvailableNumbersResponse; AvailableNumber checkAvailabilityResponse; ApiException availabilityResponseException; ActiveNumber rentAnyResponse; ActiveNumber rentResponse; - ActiveNumberListResponse activeNumberListResponse; + ActiveNumbersListResponse activeNumberListResponse; - ActiveNumberListResponse activeNumberListAllResponse; + ActiveNumbersListResponse activeNumberListAllResponse; ActiveNumber updateResponse; ActiveNumber getResponse; diff --git a/core/src/main/com/sinch/sdk/core/models/pagination/HttpRequestPageNavigator.java b/core/src/main/com/sinch/sdk/core/models/pagination/HttpRequestPageNavigator.java new file mode 100644 index 000000000..54f5f4b40 --- /dev/null +++ b/core/src/main/com/sinch/sdk/core/models/pagination/HttpRequestPageNavigator.java @@ -0,0 +1,31 @@ +package com.sinch.sdk.core.models.pagination; + +import com.sinch.sdk.core.http.HttpRequest; + +public class HttpRequestPageNavigator extends PageNavigator { + + private final HttpRequest nextPageRequest; + + public HttpRequestPageNavigator(HttpRequest nextPageRequest) { + super(null); + this.nextPageRequest = nextPageRequest; + } + + private HttpRequest computeNextPageCursor() { + return nextPageRequest; + } + + @Override + public HttpRequest getToken() { + return computeNextPageCursor(); + } + + @Override + public String toString() { + return "HttpRequestPageNavigator{" + + "nextPageRequest=" + + nextPageRequest + + "} " + + super.toString(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/ActiveNumberService.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/ActiveNumberService.java index d8247fa67..02e51cdbf 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/ActiveNumberService.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/ActiveNumberService.java @@ -16,12 +16,24 @@ import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumberUpdateRequest; import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumbersListQueryParameters; import com.sinch.sdk.domains.numbers.models.v1.request.EmergencyAddressRequest; -import com.sinch.sdk.domains.numbers.models.v1.response.ActiveNumberListResponse; +import com.sinch.sdk.domains.numbers.models.v1.response.ActiveNumbersListResponse; import com.sinch.sdk.domains.numbers.models.v1.response.ValidateAddressResponse; /** Active Number Service */ public interface ActiveNumberService { + /** + * Lists active numbers for a project + * + *

Lists all active numbers for a project. + * + * @param queryParameter (optional) + * @return ActiveNumbersListResponse + * @throws ApiException if fails to make API call + */ + ActiveNumbersListResponse list(ActiveNumbersListQueryParameters queryParameter) + throws ApiException; + /** * Remove the emergency address for a number. * @@ -60,18 +72,6 @@ public interface ActiveNumberService { */ EmergencyAddress getEmergencyAddress(String phoneNumber) throws ApiException; - /** - * Lists active numbers for a project - * - *

Lists all active numbers for a project. - * - * @param queryParameter (optional) - * @return ActiveNumberListResponse - * @throws ApiException if fails to make API call - */ - ActiveNumberListResponse list(ActiveNumbersListQueryParameters queryParameter) - throws ApiException; - /** * Add a emergency address for a number * diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/AvailableNumberService.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/AvailableNumberService.java index c7c77e29c..4b7b8137e 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/AvailableNumberService.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/AvailableNumberService.java @@ -16,7 +16,7 @@ import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentRequest; import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumbersListQueryParameters; import com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumber; -import com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumberListResponse; +import com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumbersListResponse; /** Available Number Service */ public interface AvailableNumberService { @@ -79,9 +79,9 @@ ActiveNumber rentAny(AvailableNumberRentAnyRequest availableNumberRentAnyRequest * To search for a number capable of both, list both `SMS` and `VOICE`. * * @param queryParameter (optional) - * @return AvailableNumberListResponse + * @return AvailableNumbersListResponse * @throws ApiException if fails to make API call */ - AvailableNumberListResponse searchForAvailableNumbers( + AvailableNumbersListResponse searchForAvailableNumbers( AvailableNumbersListQueryParameters queryParameter) throws ApiException; } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/AvailableRegionsService.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/AvailableRegionsService.java index 894bf6ffe..a84834615 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/AvailableRegionsService.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/AvailableRegionsService.java @@ -11,8 +11,8 @@ package com.sinch.sdk.domains.numbers.api.v1; import com.sinch.sdk.core.exceptions.ApiException; -import com.sinch.sdk.domains.numbers.models.v1.regions.available.response.AvailableRegionListResponse; import com.sinch.sdk.domains.numbers.models.v1.regions.request.AvailableRegionsListQueryParameters; +import com.sinch.sdk.domains.numbers.models.v1.regions.response.AvailableRegionsListResponse; /** Available Regions Service */ public interface AvailableRegionsService { @@ -22,10 +22,10 @@ public interface AvailableRegionsService { * *

Lists all regions for numbers provided for the project ID. * - * @return AvailableRegionListResponse + * @return AvailableRegionsListResponse * @throws ApiException if fails to make API call */ - AvailableRegionListResponse list() throws ApiException; + AvailableRegionsListResponse list() throws ApiException; /** * List available regions @@ -33,9 +33,9 @@ public interface AvailableRegionsService { *

Lists all regions for numbers provided for the project ID. * * @param queryParameter (optional) - * @return AvailableRegionListResponse + * @return AvailableRegionsListResponse * @throws ApiException if fails to make API call */ - AvailableRegionListResponse list(AvailableRegionsListQueryParameters queryParameter) + AvailableRegionsListResponse list(AvailableRegionsListQueryParameters queryParameter) throws ApiException; } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/ActiveNumberServiceImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/ActiveNumberServiceImpl.java index 5b018a7c1..a5f3f3a2e 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/ActiveNumberServiceImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/ActiveNumberServiceImpl.java @@ -24,22 +24,20 @@ import com.sinch.sdk.core.http.URLParameterUtils; import com.sinch.sdk.core.http.URLPathUtils; import com.sinch.sdk.core.models.ServerConfiguration; +import com.sinch.sdk.core.models.pagination.HttpRequestPageNavigator; import com.sinch.sdk.core.models.pagination.Page; -import com.sinch.sdk.core.models.pagination.TokenPageNavigator; -import com.sinch.sdk.core.utils.Pair; +import com.sinch.sdk.core.utils.StringUtil; import com.sinch.sdk.domains.numbers.models.v1.ActiveNumber; import com.sinch.sdk.domains.numbers.models.v1.EmergencyAddress; import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumberUpdateRequest; import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumbersListQueryParameters; import com.sinch.sdk.domains.numbers.models.v1.request.EmergencyAddressRequest; -import com.sinch.sdk.domains.numbers.models.v1.response.ActiveNumberListResponse; +import com.sinch.sdk.domains.numbers.models.v1.response.ActiveNumbersListResponse; import com.sinch.sdk.domains.numbers.models.v1.response.ValidateAddressResponse; -import com.sinch.sdk.domains.numbers.models.v1.response.internal.ActiveNumberListResponseInternal; -import com.sinch.sdk.domains.numbers.models.v1.response.internal.ActiveNumberListResponseInternalImpl; +import com.sinch.sdk.domains.numbers.models.v1.response.internal.ActiveNumbersListResponseInternal; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -74,17 +72,45 @@ public ActiveNumberServiceImpl( } @Override - public void deprovisionEmergencyAddress(String phoneNumber) throws ApiException { + public ActiveNumbersListResponse list(ActiveNumbersListQueryParameters queryParameter) + throws ApiException { - LOGGER.finest("[deprovisionEmergencyAddress]" + " " + "phoneNumber: " + phoneNumber); + LOGGER.finest("[list]" + " " + "queryParameter: " + queryParameter); - HttpRequest httpRequest = deprovisionEmergencyAddressRequestBuilder(phoneNumber); + HttpRequest httpRequest = listRequestBuilder(queryParameter); + return _getActiveNumbersPageAsListResponse(queryParameter, httpRequest); + } + + public ActiveNumbersListResponse _getActiveNumbersPageAsListResponse( + ActiveNumbersListQueryParameters queryParameter, HttpRequest httpRequest) + throws ApiException { HttpResponse response = httpClient.invokeAPI( this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); if (HttpStatus.isSuccessfulStatus(response.getCode())) { - return; + + ActiveNumbersListResponseInternal deserialized = + mapper.deserialize(response, new TypeReference() {}); + + String nextToken = deserialized.getNextPageToken(); + + ActiveNumbersListQueryParameters nextParameters = + ActiveNumbersListQueryParameters.builder(queryParameter) + .setPageToken(deserialized.getNextPageToken()) + .build(); + + HttpRequest nextPage = null; + if (!StringUtil.isEmpty(nextToken)) { + nextPage = listRequestBuilder(nextParameters); + } + + return new ActiveNumbersListResponse( + this, + new Page<>( + nextParameters, + deserialized.getActiveNumbers(), + new HttpRequestPageNavigator(nextPage))); } // fallback to default errors handling: // all error cases definition are not required from specs: will try some "hardcoded" content @@ -95,32 +121,90 @@ public void deprovisionEmergencyAddress(String phoneNumber) throws ApiException mapper.deserialize(response, new TypeReference>() {})); } - private HttpRequest deprovisionEmergencyAddressRequestBuilder(String phoneNumber) + private HttpRequest listRequestBuilder(ActiveNumbersListQueryParameters queryParameter) throws ApiException { // verify the required parameter 'this.projectId' is set if (this.projectId == null) { throw new ApiException( - 400, - "Missing the required parameter 'this.projectId' when calling" - + " deprovisionEmergencyAddress"); + 400, "Missing the required parameter 'this.projectId' when calling list"); } - // verify the required parameter 'phoneNumber' is set - if (phoneNumber == null) { - throw new ApiException( - 400, - "Missing the required parameter 'phoneNumber' when calling deprovisionEmergencyAddress"); + // verify the required parameter 'regionCode' is set + if (null == queryParameter || queryParameter.getRegionCode() == null) { + throw new ApiException(400, "Missing the required parameter 'regionCode' when calling list"); + } + // verify the required parameter 'type' is set + if (null == queryParameter || queryParameter.getType() == null) { + throw new ApiException(400, "Missing the required parameter 'type' when calling list"); } String localVarPath = - "/v1/projects/{projectId}/activeNumbers/{phoneNumber}/emergencyAddress:deprovision" + "/v1/projects/{projectId}/activeNumbers" .replaceAll( "\\{" + "projectId" + "\\}", - URLPathUtils.encodePathSegment(this.projectId.toString())) - .replaceAll( - "\\{" + "phoneNumber" + "\\}", - URLPathUtils.encodePathSegment(phoneNumber.toString())); + URLPathUtils.encodePathSegment(this.projectId.toString())); List localVarQueryParams = new ArrayList<>(); + if (null != queryParameter) { + + URLParameterUtils.addQueryParam( + queryParameter.getRegionCode(), + "regionCode", + URLParameter.form, + null, + localVarQueryParams, + true); + + URLParameterUtils.addQueryParam( + queryParameter.getSearchPattern(), + "numberPattern.pattern", + URLParameter.form, + null, + localVarQueryParams, + true); + + URLParameterUtils.addQueryParam( + queryParameter.getSearchPosition(), + "numberPattern.searchPattern", + URLParameter.form, + null, + localVarQueryParams, + true); + + URLParameterUtils.addQueryParam( + queryParameter.getType(), "type", URLParameter.form, null, localVarQueryParams, true); + + URLParameterUtils.addQueryParam( + queryParameter.getCapabilities(), + "capability", + URLParameter.form, + null, + localVarQueryParams, + true); + + URLParameterUtils.addQueryParam( + queryParameter.getPageSize(), + "pageSize", + URLParameter.form, + null, + localVarQueryParams, + true); + + URLParameterUtils.addQueryParam( + queryParameter.getPageToken(), + "pageToken", + URLParameter.form, + null, + localVarQueryParams, + true); + + URLParameterUtils.addQueryParam( + queryParameter.getOrderBy(), + "orderBy", + URLParameter.form, + null, + localVarQueryParams, + true); + } Map localVarHeaderParams = new HashMap<>(); @@ -133,7 +217,7 @@ private HttpRequest deprovisionEmergencyAddressRequestBuilder(String phoneNumber return new HttpRequest( localVarPath, - HttpMethod.POST, + HttpMethod.GET, localVarQueryParams, serializedBody, localVarHeaderParams, @@ -143,17 +227,17 @@ private HttpRequest deprovisionEmergencyAddressRequestBuilder(String phoneNumber } @Override - public ActiveNumber get(String phoneNumber) throws ApiException { + public void deprovisionEmergencyAddress(String phoneNumber) throws ApiException { - LOGGER.finest("[get]" + " " + "phoneNumber: " + phoneNumber); + LOGGER.finest("[deprovisionEmergencyAddress]" + " " + "phoneNumber: " + phoneNumber); - HttpRequest httpRequest = getRequestBuilder(phoneNumber); + HttpRequest httpRequest = deprovisionEmergencyAddressRequestBuilder(phoneNumber); HttpResponse response = httpClient.invokeAPI( this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); if (HttpStatus.isSuccessfulStatus(response.getCode())) { - return mapper.deserialize(response, new TypeReference() {}); + return; } // fallback to default errors handling: // all error cases definition are not required from specs: will try some "hardcoded" content @@ -164,19 +248,24 @@ public ActiveNumber get(String phoneNumber) throws ApiException { mapper.deserialize(response, new TypeReference>() {})); } - private HttpRequest getRequestBuilder(String phoneNumber) throws ApiException { + private HttpRequest deprovisionEmergencyAddressRequestBuilder(String phoneNumber) + throws ApiException { // verify the required parameter 'this.projectId' is set if (this.projectId == null) { throw new ApiException( - 400, "Missing the required parameter 'this.projectId' when calling get"); + 400, + "Missing the required parameter 'this.projectId' when calling" + + " deprovisionEmergencyAddress"); } // verify the required parameter 'phoneNumber' is set if (phoneNumber == null) { - throw new ApiException(400, "Missing the required parameter 'phoneNumber' when calling get"); + throw new ApiException( + 400, + "Missing the required parameter 'phoneNumber' when calling deprovisionEmergencyAddress"); } String localVarPath = - "/v1/projects/{projectId}/activeNumbers/{phoneNumber}" + "/v1/projects/{projectId}/activeNumbers/{phoneNumber}/emergencyAddress:deprovision" .replaceAll( "\\{" + "projectId" + "\\}", URLPathUtils.encodePathSegment(this.projectId.toString())) @@ -197,7 +286,7 @@ private HttpRequest getRequestBuilder(String phoneNumber) throws ApiException { return new HttpRequest( localVarPath, - HttpMethod.GET, + HttpMethod.POST, localVarQueryParams, serializedBody, localVarHeaderParams, @@ -207,17 +296,17 @@ private HttpRequest getRequestBuilder(String phoneNumber) throws ApiException { } @Override - public EmergencyAddress getEmergencyAddress(String phoneNumber) throws ApiException { + public ActiveNumber get(String phoneNumber) throws ApiException { - LOGGER.finest("[getEmergencyAddress]" + " " + "phoneNumber: " + phoneNumber); + LOGGER.finest("[get]" + " " + "phoneNumber: " + phoneNumber); - HttpRequest httpRequest = getEmergencyAddressRequestBuilder(phoneNumber); + HttpRequest httpRequest = getRequestBuilder(phoneNumber); HttpResponse response = httpClient.invokeAPI( this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); if (HttpStatus.isSuccessfulStatus(response.getCode())) { - return mapper.deserialize(response, new TypeReference() {}); + return mapper.deserialize(response, new TypeReference() {}); } // fallback to default errors handling: // all error cases definition are not required from specs: will try some "hardcoded" content @@ -228,20 +317,19 @@ public EmergencyAddress getEmergencyAddress(String phoneNumber) throws ApiExcept mapper.deserialize(response, new TypeReference>() {})); } - private HttpRequest getEmergencyAddressRequestBuilder(String phoneNumber) throws ApiException { + private HttpRequest getRequestBuilder(String phoneNumber) throws ApiException { // verify the required parameter 'this.projectId' is set if (this.projectId == null) { throw new ApiException( - 400, "Missing the required parameter 'this.projectId' when calling getEmergencyAddress"); + 400, "Missing the required parameter 'this.projectId' when calling get"); } // verify the required parameter 'phoneNumber' is set if (phoneNumber == null) { - throw new ApiException( - 400, "Missing the required parameter 'phoneNumber' when calling getEmergencyAddress"); + throw new ApiException(400, "Missing the required parameter 'phoneNumber' when calling get"); } String localVarPath = - "/v1/projects/{projectId}/activeNumbers/{phoneNumber}/emergencyAddress" + "/v1/projects/{projectId}/activeNumbers/{phoneNumber}" .replaceAll( "\\{" + "projectId" + "\\}", URLPathUtils.encodePathSegment(this.projectId.toString())) @@ -272,22 +360,17 @@ private HttpRequest getEmergencyAddressRequestBuilder(String phoneNumber) throws } @Override - public ActiveNumberListResponse list(ActiveNumbersListQueryParameters queryParameter) - throws ApiException { + public EmergencyAddress getEmergencyAddress(String phoneNumber) throws ApiException { - LOGGER.finest("[list]" + " " + "queryParameter: " + queryParameter); + LOGGER.finest("[getEmergencyAddress]" + " " + "phoneNumber: " + phoneNumber); - HttpRequest httpRequest = listRequestBuilder(queryParameter); + HttpRequest httpRequest = getEmergencyAddressRequestBuilder(phoneNumber); HttpResponse response = httpClient.invokeAPI( this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); if (HttpStatus.isSuccessfulStatus(response.getCode())) { - - ActiveNumberListResponseInternal deserialized = - mapper.deserialize(response, new TypeReference() {}); - - return mapForPaging(queryParameter, deserialized); + return mapper.deserialize(response, new TypeReference() {}); } // fallback to default errors handling: // all error cases definition are not required from specs: will try some "hardcoded" content @@ -298,90 +381,28 @@ public ActiveNumberListResponse list(ActiveNumbersListQueryParameters queryParam mapper.deserialize(response, new TypeReference>() {})); } - private HttpRequest listRequestBuilder(ActiveNumbersListQueryParameters queryParameter) - throws ApiException { + private HttpRequest getEmergencyAddressRequestBuilder(String phoneNumber) throws ApiException { // verify the required parameter 'this.projectId' is set if (this.projectId == null) { throw new ApiException( - 400, "Missing the required parameter 'this.projectId' when calling list"); - } - // verify the required parameter 'regionCode' is set - if (null == queryParameter || queryParameter.getRegionCode() == null) { - throw new ApiException(400, "Missing the required parameter 'regionCode' when calling list"); + 400, "Missing the required parameter 'this.projectId' when calling getEmergencyAddress"); } - // verify the required parameter 'type' is set - if (null == queryParameter || queryParameter.getType() == null) { - throw new ApiException(400, "Missing the required parameter 'type' when calling list"); + // verify the required parameter 'phoneNumber' is set + if (phoneNumber == null) { + throw new ApiException( + 400, "Missing the required parameter 'phoneNumber' when calling getEmergencyAddress"); } String localVarPath = - "/v1/projects/{projectId}/activeNumbers" + "/v1/projects/{projectId}/activeNumbers/{phoneNumber}/emergencyAddress" .replaceAll( "\\{" + "projectId" + "\\}", - URLPathUtils.encodePathSegment(this.projectId.toString())); + URLPathUtils.encodePathSegment(this.projectId.toString())) + .replaceAll( + "\\{" + "phoneNumber" + "\\}", + URLPathUtils.encodePathSegment(phoneNumber.toString())); List localVarQueryParams = new ArrayList<>(); - if (null != queryParameter) { - - URLParameterUtils.addQueryParam( - queryParameter.getRegionCode(), - "regionCode", - URLParameter.form, - null, - localVarQueryParams, - true); - - URLParameterUtils.addQueryParam( - queryParameter.getSearchPattern(), - "numberPattern.pattern", - URLParameter.form, - null, - localVarQueryParams, - true); - - URLParameterUtils.addQueryParam( - queryParameter.getSearchPosition(), - "numberPattern.searchPattern", - URLParameter.form, - null, - localVarQueryParams, - true); - - URLParameterUtils.addQueryParam( - queryParameter.getType(), "type", URLParameter.form, null, localVarQueryParams, true); - - URLParameterUtils.addQueryParam( - queryParameter.getCapabilities(), - "capability", - URLParameter.form, - null, - localVarQueryParams, - true); - - URLParameterUtils.addQueryParam( - queryParameter.getPageSize(), - "pageSize", - URLParameter.form, - null, - localVarQueryParams, - true); - - URLParameterUtils.addQueryParam( - queryParameter.getPageToken(), - "pageToken", - URLParameter.form, - null, - localVarQueryParams, - true); - - URLParameterUtils.addQueryParam( - queryParameter.getOrderBy(), - "orderBy", - URLParameter.form, - null, - localVarQueryParams, - true); - } Map localVarHeaderParams = new HashMap<>(); @@ -403,21 +424,6 @@ private HttpRequest listRequestBuilder(ActiveNumbersListQueryParameters queryPar localVarAuthNames); } - private ActiveNumberListResponse mapForPaging( - ActiveNumbersListQueryParameters parameters, ActiveNumberListResponseInternal _dto) { - - ActiveNumberListResponseInternalImpl dto = (ActiveNumberListResponseInternalImpl) _dto; - - String nextPageToken = dto.nextPageToken().orElse(null); - List list = dto.activeNumbers().orElse(Collections.emptyList()); - - Pair, TokenPageNavigator> paginated = - new Pair<>(list, new TokenPageNavigator(nextPageToken)); - - return new ActiveNumberListResponse( - new Page<>(parameters, paginated.getLeft(), paginated.getRight()), this.numbersService); - } - @Override public EmergencyAddress provisionEmergencyAddress( String phoneNumber, EmergencyAddressRequest emergencyAddressRequest) throws ApiException { diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/AvailableNumberServiceImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/AvailableNumberServiceImpl.java index 2d8b75f05..476c4b1d8 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/AvailableNumberServiceImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/AvailableNumberServiceImpl.java @@ -24,18 +24,17 @@ import com.sinch.sdk.core.http.URLParameterUtils; import com.sinch.sdk.core.http.URLPathUtils; import com.sinch.sdk.core.models.ServerConfiguration; +import com.sinch.sdk.core.models.pagination.Page; import com.sinch.sdk.domains.numbers.models.v1.ActiveNumber; import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentAnyRequest; import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentRequest; import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumbersListQueryParameters; import com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumber; -import com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumberListResponse; -import com.sinch.sdk.domains.numbers.models.v1.response.internal.AvailableNumberListResponseInternal; -import com.sinch.sdk.domains.numbers.models.v1.response.internal.AvailableNumberListResponseInternalImpl; +import com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumbersListResponse; +import com.sinch.sdk.domains.numbers.models.v1.response.internal.AvailableNumbersListResponseInternal; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -279,25 +278,30 @@ private HttpRequest rentAnyRequestBuilder( } @Override - public AvailableNumberListResponse searchForAvailableNumbers( + public AvailableNumbersListResponse searchForAvailableNumbers( AvailableNumbersListQueryParameters queryParameter) throws ApiException { LOGGER.finest("[searchForAvailableNumbers]" + " " + "queryParameter: " + queryParameter); HttpRequest httpRequest = searchForAvailableNumbersRequestBuilder(queryParameter); + return _getAvailableNumbersPageAsListResponse(queryParameter, httpRequest); + } + + public AvailableNumbersListResponse _getAvailableNumbersPageAsListResponse( + AvailableNumbersListQueryParameters queryParameter, HttpRequest httpRequest) + throws ApiException { HttpResponse response = httpClient.invokeAPI( this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); if (HttpStatus.isSuccessfulStatus(response.getCode())) { - AvailableNumberListResponseInternal deserialized = - mapper.deserialize(response, new TypeReference() {}); + AvailableNumbersListResponseInternal deserialized = + mapper.deserialize( + response, new TypeReference() {}); - return new AvailableNumberListResponse( - ((AvailableNumberListResponseInternalImpl) deserialized) - .availableNumbers() - .orElse(Collections.emptyList())); + return new AvailableNumbersListResponse( + this, new Page<>(null, deserialized.getAvailableNumbers(), null)); } // fallback to default errors handling: // all error cases definition are not required from specs: will try some "hardcoded" content diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/AvailableRegionsServiceImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/AvailableRegionsServiceImpl.java index dc9809c69..bcec1a9ae 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/AvailableRegionsServiceImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/AvailableRegionsServiceImpl.java @@ -24,9 +24,10 @@ import com.sinch.sdk.core.http.URLParameterUtils; import com.sinch.sdk.core.http.URLPathUtils; import com.sinch.sdk.core.models.ServerConfiguration; -import com.sinch.sdk.domains.numbers.models.v1.regions.available.response.AvailableRegionListResponse; -import com.sinch.sdk.domains.numbers.models.v1.regions.available.response.internal.AvailableRegionListResponseInternal; +import com.sinch.sdk.core.models.pagination.Page; import com.sinch.sdk.domains.numbers.models.v1.regions.request.AvailableRegionsListQueryParameters; +import com.sinch.sdk.domains.numbers.models.v1.regions.response.AvailableRegionsListResponse; +import com.sinch.sdk.domains.numbers.models.v1.regions.response.internal.AvailableRegionsListResponseInternal; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -61,28 +62,36 @@ public AvailableRegionsServiceImpl( } @Override - public AvailableRegionListResponse list() throws ApiException { + public AvailableRegionsListResponse list() throws ApiException { return list((AvailableRegionsListQueryParameters) null); } @Override - public AvailableRegionListResponse list(AvailableRegionsListQueryParameters queryParameter) + public AvailableRegionsListResponse list(AvailableRegionsListQueryParameters queryParameter) throws ApiException { LOGGER.finest("[list]" + " " + "queryParameter: " + queryParameter); HttpRequest httpRequest = listRequestBuilder(queryParameter); + return _getAvailableRegionsPageAsListResponse(queryParameter, httpRequest); + } + + public AvailableRegionsListResponse _getAvailableRegionsPageAsListResponse( + AvailableRegionsListQueryParameters queryParameter, HttpRequest httpRequest) + throws ApiException { HttpResponse response = httpClient.invokeAPI( this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); if (HttpStatus.isSuccessfulStatus(response.getCode())) { - AvailableRegionListResponseInternal deserialized = - mapper.deserialize(response, new TypeReference() {}); + AvailableRegionsListResponseInternal deserialized = + mapper.deserialize( + response, new TypeReference() {}); - return new AvailableRegionListResponse(deserialized.getAvailableRegions()); + return new AvailableRegionsListResponse( + this, new Page<>(null, deserialized.getAvailableRegions(), null)); } // fallback to default errors handling: // all error cases definition are not required from specs: will try some "hardcoded" content diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/available/response/AvailableRegion.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/response/AvailableRegion.java similarity index 96% rename from openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/available/response/AvailableRegion.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/response/AvailableRegion.java index a438d017d..f494c07f3 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/available/response/AvailableRegion.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/response/AvailableRegion.java @@ -8,7 +8,7 @@ * Do not edit the class manually. */ -package com.sinch.sdk.domains.numbers.models.v1.regions.available.response; +package com.sinch.sdk.domains.numbers.models.v1.regions.response; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.sinch.sdk.domains.numbers.models.v1.NumberType; diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/available/response/AvailableRegionImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/response/AvailableRegionImpl.java similarity index 98% rename from openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/available/response/AvailableRegionImpl.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/response/AvailableRegionImpl.java index 3782eb781..b45109b46 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/available/response/AvailableRegionImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/response/AvailableRegionImpl.java @@ -1,4 +1,4 @@ -package com.sinch.sdk.domains.numbers.models.v1.regions.available.response; +package com.sinch.sdk.domains.numbers.models.v1.regions.response; import com.fasterxml.jackson.annotation.JsonFilter; import com.fasterxml.jackson.annotation.JsonIgnore; diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/response/AvailableRegionsListResponse.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/response/AvailableRegionsListResponse.java new file mode 100644 index 000000000..9c057d179 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/response/AvailableRegionsListResponse.java @@ -0,0 +1,63 @@ +/* + * Numbers | Sinch + * + * OpenAPI document version: 1.0.3 + * Contact: Support@sinch.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit the class manually. + */ + +package com.sinch.sdk.domains.numbers.models.v1.regions.response; + +import com.sinch.sdk.core.http.HttpRequest; +import com.sinch.sdk.core.models.pagination.ListResponse; +import com.sinch.sdk.core.models.pagination.Page; +import com.sinch.sdk.domains.numbers.api.v1.adapters.AvailableRegionsServiceImpl; +import com.sinch.sdk.domains.numbers.models.v1.regions.request.AvailableRegionsListQueryParameters; +import java.util.Collection; +import java.util.Collections; +import java.util.NoSuchElementException; + +/** Auto paginated response for list of AvailableRegion */ +public class AvailableRegionsListResponse extends ListResponse { + + private final Page page; + private final AvailableRegionsServiceImpl service; + + public AvailableRegionsListResponse( + AvailableRegionsServiceImpl service, + Page page) { + this.service = service; + this.page = page; + } + + @Override + public boolean hasNextPage() { + if (null == page.getNextPageToken() || null == getContent() || getContent().isEmpty()) { + return false; + } + return true; + } + + @Override + public AvailableRegionsListResponse nextPage() { + + if (!hasNextPage()) { + throw new NoSuchElementException("Reached the last page of the API response"); + } + + return service._getAvailableRegionsPageAsListResponse( + page.getParameters(), page.getNextPageToken()); + } + + @Override + public Collection getContent() { + return page == null ? Collections.emptyList() : page.getEntities(); + } + + @Override + public String toString() { + return "AvailableRegionsListResponse {" + "page=" + page + '}'; + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/available/response/internal/AvailableRegionListResponseInternal.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/response/internal/AvailableRegionsListResponseInternal.java similarity index 70% rename from openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/available/response/internal/AvailableRegionListResponseInternal.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/response/internal/AvailableRegionsListResponseInternal.java index 7d766ab26..245f67d33 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/available/response/internal/AvailableRegionListResponseInternal.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/response/internal/AvailableRegionsListResponseInternal.java @@ -8,15 +8,15 @@ * Do not edit the class manually. */ -package com.sinch.sdk.domains.numbers.models.v1.regions.available.response.internal; +package com.sinch.sdk.domains.numbers.models.v1.regions.response.internal; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.sinch.sdk.domains.numbers.models.v1.regions.available.response.AvailableRegion; +import com.sinch.sdk.domains.numbers.models.v1.regions.response.AvailableRegion; import java.util.List; /** Response message to list regions for which numbers are provided. */ -@JsonDeserialize(builder = AvailableRegionListResponseInternalImpl.Builder.class) -public interface AvailableRegionListResponseInternal { +@JsonDeserialize(builder = AvailableRegionsListResponseInternalImpl.Builder.class) +public interface AvailableRegionsListResponseInternal { /** * Get availableRegions @@ -31,7 +31,7 @@ public interface AvailableRegionListResponseInternal { * @return New Builder instance */ static Builder builder() { - return new AvailableRegionListResponseInternalImpl.Builder(); + return new AvailableRegionsListResponseInternalImpl.Builder(); } /** Dedicated Builder */ @@ -51,6 +51,6 @@ interface Builder { * * @return The instance build with current builder values */ - AvailableRegionListResponseInternal build(); + AvailableRegionsListResponseInternal build(); } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/available/response/internal/AvailableRegionListResponseInternalImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/response/internal/AvailableRegionsListResponseInternalImpl.java similarity index 73% rename from openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/available/response/internal/AvailableRegionListResponseInternalImpl.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/response/internal/AvailableRegionsListResponseInternalImpl.java index 501583181..6ee64634a 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/available/response/internal/AvailableRegionListResponseInternalImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/regions/response/internal/AvailableRegionsListResponseInternalImpl.java @@ -1,4 +1,4 @@ -package com.sinch.sdk.domains.numbers.models.v1.regions.available.response.internal; +package com.sinch.sdk.domains.numbers.models.v1.regions.response.internal; import com.fasterxml.jackson.annotation.JsonFilter; import com.fasterxml.jackson.annotation.JsonIgnore; @@ -7,24 +7,24 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.numbers.models.v1.regions.available.response.AvailableRegion; +import com.sinch.sdk.domains.numbers.models.v1.regions.response.AvailableRegion; import java.util.List; import java.util.Objects; -@JsonPropertyOrder({AvailableRegionListResponseInternalImpl.JSON_PROPERTY_AVAILABLE_REGIONS}) +@JsonPropertyOrder({AvailableRegionsListResponseInternalImpl.JSON_PROPERTY_AVAILABLE_REGIONS}) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) -public class AvailableRegionListResponseInternalImpl - implements AvailableRegionListResponseInternal { +public class AvailableRegionsListResponseInternalImpl + implements AvailableRegionsListResponseInternal { private static final long serialVersionUID = 1L; public static final String JSON_PROPERTY_AVAILABLE_REGIONS = "availableRegions"; private OptionalValue> availableRegions; - public AvailableRegionListResponseInternalImpl() {} + public AvailableRegionsListResponseInternalImpl() {} - protected AvailableRegionListResponseInternalImpl( + protected AvailableRegionsListResponseInternalImpl( OptionalValue> availableRegions) { this.availableRegions = availableRegions; } @@ -49,8 +49,8 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - AvailableRegionListResponseInternalImpl listAvailableRegionsResponse = - (AvailableRegionListResponseInternalImpl) o; + AvailableRegionsListResponseInternalImpl listAvailableRegionsResponse = + (AvailableRegionsListResponseInternalImpl) o; return Objects.equals(this.availableRegions, listAvailableRegionsResponse.availableRegions); } @@ -62,7 +62,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class AvailableRegionListResponseInternalImpl {\n"); + sb.append("class AvailableRegionsListResponseInternalImpl {\n"); sb.append(" availableRegions: ").append(toIndentedString(availableRegions)).append("\n"); sb.append("}"); return sb.toString(); @@ -79,7 +79,7 @@ private String toIndentedString(Object o) { } @JsonPOJOBuilder(withPrefix = "set") - static class Builder implements AvailableRegionListResponseInternal.Builder { + static class Builder implements AvailableRegionsListResponseInternal.Builder { OptionalValue> availableRegions = OptionalValue.empty(); @JsonProperty(JSON_PROPERTY_AVAILABLE_REGIONS) @@ -88,8 +88,8 @@ public Builder setAvailableRegions(List availableRegions) { return this; } - public AvailableRegionListResponseInternal build() { - return new AvailableRegionListResponseInternalImpl(availableRegions); + public AvailableRegionsListResponseInternal build() { + return new AvailableRegionsListResponseInternalImpl(availableRegions); } } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/request/ActiveNumbersListQueryParameters.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/request/ActiveNumbersListQueryParameters.java index 644b79842..cd7e8c931 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/request/ActiveNumbersListQueryParameters.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/request/ActiveNumbersListQueryParameters.java @@ -11,13 +11,9 @@ package com.sinch.sdk.domains.numbers.models.v1.request; import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.core.utils.EnumDynamic; -import com.sinch.sdk.core.utils.EnumSupportDynamic; import com.sinch.sdk.domains.numbers.models.v1.Capability; import com.sinch.sdk.domains.numbers.models.v1.NumberType; -import java.util.Arrays; import java.util.List; -import java.util.stream.Stream; /** ActiveNumbersListQueryParameters */ public interface ActiveNumbersListQueryParameters { @@ -71,38 +67,12 @@ public interface ActiveNumbersListQueryParameters { */ OptionalValue getPageToken(); - /** The ordering the request is supporting */ - public class OrderByEnum extends EnumDynamic { - public static final OrderByEnum PHONE_NUMBER = new OrderByEnum("phoneNumber"); - public static final OrderByEnum DISPLAY_NAME = new OrderByEnum("displayName"); - - private static final EnumSupportDynamic ENUM_SUPPORT = - new EnumSupportDynamic<>( - OrderByEnum.class, OrderByEnum::new, Arrays.asList(PHONE_NUMBER, DISPLAY_NAME)); - - private OrderByEnum(String value) { - super(value); - } - - public static Stream values() { - return ENUM_SUPPORT.values(); - } - - public static OrderByEnum from(String value) { - return ENUM_SUPPORT.from(value); - } - - public static String valueOf(OrderByEnum e) { - return ENUM_SUPPORT.valueOf(e); - } - } - /** - * The ordering the request is supporting + * Get orderBy * * @return orderBy */ - OptionalValue getOrderBy(); + OptionalValue getOrderBy(); /** * Getting builder @@ -195,7 +165,7 @@ interface Builder { * @return Current builder * @see #getOrderBy */ - Builder setOrderBy(OrderByEnum orderBy); + Builder setOrderBy(OrderBy orderBy); /** * Create instance diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/request/ActiveNumbersListQueryParametersImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/request/ActiveNumbersListQueryParametersImpl.java index 954a8726e..df3e6278d 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/request/ActiveNumbersListQueryParametersImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/request/ActiveNumbersListQueryParametersImpl.java @@ -15,7 +15,7 @@ public class ActiveNumbersListQueryParametersImpl implements ActiveNumbersListQu private final OptionalValue> capabilities; private final OptionalValue pageSize; private final OptionalValue pageToken; - private final OptionalValue orderBy; + private final OptionalValue orderBy; private ActiveNumbersListQueryParametersImpl( OptionalValue regionCode, @@ -25,7 +25,7 @@ private ActiveNumbersListQueryParametersImpl( OptionalValue> capabilities, OptionalValue pageSize, OptionalValue pageToken, - OptionalValue orderBy) { + OptionalValue orderBy) { this.regionCode = regionCode; this.searchPattern = searchPattern; this.searchPosition = searchPosition; @@ -64,7 +64,7 @@ public OptionalValue getPageToken() { return pageToken; } - public OptionalValue getOrderBy() { + public OptionalValue getOrderBy() { return orderBy; } @@ -139,7 +139,7 @@ static class Builder implements ActiveNumbersListQueryParameters.Builder { OptionalValue> capabilities = OptionalValue.empty(); OptionalValue pageSize = OptionalValue.empty(); OptionalValue pageToken = OptionalValue.empty(); - OptionalValue orderBy = OptionalValue.empty(); + OptionalValue orderBy = OptionalValue.empty(); protected Builder() {} @@ -194,7 +194,7 @@ public Builder setPageToken(String pageToken) { return this; } - public Builder setOrderBy(OrderByEnum orderBy) { + public Builder setOrderBy(OrderBy orderBy) { this.orderBy = OptionalValue.of(orderBy); return this; } diff --git a/client/src/main/com/sinch/sdk/domains/numbers/models/v1/request/OrderBy.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/request/OrderBy.java similarity index 81% rename from client/src/main/com/sinch/sdk/domains/numbers/models/v1/request/OrderBy.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/request/OrderBy.java index c0e6f1312..26083e0b4 100644 --- a/client/src/main/com/sinch/sdk/domains/numbers/models/v1/request/OrderBy.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/request/OrderBy.java @@ -5,16 +5,13 @@ import java.util.Arrays; import java.util.stream.Stream; -/** - * Supported fields for ordering - * - * @since 1.2 - */ -public final class OrderBy extends EnumDynamic { - /** Ordering by phoneNumber */ +/** The ordering the request is supporting */ +public class OrderBy extends EnumDynamic { + + /** Ordered by phone number */ public static final OrderBy PHONE_NUMBER = new OrderBy("phoneNumber"); - /** Ordering by displayName */ + /** Ordered by display name */ public static final OrderBy DISPLAY_NAME = new OrderBy("displayName"); private static final EnumSupportDynamic ENUM_SUPPORT = diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/response/ActiveNumbersListResponse.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/response/ActiveNumbersListResponse.java new file mode 100644 index 000000000..32b096abe --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/response/ActiveNumbersListResponse.java @@ -0,0 +1,64 @@ +/* + * Numbers | Sinch + * + * OpenAPI document version: 1.0.3 + * Contact: Support@sinch.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit the class manually. + */ + +package com.sinch.sdk.domains.numbers.models.v1.response; + +import com.sinch.sdk.core.http.HttpRequest; +import com.sinch.sdk.core.models.pagination.ListResponse; +import com.sinch.sdk.core.models.pagination.Page; +import com.sinch.sdk.domains.numbers.api.v1.adapters.ActiveNumberServiceImpl; +import com.sinch.sdk.domains.numbers.models.v1.ActiveNumber; +import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumbersListQueryParameters; +import java.util.Collection; +import java.util.Collections; +import java.util.NoSuchElementException; + +/** Auto paginated response for list of ActiveNumber */ +public class ActiveNumbersListResponse extends ListResponse { + + private final Page page; + private final ActiveNumberServiceImpl service; + + public ActiveNumbersListResponse( + ActiveNumberServiceImpl service, + Page page) { + this.service = service; + this.page = page; + } + + @Override + public boolean hasNextPage() { + if (null == page.getNextPageToken() || null == getContent() || getContent().isEmpty()) { + return false; + } + return true; + } + + @Override + public ActiveNumbersListResponse nextPage() { + + if (!hasNextPage()) { + throw new NoSuchElementException("Reached the last page of the API response"); + } + + return service._getActiveNumbersPageAsListResponse( + page.getParameters(), page.getNextPageToken()); + } + + @Override + public Collection getContent() { + return page == null ? Collections.emptyList() : page.getEntities(); + } + + @Override + public String toString() { + return "ActiveNumbersListResponse {" + "page=" + page + '}'; + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/response/AvailableNumbersListResponse.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/response/AvailableNumbersListResponse.java new file mode 100644 index 000000000..f9213c72c --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/response/AvailableNumbersListResponse.java @@ -0,0 +1,63 @@ +/* + * Numbers | Sinch + * + * OpenAPI document version: 1.0.3 + * Contact: Support@sinch.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit the class manually. + */ + +package com.sinch.sdk.domains.numbers.models.v1.response; + +import com.sinch.sdk.core.http.HttpRequest; +import com.sinch.sdk.core.models.pagination.ListResponse; +import com.sinch.sdk.core.models.pagination.Page; +import com.sinch.sdk.domains.numbers.api.v1.adapters.AvailableNumberServiceImpl; +import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumbersListQueryParameters; +import java.util.Collection; +import java.util.Collections; +import java.util.NoSuchElementException; + +/** Auto paginated response for list of AvailableNumber */ +public class AvailableNumbersListResponse extends ListResponse { + + private final Page page; + private final AvailableNumberServiceImpl service; + + public AvailableNumbersListResponse( + AvailableNumberServiceImpl service, + Page page) { + this.service = service; + this.page = page; + } + + @Override + public boolean hasNextPage() { + if (null == page.getNextPageToken() || null == getContent() || getContent().isEmpty()) { + return false; + } + return true; + } + + @Override + public AvailableNumbersListResponse nextPage() { + + if (!hasNextPage()) { + throw new NoSuchElementException("Reached the last page of the API response"); + } + + return service._getAvailableNumbersPageAsListResponse( + page.getParameters(), page.getNextPageToken()); + } + + @Override + public Collection getContent() { + return page == null ? Collections.emptyList() : page.getEntities(); + } + + @Override + public String toString() { + return "AvailableNumbersListResponse {" + "page=" + page + '}'; + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/response/internal/ActiveNumberListResponseInternal.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/response/internal/ActiveNumbersListResponseInternal.java similarity index 87% rename from openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/response/internal/ActiveNumberListResponseInternal.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/response/internal/ActiveNumbersListResponseInternal.java index 8cf317b84..a66819222 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/response/internal/ActiveNumberListResponseInternal.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/response/internal/ActiveNumbersListResponseInternal.java @@ -15,8 +15,8 @@ import java.util.List; /** Response message to list your active phone numbers. */ -@JsonDeserialize(builder = ActiveNumberListResponseInternalImpl.Builder.class) -public interface ActiveNumberListResponseInternal { +@JsonDeserialize(builder = ActiveNumbersListResponseInternalImpl.Builder.class) +public interface ActiveNumbersListResponseInternal { /** * List of numbers associated to the client project specified in ListActiveNumbers. @@ -45,7 +45,7 @@ public interface ActiveNumberListResponseInternal { * @return New Builder instance */ static Builder builder() { - return new ActiveNumberListResponseInternalImpl.Builder(); + return new ActiveNumbersListResponseInternalImpl.Builder(); } /** Dedicated Builder */ @@ -83,6 +83,6 @@ interface Builder { * * @return The instance build with current builder values */ - ActiveNumberListResponseInternal build(); + ActiveNumbersListResponseInternal build(); } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/response/internal/ActiveNumberListResponseInternalImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/response/internal/ActiveNumbersListResponseInternalImpl.java similarity index 83% rename from openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/response/internal/ActiveNumberListResponseInternalImpl.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/response/internal/ActiveNumbersListResponseInternalImpl.java index 23f852783..6daa42c60 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/response/internal/ActiveNumberListResponseInternalImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/response/internal/ActiveNumbersListResponseInternalImpl.java @@ -12,13 +12,13 @@ import java.util.Objects; @JsonPropertyOrder({ - ActiveNumberListResponseInternalImpl.JSON_PROPERTY_ACTIVE_NUMBERS, - ActiveNumberListResponseInternalImpl.JSON_PROPERTY_NEXT_PAGE_TOKEN, - ActiveNumberListResponseInternalImpl.JSON_PROPERTY_TOTAL_SIZE + ActiveNumbersListResponseInternalImpl.JSON_PROPERTY_ACTIVE_NUMBERS, + ActiveNumbersListResponseInternalImpl.JSON_PROPERTY_NEXT_PAGE_TOKEN, + ActiveNumbersListResponseInternalImpl.JSON_PROPERTY_TOTAL_SIZE }) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) -public class ActiveNumberListResponseInternalImpl implements ActiveNumberListResponseInternal { +public class ActiveNumbersListResponseInternalImpl implements ActiveNumbersListResponseInternal { private static final long serialVersionUID = 1L; public static final String JSON_PROPERTY_ACTIVE_NUMBERS = "activeNumbers"; @@ -33,9 +33,9 @@ public class ActiveNumberListResponseInternalImpl implements ActiveNumberListRes private OptionalValue totalSize; - public ActiveNumberListResponseInternalImpl() {} + public ActiveNumbersListResponseInternalImpl() {} - protected ActiveNumberListResponseInternalImpl( + protected ActiveNumbersListResponseInternalImpl( OptionalValue> activeNumbers, OptionalValue nextPageToken, OptionalValue totalSize) { @@ -86,8 +86,8 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - ActiveNumberListResponseInternalImpl listActiveNumbersResponse = - (ActiveNumberListResponseInternalImpl) o; + ActiveNumbersListResponseInternalImpl listActiveNumbersResponse = + (ActiveNumbersListResponseInternalImpl) o; return Objects.equals(this.activeNumbers, listActiveNumbersResponse.activeNumbers) && Objects.equals(this.nextPageToken, listActiveNumbersResponse.nextPageToken) && Objects.equals(this.totalSize, listActiveNumbersResponse.totalSize); @@ -101,7 +101,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class ActiveNumberListResponseInternalImpl {\n"); + sb.append("class ActiveNumbersListResponseInternalImpl {\n"); sb.append(" activeNumbers: ").append(toIndentedString(activeNumbers)).append("\n"); sb.append(" nextPageToken: ").append(toIndentedString(nextPageToken)).append("\n"); sb.append(" totalSize: ").append(toIndentedString(totalSize)).append("\n"); @@ -120,7 +120,7 @@ private String toIndentedString(Object o) { } @JsonPOJOBuilder(withPrefix = "set") - static class Builder implements ActiveNumberListResponseInternal.Builder { + static class Builder implements ActiveNumbersListResponseInternal.Builder { OptionalValue> activeNumbers = OptionalValue.empty(); OptionalValue nextPageToken = OptionalValue.empty(); OptionalValue totalSize = OptionalValue.empty(); @@ -143,8 +143,8 @@ public Builder setTotalSize(Integer totalSize) { return this; } - public ActiveNumberListResponseInternal build() { - return new ActiveNumberListResponseInternalImpl(activeNumbers, nextPageToken, totalSize); + public ActiveNumbersListResponseInternal build() { + return new ActiveNumbersListResponseInternalImpl(activeNumbers, nextPageToken, totalSize); } } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/response/internal/AvailableNumberListResponseInternal.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/response/internal/AvailableNumbersListResponseInternal.java similarity index 81% rename from openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/response/internal/AvailableNumberListResponseInternal.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/response/internal/AvailableNumbersListResponseInternal.java index 576d26f6f..6096695f7 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/response/internal/AvailableNumberListResponseInternal.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/response/internal/AvailableNumbersListResponseInternal.java @@ -15,8 +15,8 @@ import java.util.List; /** Response message to list available phone numbers. */ -@JsonDeserialize(builder = AvailableNumberListResponseInternalImpl.Builder.class) -public interface AvailableNumberListResponseInternal { +@JsonDeserialize(builder = AvailableNumbersListResponseInternalImpl.Builder.class) +public interface AvailableNumbersListResponseInternal { /** * List of available phone numbers. @@ -31,7 +31,7 @@ public interface AvailableNumberListResponseInternal { * @return New Builder instance */ static Builder builder() { - return new AvailableNumberListResponseInternalImpl.Builder(); + return new AvailableNumbersListResponseInternalImpl.Builder(); } /** Dedicated Builder */ @@ -51,6 +51,6 @@ interface Builder { * * @return The instance build with current builder values */ - AvailableNumberListResponseInternal build(); + AvailableNumbersListResponseInternal build(); } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/response/internal/AvailableNumberListResponseInternalImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/response/internal/AvailableNumbersListResponseInternalImpl.java similarity index 78% rename from openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/response/internal/AvailableNumberListResponseInternalImpl.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/response/internal/AvailableNumbersListResponseInternalImpl.java index 8688d24a3..908287d85 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/response/internal/AvailableNumberListResponseInternalImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/models/v1/response/internal/AvailableNumbersListResponseInternalImpl.java @@ -11,20 +11,20 @@ import java.util.List; import java.util.Objects; -@JsonPropertyOrder({AvailableNumberListResponseInternalImpl.JSON_PROPERTY_AVAILABLE_NUMBERS}) +@JsonPropertyOrder({AvailableNumbersListResponseInternalImpl.JSON_PROPERTY_AVAILABLE_NUMBERS}) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) -public class AvailableNumberListResponseInternalImpl - implements AvailableNumberListResponseInternal { +public class AvailableNumbersListResponseInternalImpl + implements AvailableNumbersListResponseInternal { private static final long serialVersionUID = 1L; public static final String JSON_PROPERTY_AVAILABLE_NUMBERS = "availableNumbers"; private OptionalValue> availableNumbers; - public AvailableNumberListResponseInternalImpl() {} + public AvailableNumbersListResponseInternalImpl() {} - protected AvailableNumberListResponseInternalImpl( + protected AvailableNumbersListResponseInternalImpl( OptionalValue> availableNumbers) { this.availableNumbers = availableNumbers; } @@ -49,8 +49,8 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - AvailableNumberListResponseInternalImpl listAvailableNumbersResponse = - (AvailableNumberListResponseInternalImpl) o; + AvailableNumbersListResponseInternalImpl listAvailableNumbersResponse = + (AvailableNumbersListResponseInternalImpl) o; return Objects.equals(this.availableNumbers, listAvailableNumbersResponse.availableNumbers); } @@ -62,7 +62,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class AvailableNumberListResponseInternalImpl {\n"); + sb.append("class AvailableNumbersListResponseInternalImpl {\n"); sb.append(" availableNumbers: ").append(toIndentedString(availableNumbers)).append("\n"); sb.append("}"); return sb.toString(); @@ -79,7 +79,7 @@ private String toIndentedString(Object o) { } @JsonPOJOBuilder(withPrefix = "set") - static class Builder implements AvailableNumberListResponseInternal.Builder { + static class Builder implements AvailableNumbersListResponseInternal.Builder { OptionalValue> availableNumbers = OptionalValue.empty(); @JsonProperty(JSON_PROPERTY_AVAILABLE_NUMBERS) @@ -88,8 +88,8 @@ public Builder setAvailableNumbers(List availableNumbers) { return this; } - public AvailableNumberListResponseInternal build() { - return new AvailableNumberListResponseInternalImpl(availableNumbers); + public AvailableNumbersListResponseInternal build() { + return new AvailableNumbersListResponseInternalImpl(availableNumbers); } } } diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/numbers/models/v1/ActiveNumberDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/numbers/models/v1/ActiveNumberDtoTest.java index 17b481528..26b91c0b5 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/numbers/models/v1/ActiveNumberDtoTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/numbers/models/v1/ActiveNumberDtoTest.java @@ -6,7 +6,7 @@ import com.sinch.sdk.core.TestHelpers; import com.sinch.sdk.domains.numbers.api.v1.adapters.NumbersBaseTest; import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumberUpdateRequest; -import com.sinch.sdk.domains.numbers.models.v1.response.internal.ActiveNumberListResponseInternal; +import com.sinch.sdk.domains.numbers.models.v1.response.internal.ActiveNumbersListResponseInternal; import java.time.Instant; import java.util.Arrays; import org.json.JSONException; @@ -60,15 +60,15 @@ public class ActiveNumberDtoTest extends NumbersBaseTest { .setCallbackUrl("foo callback") .build(); - public static ActiveNumberListResponseInternal activeNumberList = - ActiveNumberListResponseInternal.builder() + public static ActiveNumbersListResponseInternal activeNumberList = + ActiveNumbersListResponseInternal.builder() .setActiveNumbers(Arrays.asList(activeNumber)) .setNextPageToken("foo") .setTotalSize(1) .build(); - public static ActiveNumberListResponseInternal activeNumberListLight = - ActiveNumberListResponseInternal.builder() + public static ActiveNumbersListResponseInternal activeNumberListLight = + ActiveNumbersListResponseInternal.builder() .setActiveNumbers( Arrays.asList( ActiveNumber.builder() @@ -106,8 +106,8 @@ void deserialize() throws JsonProcessingException { @Test void deserializeList() throws JsonProcessingException { - ActiveNumberListResponseInternal deserializedString = - objectMapper.readValue(activeListResponseJson, ActiveNumberListResponseInternal.class); + ActiveNumbersListResponseInternal deserializedString = + objectMapper.readValue(activeListResponseJson, ActiveNumbersListResponseInternal.class); TestHelpers.recursiveEquals(activeNumberList, deserializedString); } @@ -115,8 +115,9 @@ void deserializeList() throws JsonProcessingException { @Test void deserializeListLight() throws JsonProcessingException { - ActiveNumberListResponseInternal deserializedString = - objectMapper.readValue(activeListLightResponseJson, ActiveNumberListResponseInternal.class); + ActiveNumbersListResponseInternal deserializedString = + objectMapper.readValue( + activeListLightResponseJson, ActiveNumbersListResponseInternal.class); TestHelpers.recursiveEquals(activeNumberListLight, deserializedString); } diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/numbers/models/v1/AvailableNumberDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/numbers/models/v1/AvailableNumberDtoTest.java index 9c5ba47fc..34700dad4 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/numbers/models/v1/AvailableNumberDtoTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/numbers/models/v1/AvailableNumberDtoTest.java @@ -6,7 +6,7 @@ import com.sinch.sdk.core.TestHelpers; import com.sinch.sdk.domains.numbers.api.v1.adapters.NumbersBaseTest; import com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumber; -import com.sinch.sdk.domains.numbers.models.v1.response.internal.AvailableNumberListResponseInternal; +import com.sinch.sdk.domains.numbers.models.v1.response.internal.AvailableNumbersListResponseInternal; import java.util.Collections; import org.junit.jupiter.api.Test; @@ -31,8 +31,8 @@ public class AvailableNumberDtoTest extends NumbersBaseTest { .setMonthlyPrice(Money.builder().setCurrencyCode("EUR").setAmount(0.80).build()) .build(); - public static AvailableNumberListResponseInternal availableNumberList = - AvailableNumberListResponseInternal.builder() + public static AvailableNumbersListResponseInternal availableNumberList = + AvailableNumbersListResponseInternal.builder() .setAvailableNumbers(Collections.singletonList(availableNumber)) .build(); @@ -48,8 +48,8 @@ void deserialize() throws JsonProcessingException { @Test void deserializeList() throws JsonProcessingException { - AvailableNumberListResponseInternal deserializedString = - objectMapper.readValue(availableListResponse, AvailableNumberListResponseInternal.class); + AvailableNumbersListResponseInternal deserializedString = + objectMapper.readValue(availableListResponse, AvailableNumbersListResponseInternal.class); TestHelpers.recursiveEquals(availableNumberList, deserializedString); } diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/numbers/models/v1/AvailableRegionsDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/numbers/models/v1/AvailableRegionsDtoTest.java index dc7431043..d1ce4168a 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/numbers/models/v1/AvailableRegionsDtoTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/numbers/models/v1/AvailableRegionsDtoTest.java @@ -5,8 +5,8 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.sinch.sdk.core.TestHelpers; import com.sinch.sdk.domains.numbers.api.v1.adapters.NumbersBaseTest; -import com.sinch.sdk.domains.numbers.models.v1.regions.available.response.AvailableRegion; -import com.sinch.sdk.domains.numbers.models.v1.regions.available.response.internal.AvailableRegionListResponseInternal; +import com.sinch.sdk.domains.numbers.models.v1.regions.response.AvailableRegion; +import com.sinch.sdk.domains.numbers.models.v1.regions.response.internal.AvailableRegionsListResponseInternal; import java.util.ArrayList; import java.util.Arrays; import org.junit.jupiter.api.Test; @@ -24,16 +24,16 @@ public class AvailableRegionsDtoTest extends NumbersBaseTest { .setTypes(Arrays.asList(NumberType.MOBILE)) .build(); - public static AvailableRegionListResponseInternal availableRegionList = - AvailableRegionListResponseInternal.builder() + public static AvailableRegionsListResponseInternal availableRegionList = + AvailableRegionsListResponseInternal.builder() .setAvailableRegions(new ArrayList<>(Arrays.asList(availableRegion))) .build(); @Test void deserializeList() throws JsonProcessingException { - AvailableRegionListResponseInternal deserializedString = - objectMapper.readValue(availableListResponse, AvailableRegionListResponseInternal.class); + AvailableRegionsListResponseInternal deserializedString = + objectMapper.readValue(availableListResponse, AvailableRegionsListResponseInternal.class); TestHelpers.recursiveEquals(availableRegionList, deserializedString); } diff --git a/sample-app/src/main/java/com/sinch/sample/numbers/List.java b/sample-app/src/main/java/com/sinch/sample/numbers/List.java index 2c4cf2f47..17aa71eb2 100644 --- a/sample-app/src/main/java/com/sinch/sample/numbers/List.java +++ b/sample-app/src/main/java/com/sinch/sample/numbers/List.java @@ -4,7 +4,7 @@ import com.sinch.sdk.domains.numbers.api.v1.NumbersService; import com.sinch.sdk.domains.numbers.models.v1.NumberType; import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumbersListQueryParameters; -import com.sinch.sdk.domains.numbers.models.v1.response.ActiveNumberListResponse; +import com.sinch.sdk.domains.numbers.models.v1.response.ActiveNumbersListResponse; import java.io.IOException; import java.util.logging.Logger; @@ -28,7 +28,7 @@ public void run() { LOGGER.info("List"); - ActiveNumberListResponse response = + ActiveNumbersListResponse response = service.list( ActiveNumbersListQueryParameters.builder() .setRegionCode("US") diff --git a/sample-app/src/main/java/com/sinch/sample/numbers/SearchForAvailableNumbers.java b/sample-app/src/main/java/com/sinch/sample/numbers/SearchForAvailableNumbers.java index 4fbb19331..596cfef20 100644 --- a/sample-app/src/main/java/com/sinch/sample/numbers/SearchForAvailableNumbers.java +++ b/sample-app/src/main/java/com/sinch/sample/numbers/SearchForAvailableNumbers.java @@ -5,7 +5,7 @@ import com.sinch.sdk.domains.numbers.models.v1.Capability; import com.sinch.sdk.domains.numbers.models.v1.NumberType; import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumbersListQueryParameters; -import com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumberListResponse; +import com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumbersListResponse; import java.io.IOException; import java.util.Collections; import java.util.logging.Logger; @@ -31,7 +31,7 @@ public void run() { LOGGER.info("SearchForAvailableNumbers"); int page = 1; - AvailableNumberListResponse response = + AvailableNumbersListResponse response = service.searchForAvailableNumbers( AvailableNumbersListQueryParameters.builder() .setRegionCode("US") diff --git a/sample-app/src/main/java/com/sinch/sample/numbers/regions/List.java b/sample-app/src/main/java/com/sinch/sample/numbers/regions/List.java index 07ed94e18..dd298baba 100644 --- a/sample-app/src/main/java/com/sinch/sample/numbers/regions/List.java +++ b/sample-app/src/main/java/com/sinch/sample/numbers/regions/List.java @@ -2,7 +2,7 @@ import com.sinch.sample.BaseApplication; import com.sinch.sdk.domains.numbers.api.v1.AvailableRegionsService; -import com.sinch.sdk.domains.numbers.models.v1.regions.available.response.AvailableRegionListResponse; +import com.sinch.sdk.domains.numbers.models.v1.regions.response.AvailableRegionsListResponse; import java.io.IOException; import java.util.logging.Logger; @@ -27,7 +27,7 @@ public void run() { LOGGER.info("List"); int page = 1; - AvailableRegionListResponse response = service.list(); + AvailableRegionsListResponse response = service.list(); LOGGER.info(String.format("Response (page %d): %s", page, response)); From 32f2ac91cc246d9ab8b572bc8e5fd5c84debfafc Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier Date: Fri, 7 Nov 2025 16:02:51 +0100 Subject: [PATCH 027/122] refactor (Java/PageNavigator): Use generic PageNavigator in place of dedicated class --- .../v1/adapters/ActiveNumberServiceTest.java | 6 ++-- .../pagination/HttpRequestPageNavigator.java | 31 ------------------- .../core/models/pagination/PageNavigator.java | 2 +- .../v1/adapters/ActiveNumberServiceImpl.java | 6 ++-- 4 files changed, 6 insertions(+), 39 deletions(-) delete mode 100644 core/src/main/com/sinch/sdk/core/models/pagination/HttpRequestPageNavigator.java diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/api/v1/adapters/ActiveNumberServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/api/v1/adapters/ActiveNumberServiceTest.java index ed4e2e2c8..65bfbce0e 100644 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/api/v1/adapters/ActiveNumberServiceTest.java +++ b/client/src/test/java/com/sinch/sdk/domains/numbers/api/v1/adapters/ActiveNumberServiceTest.java @@ -22,8 +22,8 @@ import com.sinch.sdk.core.http.URLPathUtils; import com.sinch.sdk.core.models.ServerConfiguration; import com.sinch.sdk.core.models.ServerConfigurationTest.ServerConfigurationMatcher; -import com.sinch.sdk.core.models.pagination.HttpRequestPageNavigator; import com.sinch.sdk.core.models.pagination.Page; +import com.sinch.sdk.core.models.pagination.PageNavigator; import com.sinch.sdk.domains.numbers.api.v1.NumbersService; import com.sinch.sdk.domains.numbers.models.v1.ActiveNumber; import com.sinch.sdk.domains.numbers.models.v1.ActiveNumberDtoTest; @@ -153,7 +153,7 @@ void listWithRequiredParameters() throws ApiException { .setPageToken("") .build(), ActiveNumberDtoTest.activeNumberListLight.getActiveNumbers(), - new HttpRequestPageNavigator(null))); + new PageNavigator<>(null))); ActiveNumbersListResponse response = service.list( @@ -218,7 +218,7 @@ void listWithOptionalParameters() throws ApiException { .setOrderBy(OrderBy.PHONE_NUMBER) .build(), ActiveNumberDtoTest.activeNumberList.getActiveNumbers(), - new HttpRequestPageNavigator( + new PageNavigator<>( new HttpRequest( "/v1/projects/" + URLPathUtils.encodePathSegment(URI_UUID) diff --git a/core/src/main/com/sinch/sdk/core/models/pagination/HttpRequestPageNavigator.java b/core/src/main/com/sinch/sdk/core/models/pagination/HttpRequestPageNavigator.java deleted file mode 100644 index 54f5f4b40..000000000 --- a/core/src/main/com/sinch/sdk/core/models/pagination/HttpRequestPageNavigator.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.sinch.sdk.core.models.pagination; - -import com.sinch.sdk.core.http.HttpRequest; - -public class HttpRequestPageNavigator extends PageNavigator { - - private final HttpRequest nextPageRequest; - - public HttpRequestPageNavigator(HttpRequest nextPageRequest) { - super(null); - this.nextPageRequest = nextPageRequest; - } - - private HttpRequest computeNextPageCursor() { - return nextPageRequest; - } - - @Override - public HttpRequest getToken() { - return computeNextPageCursor(); - } - - @Override - public String toString() { - return "HttpRequestPageNavigator{" - + "nextPageRequest=" - + nextPageRequest - + "} " - + super.toString(); - } -} diff --git a/core/src/main/com/sinch/sdk/core/models/pagination/PageNavigator.java b/core/src/main/com/sinch/sdk/core/models/pagination/PageNavigator.java index 933dfd38c..b454b3a4f 100644 --- a/core/src/main/com/sinch/sdk/core/models/pagination/PageNavigator.java +++ b/core/src/main/com/sinch/sdk/core/models/pagination/PageNavigator.java @@ -8,7 +8,7 @@ public class PageNavigator { private final T token; - protected PageNavigator(T token) { + public PageNavigator(T token) { this.token = token; } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/ActiveNumberServiceImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/ActiveNumberServiceImpl.java index a5f3f3a2e..32cb5123b 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/ActiveNumberServiceImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/ActiveNumberServiceImpl.java @@ -24,8 +24,8 @@ import com.sinch.sdk.core.http.URLParameterUtils; import com.sinch.sdk.core.http.URLPathUtils; import com.sinch.sdk.core.models.ServerConfiguration; -import com.sinch.sdk.core.models.pagination.HttpRequestPageNavigator; import com.sinch.sdk.core.models.pagination.Page; +import com.sinch.sdk.core.models.pagination.PageNavigator; import com.sinch.sdk.core.utils.StringUtil; import com.sinch.sdk.domains.numbers.models.v1.ActiveNumber; import com.sinch.sdk.domains.numbers.models.v1.EmergencyAddress; @@ -108,9 +108,7 @@ public ActiveNumbersListResponse _getActiveNumbersPageAsListResponse( return new ActiveNumbersListResponse( this, new Page<>( - nextParameters, - deserialized.getActiveNumbers(), - new HttpRequestPageNavigator(nextPage))); + nextParameters, deserialized.getActiveNumbers(), new PageNavigator<>(nextPage))); } // fallback to default errors handling: // all error cases definition are not required from specs: will try some "hardcoded" content From 643a3b06255551acb2913dbb029f901d11d26c96 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier Date: Fri, 7 Nov 2025 18:06:52 +0100 Subject: [PATCH 028/122] feat (Page): Remove unnecessary query parameters for pagination --- .../v1/adapters/ActiveNumberServiceTest.java | 17 ++--------------- .../v1/adapters/ActiveNumberServiceImpl.java | 4 +--- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/api/v1/adapters/ActiveNumberServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/api/v1/adapters/ActiveNumberServiceTest.java index 65bfbce0e..531c813ab 100644 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/api/v1/adapters/ActiveNumberServiceTest.java +++ b/client/src/test/java/com/sinch/sdk/domains/numbers/api/v1/adapters/ActiveNumberServiceTest.java @@ -147,11 +147,7 @@ void listWithRequiredParameters() throws ApiException { new ActiveNumbersListResponse( lowService, new Page<>( - ActiveNumbersListQueryParameters.builder() - .setRegionCode("region") - .setType(NumberType.MOBILE) - .setPageToken("") - .build(), + null, ActiveNumberDtoTest.activeNumberListLight.getActiveNumbers(), new PageNavigator<>(null))); @@ -207,16 +203,7 @@ void listWithOptionalParameters() throws ApiException { new ActiveNumbersListResponse( lowService, new Page<>( - ActiveNumbersListQueryParameters.builder() - .setRegionCode("another region") - .setType(NumberType.TOLL_FREE) - .setSearchPattern("pattern value") - .setSearchPosition(SearchPosition.END) - .setCapabilities(Arrays.asList(Capability.VOICE)) - .setPageSize(5) - .setPageToken("foo") - .setOrderBy(OrderBy.PHONE_NUMBER) - .build(), + null, ActiveNumberDtoTest.activeNumberList.getActiveNumbers(), new PageNavigator<>( new HttpRequest( diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/ActiveNumberServiceImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/ActiveNumberServiceImpl.java index 32cb5123b..6a522b1fe 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/ActiveNumberServiceImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/ActiveNumberServiceImpl.java @@ -106,9 +106,7 @@ public ActiveNumbersListResponse _getActiveNumbersPageAsListResponse( } return new ActiveNumbersListResponse( - this, - new Page<>( - nextParameters, deserialized.getActiveNumbers(), new PageNavigator<>(nextPage))); + this, new Page<>(null, deserialized.getActiveNumbers(), new PageNavigator<>(nextPage))); } // fallback to default errors handling: // all error cases definition are not required from specs: will try some "hardcoded" content From e56fc4398335342970ce781452a237dc0eb0aa4f Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier Date: Sat, 8 Nov 2025 08:42:37 +0100 Subject: [PATCH 029/122] PR comment --- .../sdk/domains/numbers/api/v1/adapters/NumbersService.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/client/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/NumbersService.java b/client/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/NumbersService.java index d81c5b663..d060f4627 100644 --- a/client/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/NumbersService.java +++ b/client/src/main/com/sinch/sdk/domains/numbers/api/v1/adapters/NumbersService.java @@ -87,8 +87,7 @@ public AvailableRegionsService regions() { return this.regions; } - // should be protected when V0 design will be removed onto 2.0 version - public ActiveNumberServiceFacade active() { + ActiveNumberServiceFacade active() { if (null == this.active) { instanceLazyInit(); this.active = From 55cfc12356a534f48021768a53f9bc98ff60f69b Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier Date: Wed, 12 Nov 2025 18:11:48 +0100 Subject: [PATCH 030/122] feat (Verification): Remove 'template' support for 'StartSMS' --- MIGRATION-GUIDE.md | 1 + .../VerificationStartServiceTest.java | 1 - .../request/VerificationStartRequestSms.java | 17 ---------- .../VerificationStartRequestSmsImpl.java | 22 ------------- .../internal/VerificationStartSmsOptions.java | 17 ---------- .../VerificationStartSmsOptionsImpl.java | 33 ++----------------- .../request/VerificationStartRequestTest.java | 2 -- .../VerificationStartSmsOptionsTest.java | 3 -- .../VerificationStartRequestSmsDto.json | 1 - .../VerificationStartSmsOptionsDto.json | 5 ++- ...SmsOptionsWithAdditionalPropertiesDto.json | 1 - 11 files changed, 6 insertions(+), 97 deletions(-) diff --git a/MIGRATION-GUIDE.md b/MIGRATION-GUIDE.md index 0a0f10308..ddb5ba246 100644 --- a/MIGRATION-GUIDE.md +++ b/MIGRATION-GUIDE.md @@ -374,6 +374,7 @@ Use the new versioned API under `voice().v1()` to get access to [VoiceService](h - `event` field removed from `VerificationRequestEvent`, `VerificationResultEvent` events. - `method` values based onto common `VerificationMethod` class. - `VerificationMethod.DATA` enum no longer defined. No need to be replaced because not public definition is required. +- `template` field removed from `VerificationStartRequestSms`. #### Replacement APIs diff --git a/client/src/test/java/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationStartServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationStartServiceTest.java index 68ce9bb04..d3f71ce1b 100644 --- a/client/src/test/java/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationStartServiceTest.java +++ b/client/src/test/java/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationStartServiceTest.java @@ -98,7 +98,6 @@ void startSmsWithAcceptLanguage() throws ApiException { .setCustom(startVerificationSmsRequestDtoImpl.getCustom()) .setExpiry(startVerificationSmsRequestDtoImpl.getExpiry()) .setCodeType(startVerificationSmsRequestDtoImpl.getCodeType()) - .setTemplate(startVerificationSmsRequestDtoImpl.getTemplate()) .setAcceptLanguage("es-ES") .putExtraOption("my key", startVerificationSmsRequestDtoImpl.getExtraOption("my key")) .build(); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestSms.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestSms.java index dd2bf9b1b..1e44fb208 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestSms.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestSms.java @@ -63,14 +63,6 @@ public interface VerificationStartRequestSms */ String getExpiry(); - /** - * The SMS template must include a placeholder {{CODE}} where the verification code - * will be inserted, and it can otherwise be customized as desired. - * - * @return template - */ - String getTemplate(); - /** * In SMS Verification, value of Accept-Language @@ -147,15 +139,6 @@ interface Builder */ Builder setExpiry(String expiry); - /** - * see getter - * - * @param template see getter - * @return Current builder - * @see #getTemplate - */ - Builder setTemplate(String template); - /** * see getter * diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestSmsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestSmsImpl.java index 94fb34eb0..0ac5b20b9 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestSmsImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/VerificationStartRequestSmsImpl.java @@ -158,22 +158,6 @@ public OptionalValue expiry() { : OptionalValue.empty(); } - @JsonIgnore - public String getTemplate() { - if (null == smsOptions || !smsOptions.isPresent() || null == smsOptions.get().getTemplate()) { - return null; - } - return smsOptions.get().getTemplate(); - } - - public OptionalValue template() { - return null != smsOptions && smsOptions.isPresent() - ? smsOptions - .map(f -> ((VerificationStartSmsOptionsImpl) f).template()) - .orElse(OptionalValue.empty()) - : OptionalValue.empty(); - } - @JsonIgnore public String getAcceptLanguage() { if (null == smsOptions @@ -298,12 +282,6 @@ public Builder setExpiry(String expiry) { return this; } - @JsonIgnore - public Builder setTemplate(String template) { - getDelegatedBuilder().setTemplate(template); - return this; - } - @JsonIgnore public Builder setAcceptLanguage(String acceptLanguage) { getDelegatedBuilder().setAcceptLanguage(acceptLanguage); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartSmsOptions.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartSmsOptions.java index 67ea17a8e..5aafdbd9f 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartSmsOptions.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartSmsOptions.java @@ -37,14 +37,6 @@ public interface VerificationStartSmsOptions extends AdditionalProperties { */ String getExpiry(); - /** - * The SMS template must include a placeholder {{CODE}} where the verification code - * will be inserted, and it can otherwise be customized as desired. - * - * @return template - */ - String getTemplate(); - /** * In SMS Verification, value of Accept-Language @@ -84,15 +76,6 @@ interface Builder extends AdditionalProperties.Builder { */ Builder setExpiry(String expiry); - /** - * see getter - * - * @param template see getter - * @return Current builder - * @see #getTemplate - */ - Builder setTemplate(String template); - /** * see getter * diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartSmsOptionsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartSmsOptionsImpl.java index 3a5134313..bc7bb84d0 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartSmsOptionsImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/verification/models/v1/start/request/internal/VerificationStartSmsOptionsImpl.java @@ -16,8 +16,7 @@ @JsonPropertyOrder({ VerificationStartSmsOptionsImpl.JSON_PROPERTY_CODE_TYPE, - VerificationStartSmsOptionsImpl.JSON_PROPERTY_EXPIRY, - VerificationStartSmsOptionsImpl.JSON_PROPERTY_TEMPLATE + VerificationStartSmsOptionsImpl.JSON_PROPERTY_EXPIRY }) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) @@ -32,10 +31,6 @@ public class VerificationStartSmsOptionsImpl implements VerificationStartSmsOpti private OptionalValue expiry; - public static final String JSON_PROPERTY_TEMPLATE = "template"; - - private OptionalValue template; - private OptionalValue acceptLanguage; /** @@ -49,12 +44,10 @@ public VerificationStartSmsOptionsImpl() {} protected VerificationStartSmsOptionsImpl( OptionalValue codeType, OptionalValue expiry, - OptionalValue template, OptionalValue acceptLanguage, OptionalValue> additionalProperties) { this.codeType = codeType; this.expiry = expiry; - this.template = template; this.acceptLanguage = acceptLanguage; this.additionalProperties = additionalProperties; } @@ -81,17 +74,6 @@ public OptionalValue expiry() { return expiry; } - @JsonIgnore - public String getTemplate() { - return template.orElse(null); - } - - @JsonProperty(JSON_PROPERTY_TEMPLATE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OptionalValue template() { - return template; - } - @JsonIgnore public String getAcceptLanguage() { return acceptLanguage.orElse(null); @@ -131,7 +113,6 @@ public boolean equals(Object o) { (VerificationStartSmsOptionsImpl) o; return Objects.equals(this.codeType, verificationStartRequestSmsAllOfSmsOptions.codeType) && Objects.equals(this.expiry, verificationStartRequestSmsAllOfSmsOptions.expiry) - && Objects.equals(this.template, verificationStartRequestSmsAllOfSmsOptions.template) && Objects.equals( this.acceptLanguage, verificationStartRequestSmsAllOfSmsOptions.acceptLanguage) && Objects.equals( @@ -141,7 +122,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(codeType, expiry, template, acceptLanguage, additionalProperties); + return Objects.hash(codeType, expiry, acceptLanguage, additionalProperties); } @Override @@ -150,7 +131,6 @@ public String toString() { sb.append("class VerificationStartSmsOptionsImpl {\n"); sb.append(" codeType: ").append(toIndentedString(codeType)).append("\n"); sb.append(" expiry: ").append(toIndentedString(expiry)).append("\n"); - sb.append(" template: ").append(toIndentedString(template)).append("\n"); sb.append(" acceptLanguage: ").append(toIndentedString(acceptLanguage)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) @@ -173,7 +153,6 @@ private String toIndentedString(Object o) { static class Builder implements VerificationStartSmsOptions.Builder { OptionalValue codeType = OptionalValue.empty(); OptionalValue expiry = OptionalValue.empty(); - OptionalValue template = OptionalValue.empty(); OptionalValue acceptLanguage = OptionalValue.empty(); OptionalValue> additionalProperties = OptionalValue.empty(); @@ -189,12 +168,6 @@ public Builder setExpiry(String expiry) { return this; } - @JsonProperty(JSON_PROPERTY_TEMPLATE) - public Builder setTemplate(String template) { - this.template = OptionalValue.of(template); - return this; - } - @JsonIgnore public Builder setAcceptLanguage(String acceptLanguage) { this.acceptLanguage = OptionalValue.of(acceptLanguage); @@ -212,7 +185,7 @@ public Builder put(String key, Object value) { public VerificationStartSmsOptions build() { return new VerificationStartSmsOptionsImpl( - codeType, expiry, template, acceptLanguage, additionalProperties); + codeType, expiry, acceptLanguage, additionalProperties); } } } diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/start/request/VerificationStartRequestTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/start/request/VerificationStartRequestTest.java index 0342cb818..bad5a79d0 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/start/request/VerificationStartRequestTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/start/request/VerificationStartRequestTest.java @@ -65,7 +65,6 @@ public class VerificationStartRequestTest extends VerificationBaseTest { .setIdentity(NumberIdentity.valueOf("+endpoint")) .setExpiry("01:02:03") .setCodeType(SmsCodeType.ALPHANUMERIC) - .setTemplate("My template require to use '{{CODE}}' code") .putExtraOption("my key", "my value") .build()); @@ -78,7 +77,6 @@ public class VerificationStartRequestTest extends VerificationBaseTest { .setIdentity(NumberIdentity.valueOf("+endpoint")) .setExpiry("01:02:03") .setCodeType(SmsCodeType.ALPHANUMERIC) - .setTemplate("My template require to use '{{CODE}}' code") .setAcceptLanguage("es-ES") .putExtraOption("my key", "my value") .build()); diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/start/request/internal/VerificationStartSmsOptionsTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/start/request/internal/VerificationStartSmsOptionsTest.java index 808861aae..9a33d1d69 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/start/request/internal/VerificationStartSmsOptionsTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/verification/models/dto/v1/start/request/internal/VerificationStartSmsOptionsTest.java @@ -18,14 +18,12 @@ public class VerificationStartSmsOptionsTest extends VerificationBaseTest { VerificationStartSmsOptions.builder() .setExpiry("01:02:03") .setCodeType(SmsCodeType.ALPHANUMERIC) - .setTemplate("My template requires to use '{{CODE}}' placeholder") .build(); public static VerificationStartSmsOptions startVerificationSmsOptionWithAdditionalPropertiesDto = VerificationStartSmsOptions.builder() .setExpiry("01:02:03") .setCodeType(SmsCodeType.ALPHANUMERIC) - .setTemplate("My template requires to use '{{CODE}}' placeholder") .put("a key", "a value") .put("secondKey", "second value") .build(); @@ -34,7 +32,6 @@ public class VerificationStartSmsOptionsTest extends VerificationBaseTest { VerificationStartSmsOptions.builder() .setExpiry("01:02:03") .setCodeType(SmsCodeType.ALPHANUMERIC) - .setTemplate("My template requires to use '{{CODE}}' placeholder") .setAcceptLanguage("es-ES") .build(); diff --git a/openapi-contracts/src/test/resources/domains/verification/v1/start/request/VerificationStartRequestSmsDto.json b/openapi-contracts/src/test/resources/domains/verification/v1/start/request/VerificationStartRequestSmsDto.json index b29236752..6ea53fecc 100644 --- a/openapi-contracts/src/test/resources/domains/verification/v1/start/request/VerificationStartRequestSmsDto.json +++ b/openapi-contracts/src/test/resources/domains/verification/v1/start/request/VerificationStartRequestSmsDto.json @@ -9,7 +9,6 @@ "smsOptions": { "expiry": "01:02:03", "codeType": "Alphanumeric", - "template": "My template require to use '{{CODE}}' code", "my key": "my value" } } diff --git a/openapi-contracts/src/test/resources/domains/verification/v1/start/request/internal/VerificationStartSmsOptionsDto.json b/openapi-contracts/src/test/resources/domains/verification/v1/start/request/internal/VerificationStartSmsOptionsDto.json index d40b8f846..8b556aabb 100644 --- a/openapi-contracts/src/test/resources/domains/verification/v1/start/request/internal/VerificationStartSmsOptionsDto.json +++ b/openapi-contracts/src/test/resources/domains/verification/v1/start/request/internal/VerificationStartSmsOptionsDto.json @@ -1,5 +1,4 @@ { "expiry": "01:02:03", - "codeType": "Alphanumeric", - "template": "My template requires to use '{{CODE}}' placeholder" -} \ No newline at end of file + "codeType": "Alphanumeric" +} diff --git a/openapi-contracts/src/test/resources/domains/verification/v1/start/request/internal/VerificationStartSmsOptionsWithAdditionalPropertiesDto.json b/openapi-contracts/src/test/resources/domains/verification/v1/start/request/internal/VerificationStartSmsOptionsWithAdditionalPropertiesDto.json index aeff7f2fa..c72c8514b 100644 --- a/openapi-contracts/src/test/resources/domains/verification/v1/start/request/internal/VerificationStartSmsOptionsWithAdditionalPropertiesDto.json +++ b/openapi-contracts/src/test/resources/domains/verification/v1/start/request/internal/VerificationStartSmsOptionsWithAdditionalPropertiesDto.json @@ -1,7 +1,6 @@ { "expiry": "01:02:03", "codeType": "Alphanumeric", - "template": "My template requires to use '{{CODE}}' placeholder", "a key": "a value", "secondKey": "second value" } From 82ce8f1ca67d36ff03e67deb986a1c539515b853 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier <141755467+JPPortier@users.noreply.github.com> Date: Tue, 18 Nov 2025 08:11:45 +0100 Subject: [PATCH 031/122] W43 catch up mailgun (#283) * feat (Mailgun): 'resend' endpoint * refactor (Mailgun): Function renaming --- .../ArrayToCommaSeparatedFormSerializer.java | 15 ++ .../v1/emails/request/SendEmailRequest.java | 2 +- ...rayToCommaSeparatedFormSerializerTest.java | 45 +++++ .../api/v1/adapters/EmailsServiceTest.java | 35 +++- .../e2e/domains/mailgun/v1/EmailsSteps.java | 27 ++- .../domains/mailgun/api/v1/EmailsService.java | 24 ++- .../mailgun/api/v1/TemplatesService.java | 48 ++--- .../api/v1/adapters/EmailsServiceImpl.java | 104 ++++++++-- .../api/v1/adapters/TemplatesServiceImpl.java | 190 +++++++++--------- .../v1/emails/request/ResendRequest.java | 57 ++++++ .../v1/emails/request/ResendRequestImpl.java | 92 +++++++++ .../response/ListTemplatesResponse.java | 3 +- .../response/ListVersionsResponse.java | 3 +- .../v1/emails/request/ResendRequestTest.java | 38 ++++ .../sinch/sample/mailgun/messages/ReSend.java | 40 ++++ .../sample/mailgun/messages/SendEmail.java | 4 +- .../mailgun/messages/SendMimeEmail.java | 2 +- 17 files changed, 583 insertions(+), 146 deletions(-) create mode 100644 client/src/main/com/sinch/sdk/domains/mailgun/api/v1/adapters/ArrayToCommaSeparatedFormSerializer.java create mode 100644 client/src/test/java/com/sinch/sdk/domains/mailgun/api/v1/adapters/ArrayToCommaSeparatedFormSerializerTest.java create mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/ResendRequest.java create mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/ResendRequestImpl.java create mode 100644 openapi-contracts/src/test/java/com/sinch/sdk/domains/mailgun/models/v1/emails/request/ResendRequestTest.java create mode 100644 sample-app/src/main/java/com/sinch/sample/mailgun/messages/ReSend.java diff --git a/client/src/main/com/sinch/sdk/domains/mailgun/api/v1/adapters/ArrayToCommaSeparatedFormSerializer.java b/client/src/main/com/sinch/sdk/domains/mailgun/api/v1/adapters/ArrayToCommaSeparatedFormSerializer.java new file mode 100644 index 000000000..c8c8efb6e --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/mailgun/api/v1/adapters/ArrayToCommaSeparatedFormSerializer.java @@ -0,0 +1,15 @@ +package com.sinch.sdk.domains.mailgun.api.v1.adapters; + +import com.sinch.sdk.core.databind.FormSerializer; +import java.util.List; +import java.util.Map; + +public class ArrayToCommaSeparatedFormSerializer extends FormSerializer> { + + @Override + public void serialize(List in, String fieldName, Map out) { + if (null != in) { + out.put(fieldName, String.join(",", in)); + } + } +} diff --git a/client/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailRequest.java b/client/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailRequest.java index 705a4e69f..1f1eac037 100644 --- a/client/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailRequest.java +++ b/client/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/SendEmailRequest.java @@ -3,7 +3,7 @@ /** * Base class for all classes supported by SendEmail * - * @see com.sinch.sdk.domains.mailgun.api.v1.EmailsService#sendEmail(String, SendEmailRequest) + * @see com.sinch.sdk.domains.mailgun.api.v1.EmailsService#send(String, SendEmailRequest) * @since 1.6 */ public interface SendEmailRequest {} diff --git a/client/src/test/java/com/sinch/sdk/domains/mailgun/api/v1/adapters/ArrayToCommaSeparatedFormSerializerTest.java b/client/src/test/java/com/sinch/sdk/domains/mailgun/api/v1/adapters/ArrayToCommaSeparatedFormSerializerTest.java new file mode 100644 index 000000000..87ea2f275 --- /dev/null +++ b/client/src/test/java/com/sinch/sdk/domains/mailgun/api/v1/adapters/ArrayToCommaSeparatedFormSerializerTest.java @@ -0,0 +1,45 @@ +package com.sinch.sdk.domains.mailgun.api.v1.adapters; + +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +class ArrayToCommaSeparatedFormSerializerTest { + + ArrayToCommaSeparatedFormSerializer serializer = new ArrayToCommaSeparatedFormSerializer(); + + @Test + void serializeNonEmptyList() { + Map map = new HashMap<>(); + serializer.serialize(Arrays.asList("value1", "value2", "value3, value 4"), "key", map); + + Assertions.assertEquals("value1,value2,value3, value 4", map.get("key")); + } + + @Test + void serializeEmptyCommas() { + Map map = new HashMap<>(); + serializer.serialize(Arrays.asList("value1", ", ,, "), "key", map); + + Assertions.assertEquals("value1,, ,, ", map.get("key")); + } + + @Test + void serializeEmptyList() { + Map map = new HashMap<>(); + serializer.serialize(Collections.emptyList(), "key", map); + + Assertions.assertEquals("", map.get("key")); + } + + @Test + void serializeNullList() { + Map map = new HashMap<>(); + serializer.serialize(null, "key", map); + + Assertions.assertNull(map.get("key")); + } +} diff --git a/client/src/test/java/com/sinch/sdk/domains/mailgun/api/v1/adapters/EmailsServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/mailgun/api/v1/adapters/EmailsServiceTest.java index 46cd8513e..2bf262277 100644 --- a/client/src/test/java/com/sinch/sdk/domains/mailgun/api/v1/adapters/EmailsServiceTest.java +++ b/client/src/test/java/com/sinch/sdk/domains/mailgun/api/v1/adapters/EmailsServiceTest.java @@ -20,6 +20,7 @@ import com.sinch.sdk.core.models.ServerConfiguration; import com.sinch.sdk.core.models.ServerConfigurationTest.ServerConfigurationMatcher; import com.sinch.sdk.domains.mailgun.api.v1.EmailsService; +import com.sinch.sdk.domains.mailgun.models.v1.emails.request.ResendRequestTest; import com.sinch.sdk.domains.mailgun.models.v1.emails.request.SendEmailRequestTest; import com.sinch.sdk.domains.mailgun.models.v1.emails.request.SendMimeEmailRequestTest; import com.sinch.sdk.domains.mailgun.models.v1.emails.response.GetStoredEmailResponse; @@ -87,7 +88,7 @@ void send() { .thenReturn(httpResponse); SendEmailResponse response = - service.sendEmail(domainName, SendEmailRequestTest.sendEmailHtmlInlineRequest); + service.send(domainName, SendEmailRequestTest.sendEmailHtmlInlineRequest); TestHelpers.recursiveEquals(response, SendEmailResponseTest.expectedSendEmailResponse); } @@ -114,7 +115,37 @@ void sendMime() { .thenReturn(httpResponse); SendEmailResponse response = - service.sendMimeEmail(domainName, SendMimeEmailRequestTest.sendMimEmailRequest); + service.sendInMimeFormat(domainName, SendMimeEmailRequestTest.sendMimEmailRequest); + + TestHelpers.recursiveEquals(response, SendEmailResponseTest.expectedSendEmailResponse); + } + + @Test + void resend() { + + HttpRequest httpRequest = + new HttpRequest( + "/v3/domains/" + + URLPathUtils.encodePathSegment(domainName) + + "/messages/foo%20StorageKey", + HttpMethod.POST, + Collections.emptyList(), + ResendRequestTest.expectedResendRequest, + Collections.emptyMap(), + Collections.singletonList(HttpContentType.APPLICATION_JSON), + Collections.singletonList(HttpContentType.MULTIPART_FORM_DATA), + Collections.singletonList(AUTH_NAME)); + HttpResponse httpResponse = + new HttpResponse(200, null, Collections.emptyMap(), jsonSendEmailResponseDto.getBytes()); + + when(httpClient.invokeAPI( + eq(serverConfiguration), + eq(authManagers), + argThat(new HttpRequestMatcher(httpRequest)))) + .thenReturn(httpResponse); + + SendEmailResponse response = + service.resend(domainName, storageKey, ResendRequestTest.resentRequest); TestHelpers.recursiveEquals(response, SendEmailResponseTest.expectedSendEmailResponse); } diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/mailgun/v1/EmailsSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/mailgun/v1/EmailsSteps.java index 028ad8fe7..13b3b21dc 100644 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/mailgun/v1/EmailsSteps.java +++ b/client/src/test/java/com/sinch/sdk/e2e/domains/mailgun/v1/EmailsSteps.java @@ -2,6 +2,7 @@ import com.sinch.sdk.core.TestHelpers; import com.sinch.sdk.domains.mailgun.api.v1.EmailsService; +import com.sinch.sdk.domains.mailgun.models.v1.emails.request.ResendRequest; import com.sinch.sdk.domains.mailgun.models.v1.emails.request.SendEmailHtmlInlineRequest; import com.sinch.sdk.domains.mailgun.models.v1.emails.request.SendEmailRequest; import com.sinch.sdk.domains.mailgun.models.v1.emails.request.SendMimeEmailRequest; @@ -27,6 +28,7 @@ public class EmailsSteps { EmailsService service; SendEmailResponse sendEmailResponse; + SendEmailResponse resendResponse; SendEmailResponse sendMimeEmailResponse; GetStoredEmailResponse getStoredEmailResponse; SendingQueuesStatusResponse sendingQueuesStatusResponse; @@ -51,7 +53,7 @@ public void send() { .setSubject("E2E test text email") .build(); - sendEmailResponse = service.sendEmail(domainName, request); + sendEmailResponse = service.send(domainName, request); } @When("^I send a request to send a MIME email$") @@ -71,7 +73,16 @@ public void sendMime() { .setMessage(tempFile) .build(); - sendMimeEmailResponse = service.sendMimeEmail(domainName, request); + sendMimeEmailResponse = service.sendInMimeFormat(domainName, request); + } + + @When("^I send a request to resend a text email$") + public void resend() { + + ResendRequest request = + ResendRequest.builder().setTo(Collections.singletonList("destination@e2e.tst")).build(); + + resendResponse = service.resend(domainName, storageKey, request); } @When("^I send a request to retrieve a stored email$") @@ -117,6 +128,18 @@ public void sendMimeResult() { TestHelpers.recursiveEquals(expected, sendMimeEmailResponse); } + @Then("the \"resend\" response contains information about the text email") + public void resendResult() { + + SendEmailResponse expected = + SendEmailResponse.builder() + .setId("<20240606154318.027ac0b5fc80da62@sandbox123.mailgun.org>") + .setMessage("Queued. Thank you.") + .build(); + + TestHelpers.recursiveEquals(expected, resendResponse); + } + @Then("the getEmail response contains the email details") public void getStoredEmailResult() { diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/api/v1/EmailsService.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/api/v1/EmailsService.java index 84a524b11..9b550c0f4 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/api/v1/EmailsService.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/api/v1/EmailsService.java @@ -11,6 +11,7 @@ package com.sinch.sdk.domains.mailgun.api.v1; import com.sinch.sdk.core.exceptions.ApiException; +import com.sinch.sdk.domains.mailgun.models.v1.emails.request.ResendRequest; import com.sinch.sdk.domains.mailgun.models.v1.emails.request.SendEmailRequest; import com.sinch.sdk.domains.mailgun.models.v1.emails.request.SendMimeEmailRequest; import com.sinch.sdk.domains.mailgun.models.v1.emails.response.GetStoredEmailResponse; @@ -38,12 +39,28 @@ public interface EmailsService { * to use to retrieve the email. * * @param domainName Domain name that was used to send the email (required) - * @param storageKey Storage key from the emails associated events (required) + * @param storageKey Storage key from the email's associated events (Example: + * Accepted/Delivered events `storage.key` field). Note: Storage keys are available + * for the duration of your domain's message retention policy. (required) * @return GetStoredEmailResponse * @throws ApiException if fails to make API call */ GetStoredEmailResponse getStoredEmail(String domainName, String storageKey) throws ApiException; + /** + * Resend an email + * + * @param domainName Domain name used to send the message (required) + * @param storageKey Storage key from the email's associated events (Example: + * Accepted/Delivered events `storage.key` field). Note: Storage keys are available + * for the duration of your domain's message retention policy. (required) + * @param requestParameters Request parameters + * @return SendEmailResponse + * @throws ApiException if fails to make API call + */ + SendEmailResponse resend(String domainName, String storageKey, ResendRequest requestParameters) + throws ApiException; + /** * Send an email * @@ -58,8 +75,7 @@ public interface EmailsService { * @return SendEmailResponse * @throws ApiException if fails to make API call */ - SendEmailResponse sendEmail(String domainName, SendEmailRequest requestParameters) - throws ApiException; + SendEmailResponse send(String domainName, SendEmailRequest requestParameters) throws ApiException; /** * Send an email in MIME format @@ -72,7 +88,7 @@ SendEmailResponse sendEmail(String domainName, SendEmailRequest requestParameter * @return SendEmailResponse * @throws ApiException if fails to make API call */ - SendEmailResponse sendMimeEmail(String domainName, SendMimeEmailRequest requestParameters) + SendEmailResponse sendInMimeFormat(String domainName, SendMimeEmailRequest requestParameters) throws ApiException; /** diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/api/v1/TemplatesService.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/api/v1/TemplatesService.java index 74167b1dc..37e7b3b46 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/api/v1/TemplatesService.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/api/v1/TemplatesService.java @@ -27,6 +27,30 @@ /** Templates Service */ public interface TemplatesService { + /** + * Get templates (using default parameters) + * + *

Returns a list of templates for the domain. + * + * @param domainName Domain name to fetch the templates for. (required) + * @return ListTemplatesResponse + * @throws ApiException if fails to make API call + */ + ListTemplatesResponse list(String domainName) throws ApiException; + + /** + * Get templates + * + *

Returns a list of templates for the domain. + * + * @param domainName Domain name to fetch the templates for. (required) + * @param queryParameter (optional) + * @return ListTemplatesResponse + * @throws ApiException if fails to make API call + */ + ListTemplatesResponse list(String domainName, ListTemplatesQueryParameters queryParameter) + throws ApiException; + /** * Copy a version (using default parameters) * @@ -187,30 +211,6 @@ void deleteVersion(String domainName, String templateName, String versionName) VersionDetails getVersion(String domainName, String templateName, String versionName) throws ApiException; - /** - * Get templates (using default parameters) - * - *

Returns a list of templates for the domain. - * - * @param domainName Domain name to fetch the templates for. (required) - * @return ListTemplatesResponse - * @throws ApiException if fails to make API call - */ - ListTemplatesResponse list(String domainName) throws ApiException; - - /** - * Get templates - * - *

Returns a list of templates for the domain. - * - * @param domainName Domain name to fetch the templates for. (required) - * @param queryParameter (optional) - * @return ListTemplatesResponse - * @throws ApiException if fails to make API call - */ - ListTemplatesResponse list(String domainName, ListTemplatesQueryParameters queryParameter) - throws ApiException; - /** * Get all template versions (using default parameters) * diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/api/v1/adapters/EmailsServiceImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/api/v1/adapters/EmailsServiceImpl.java index 543c4e150..897111b59 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/api/v1/adapters/EmailsServiceImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/api/v1/adapters/EmailsServiceImpl.java @@ -23,6 +23,7 @@ import com.sinch.sdk.core.http.URLParameter; import com.sinch.sdk.core.http.URLPathUtils; import com.sinch.sdk.core.models.ServerConfiguration; +import com.sinch.sdk.domains.mailgun.models.v1.emails.request.ResendRequest; import com.sinch.sdk.domains.mailgun.models.v1.emails.request.SendEmailRequest; import com.sinch.sdk.domains.mailgun.models.v1.emails.request.SendMimeEmailRequest; import com.sinch.sdk.domains.mailgun.models.v1.emails.response.GetStoredEmailResponse; @@ -186,12 +187,20 @@ private HttpRequest getStoredEmailRequestBuilder(String domainName, String stora } @Override - public SendEmailResponse sendEmail(String domainName, SendEmailRequest requestParameters) - throws ApiException { + public SendEmailResponse resend( + String domainName, String storageKey, ResendRequest requestParameters) throws ApiException { LOGGER.finest( - "[sendEmail] " + "domainName: " + domainName + ", " + " request:" + requestParameters); - HttpRequest httpRequest = sendEmailRequestBuilder(domainName, requestParameters); + "[resend] " + + "domainName: " + + domainName + + ", " + + "storageKey: " + + storageKey + + ", " + + " request:" + + requestParameters); + HttpRequest httpRequest = resendRequestBuilder(domainName, storageKey, requestParameters); HttpResponse response = httpClient.invokeAPI( this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); @@ -208,12 +217,76 @@ public SendEmailResponse sendEmail(String domainName, SendEmailRequest requestPa mapper.deserialize(response, new TypeReference>() {})); } - private HttpRequest sendEmailRequestBuilder(String domainName, SendEmailRequest requestParameters) - throws ApiException { + private HttpRequest resendRequestBuilder( + String domainName, String storageKey, ResendRequest requestParameters) throws ApiException { // verify the required parameter 'domainName' is set if (domainName == null) { throw new ApiException( - 400, "Missing the required parameter 'domainName' when calling sendEmail"); + 400, "Missing the required parameter 'domainName' when calling resend"); + } + // verify the required parameter 'storageKey' is set + if (storageKey == null) { + throw new ApiException( + 400, "Missing the required parameter 'storageKey' when calling resend"); + } + + String localVarPath = + "/v3/domains/{domain_name}/messages/{storage_key}" + .replaceAll( + "\\{" + "domain_name" + "\\}", + URLPathUtils.encodePathSegment(domainName.toString())) + .replaceAll( + "\\{" + "storage_key" + "\\}", + URLPathUtils.encodePathSegment(storageKey.toString())); + + List localVarQueryParams = new ArrayList<>(); + + Map localVarHeaderParams = new HashMap<>(); + + final Collection localVarAccepts = Arrays.asList("application/json"); + final Collection localVarContentTypes = Arrays.asList("multipart/form-data"); + final Collection localVarAuthNames = Arrays.asList("basicAuth"); + final Map localFormParams = + mapper.serializeFormParameters(localVarContentTypes, requestParameters); + + return new HttpRequest( + localVarPath, + HttpMethod.POST, + localVarQueryParams, + localFormParams, + localVarHeaderParams, + localVarAccepts, + localVarContentTypes, + localVarAuthNames); + } + + @Override + public SendEmailResponse send(String domainName, SendEmailRequest requestParameters) + throws ApiException { + + LOGGER.finest("[send] " + "domainName: " + domainName + ", " + " request:" + requestParameters); + HttpRequest httpRequest = sendRequestBuilder(domainName, requestParameters); + HttpResponse response = + httpClient.invokeAPI( + this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); + + if (HttpStatus.isSuccessfulStatus(response.getCode())) { + return mapper.deserialize(response, new TypeReference() {}); + } + // fallback to default errors handling: + // all error cases definition are not required from specs: will try some "hardcoded" content + // parsing + throw ApiExceptionBuilder.build( + response.getMessage(), + response.getCode(), + mapper.deserialize(response, new TypeReference>() {})); + } + + private HttpRequest sendRequestBuilder(String domainName, SendEmailRequest requestParameters) + throws ApiException { + // verify the required parameter 'domainName' is set + if (domainName == null) { + throw new ApiException(400, "Missing the required parameter 'domainName' when calling send"); } String localVarPath = @@ -244,12 +317,17 @@ private HttpRequest sendEmailRequestBuilder(String domainName, SendEmailRequest } @Override - public SendEmailResponse sendMimeEmail(String domainName, SendMimeEmailRequest requestParameters) - throws ApiException { + public SendEmailResponse sendInMimeFormat( + String domainName, SendMimeEmailRequest requestParameters) throws ApiException { LOGGER.finest( - "[sendMimeEmail] " + "domainName: " + domainName + ", " + " request:" + requestParameters); - HttpRequest httpRequest = sendMimeEmailRequestBuilder(domainName, requestParameters); + "[sendInMimeFormat] " + + "domainName: " + + domainName + + ", " + + " request:" + + requestParameters); + HttpRequest httpRequest = sendInMimeFormatRequestBuilder(domainName, requestParameters); HttpResponse response = httpClient.invokeAPI( this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); @@ -266,12 +344,12 @@ public SendEmailResponse sendMimeEmail(String domainName, SendMimeEmailRequest r mapper.deserialize(response, new TypeReference>() {})); } - private HttpRequest sendMimeEmailRequestBuilder( + private HttpRequest sendInMimeFormatRequestBuilder( String domainName, SendMimeEmailRequest requestParameters) throws ApiException { // verify the required parameter 'domainName' is set if (domainName == null) { throw new ApiException( - 400, "Missing the required parameter 'domainName' when calling sendMimeEmail"); + 400, "Missing the required parameter 'domainName' when calling sendInMimeFormat"); } String localVarPath = diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/api/v1/adapters/TemplatesServiceImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/api/v1/adapters/TemplatesServiceImpl.java index a49252ac9..f841026b9 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/api/v1/adapters/TemplatesServiceImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/api/v1/adapters/TemplatesServiceImpl.java @@ -76,6 +76,101 @@ public TemplatesServiceImpl( this.mapper = mapper; } + @Override + public ListTemplatesResponse list(String domainName) throws ApiException { + return list(domainName, (ListTemplatesQueryParameters) null); + } + + @Override + public ListTemplatesResponse list(String domainName, ListTemplatesQueryParameters queryParameter) + throws ApiException { + + LOGGER.finest( + "[list]" + " " + "domainName: " + domainName + ", " + "queryParameter: " + queryParameter); + + HttpRequest httpRequest = listRequestBuilder(domainName, queryParameter); + return _getTemplatesPageAsListResponse(httpRequest); + } + + public ListTemplatesResponse _getTemplatesPageAsListResponse(HttpRequest httpRequest) + throws ApiException { + HttpResponse response = + httpClient.invokeAPI( + this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); + + if (HttpStatus.isSuccessfulStatus(response.getCode())) { + + ListTemplatesResponseInternal deserialized = + mapper.deserialize(response, new TypeReference() {}); + + HttpRequest nextPage = + new HttpRequest( + deserialized.getPaging().getNext(), + httpRequest.getMethod(), + null, + httpRequest.getHeaderParams(), + httpRequest.getAccept(), + httpRequest.getContentType(), + httpRequest.getAuthNames()); + + return new ListTemplatesResponse( + this, new Page<>(null, deserialized.getItems(), new MailgunPageNavigator(nextPage))); + } + // fallback to default errors handling: + // all error cases definition are not required from specs: will try some "hardcoded" content + // parsing + throw ApiExceptionBuilder.build( + response.getMessage(), + response.getCode(), + mapper.deserialize(response, new TypeReference>() {})); + } + + private HttpRequest listRequestBuilder( + String domainName, ListTemplatesQueryParameters queryParameter) throws ApiException { + // verify the required parameter 'domainName' is set + if (domainName == null) { + throw new ApiException(400, "Missing the required parameter 'domainName' when calling list"); + } + + String localVarPath = + "/v3/{domain_name}/templates" + .replaceAll( + "\\{" + "domain_name" + "\\}", + URLPathUtils.encodePathSegment(domainName.toString())); + + List localVarQueryParams = new ArrayList<>(); + if (null != queryParameter) { + + URLParameterUtils.addQueryParam( + queryParameter.getPage(), "page", URLParameter.form, null, localVarQueryParams, true); + + URLParameterUtils.addQueryParam( + queryParameter.getLimit(), "limit", URLParameter.form, null, localVarQueryParams, true); + + URLParameterUtils.addQueryParam( + queryParameter.getPivot(), "p", URLParameter.form, null, localVarQueryParams, true); + } + + Map localVarHeaderParams = new HashMap<>(); + + final Collection localVarAccepts = Arrays.asList("application/json"); + + final Collection localVarContentTypes = Arrays.asList(); + + final Collection localVarAuthNames = Arrays.asList("basicAuth"); + final String serializedBody = null; + + return new HttpRequest( + localVarPath, + HttpMethod.GET, + localVarQueryParams, + serializedBody, + localVarHeaderParams, + localVarAccepts, + localVarContentTypes, + localVarAuthNames); + } + @Override public VersionDetails copyVersion( String domainName, String templateName, String versionName, String newVersionName) @@ -819,101 +914,6 @@ private HttpRequest getVersionRequestBuilder( localVarAuthNames); } - @Override - public ListTemplatesResponse list(String domainName) throws ApiException { - return list(domainName, (ListTemplatesQueryParameters) null); - } - - @Override - public ListTemplatesResponse list(String domainName, ListTemplatesQueryParameters queryParameter) - throws ApiException { - - LOGGER.finest( - "[list]" + " " + "domainName: " + domainName + ", " + "queryParameter: " + queryParameter); - - HttpRequest httpRequest = listRequestBuilder(domainName, queryParameter); - return _getTemplatesPageAsListResponse(httpRequest); - } - - public ListTemplatesResponse _getTemplatesPageAsListResponse(HttpRequest httpRequest) - throws ApiException { - HttpResponse response = - httpClient.invokeAPI( - this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); - - if (HttpStatus.isSuccessfulStatus(response.getCode())) { - - ListTemplatesResponseInternal deserialized = - mapper.deserialize(response, new TypeReference() {}); - - HttpRequest nextPage = - new HttpRequest( - deserialized.getPaging().getNext(), - httpRequest.getMethod(), - null, - httpRequest.getHeaderParams(), - httpRequest.getAccept(), - httpRequest.getContentType(), - httpRequest.getAuthNames()); - - return new ListTemplatesResponse( - this, new Page<>(null, deserialized.getItems(), new MailgunPageNavigator(nextPage))); - } - // fallback to default errors handling: - // all error cases definition are not required from specs: will try some "hardcoded" content - // parsing - throw ApiExceptionBuilder.build( - response.getMessage(), - response.getCode(), - mapper.deserialize(response, new TypeReference>() {})); - } - - private HttpRequest listRequestBuilder( - String domainName, ListTemplatesQueryParameters queryParameter) throws ApiException { - // verify the required parameter 'domainName' is set - if (domainName == null) { - throw new ApiException(400, "Missing the required parameter 'domainName' when calling list"); - } - - String localVarPath = - "/v3/{domain_name}/templates" - .replaceAll( - "\\{" + "domain_name" + "\\}", - URLPathUtils.encodePathSegment(domainName.toString())); - - List localVarQueryParams = new ArrayList<>(); - if (null != queryParameter) { - - URLParameterUtils.addQueryParam( - queryParameter.getPage(), "page", URLParameter.form, null, localVarQueryParams, true); - - URLParameterUtils.addQueryParam( - queryParameter.getLimit(), "limit", URLParameter.form, null, localVarQueryParams, true); - - URLParameterUtils.addQueryParam( - queryParameter.getPivot(), "p", URLParameter.form, null, localVarQueryParams, true); - } - - Map localVarHeaderParams = new HashMap<>(); - - final Collection localVarAccepts = Arrays.asList("application/json"); - - final Collection localVarContentTypes = Arrays.asList(); - - final Collection localVarAuthNames = Arrays.asList("basicAuth"); - final String serializedBody = null; - - return new HttpRequest( - localVarPath, - HttpMethod.GET, - localVarQueryParams, - serializedBody, - localVarHeaderParams, - localVarAccepts, - localVarContentTypes, - localVarAuthNames); - } - @Override public ListVersionsResponse listVersions(String domainName, String templateName) throws ApiException { diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/ResendRequest.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/ResendRequest.java new file mode 100644 index 000000000..a9fa2584a --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/ResendRequest.java @@ -0,0 +1,57 @@ +/* + * Mailgun API + * + * OpenAPI document version: 3.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit the class manually. + */ + +package com.sinch.sdk.domains.mailgun.models.v1.emails.request; + +import java.util.List; + +/** ResendRequest */ +public interface ResendRequest { + + /** + * Email address of the recipient(s). Supports friendly name format. Example: + * \"Bob <bob@host.com>\". Use commas to separate multiple recipients. + * Duplicate addresses are automatically ignored. + * + *

Field is required + * + * @return to + */ + List getTo(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new ResendRequestImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param to see getter + * @return Current builder + * @see #getTo + */ + Builder setTo(List to); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + ResendRequest build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/ResendRequestImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/ResendRequestImpl.java new file mode 100644 index 000000000..4e21a5f44 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/emails/request/ResendRequestImpl.java @@ -0,0 +1,92 @@ +package com.sinch.sdk.domains.mailgun.models.v1.emails.request; + +import com.sinch.sdk.core.databind.annotation.FormSerialize; +import com.sinch.sdk.core.databind.annotation.Property; +import com.sinch.sdk.core.databind.annotation.Required; +import com.sinch.sdk.core.models.OptionalValue; +import java.util.List; +import java.util.Objects; + +public class ResendRequestImpl implements ResendRequest { + private static final long serialVersionUID = 1L; + + public static final String PROPERTY_TO = "to"; + + private OptionalValue> to; + + public ResendRequestImpl() {} + + protected ResendRequestImpl(OptionalValue> to) { + this.to = to; + } + + public List getTo() { + return to.orElse(null); + } + + @Required + @Property(PROPERTY_TO) + @FormSerialize( + using = + com.sinch.sdk.domains.mailgun.api.v1.adapters.ArrayToCommaSeparatedFormSerializer.class) + public OptionalValue> to() { + return to; + } + + /** + * Return true if this + * POST-v3-domains-domain_name-messages-storage_key-multipart-form-data-RequestBody object is + * equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ResendRequestImpl poSTV3DomainsDomainNameMessagesStorageKeyMultipartFormDataRequestBody = + (ResendRequestImpl) o; + return Objects.equals( + this.to, poSTV3DomainsDomainNameMessagesStorageKeyMultipartFormDataRequestBody.to); + } + + @Override + public int hashCode() { + return Objects.hash(to); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ResendRequestImpl {\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + static class Builder implements ResendRequest.Builder { + OptionalValue> to = OptionalValue.empty(); + + @Property(value = PROPERTY_TO) + public Builder setTo(List to) { + this.to = OptionalValue.of(to); + return this; + } + + public ResendRequest build() { + return new ResendRequestImpl(to); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/ListTemplatesResponse.java b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/ListTemplatesResponse.java index 49ff5c8ed..29fff6147 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/ListTemplatesResponse.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/mailgun/models/v1/templates/response/ListTemplatesResponse.java @@ -16,6 +16,7 @@ import com.sinch.sdk.domains.mailgun.api.v1.adapters.TemplatesServiceImpl; import com.sinch.sdk.domains.mailgun.models.v1.templates.Template; import java.util.Collection; +import java.util.Collections; import java.util.NoSuchElementException; /** Auto paginated response for list of Template */ @@ -50,7 +51,7 @@ public ListTemplatesResponse nextPage() { @Override public Collection